Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

[ Revised - How to Put Tags into Description Tab ] How to Put Recommended Products Inside Product Description Tab
 
kframe
Jr. Member
 
Total Posts:  21
Joined:  2008-09-13
 

Hey Fellow Magentoers!

I in a bit of a jam here and I’m really hoping one of you (or many of you) can help me out!

I’m trying to place Recommended Products in the Products Description Tab so that you can read the product description and then see other recommended products right below that and not in another tab. 

I was able to include the Tags tab in the Description Tab by just copying and pasting the code from modern/template/tag/list.phtml into modern/template/catalog/product/view/description.phtml and it works like a charm!  But, when I try to do the same thing with the contents of the file modern/template/catalog/product/list/upsell.phtml, I get the following error:

Invalid method Mage_Catalog_Block_Product_View_Description::resetItemsIterator(Array
(
)
)

Here’s the code I’m pasting into description.phtml:

<div class="up-sell-block">
<p><strong><?php echo $this->__('You may also be interested in the following product(s)') ?></strong></p>

<table cellspacing="0" class="generic-product-grid catalog-listing” id="upsell-product-table">

<?php // $this->setColumnCount(3); // uncomment this line if you want to have another number of columns. also can be changed in layout ?>

<?php $this->resetItemsIterator() ?>

<?php for($_i=0;$_i<$this->getRowCount();$_i++): ?>
<tr>
<?php for($_j=0;$_j<$this->getColumnCount();$_j++): ?>
<?php if($_link=$this->getIterableItem()): ?>
<td>
<p class="product-image"><a href="<?php echo $_link->getProductUrl() ?>"><img src="<?php echo $this->helper('catalog/image')->init($_link, 'small_image')->resize(125) ?>” width="125" height="125" alt="<?php echo $this->htmlEscape($_link->getName()) ?>"/></a></p>
<h5><a href="<?php echo $_link->getProductUrl() ?>"><?php echo $this->htmlEscape($_link->getName()) ?></a></h5>
<?php echo $this->getPriceHtml($_link, true) ?>
<?php echo $this->getReviewsSummaryHtml($_link) ?>
</td>
<?php else: ?>
<td class="empty-product"> </td>
<?php endif; ?>
<?php endfor; ?>
</tr>
<?php endfor; ?>
</table>
<script type="text/javascript\">decorateTable(’upsell-product-table’)</script>
</div>

I know this should be such an easy thing that I’m missing but I just can’t figure it out to save my life!  Any help from you “Description Editing Experts” out there would be very much appreciated!! smile

Thanks so much in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
anthonyfojas
Member
 
Total Posts:  33
Joined:  2008-08-19
 

I havent tested this, but just looking at the modern/layout/catalog.xml file, under catalog_product_view, you need to change the reference to “upsell_products” to reference “description” (<reference name="upsell_products"> becomes <reference name="description">).  Then you need to add all the methods from the Mage_Catalog_Block_Product_List_Upsell (app/code/core/catalog/block/product/list/upsell.php) class to the Mage_Catalog_Block_Product_View_Description (app/code/core/catalog/block/product/view/description.php) class.

Basically the issue is that in the description.phtml file $this refers to an object of the Mage_Catalog_Block_Product_View_Description class, but $this in the catalog/product/list/upsell.phtml file refers to an object of the Mage_Catalog_Block_Product_List_Upsell class.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kframe
Jr. Member
 
Total Posts:  21
Joined:  2008-09-13
 

Genius!  Absolute genius!!  Thanks so much anthony!  This was a super important part of our site and I don’t think I could have figured it out on my own.  My most sincere thanks!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Priest
Jr. Member
 
Total Posts:  20
Joined:  2008-04-21
 

kframe,

I’m curious to see what this looks like on the product page, can you post a link to your shop, or PM me if it’s not yet public.

Thanks!
Priest

 
Magento Community Magento Community
Magento Community
Magento Community
 
kframe
Jr. Member
 
Total Posts:  21
Joined:  2008-09-13
 

Hello again, all! 

so, in my first post when I was talking about adding the tags to the description tab I said it “worked like a charm”.  I should have said it LOOKS like it works like a charm.  Turns out when I try to actually add tags, the form isn’t being processed.  When I view source on the page it looks like the problem is there is no defined action.  Take a look:

---------------------
<div class="add-tag-title">add your tags:</div>
<div class="add-tag-box">
<form id="addTagForm" action="” method="get">

<div class="input-box">
<input type="text" class="input-text required-entry” name="tagName" />
</div>
<div><a href="#" onclick="submitTagForm()"><img src="http://www.socalcleanse.com/shop/skin/frontend/default/modern/images/btn_add_tags.gif" alt="Add Tags” class="v-middle"/></a></div>
</form>
<script type="text/javascript\">
var addTagFormJs = new VarienForm(’addTagForm’);
function submitTagForm(){
if(addTagFormJs.validator.validate()) {
addTagFormJs.form.submit();
}
}
</script>
<div class="clear"></div>
<small>Use spaces to separate tags. Use single quotes (’) for phrases.</small>

</div>
</div>

---------------
As I said before, to move the tags into the description tab, I simply copied the contents of frontend/default/modern/template/tag/list.phtml and pasted them into the description tag ( template/catalog/product/view/description.phtml ).  That area of my description.phtml file now looks like this:

<div class="padder">
<?php if( $this->getCount() ): ?>
<h5><?php echo $this->__('other people marked this product with these tags:') ?></h5>
<ul class="tags-list">
<?php $_iterator = 0; ?>
<?php foreach( $this->getTags() as $_tag ): ?>
<li<?php if( 1 == ++$_iterator && $this->getCount() != 1 ): ?> class="first"<?php elseif($_iterator == $this->getCount()): ?> class="last"<?php endif; ?>><a href="<?php echo $_tag->getTaggedProductsUrl() ?>"><?php echo $this->htmlEscape($_tag->getName()) ?></a> (<?php echo $_tag->getPopularity() ?>)</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>

-----------------------

I also changed the reference name to “description in the modern/layout/tag.xml file (below) and that seems to have had no effect.

<catalog_product_view>
<!-- Mage_Tag -->
<reference name="description">
<block type="tag/product_list" name="product_tag_list" before="-" template="tag/list.phtml"></block>
</reference>

</catalog_product_view>

Any ideas on how I can get this to work would be greatly appreciated!!  I’ll even buy you a cup of coffee… or booze… whatever your poison! smile

Thanks so much!

 
Magento Community Magento Community
Magento Community
Magento Community
 
kframe
Jr. Member
 
Total Posts:  21
Joined:  2008-09-13
 

Priest -

Screenshot is attached.  We’re still in design/programming mode.  Hoping to launch...dare I say it… soon! smile

Image Attachments
description-tab.gif
 
Magento Community Magento Community
Magento Community
Magento Community
 
kframe
Jr. Member
 
Total Posts:  21
Joined:  2008-09-13
 

Ok, I’ve made some progress on this.... It turns out that the action that I was missing for the tags form was actually in the modern/layout/tag.xml file.  I had commented out the action because it also adds a tab to the product page.  I only want to have the description tab and I didn’t realize that this action is also used to process the form.  Sooo… now the tag.xml file looks like this:

<catalog_product_view>
<!-- Mage_Tag -->
<reference name="product.info.tabs">
<action method="addTab" translate="title" module="tax"><alias>tags</alias><title>Product Tags</title>
<block>tag/product_list</block><template>tag/list.phtml</template>
</action>

</reference>

</catalog_product_view>

Now, the tag form works in the description tag BUT it also creates another tab called Product Tags.  argh!  wink Is there some other action method I can use here other than “addTab”?? 

I’m completely desperate at this point so any ideas would be very much appreciated!!!!

Thanks all.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top