2013-04-30 90 views

回答

0

與控制器創建自定義的Magento模塊

然後在你的SavepriceController.php創建一個保存操作

public function saveAction(){ 
    $websites = Mage::app()->getWebsites(); 

    $product_id = $this->getRequest()->getParam('product_id'); 
    // need to validate price here 
    $price = $this->getRequest()->getParam('price'); 

    $product = Mage::getModel('catalog/product')->load($product_id) 
    if($product->getId()){ 
     $product->setPrice($price)->save(); 
    } 
} 

然後文本字段添加到您的前端頁面

<form action='http://site.com/modulename/Saveprice/save' method='post'> 
     <input type='hidden' name='product_id' value='add product id here' /> 
     <input type='text' name='price' /> 
     <input type='submit' value='submit' /> 
</form>