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)
-   -   How To Add Upsell to Category listing? (https://forum.x-cart.com/showthread.php?t=13550)

gbanse 04-22-2005 07:14 AM

How To Add Upsell to Category listing?
 
I'm in the middle of reformatting the category page. I want to include one upselling item with each item in the category (if one exists).

The product price (within products.tpl) for each item has been changed to:

and now right beneath it I want to place some static text and the price for the upsell item which will be the text for the link to that product. SO the lines will look like this:

Our Price: $24.50 links to product page
with matching t-shirt: $30.50 links to upsell item

I've been trying to get the standard upsell module to work figuring if I could get it to work then I could make a copy of it and format that to what I need. I've tried:
Quote:

{include file="modules/Upselling_Products/related_products.tpl" }
to no avail.

Might someone be able to nudge me in the right direction please?

gbanse 04-22-2005 08:22 AM

I've taken the base code for producing the upsell links and moved it to within the products.tpl file like so:

Quote:

{capture name=upsell}
{section name=upsell_num loop=$product_links}
<A href="product.php?productid={ $product_links[upsell_num].productid }"{if $config.Modules.upselling_new_window eq 'Y'} target="_blank"{/if}>
{$product_links[upsell_num].product}
</A>
{/section}
{/capture}
{$smarty.capture.upsell}

It seems that there is no array $product_links - or at least it's not outputting correctly. I'm not sure if this will require writing some custom PHP function or if it's a simple matter of finding the right syntax for the above.

gbanse 04-22-2005 09:18 AM

In the middle of the category.php file now. I think (it would be nice if someone could confirm this) this is the correct file that builds the lists of products for each category.

Have added my own query
Quote:

if (defined('NEED_PRODUCT_CATEGORIES')) {
global $productid;
$_categories = func_query("SELECT $to_search, $sql_tbl[products_categories].productid, $sql_tbl[products_categories].main FROM $sql_tbl[categories] $join_tbl LEFT JOIN $sql_tbl[products_categories] ON $sql_tbl[categories].categoryid=$sql_tbl[products_categories].categoryid AND $sql_tbl[products_categories].productid='$productid' GROUP BY $sql_tbl[categories].categoryid");
$_upsell_link = func_query("SELECT $sql_tbl[product_links].productid2 FROM $sql_tbl[product_links] WHERE $sql_tbl[product_links].productid1 == $productid");
} else {
$_categories = func_query("SELECT $to_search FROM $sql_tbl[categories] USE INDEX (am) $join_tbl ".(!empty($search_condition)?"WHERE ".implode(" AND ", $search_condition):"")." GROUP BY $sql_tbl[categories].categoryid ".$sort_condition);
}


I'm trying to figure out how to get the result set (in my case a single product) in an array that I can use in the products.tpl file.

jb5ep 04-26-2005 11:05 AM

Hi there Gregg,

Did you have any luck with this? I'm facing a similar problem..

http://forum.x-cart.com/viewtopic.php?t=18722

Tech support have pointed me in the direction of the SQL used in related_products.php needing to be modified for use on cart.php, but that's about as far as i've got...


Cheers,
JB

Jon 04-26-2005 03:02 PM

The upselling links is for 1 product. When you are dealing with the category pages, you are dealing with multiple products, and thus the upselling links will not work, because the productid's are arrays, not a standard productid.

gbanse 04-26-2005 05:30 PM

Thanks Jon.
I actually PM'd jb5ep and told him that I went ahead and secured the X-Cart team to make the mods for me. They've already got a working copy ready and tomorrow I suspect I'll have the code.


All times are GMT -8. The time now is 07:10 AM.

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