Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

How To Add Upsell to Category listing?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 04-22-2005, 07:14 AM
 
gbanse gbanse is offline
 

Advanced Member
  
Join Date: Mar 2005
Location: Vermont, USA
Posts: 53
 

Default 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?
__________________
Gregg
XC v4.0.12 (13 and 17) Gold
Reply With Quote
  #2  
Old 04-22-2005, 08:22 AM
 
gbanse gbanse is offline
 

Advanced Member
  
Join Date: Mar 2005
Location: Vermont, USA
Posts: 53
 

Default

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.
__________________
Gregg
XC v4.0.12 (13 and 17) Gold
Reply With Quote
  #3  
Old 04-22-2005, 09:18 AM
 
gbanse gbanse is offline
 

Advanced Member
  
Join Date: Mar 2005
Location: Vermont, USA
Posts: 53
 

Default

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.
__________________
Gregg
XC v4.0.12 (13 and 17) Gold
Reply With Quote
  #4  
Old 04-26-2005, 11:05 AM
 
jb5ep jb5ep is offline
 

Advanced Member
  
Join Date: Apr 2005
Location: U.K.
Posts: 65
 

Default

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
__________________
X-Cart 4.0.17
ezUpsell
PHP 4.4.1
MySQL 4.0.25-standard
Apache 1.3.34
Linux
Reply With Quote
  #5  
Old 04-26-2005, 03:02 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

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.
Reply With Quote
  #6  
Old 04-26-2005, 05:30 PM
 
gbanse gbanse is offline
 

Advanced Member
  
Join Date: Mar 2005
Location: Vermont, USA
Posts: 53
 

Default

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.
__________________
Gregg
XC v4.0.12 (13 and 17) Gold
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:58 PM.

   

 
X-Cart forums © 2001-2020