2013-05-17 64 views
0

我使用此magento擴展http://www.magentocommerce.com/magento-connect/custom-attributes-4340.html來創建客戶屬性。我能夠創建該屬性並在後端查看它。但是當用戶通過前端登錄時,我無法編輯/更新這些值。Magento編輯前端用戶編輯屏幕的自定義屬性

這是我在edit.phtml頁面上的代碼。

<li><?php $attribute = Mage::getModel('eav/config')->getAttribute('customer','height'); ?> 
<label for="height"><?=$this->__('Height') ?></label> 
    <div class="input-box"> 
    <input type="text" name="height" id="height" /> 
    </div> 
</li> 

我沒有任何手動添加任何東西到我的數據庫或創建任何模塊。嚴格使用此擴展名。任何幫助將非常感激。

回答

0

爲了節省這個輸入到屬性你可以做的是表單提交更新屬性。

1)在提交表單的頁面上獲取高度值。例如$ height_val

2)現在$ height_val具有該值,因此您可以嘗試此代碼,這將更新該屬性的值而不保存整個產品。

$customer->setHeight($height_val); 

$customer->getResource()->saveAttribute($customer, 'height'); 
+0

感謝您的答覆DepH,但我沒有在這裏處理產品。我只是想更新註冊用戶信息。我嘗試了你提到的,但這似乎並不奏效。 – fidellakis