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

Slow x-cart cart page

   X-Cart forums > X-Cart 5 > General questions (X-Cart 5)
Thread Tools Search this Thread
Old 07-29-2020, 11:56 PM
JosephFrench JosephFrench is offline
Join Date: Jul 2020
Posts: 1

Default Slow x-cart cart page

Hi guy

I have a x-cart 5.3 webshop with PHP 5.3 in cart.php you have 2 requests with LEFT JOIN is it possible to change that to INNER JOIN ?

Or is any other optimisation possible ?

Here the code:

$products_array = func_query_first("SELECT $sql_tbl[products].*, MIN($sql_tbl[pricing].price) as price, IF($sql_tbl[images_T].id IS NULL, '', 'Y') as is_thumbnail, $sql_tbl[images_T].image_path, $sql_tbl[images_T].image_x, $sql_tbl[images_T].image_y, IF($sql_tbl[images_P].id IS NULL, '', 'P') as is_pimage, $sql_tbl[images_P].image_path as pimage_path, $sql_tbl[images_P].image_x as pimage_x, $sql_tbl[images_P].image_y as pimage_y FROM $sql_tbl[pricing],$sql_tbl[products] LEFT JOIN $sql_tbl[images_T] ON $sql_tbl[images_T].id = $sql_tbl[products].productid LEFT JOIN $sql_tbl[images_P] ON $sql_tbl[images_P].id = $sql_tbl[products].productid WHERE $sql_tbl[products].productid=$sql_tbl[pricing].productid AND $sql_tbl[products].forsale != 'N' AND $sql_tbl[products].productid='$productid' AND $avail_condition $sql_tbl[pricing].quantity<='$amount' AND $sql_tbl[pricing].membershipid IN('$membershipid', 0) AND $sql_tbl[pricing].variantid = '$variantid' GROUP BY $sql_tbl[products].productid ORDER BY $sql_tbl[pricing].quantity DESC");


$discount_info = func_query_first("SELECT $sql_tbl[discounts].*, $max_discount_str FROM $sql_tbl[discounts] LEFT JOIN $sql_tbl[discount_memberships] ON $sql_tbl[discounts].discountid = $sql_tbl[discount_memberships].discountid WHERE minprice<='$avail_discount_total' $provider_condition AND ($sql_tbl[discount_memberships].membershipid IS NULL OR $sql_tbl[discount_memberships].membershipid = '$membershipid') ORDER BY max_discount DESC");
Joseph French
Reply With Quote
Old 07-30-2020, 10:09 AM
memoto memoto is offline

X-Cart team
Join Date: Feb 2018
Posts: 246

Default Re: Slow x-cart cart page

Hmmm... 5.3.x branch requires PHP 5.4 at least.

As for the optimization - I wouldn't recommend applying any changes as almost every script in X-Cart 5 is straightly coonected to all the others.

The best way to optimze your website performance is to upgrade to PHP 7.2 at least and work with some PHP extensions
X-Cart Team
Reply With Quote
   X-Cart forums > X-Cart 5 > General questions (X-Cart 5)

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 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 06:54 AM.


X-Cart forums © 2001-2020