pass newly added attributes from product detail page to cart page (magento) -
i using magento version 1.7.0
i have added shirt size(newly added attributes) drop down box in product detail page.using below code
app\design\frontend\default{mytempalte}\template\catalog\product\view.phtml
<?php $product = $_product->getattributetext('size_chart'); ?> shirt size <select name="size_chart"> <option value="select">select</option> <?php for($i = 0;$i < count($product);$i++) { ?> <option value="<?php echo $product[$i]; ?>"><?php echo $product[$i]; ?></option> <?php } ?> </select>
customer can able select shirt size .after select shirt size need show shirt size in cart , checkout page.
how pass shirt size value product detail other page?.
thanks
actually, in cart page may cart items in quote object.
$cart = mage::getmodel('checkout/cart')->getquote(); $items = $cart->getallvisibleitems(); foreach ($items $item){ $options = $item->getproductoptions(); $superattributes = $options['info_buyrequest']['super_attribute']; if (!!$superattributes){ $attributeobjsize = mage::getmodel('eav/config')->getattribute(mage_catalog_model_product::entity,'size_chart'); $attributeobjsizeid = $attributeobjsize->getattributeid(); foreach ($superattributes $code=>$superattribute){ if ($attributeobjsizeid == $code){ $sizecode = $superattribute; $sizelabel = $attributeobjsize->getsource()->getoptiontext($sizecode); } } } }
the $sizelabel should want have. hope works.
Comments
Post a Comment