如何在magento的购物车中显示产品名称后的链接

时间:2017-01-03 12:55:25

标签: php magento

我想在磁力车的购物车页面中显示产品名称后面的链接。

我尝试使用" 渲染器"但它不起作用。我在" Renderer"。

中添加了以下代码
<?php
class ProductCustomizer_ProductCustomizer_Block_Checkout_Cart_Item_Renderer extends Mage_Checkout_Block_Cart_Item_Renderer{

    public function getProductName()
    {
        $name = parent::getProductName();
        $item = $this->_item;
        $results_data = $item->getOptionByCode("customizer_data");
        if($results_data){
            $results = unserialize($results_data);
            $imagePathFull = $results['image']['url'];
            return "Custom - ".$name." - <a target='_blank' href='{$imagePathFull}'>View Image</a>";
        }else{
            return $name;
        }
    }
}

现在我正在尝试使用其他信息块添加链接,但它无法正常工作。我在 Config.xml 文件

中添加了以下代码
<catalog_product_view>
    <reference name="product.info.additional">
        <block type="catalog/product_view_additional" name="product.info.productcustomizer.additional" template="productcustomizer/checkout/cart/additional.phtml" />
    </reference>
</catalog_product_view>

1 个答案:

答案 0 :(得分:0)

我在config.xml文件中尝试过这段代码。现在它工作正常

<checkout_cart_index>
    <reference name="checkout.cart">
        <block type="checkout/cart" name="additional.product.info" template="productcustomizer/checkout/cart/additional.phtml" />
    </reference>
</checkout_cart_index>
相关问题