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

Upselling Products module modification

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #71  
Old 01-20-2005, 04:13 PM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

updated for 4.0.10

related_products.php

Code:
<?php /*****************************************************************************\ +-----------------------------------------------------------------------------+ | X-Cart | | Copyright (c) 2001-2004 Ruslan R. Fazliev <rrf@rrf.ru> | | All rights reserved. | +-----------------------------------------------------------------------------+ | PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" | | FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE | | AT THE FOLLOWING URL: http://www.x-cart.com/license.php | | | | THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE | | THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. | | FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING | | AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). | | PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT | | CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, | | COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY | | (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS | | LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS | | AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND | | OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS | | AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE | | THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.| | THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2004 | | Ruslan R. Fazliev. All Rights Reserved. | +-----------------------------------------------------------------------------+ \*****************************************************************************/ # # Updated by shan - 21/01/05 # # $Id: related_products.php,v 1.16.2.2 2005/01/12 07:42:51 svowl Exp $ # # This Module forms list of upsailing products # if ( !defined('XCART_SESSION_START') ) { header("Location: ../../"); die("Access denied"); } $product_links = func_query("SELECT DISTINCT $sql_tbl[products].descr, $sql_tbl[products].avail, $sql_tbl[products].min_amount, $sql_tbl[products].productid, $sql_tbl[products].productcode, MIN($sql_tbl[pricing].price) AS price, IF ($sql_tbl[products_lng].product IS NOT NULL,$sql_tbl[products_lng].product, $sql_tbl[products].product) AS product FROM $sql_tbl[products], $sql_tbl[pricing], $sql_tbl[product_links] LEFT JOIN $sql_tbl[products_lng] ON $sql_tbl[products_lng].productid = $sql_tbl[products].productid AND $sql_tbl[products_lng].code='$store_language' WHERE $sql_tbl[products].productid=$sql_tbl[product_links].productid2 AND $sql_tbl[product_links].productid1='$productid' AND $sql_tbl[pricing].productid=$sql_tbl[products].productid AND $sql_tbl[pricing].quantity=1 AND $sql_tbl[pricing].variantid = 0 AND ($sql_tbl[pricing].membership='$membership' OR $sql_tbl[pricing].membership='') AND $sql_tbl[products].forsale='Y' GROUP BY $sql_tbl[products].productid ORDER BY $sql_tbl[product_links].orderby, product"); $smarty->assign("product_links",$product_links); ?>

related_products.tpl

Code:
{* $Id: related_products.tpl,v 1.7.6.1 2004/07/15 10:28:54 svowl Exp $ *} {* UPDATED BY SHAN 21/01/05 *} {if $product_links ne ""} {capture name=dialog} <table width="100%" border=0 cellpadding="0" cellspacing=0> {section name=cat_num loop=$product_links} <tr class="ItemsList"> <td width="70" align=center valign=top> {include file="product_thumbnail.tpl" productid=$product_links[cat_num].productid image_x=60} </td> <td align=top valign=top> <table border=0 cellspacing=5 width="100%"> <tr valign="middle"> <td align=top> {$product_links[cat_num].product|escape} </td> <td align=right>{include file="customer/main/buy_now.tpl" type=small product=$product_links[cat_num]}</td> </tr> <tr> <td valign=top> {$product_links[cat_num].descr} <font class=ProductPrice>{$lng.lbl_our_price}: {include file="currency.tpl" value=$product_links[cat_num].price}</font> <font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product_links[cat_num].price}</font> </td> <td colspan="3" align="right" valign=top> </td> </tr> </table> </td></tr> <tr class="ItemsList"> <td colspan="5" align=center valign=top><hr></td> </tr> {/section} </table> {/capture} {include file="dialog.tpl" title=$lng.lbl_related_products content=$smarty.capture.dialog extra="width=100%"} {/if}
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #72  
Old 02-16-2005, 09:39 PM
 
jorval jorval is offline
 

Newbie
  
Join Date: Apr 2004
Posts: 2
 

Default works perfectly in 4.09

Shan

thanks so much for updating it for current versions. Works like a charm!

If i dont want to display the description just the title, what do i need to change?

Thanks
__________________
X-cart 4.09 slightly modified
Reply With Quote
  #73  
Old 02-17-2005, 12:22 AM
 
andreas04031 andreas04031 is offline
 

Advanced Member
  
Join Date: Jun 2004
Location: Dallas, TX
Posts: 64
 

Default

Very nice mod, I got it to work in 4.0.11 but I have a strange error which shows up in the code and when I point the mouse on top of a product because smarty puts the error into the alt tag:

Code:
<a href="product.php?productid=146" >[img]/projektemx/xcart4/image.php?productid=146[/img]Warning[/b]: htmlspecialchars() expects parameter 1 to be string, array given in f:\wampp13cs\htdocs\projektemx\xcart4\Smarty-2.6.3\plugins\modifier.escape.php on line 25 Array" border="0"></a>

I have it running on a local test cart 4.0.11, fresh install, some mods.
Any suggestions?

Forgot to ask this: the quantity dropdown and the buy now button are not aligned nicely, they are spread all over the place, I guess depending on the width of the description of the item. Is the description short the dropdown and buy now button is pretty much in the center and if the description is long both moves to the right side, I try to fix it in the related_products.tpl but no success.
Andy
__________________
X-Cart version 3.5.9 (online)
X-Cart Version 4.0.19 (online)
X-Cart Version 4.1.3 (in dev)
PHP 4.4.4
MySQL 4.1.21
Reply With Quote
  #74  
Old 02-17-2005, 10:34 PM
 
PremiumPonyParts PremiumPonyParts is offline
 

Senior Member
  
Join Date: Dec 2004
Posts: 114
 

Default

I'm using the code supplied for 4.0.10
and it was telling me i was out of stock

I looked into the code and at

Code:
<td align=right>{include file="customer/main/buy_now.tpl" type=small product=$product_links[cat_num]}</td> </tr>
Replace with
Code:
<td align=right>{include file="customer/main/buy_now.tpl" type=small product=$product_links[cat_num].productid}</td> </tr>

And it should work fine and dandy.
Also, another fix to make the Buy Now buttons aligned on the right side
edit the following code
Code:
<td align=top valign=top> <table border=0 cellspacing=5 width="100%"> <tr valign="middle"> <td align=top>
With
Code:
<td align=top valign=top> <table border=0 cellspacing=5 width="100%"> <table> <tr valign="middle"> <td align=top width="100%">
That should fix the broken table and also push the Button over to the far right and keep it aligned.

Also, I am curious as to why you get an error msg as an alt text when rolling over images. To view this
http://www.premiumponyparts.com/product.php?productid=1967&cat=0&page=1
__________________
Version 4.0.8
Reply With Quote
  #75  
Old 02-17-2005, 11:02 PM
 
andreas04031 andreas04031 is offline
 

Advanced Member
  
Join Date: Jun 2004
Location: Dallas, TX
Posts: 64
 

Default

Great, it looks really nice now.
What I still have is the strange alt tag message, do you guys see the same? Andy


PremiumPonyParts, thanks for fixing the table problem.

I just looked at your site and I found the same alt tag problem. Look at your code line 1139:
<a href="product.php?productid=1975" target="_blank">[img]/image.php?productid=1975[/img]Warning[/b]: htmlspecialchars() expects parameter 1 to be string, array given in /home/premiump/public_html/Smarty-2.6.3/plugins/modifier.escape.php on line 25

Array" border="0"></a>

and your Buy Now button doesn't work, I get an JavaScript Error:
line 1160 and 1219
__________________
X-Cart version 3.5.9 (online)
X-Cart Version 4.0.19 (online)
X-Cart Version 4.1.3 (in dev)
PHP 4.4.4
MySQL 4.1.21
Reply With Quote
  #76  
Old 02-18-2005, 07:12 PM
 
PremiumPonyParts PremiumPonyParts is offline
 

Senior Member
  
Join Date: Dec 2004
Posts: 114
 

Default

Yeah, Im looking to see what is wrong. Hopefully Ill find it and post the problems in here. Still new to x-cart coding and smarty.

Unable to find out what was wrong.. Myb the writer of the mod can figure it out
__________________
Version 4.0.8
Reply With Quote
  #77  
Old 02-23-2005, 11:07 AM
 
joestern joestern is offline
 

Senior Member
  
Join Date: Apr 2004
Posts: 187
 

Default

Does anyone know how to get the entire related_products.tpl to show on the cart page and include all upsells that are related to items that are in the cart? I tried to add this to cart.tpl:

Code:
{if $active_modules.Upselling_Products ne ""} {include file="modules/Upselling_Products/related_products.tpl" } {/if}

I'm sure for reasons that are obvious to those who know what they're doing, this did not work.

Any thoughts would be hugely appreciated.
__________________
X-Cart version 4.7.12
Reply With Quote
  #78  
Old 02-23-2005, 11:32 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Instead of tearing your hair out, just spend some money on one of Jon's mods which do exactly what you are looking for. They are available here:

http://www.websitecm.com/
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #79  
Old 02-23-2005, 11:36 AM
 
joestern joestern is offline
 

Senior Member
  
Join Date: Apr 2004
Posts: 187
 

Default

Believe me, that is a very small price to pay and I have no problem spending the money... but I have a very customized version of x-cart and I am not interested in the "excheckout" process...although I do think he did a great job with it.
__________________
X-Cart version 4.7.12
Reply With Quote
  #80  
Old 02-23-2005, 11:40 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

I'm not talking about the EZ checkout...I'm talking about EZ upsell. Doesn't matter how custom your cart is. If you didn't get a response from them, try purchasing it from Carrie at:

http://www.bcsengineering.com/store/catalog/XCart_ezUpsell-p-96.html

She'll even install it for you for $50.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 03:32 PM.

   

 
X-Cart forums © 2001-2020