Note that there are some explanatory texts on larger screens.

plurals
  1. POuse case for getProductAdditionalInformationBlock in magento
    primarykey
    data
    text
    <p>I'd like to put some additional info under each item in the cart. I have this info already saved in table "sales_flat_quote_item" in "additional_info" field. So the question is only how to show it globally at all places where the items are shown.</p> <p>I saw in several places under item name there is a structure like this:</p> <pre><code>&lt;?php if ($addtInfoBlock = $this-&gt;getProductAdditionalInformationBlock()):?&gt; &lt;?php echo $addtInfoBlock-&gt;setItem($_item)-&gt;toHtml() ?&gt; &lt;?php endif;?&gt; </code></pre> <p>For example in this files: /app/design/frontend/base/default/template/checkout/cart/item/default.phtml /app/design/frontend/base/default/template/checkout/onepage/review/item.phtml</p> <p>So I suppose this is the place I should use for such task.</p> <p>What I figured out is that: I have to add my own block definition to for example:</p> <pre><code>&lt;checkout_cart_index&gt; &lt;block type="core/text_list" name="additional.product.info" translate="label"&gt; &lt;label&gt;Additional Product Info&lt;/label&gt; &lt;block type="various/itemrendererdefault" name="glass.additional" as="glass" template="checkout/cart/glass_additional.phtml"/&gt; &lt;/block&gt; &lt;/checkout_cart_index&gt; </code></pre> <p>This is no problem so far. My class is loaded </p> <pre><code>class Site1_Various_Block_Itemrendererdefault extends Mage_Core_Block_Template { public function setItem(Varien_Object $item) { $this-&gt;setData('item', $item); return $this; } public function getItem() { return $this-&gt;_getData('item'); } } </code></pre> <p>and the template checkout/cart/glass_additional.phtml is called. </p> <p>But inside the template I have no idea how to get the info about what $item should I process. I tried:</p> <pre><code>$_item = $this-&gt;getItem(); print_r($_item); $_item = $this-&gt;getData(); print_r($_item); </code></pre> <p>but it returns nothing.</p> <p>So my question is: How to get $item data inside my template. Can I access the data set in?</p> <pre><code>... $addtInfoBlock-&gt;setItem($_item)-&gt;toHtml(); ... </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload