0

我不知道如何做到这一点,这确实需要添加到正常产品的工作商店,我可以制作一个新模板来做到这一点。

4

1 回答 1

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>
于 2013-04-30T17:20:02.793 回答