1
你好,我刚刚登录问这个问题。我尝试用该论坛给出的答案来解决这个问题,但是一切都不行。 我只想将购物车中的商品添加到magento kontactform
中的文本字段中。我使用form.phtml在phtml Contactform(Magento)中显示购物车物品
我试图显示与侧边栏车:
<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>
,但我得到这个错误:
Fatal error: Call to a member function getProduct() on a non-object in /www/htdocs/xxxxx/magento/app/design/frontend/base/default/template/checkout/cart/sidebar/default.phtml on line 29
第29行是:
$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
所以有人可以帮助我,并对我的残酷英语感到抱歉:-)
替换使用此代码 getLayout() - > createBlock('结帐/ cart_sidebar ') - > setTemplate(' 结帐/购物车/ sidebar.phtml') - > toHtml(); ?> –
如果条件“<?php if($ this-> getIsNeedToDisplaySideBar()):>” –
您还需要评论吗?嗨,谢谢你,但它仍然没有成功,我是php newbe也许我做了一些基本上错误的事情。我添加代码 'code' <?php if($ this-> getIsNeedToDisplaySideBar()):?> <?php echo $ this-> getLayout() - > createBlock('checkout/cart_sidebar') - > setTemplate '结帐/购物车/ sidebar.phtml') - > toHtml(); ?> <?php endif; ?> '代码' – bikefactory