php - Magento 添加到愿望 list 代码不起作用

标签 php magento

我正在使用这段代码将愿望 list 添加到我的产品 View

<a onclick="setLocation('<?php echo $this->getAddToWishlistUrl($_product) ?>')"
 class="buttons-wish" title="<?php echo $this->__('Add to Wishlist') ?>"></a>
<a onclick="setLocation('<?php echo $this->getAddToCompareUrl($_product) ?>')"
 class="buttons-compare" title="<?php echo $this->__('Add to Compare') ?>"></a>

但由于某种原因它不起作用。

我需要帮助来解决问题

最佳答案

试试这个。

<a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>                                                    
<a href="<?php echo $this->helper('catalog/product_compare')->getAddUrl($_product) ?>"><?php echo $this->__('Add to Compare') ?></a>

关于php - Magento 添加到愿望 list 代码不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21172562/

相关文章:

php - stdClass 属性的类型提示?

php - 菜单树不显示

Magento: ?___SID=U 出现在一些网址中

php - 如何在php中设置获取数据的值

javascript - Codeigniter ajax插入成功重定向

php - 通过父类中的实例化类访问常量

Magento 不向未登录的用户显示产品

mysql - 使用 SQL 计算记录组合的有效方法?

php - magento 完整包安装和使用 Composer for Magento 之间的区别?

jquery - 如何调试 Magento 的自定义 Colorbox 安装