doufendi9063 2013-01-14 10:05
浏览 29

在magento中的购物车页面上添加其他信息

I am doing a magento customization site ,I need to add some additional information about the product to cart page, checkout page . I am new to magento please help how can i do this.

I tried this code in app\design\frontend\base\default\template\checkout\cart\item\default.phtml

$_product =$_item->getProductId();
 $_helper = $this->helper('catalog/output');
    $_product = $this->getProduct()
?>
<?php if($_additional = $this->getAdditionalData()): ?>

    <div class="availability in-stock"><b>Compatible with : </b><div class="button2" style="color:#77C25A;"><?php  echo $_additional['computer_manufacturers']['value']; echo " | "; echo $_additional['model_type']['value']; echo " | "; echo $_additional['model_version']['value'] ;  ?>  </div></div>


<?php endif;?>
  • 写回答

1条回答 默认 最新

  • doushao1087 2013-01-25 23:26
    关注

    Hi you can try the following:

    $product = Mage::getModel("Catalog/Product")->load($_item->getProduct()->getId()); 
    //echo sprintf("<pre>%s</pre>",print_r($product->getData(),true));
    echo $product->getColor(); //shows the key 3
    echo $product->getData('color'); //shows the key 3
    echo $product->getAttributeText('color'); //shows the text blue
    

    Make the attributes available in frontend:

    On manage attribute page:

    • Allow HTML Tags on Frontend
    • Visible on Product View Page on Front-end

    Remove the comment on the sprintf to see thats in there. When you have a _ in the key you should use CamelCase notation so the_color will become getTheColor().

    Hope it helps !

    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看