【问题标题】:show custom options in admin在管理员中显示自定义选项
【发布时间】:2014-02-28 20:33:07
【问题描述】:

我似乎无法在下面的 magento 代码中显示自定义选项字段 - 你们中的任何一个好人可以帮助我吗?

public function getProductName($product)
{
    $value = '<b>'.$product->getname().'</b>';
    if ($product->getproduct_type() == 'configurable')
    {
        //add sub products
        $collection = mage::getModel('sales/order_item')
                            ->getCollection()
                            ->addFieldToFilter('parent_item_id', $product->getitem_id());
        foreach ($collection as $subProduct)
        {
            $value .= '<br><i>'.$subProduct->getname().'</i>';

            //add product configurable attributes values
            $attributesDescription = mage::helper('ProductReturn/Configurable')->getDescription($subProduct->getproduct_id(), $product->getrp_product_id());
            if ($attributesDescription != '')
                $value .= '<br>'.$attributesDescription;
        }

    }
    return $value;
}

【问题讨论】:

  • 您好,如果 $product 是您的 productId,请尝试以下代码: $_product = $product;回声 $_product->getCustomOptionName(); getCustomOptionName 例如 forauction_type -> getAuction_type();
  • 谢谢 Jaydeep - 我认为自定义选项会在 magento 中正常列出?由于提到了 2 个 $product 属性,我将把这段代码放在哪一行。
  • 你是在说你的代码还是我的?
  • 原代码中有2个$product属性

标签: php magento options


【解决方案1】:

$product 有问题->getproduct_type() 没有错,应该试试$product-&gt;getTypeId()

【讨论】:

  • 谢谢阿米特 - 不幸的是认为 getItemOptions 对我不起作用,但没有运气:-(还有其他想法吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多