Jump to content

spearmootz

Members
  • Posts

    6
  • Joined

  • Last visited

Profile Information

  • First Name
    Ricardo
  • Last Name
    Spear

spearmootz's Achievements

Newbie

Newbie (1/14)

0

Reputation

1

Community Answers

  1. so here is my code to update stock, i am getting a duplicate entry error. i do not want to create a new stock as it exists, just update it. $id_stock_available = (int)StockAvailable::getStockAvailableIdByProductId((int) $id_product, (int) $id_attribute, (int) $store); if ($id_stock_available) { $stock_available = new StockAvailable($id_stock_available); $stock_available->quantity = (int)$updates[$key]['stock']; $stock_available->update(); } whenever the update function is ran i get the following error. I do no understand, im not trying to insert a new one. i am trying to update an old quantity Fatal error: Uncaught Duplicate entry '16792-0-0-2' for key 'product_sqlstock'<br /><br /><pre>INSERT INTO `ps_stock_available` (`id_product`, `id_product_attribute`, `id_shop`, `id_shop_group`, `quantity`, `depends_on_stock`, `out_of_stock`) VALUES ('16792', '0', '0', '2', '20', '0', '0')</pre> thrown in C:\wamp\www\prestashop\classes\db\Db.php on line 646
  2. I changed the code and posted it on GitHub as a fork. it was accepted. the problem was that the jquery inner container width function was returning a false value. changed it to regular javascript and it works like a charm.
  3. i have this problem as well in the default theme. so i was doing some testing and it seems that when force compilation is turned on the category works. but when any of the other options are selected it stops working.
  4. ok, so i just noticed that you can look at what is creating the query by looking at the right column, i noticed that the 30-40 second long query was being created by the specials block module, i disabled it and now i am left with a 1 second query created by the layered block which is not too bad. there is a programming issue to be looked at in those two modules. if you look at it mysql has to make thousands of comparisons just to evaluate one row in mysql so there is this exponential effect.
  5. i should have mentioned it. the layered navigation was disabled when i got that query.
  6. sometimes when i am browsing in my shop, randomely i get these really long queries that take 40 seconds. i tried with a different browsers to make sure it wasnt something with regards to cache, i tried all the performance settings. this happens in the product category only. this goes on until id_product > 16000 or so which is how many products i have in the whole store. SELECT SQL_NO_CACHE product_shop.id_product, MAX(product_attribute_shop.id_product_attribute) id_product_attribute FROM `ps_product` p INNER JOIN ps_product_shop product_shop ON (product_shop.id_product = p.id_product AND product_shop.id_shop = 1) LEFT JOIN `ps_product_attribute` pa ON (product_shop.id_product = pa.id_product) LEFT JOIN ps_product_attribute_shop product_attribute_shop ON (product_attribute_shop.id_product_attribute = pa.id_product_attribute AND product_attribute_shop.id_shop = 1 AND product_attribute_shop.default_on = 1) WHERE product_shop.`active` = 1 AND (( product_shop.`id_product` = 1) OR( product_shop.`id_product` = 2) OR( product_shop.`id_product` = 3) OR( product_shop.`id_product` = 4) OR( product_shop.`id_product` = 5) OR( product_shop.`id_product` = 6) OR( product_shop.`id_product` = 7) OR( product_shop.`id_product` = 8) OR( product_shop.`id_product` = 9) OR( product_shop.`id_product` = 10) OR( product_shop.`id_product` = 11) OR( product_shop.`id_product` = 12) OR( product_shop.`id_product` = 13) OR( product_shop.`id_product` = 14) OR( product_shop.`id_product` = 15) OR( product_shop.`id_product` = 16) OR( product_shop.`id_product` = 17) OR( product_shop.`id_product` = 18) OR( product_shop.`id_product` = 19) OR( product_shop.`id_product` = 20) OR( product_shop.`id_product` = 21) OR( product_shop.`id_product` = 22)
×
×
  • Create New...