VirtueMart 1.1.x [ Old version - no longer supported ] > Security (https) / Performance / SEO/ SEF issues VM 1.1

related products is slow.

(1/1)

stinga:
I changed

--- Code: ---
// Let's have a look wether the product has related products.

$q = "SELECT product_sku, related_products FROM #__{vm}_product,#__{vm}_product_relations ";
$q .= "WHERE #__{vm}_product_relations.product_id='$product_id' AND product_publish='Y' ";
//+
//stinga increased 4 related products to 6
//-
$q .= "AND FIND_IN_SET(#__{vm}_product.product_id, REPLACE(related_products, '|', ',' )) LIMIT 0, 6";
$db->query( $q );

--- End code ---
to

--- Code: ---// Let's have a look wether the product has related products.

$q = "select replace(pr.related_products,'|',',') related_products from #__{vm}_product_relations pr, #__{vm}_product p  where p.product_id='$product_id' and pr.product_id = p.product_id and p.product_publish='y'";
$db->query($q);
$db->next_record();

$q = "select product_sku, related_products FROM #__{vm}_product p, #__{vm}_product_relations pr WHERE pr.product_id in (". $db->f('related_products').") AND product_publish='Y' and pr.product_id=p.product_id limit 50";

//$q = "SELECT product_sku, related_products FROM #__{vm}_product,#__{vm}_product_relations ";
//$q .= "WHERE #__{vm}_product_relations.product_id='$product_id' AND product_publish='Y' ";
//+
//stinga increased 4 related products to 6
//-
//$q .= "AND FIND_IN_SET(#__{vm}_product.product_id, REPLACE(related_products, '|', ',' )) LIMIT 0, 6";
$db->query( $q );

--- End code ---

With the 391539 prducts we have, it was taking just over a second to process. index.php is now generated in under 1 second, usually 0.4 of a second. Which is a long way from the 10 seconds plus it used to take.

Navigation

[0] Message Index

Go to full version