How to get url to remove product from cart in Magento?

后端 未结 2 1065
刺人心
刺人心 2021-02-06 18:44

I looked at default/template/checkout/cart.html and found this code:

        getItems() as $_item): ?>
            

        
2条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-06 19:12

    To get the return URL as well what I did is:

    In the Block

    protected function getDeleteUrl($item)
    {
        $params = array(
            'id'=>$item->getId(),
            Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => Mage::helper('core')->urlEncode($this->getUrl('checkout/cart'))
        );
        return $this->getUrl('checkout/cart/delete', $params);
    }
    

    In the PHTML

    getItems() as $_item): ?>
        getDeleteUrl($_item) ?>
    
    

提交回复
热议问题