你好,我刚登录来问这个问题。我试图解决这个问题,在该论坛给出的答案,但有些东西不会工作。我只想将购物车中的商品包含到 magento kontactform
中的文本字段中。我使用form. php
我尝试用:
显示侧边栏购物车 <label for="comment">Artikel</label>
<div class="input-box">
<textarea name="comment" id="comment" title="Artikel" class="required-entry input-text" cols="5" rows="3">
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('checkout/cart/sidebar/default.phtml')->toHtml(); ?>
</textarea>
</div>
</li>
<li class="wide">
<label for="comment" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Comment') ?></label>
<div class="input-box">
<textarea name="comment" id="comment" title="<?php echo Mage::helper('contacts')->__('Comment') ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
但是我得到这个错误:
第29行致命错误:调用a上的成员函数getProduct()非在/www/根/xxxxx/线上购物/app/设计/前端/基地/违约/模板/付款/车/栏/default.phtml 在线29
是:
$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
所以可能有人可以帮助我,对不起我的残酷的英语:-)
实际上,您正在使用core/template块,这就是为什么您得到错误,所以请使用checkout/cart_sidebar块。请用下面的代码替换您的代码。
代码<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('checkout/cart/sidebar/default.phtml')->toHtml(); ?>
替换为
<?php echo $this->getLayout()->createBlock('checkout/cart_sidebar')->setTemplate('checkout/cart/minicart/items.phtml')->toHtml(); ?>
谢谢