Wednesday 18 September 2013

aad to cart product with custom option, super attribute magento

$cartarray = array($textaria_option => $instructions_text,
 $width_option_id => $width,
 $height_option_id => $height,
 $side_optionId => $side_optionVal,
 );
foreach($cartarray as $key=>$val){
if($val!= ''){
$arv[$key] = $val;
}
}

$productIdtoadd=$productDub->getId();
$cart = Mage::getSingelton('checkout/cart');
$cart->addProduct($productIdtoadd, array(
'qty' => $qty,
'total_price'=>$total,
'super_attribute' => array($attributeid =>$assproductColorOptionId),
'options' =>$arv
)
);

Tuesday 17 September 2013

get product custom option magento

$priductid = 82;
$product = Mage::getModel('catalog/product')->load($priductid);

foreach ($product->getOptions() as $o) {
                              $values = $o->getValues();
$optionType = $o->getType();/*********TYPE************/
  $o->getId(); /************getId*****************/

                                     /* dropdown type custom option */
if ($optionType == 'drop_down') {
                                    foreach ($values as $k => $v) {
$drpdoption = $v->getData();
                                    }
                                }
                                       /* end dropdown type custom option */

}