X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Upselling Products module modification (https://forum.x-cart.com/showthread.php?t=4444)

nerd luv 07-06-2004 12:26 PM

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?

sarahnk 08-02-2004 01:07 PM

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");

sarahnk 08-02-2004 01:39 PM

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"]));
          }
      }
  }
};


markwhoo 09-11-2004 08:33 PM

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

greenpac 10-26-2004 12:11 PM

It doesn't appear to be working in 4.0.4 at all. Does anyone have any suggestions why not?

AJ-UKRS 11-12-2004 11:53 AM

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}


vortexonline 11-26-2004 09:06 PM

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?

Jon 11-27-2004 12:34 PM

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"]."'"));

GM 11-28-2004 05:17 AM

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. :D

vortexonline 11-29-2004 12:50 PM

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?


All times are GMT -8. The time now is 12:42 AM.

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