X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Upselling Product Categories (https://forum.x-cart.com/showthread.php?t=57631)

DrQuietus 01-20-2011 06:12 AM

Upselling Product Categories
 
Is there a way to show the category that an upselling product is in?

gb2world 01-20-2011 05:14 PM

Re: Upselling Product Categories
 
You can use webmaster mode to see if the root category is available in the array that holds the information for the upselling products. If it is not, then you have to modify the php code with the query for the products to include the category.

In 4.4.x - load the page in question with webmaster mode enabled. In the webmaster mode console, select "Show variables". Look for the array with the upselling products. If the category is there, you can use it. If not - the task becomes more complex to modify the query in the php.

---

DrQuietus 01-23-2011 01:03 AM

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.

DrQuietus 01-23-2011 01:36 AM

Re: Upselling Product Categories
 
Slight amendment, to avoid more category loops:

Code:

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



All times are GMT -8. The time now is 08:00 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.