View Single Post
  #3  
Old 01-23-2011, 01:03 AM
  DrQuietus's Avatar 
DrQuietus DrQuietus is offline
 

Advanced Member
  
Join Date: Dec 2005
Posts: 81
 

Default Re: Upselling Product Categories

OK, what I have is a table that shows the upselling products, however there are more than one products in each category and I didn't want to list the category names multiple times, just once for all the products in the category.

My solution only works if the sort order and category id's are the same, so that is an issue but is an issue for later. And I don't have that many categories, if I did this would be horribly inefficient.

here is my inelegant solution:

Code:
<table> {section name=cat_num loop=$product_links} {assign var='i' value=$u_product_info[cat_num].categoryid} {foreach from=$categories_menu_list item=c name=categories} {if $c.categoryid eq $i and $i ne $n} <tr> <th colspan="3">{$c.category}</th> </tr> {assign var='n' value=$c.categoryid} {/if} {/foreach} <tr> -----UPSELLING PRODUCTS----- </tr> {/section} </table>

Can anyone think of another way to do this without having to loop through all the categories for each product (the category names are not being called in the $product_links loop, which is why I have the $categories_menu_list). Like gb2world said I probably need to modify the query, and I have no idea how to do that. I would still have the issue of only showing the category name once. I can't send the link, because the store is closed until I get all the content in, once it goes live I can provide the link.
__________________
Dave Jones
dave@industrialwebworks.net
Mostly 4.7.2 - 4.7.5
Reply With Quote