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
  #61  
Old 07-06-2004, 12:26 PM
 
nerd luv nerd luv is offline
 

Advanced Member
  
Join Date: Jun 2003
Location: California, USA
Posts: 58
 

Default Displaying in columns instead of rows

Might there be a way to display related products in a smiliar way to category pages?

For example, on my category pages I have thumbnails in 3 columns along with the name of the product. I'd like a similar layout for the related products. I don't really want the extra stuff (buy button, wishlist button, price, etc.) Just the thumbnail and product name, with each related product going in a new column, instead of below in the same column.

Does that make sense? Has anyone done that?
__________________
Always happy to Paypal over some money for X-Cart solutions. I need to get this store running! Help!
--Testing 3.5.8, heavily modified, Linux, Apache 1.3.31, PHP 4.3.4--
Reply With Quote
  #62  
Old 08-02-2004, 01:07 PM
 
sarahnk sarahnk is offline
 

Advanced Member
  
Join Date: Jan 2004
Location: New York, NY
Posts: 58
 

Default

I'm trying to get this work on 4.0.1 but it gives me this error
  • INVALID SQL: 1064 : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE productid='19'' at line 1
    SQL QUERY FAILURE: SELECT COUNT(*) FROM WHERE productid='19'

I also changed this line:

Code:
$product_links = (func_query$search_query = "select DISTINCT $sql_tbl[products].*, $sql_tbl[categories].category, $sql_tbl[pricing].price from $sql_tbl[products], $sql_tbl[pricing], $sql_tbl[categories], $sql_tbl[product_links] where ($sql_tbl[pricing].membership='') and ($sql_tbl[pricing].productid=$sql_tbl[products].productid) and ($sql_tbl[pricing].quantity=1) and ($sql_tbl[products].categoryid=$sql_tbl[categories].categoryid) and $sql_tbl[products].forsale='Y' and ($sql_tbl[products].productid=$sql_tbl[product_links].productid2) and ($sql_tbl[product_links].productid1='$productid') ORDER BY $sql_tbl[products].product");


to this: (from 4.0.1 version)
Code:
$product_links = func_query("SELECT DISTINCT $sql_tbl[products].productid, $sql_tbl[products].product, $sql_tbl[products].productcode, MIN($sql_tbl[pricing].price) AS price FROM $sql_tbl[products], $sql_tbl[pricing], $sql_tbl[product_links] 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, $sql_tbl[products].product");
__________________
3rd site: 4.1.0 (currently working on)

2nd site: Version 4.0.12

X-Cart version 3.5.14
PHP 4.3.3 details
MySQL server 4.0.15
Reply With Quote
  #63  
Old 08-02-2004, 01:39 PM
 
sarahnk sarahnk is offline
 

Advanced Member
  
Join Date: Jan 2004
Location: New York, NY
Posts: 58
 

Default

ok ... i figured it out...

i took out these lines which were causing errors because i wasn't using any other language.
Code:
if(is_array($product_links)){ foreach($product_links as $p_v => $p_k){ $int_res = ''; if(is_array($p_k)){ # # Check if product have product options # $product_links[$p_v][product_options] = array_pop(func_query_first("SELECT COUNT(*) FROM $sql_tbl[product_options] WHERE productid='".$p_k["productid"]."'")); # # Replace descr and fulldescr on international (if defined) # $int_res = func_query_first("SELECT * FROM $sql_tbl[products_lng] WHERE code='$store_language' AND productid='".$p_k['productid']."'"); if ($int_res["product"]){ $product_links[$p_v]["product"] = stripslashes($int_res["product"]); } if ($int_res["descr"]){ $product_links[$p_v]["descr"] = str_replace("\n"," ", stripslashes($int_res["descr"])); } if ($int_res["full_descr"]){ $product_links[$p_v]["fulldescr"] = str_replace("\n"," ", stripslashes($int_res["full_descr"])); } } } };
__________________
3rd site: 4.1.0 (currently working on)

2nd site: Version 4.0.12

X-Cart version 3.5.14
PHP 4.3.3 details
MySQL server 4.0.15
Reply With Quote
  #64  
Old 09-11-2004, 08:33 PM
 
markwhoo markwhoo is offline
 

X-Adept
  
Join Date: Nov 2003
Posts: 799
 

Default

Quote:
Originally Posted by sarahnk
I'm trying to get this work on 4.0.1 but it gives me this error
  • INVALID SQL: 1064 : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE productid='19'' at line 1
    SQL QUERY FAILURE: SELECT COUNT(*) FROM WHERE productid='19'

I also changed this line:

Code:
$product_links = (func_query$search_query = "select DISTINCT $sql_tbl[products].*, $sql_tbl[categories].category, $sql_tbl[pricing].price from $sql_tbl[products], $sql_tbl[pricing], $sql_tbl[categories], $sql_tbl[product_links] where ($sql_tbl[pricing].membership='') and ($sql_tbl[pricing].productid=$sql_tbl[products].productid) and ($sql_tbl[pricing].quantity=1) and ($sql_tbl[products].categoryid=$sql_tbl[categories].categoryid) and $sql_tbl[products].forsale='Y' and ($sql_tbl[products].productid=$sql_tbl[product_links].productid2) and ($sql_tbl[product_links].productid1='$productid') ORDER BY $sql_tbl[products].product");


to this: (from 4.0.1 version)
Code:
$product_links = func_query("SELECT DISTINCT $sql_tbl[products].productid, $sql_tbl[products].product, $sql_tbl[products].productcode, MIN($sql_tbl[pricing].price) AS price FROM $sql_tbl[products], $sql_tbl[pricing], $sql_tbl[product_links] 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, $sql_tbl[products].product");

I have completed the quoted change and also deleted the section of code that was causing the sql errors in sarahnk's second posting.

I am currently upgrading to 4.03 and when I look at my upsells, it shows items are out of stock.

The real issue is there are 100 items in stock not zero!

Is there anyone else out there that has tried this mod on 4.03 and discovered similar problems?

I would really appreciate any help
__________________
vs 4.1.12
Reply With Quote
  #65  
Old 10-26-2004, 12:11 PM
 
greenpac greenpac is offline
 

Member
  
Join Date: Oct 2004
Posts: 17
 

Default

It doesn't appear to be working in 4.0.4 at all. Does anyone have any suggestions why not?
__________________
X-Cart Gold
4.0.4 [Linux]
Reply With Quote
  #66  
Old 11-12-2004, 11:53 AM
 
AJ-UKRS AJ-UKRS is offline
 

Advanced Member
  
Join Date: Jan 2004
Posts: 92
 

Default

and if you want to just have a bullet point image with the link, simply edit related_products.tpl in /xcart/skin1/modules/Upselling_Products/ to be the following:

Code:
{* $Id: related_products.tpl,v 1.7 2003/11/26 10:27:05 mAKI Exp $ *} {if $product_links ne ""} {capture name=dialog} <table border="0" cellpadding="2" cellspacing="2" width="100%" style="border-collapse: collapse" bordercolor="#111111"> {section name=cat_num loop=$product_links} <tr> <td width="1%">{include file="product_thumbnail.tpl" productid=$product_links[cat_num].productid image_x=30}</td> <td width="99%">{$product_links[cat_num].product|escape}</td> </tr> {/section} </table> {/capture} {include file="dialog.tpl" title=$lng.lbl_related_products content=$smarty.capture.dialog extra="width=100%"} {/if}
Reply With Quote
  #67  
Old 11-26-2004, 09:06 PM
 
vortexonline vortexonline is offline
 

Member
  
Join Date: Nov 2004
Location: Albany, NY
Posts: 25
 

Default

Quote:
Originally Posted by greenpac
It doesn't appear to be working in 4.0.4 at all. Does anyone have any suggestions why not?

Well i get the SQL error, but it works on 4.0.7. Its just the damn error.

Its happening here for me:
Code:
$product_links[$p_v][product_options] = array_pop(func_query_first("SELECT COUNT(*) FROM $sql_tbl[product_options] WHERE productid='".$p_k["productid"]."'"));

error is:

Code:
INVALID SQL: 1064 : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE productid='34'' at line 1 SQL QUERY FAILURE: SELECT COUNT(*) FROM WHERE productid='34'

Any pros out there see what it is?
__________________
X-Cart 4.0.7
PHP 4.3.10
MySQL 4.0.22-standard
Reply With Quote
  #68  
Old 11-27-2004, 12:34 PM
  Jon's Avatar 
Jon Jon is offline
 

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

Default

Looks like it may not be picking up the database table name.

Try:

Code:
$product_links[$p_v][product_options] = array_pop(func_query_first("SELECT COUNT(*) FROM xcart_product_options WHERE productid='".$p_k["productid"]."'"));
Reply With Quote
  #69  
Old 11-28-2004, 05:17 AM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

Thanks AJ-UKRS, that was just what I needed. By the way, this is a great mod! In my case though AJ-UKRS idea was the solution.
__________________
v. 4.0.14 (GM Style)
O.S. Linux
Build Your Own Diamond Ring
Reply With Quote
  #70  
Old 11-29-2004, 12:50 PM
 
vortexonline vortexonline is offline
 

Member
  
Join Date: Nov 2004
Location: Albany, NY
Posts: 25
 

Default How would i set this up to do columns?

Quote:
Originally Posted by AJ-UKRS
and if you want to just have a bullet point image with the link, simply edit related_products.tpl in /xcart/skin1/modules/Upselling_Products/ to be the following:

Code:
{* $Id: related_products.tpl,v 1.7 2003/11/26 10:27:05 mAKI Exp $ *} {if $product_links ne ""} {capture name=dialog} <table border="0" cellpadding="2" cellspacing="2" width="100%" style="border-collapse: collapse" bordercolor="#111111"> {section name=cat_num loop=$product_links} <tr> <td width="1%">{include file="product_thumbnail.tpl" productid=$product_links[cat_num].productid image_x=30}</td> <td width="99%">{$product_links[cat_num].product|escape}</td> </tr> {/section} </table> {/capture} {include file="dialog.tpl" title=$lng.lbl_related_products content=$smarty.capture.dialog extra="width=100%"} {/if}

How can i get this to display in colums? Mabe 3 per column, and centered?
__________________
X-Cart 4.0.7
PHP 4.3.10
MySQL 4.0.22-standard
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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:10 PM.

   

 
X-Cart forums © 2001-2020