0
我正在使用可配置产品,我创建了显示可配置产品的自定义视图。我在将可配置产品添加到购物车时出现错误(请指定产品的选项)。 只有使用可配置产品才会出现此错误。请指定产品的选项。可配置产品magento
我使用此代码为在上面的代码添加到购物车
$params = array(
'product' => $product->getId(),
'super_attribute' => array (
133 => '3',
143 => '19',
142 => '18',
141 => '16',
140 => '14',
139 => '12',
138 => '10',
137 => '22',
136 => '9',
135 => '6',
144 => '21',
),
'qty' => 2,
);
$cart = Mage::getSingleton('checkout/cart');
$cart->addProduct($product, $params);
$cart->save();
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
'super_attribute' => array (
133 => '3',
143 => '19',
142 => '18',
141 => '16',
140 => '14',
139 => '12',
138 => '10',
137 => '22',
136 => '9',
135 => '6',
144 => '21',
)
数组包含我所选择的产品属性值。 我不知道为什么会发生这种情况。