更新文本字段而不重新加载页面

时间:2015-12-18 07:05:39

标签: javascript magento php

我们正在使用magento多供应商网站

对于多个产品,我们在供应商帐户中显示价格,销售价格,数量等。

我们为供应商提供了一个选项,可以通过点击一个"更新"来更新单个产品的所有文本字段。按钮。它工作正常,但重新加载页面后工作。 我想更新文本字段而不重新加载页面

我们正在使用以下代码:

PHTML

<input type="hidden" name="product_mass_update[]"  value="<?php echo $products->getEntityId(); ?>"/>
<input class="ama1" type = "text" id = "price_<?php echo $products->getId(); ?>" onkeydown="validateNumbers(event)" name= "price[]" value = "<?php echo $products->getPrice(); ?>" style = ""/>
    <input class="ama1" type = "text" id = "specialprice_<?php echo $products->getId(); ?>" onkeydown="validateNumbers(event)" name = "specialprice[]" value = "<?php echo $products->getSpecialPrice(); ?>" onblur="updateFieldSpecialPrice('<?php echo $products->getId(); ?>')" style = ""/>

public function massupdatesellerproAction(){
    if($this->getRequest()->isPost()){
        if(!$this->_validateFormKey()){
             $this->_redirect('marketplace/marketplaceaccount/myproductslist/');
        }
        $ids= $this->getRequest()->getParam('product_mass_update');
        $price= $this->getRequest()->getParam('price');
        $special= $this->getRequest()->getParam('specialprice');
        foreach ($ids as $key => $value) {
    $product = Mage::getModel('catalog/product')->load($value);
    $product->setPrice($price[$key]);
    $product->setSpecialPrice($special[$key]);
    $product->save();
        }
        Mage::getSingleton('core/session')->addSuccess( Mage::helper('marketplace')->__('Products has been sucessfully deleted from your account'));
        $this->_redirect('marketplace/marketplaceaccount/myproductslist/');


    }}

0 个答案:

没有答案