简体   繁体   English

如何在Checken Magento中获得分组产品名称

[英]How to get Grouped Product Name in Checkout Magento

I am trying to make a shopping cart using magneto . 我正在尝试用magneto制造购物车。

The single products only have titles like S, M, L, XL and no product name. 单个产品仅具有标题,例如S,M,L,XL,而没有产品名称。 The product name is too long to display it everywhere. 产品名称太长,无法在任何地方显示。 It should only be displayed in cart and checkout. 它只能显示在购物车和结帐中。

I am not able to get any parent IDs of the product. 我无法获得该产品的任何父代ID。 I used following code for this 我为此使用了以下代码

$grouped_product_ids = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($_item->getSku());

print_r($grouped_product_ids);

if (!empty($grouped_product_ids)){
    echo $grouped_product_ids()->getName(); //product name;
};

How can I get the ID of the Grouped Product? 如何获取分组产品的ID? Or how can I get the name of the Grouped Product? 或如何获得分组产品的名称?

You can try below code: 您可以尝试以下代码:

$grouped_product_ids = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($_item->getSku());

print_r($grouped_product_ids);

if (!empty($grouped_product_ids)){
foreach($grouped_product_ids as $grouped_product_id)
{
$grpProduct = Mage::getModel('catalog/product')->load($grouped_product_id);
echo $grpProduct->getName();
}
}

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

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