简体   繁体   English

购物车中的Magento自定义选项标签

[英]Magento Custom Option label in Shopping Cart

I have simple products with custom options (in this case it's color). 我有带有自定义选项的简单产品(在本例中为颜色)。 They are NOT configurable products. 它们不是可配置的产品。 If you are unsure what I mean by custom options see this:http://vimeo.com/15475673 如果不确定我的自定义选项是什么意思,请参见:http://vimeo.com/15475673

They are custom options (not Attributes). 它们是自定义选项(不是属性)。

I would like the label (ie green or red or blue) of the chosen option to be displayed next to the SKU in my shopping cart. 我希望所选选项的标签(即绿色,红色或蓝色)显示在购物车中的SKU旁边。 My current code (default/template/checkout/cart/item/default.phtml) looks like this: 我当前的代码(default / template / checkout / cart / item / default.phtml)如下所示:

<?php echo 'SKU:' ?>
<?php echo $_item->getSku() ?>

How do I call out and echo the custom option label? 如何调出并回显自定义选项标签?

using this you can able to get product custom option value write this code in your cart page and you will get the custom option in your cart page. 使用此方法,您可以获取产品自定义选项值,并将此代码写入购物车页面,您将在购物车页面中获得自定义选项。

$productOptions= $item->getProduct()->getTypeInstance(true)->
getOrderOptions($item->getProduct());

hope this will help you 希望这个能对您有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM