以编程方式将可配置产品添加到magento中

时间:2016-07-05 07:57:49

标签: magento-1.9

我想为magento网站的移动应用添加可配置产品到购物车。我尝试了各种解决方案但未能添加。请帮我。或建议任何其他api添加到购物车功能。

1 个答案:

答案 0 :(得分:1)

请检查产品网站ID和当前商店网站ID是否匹配。

请参阅此文件: core / mage / checkout / model / cart.php

$currentWebsiteId = Mage::app()->getStore()->getWebsiteId();
    if (!$product
        || !$product->getId()
        || !is_array($product->getWebsiteIds())
        || !in_array($currentWebsiteId, $product->getWebsiteIds())
    ) {
      Mage::throwException(Mage::helper('checkout')->__('The product could not be found.'));
    }
    return $product; 
相关问题