Hello i just signed in to ask this question. i try to fix that issue with the given answers in that forum, but somthing won´t work. I just want to include the items in the shopping cart to an text-field in an magento kontactform
. i use form.phtml
i try to display the sidebar cart with:
<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>
but i get this error:
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
in line 29 is:
$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
so may someone can help me, and sorry for my cruel english :-)
Actually, You are using core/template block that's why you are getting error so please use checkout/cart_sidebar block. Please replace your code with below code.
Your Code
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('checkout/cart/sidebar/default.phtml')->toHtml(); ?>
Replace with
<?php echo $this->getLayout()->createBlock('checkout/cart_sidebar')->setTemplate('checkout/cart/minicart/items.phtml')->toHtml(); ?>
Thanks