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)
-   -   Product options on products.tpl (https://forum.x-cart.com/showthread.php?t=2342)

Jon 07-02-2003 09:39 AM

Any thoughts anybody? This is important for me. Thanks.

minorgod 07-02-2003 01:22 PM

Did you modify the template as well? You need to modify both the PHP source code and the template code to display the options properly.

Jon 07-02-2003 02:04 PM

Yes I modified both, and it works well for the category listings. However it doesnt' work for featured products.

Joe Schwartz 06-23-2005 09:15 PM

SQL error in version 4.0.12
 
I've tried to adapt this code for my 4.0.12 x-cart store, but keep getting this error:

Quote:

SELECT * from WHERE productid='13' Error code : 1064 Description : You have an error in your SQL syntax near 'WHERE productid='13'' at line 1


The error occurs with any product (any productid) regardless of whether or not it has product options. I'm pretty sure the error is in the products.php file in this section:

Code:

  // first we build a query to get all the product options with a single query
  $query="SELECT * from $sql_tbl[product_options] WHERE ";
  foreach($products as $key=>$value){
        $query.="productid='$value[productid]' ";
        if($i < $productcount-1){
            $query.="OR ";
        }
        $i++;
  }


I know this is an old thread, but if anyone has adapted this code for 4.x.x of x-cart, I'd be grateful for any insight.

Many thanks,

Joe

minorgod 06-24-2005 09:36 AM

It looks like you have no value for $sql_tbl[product_options]. Make sure this is defined properly. They may have changed the name of the table in the newer version of x-cart, so just go into your config file or look at your xcart database and make sure you are usnig the correct key name in your $sql_tbl array to specify the product_options table.

Joe Schwartz 06-24-2005 04:30 PM

SQL Error gone, but options still not shown on products.tpl
 
minorgod,

Thanks so much. You were right on the money that the SQL values were not properly defined. I went into config.php and added:

Code:

        "product_options" => "xcart_product_options_ex",
        "product_options_js" => "xcart_product_options_js",


to the SQL Table aliases (there is also "xcart_product_options_lng" which I have not figured out yet how it works with "xcart_product_options_ex").

I noticed that in the SQL table for xcart_product_options_ex there was no productid field and that now it was called optionid. As such I edited your mod in products.php to reflect this:

Code:

  $query="SELECT * from $sql_tbl[product_options] WHERE ";
  foreach($products as $key=>$value){
        $query.="optionid='$value[productid]' ";
        if($i < $productcount-1){
            $query.="OR ";
        }
        $i++;
  }


This removed the SQL errors, however the products.tpl does not display the product options. In fact, the product pages display as if no changes have been made. Obviously I am missing something (not surprising as I feel I am in over my head with this mod). Any suggestions on where to look next would be most appreciated.

Joe

dgreen 10-11-2005 07:06 AM

product options on products page
 
Did you ever get this figured out for 4.0.x?

I am looking for a solution

Joe Schwartz 10-11-2005 07:21 AM

Re: product options on products page
 
Quote:

Originally Posted by dgreen
Did you ever get this figured out for 4.0.x?

I am looking for a solution


I never did find a solution for this. As I needed this for only a couple of products, I ended up making a workaround in which I formatted my product.tpl to resemble my products.tpl and then linked directly via the Categories list to individual products.

Joe


All times are GMT -8. The time now is 11:17 PM.

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