0
맞춤 옵션 (유형 -1 및 유형 2)이있는 가상 제품이 있습니다. 가격은 유형에 따라 달라질 수 있습니다. 이 옵션이있는 장바구니에 직접 추가하고 사용자 지정 옵션에 따라 가격을 변경할 수있는 방법은 무엇입니까? 이 코드를 시도했지만 작동하지 않습니다.Magento의 제품 맞춤 옵션이있는 장바구니에 담기
<?php
// the ID of the product
$product_id = "123";
$product = Mage::getModel('catalog/product')->load($product_id);
$cart = Mage::getModel('checkout/cart');
$cart->init();
$params = array(
'product' => $product_id,
'qty' => 1,
'options' => array(
'options' => array(
'7462' => 'Type Option Id' ,
'3731' => 'Type-1',
)
)
);
$cart->addProduct($product, $params);
$cart->save();
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
$this->_redirect('checkout/cart');
?>