Magento自定义API用于添加产品心愿单

时间:2013-08-06 10:40:36

标签: magento

我正在为wishlist实现magento自定义API。

有人知道,如何添加心愿单。

我尝试使用magento'wishlist'模块,但产品未保存到愿望清单。

我正在使用以下功能进行保存。

public function addNewItem($product, $customer_id, $buyRequest = null, $forciblySetQty = false)
    {
    }

我可以使用这篇文章获得心愿单。 http://pastebin.com/G7ci0Mhu

1 个答案:

答案 0 :(得分:0)

    This may help you

        <?php $wishlist = Mage::getModel('wishlist/item')->load($_product->getId(),'product_id');
              if($wishlist->getId())
                  //product is added
              echo "Added! - Product is in the wishlist!";
              else
                  //add product to wishlist
              echo "<a href='".$this->helper('wishlist')->getAddUrl($_product) ."'>Add This?</a>";
          ;?>

        Mage::getModel('wishlist/item')->load($id)->delete();

        http://abhijitberadeveloper.blogspot.in/2012/07/product-add-wishlist.html
http://docs.magentocommerce.com/Mage_Wishlist/Mage_Wishlist_Helper_Data.html#methodgetWishlistItemCollection

http://docs.magentocommerce.com/Mage_Wishlist/Mage_Wishlist_Helper_Data.html#methodgetWishlistItemCollection