Add option value to product, then to cart with Magento

后端 未结 4 1129
暗喜
暗喜 2021-01-02 12:33

I searched around for a while and only came up wit solutions that added whole new option sets to products in a Magento store.

What I\'m trying to accomplish is a wa

4条回答
  •  青春惊慌失措
    2021-01-02 13:00

    In Magento 1.7 you have to wrap the params array in a Varien Object.

                    $params = array(
                        'product' => $_fancypack->getId(),
                        'qty' => 1,
                        'options' => array(
                            $this->_getOptionId($_fancypack,'Product SKU') => $product->getId() .'/'. $product->getSku()
                        )
                    );
    
                    $request = new Varien_Object();
                    $request->setData($params);
    
                    $quote->addProduct($_fancypack, $request);
    

提交回复
热议问题