Magento : Make 'Continue Shopping' button redirect to the last-added-to-cart product's category
Edit cart.phtml and replace following code
with
<?php if($this->getContinueShoppingUrl()): ?>
<button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button btn-continue" onclick="setLocation('<?php echo $this->getContinueShoppingUrl(); ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
<?php endif; ?>
with
<?php
$lastProductAddedToCartId = Mage::getSingleton('checkout/session')->getLastAddedProductId();
if($lastProductAddedToCartId) {
$productCategoryIdsArray = Mage::getModel('catalog/product')->load($lastProductAddedToCartId)->getCategoryIds();
$continueShoppingCategoryUrl = Mage::getModel('catalog/category')->load($productCategoryIdsArray[0])->getUrl();
}
?>
<?php if($this->getContinueShoppingUrl()): ?>
<button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button btn-continue" onclick="setLocation('<?php echo (isset($continueShoppingCategoryUrl)) ? $continueShoppingCategoryUrl : $this->getContinueShoppingUrl(); ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
<?php endif; ?>
来源: http://dbhoopendra.blogspot.com/2013/07/magento-make-magento-continue-shopping.html#.Ug8WGVOE7D4
本文介绍如何修改Magento中购物车页面的'Continue Shopping'按钮行为,使其点击后跳转到最近添加到购物车的商品所在类别页面。通过编辑cart.phtml文件并替换原有代码实现这一功能。
3049

被折叠的 条评论
为什么被折叠?



