Hello
I try understand why generator attribute is so long...?
for example if i have 4x4x4x5 combination = 320
When i run profilling:
for all generation combination i have this query
/classes/stock/StockAvailable.php:446
SELECT SQL_NO_CACHE SUM(quantity) as quantity
FROM tm_stock_available
WHERE id_product = 8
AND id_product_attribute <> 0 AND id_shop = 1 AND id_shop_group = 0 LIMIT 1
time : 183.1ms
4x4x4x5 * 180ms = 57,6secound
i try comment this total_quantity and set static total_quantity
/* $total_quantity = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT SUM(quantity) as quantity
FROM '._DB_PREFIX_.'stock_available
WHERE id_product = '.(int)$this->id_product.'
AND id_product_attribute <> 0 '.
StockAvailable::addSqlShopRestriction(null, $id_shop)
);*/
$total_quantity = 2000;
$this->setQuantity($this->id_product, 0, $total_quantity, $id_shop);
this trick speed generation combination.
Why this sql query took too long ??? 180ms???
SELECT SQL_NO_CACHE SUM(quantity) as quantity
FROM tm_stock_available
WHERE id_product = 8
AND id_product_attribute <> 0 AND id_shop = 1 AND id_shop_group = 0 LIMIT 1
Thank you for any tips