2012-08-22 53 views

回答

3

此功能已經存在於Magento中。

如果你想通過代碼來檢查這個功能比檢查了這一點 -

<div class="add-to-box"> 
    <?php echo $this->getChildHtml('addto') ?> 
</div> 

此代碼可以在[主題] /template/catelog/product/view.phtml找到。

此代碼會導致調用「添加到收藏」按鈕,在商品詳細頁,這個按鈕來自[主題] /template/catelog/product/view/addto.phtml。

從這裏你可以管理這個按鈕。


您還可以啓用或通過管理部分禁用此功能 -

要控制添加到收藏鏈接的顯示:

  1. 從管理控制檯中,選擇System>組態。
  2. 在左側的配置面板中的客戶下,選擇願望清單選項卡。
  3. 單擊以展開常規選項部分,執行下列操作之一:

    • 啓用設置爲Yes以顯示添加到收藏鏈接類別頁面和產品頁面。

    • 將啓用設置爲否可從類別頁面和產品頁面中刪除添加到心願列表鏈接。


希望能對大家有所幫助。

謝謝!

0

我會寫這個作爲評論Anx的答案,但我沒有50聲望(有趣的系統,當然評論比答案更微不足道?),所以我增加了另一個答案。

如果您在遵循Anx的建議後仍然遇到麻煩,那麼您可能會遇到與我一樣的奇怪情況 - core_config_data表中沒有配置設置「wishlist/general/active」的條目。儘管它在管理面板中被標記爲活動。要解決這個問題,我只需進入系統>配置>心願單,然後單擊「保存配置」而不更改任何內容。 Presto中,條目出現在core_config_data(以及「wishlist/email/email_template」,「wishlist/email/email_identity」和「wishlist/wishlist_link/use_qty」)中。

1

使用「添加到收藏」按鈕

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

使用「添加到購物車」下面的代碼按鈕下面的代碼

<button type="button" title="<?php echo $this->__('Add to Cart') ?>" 
    class="button btn-cart" 
    onclick="setLocation('<?php echo $this->helper('checkout/cart')->getAddUrl($_product) ?>')"> 
    <span> 
     <span><?php echo $this->__('Add to Cart') ?></span> 
    </span> 
</button> 
3

簡約歸到:...目錄/產品/view/addto.phtml然後:

<a href="<?php echo $this-> 
helper('wishlist')->getAddUrl($_product) ?>"> 
<?php echo $this->__('Add to Wishlist') ?></a> 
相關問題