web.geek Posted January 16, 2011 Share Posted January 16, 2011 Whew! This one gave me the run around for a while, so I thought I would share what I found.Version 1.4.0.8 + SVN trunk | IE 8.0.6 and FF 3.6.13Under Preferences > Products, I changed the setting for Display "add to cart" button when product has attributes to No; because I want to force the customer to view the product and select the proper attribute combinations. After I set that value and saved, I added a new product with 4 attribute combinations. I viewed the product under its category, and everything looked fine.Then, I viewed the product under "New Products," and the Add to Cart button appeared! I added another product with a similar number of attribute combinations, and it was fine under its category and the "New Products" display. Next, I wasted a couple of hours of forum searching and code diving. I deleted some products and re-added them. The problem seemed random.Then, I decided to look in the database and see if there was a difference between the products that were working properly and those that weren't. I found one column in the `xx_product` table that was different than the others. The `cache_default_attribute` value was zero for the faulty product, and had values of 1 or 3 for the others.I changed the zero value to one, cleared my cache, and BAM - no "Add to cart" button. Now I should find out where this value gets set, what setting it should have, and why it isn't setting properly; but that may have to wait.UPDATE: The only code related to that column I could find was in /classes/Product.php Link to comment Share on other sites More sharing options...
web.geek Posted January 19, 2011 Author Share Posted January 19, 2011 I haven't had time yet to track down the code that updates this column. I did, however, create a database script, since I'm a DB guy, that will set the cache_default_attribute of a given product to its default attribute combination, if it is not set by the system. Just substitute the "x" value with the id_product value for the product you are updating: /* Execute after adding product, running attribute generator, and selecting a default attribute combination Replace x with the proper product id */ UPDATE `ps_product` SET `cache_default_attribute` = ( SELECT `id_product_attribute` FROM `ps_product_attribute` WHERE `default_on` = 1 AND `id_product` = x) WHERE `id_product` = x; 1 Link to comment Share on other sites More sharing options...
Mr S Posted November 22, 2013 Share Posted November 22, 2013 (edited) Thank you for the information @web.geek attached is a PHP Script to re-index product cache attributesYou need to edit the file product_cache_attributes.php to updated your DB username & password than upload it to your web-server with FTP and open the file URL in your web browser. product_cache_attributes.php Edited November 22, 2013 by HA!*!*Y (see edit history) 1 Link to comment Share on other sites More sharing options...
botmez Posted January 11, 2014 Share Posted January 11, 2014 Update on date base Ok bUT NOTHING ON PRODUCT PAGE how can we solve that ? Link to comment Share on other sites More sharing options...
joseantgv Posted June 16, 2014 Share Posted June 16, 2014 I have solved it by executing this query: UPDATE `ps_product` SET `cache_default_attribute` = 0; UPDATE `ps_product_shop` SET `cache_default_attribute` = 0; UPDATE `ps_product` AS p, `ps_product_attribute` AS pa SET p.`cache_default_attribute` = pa.`id_product_attribute` WHERE p.`id_product` = pa.`id_product` AND pa.`default_on` = 1; UPDATE `ps_product_shop` AS p, `ps_product_attribute` AS pa SET p.`cache_default_attribute` = pa.`id_product_attribute` WHERE p.`id_product` = pa.`id_product` AND pa.`default_on` = 1; 1 Link to comment Share on other sites More sharing options...
WemkeD Posted November 18, 2014 Share Posted November 18, 2014 I have solved it by executing this query: UPDATE `ps_product` SET `cache_default_attribute` = 0; UPDATE `ps_product_shop` SET `cache_default_attribute` = 0; UPDATE `ps_product` AS p, `ps_product_attribute` AS pa SET p.`cache_default_attribute` = pa.`id_product_attribute` WHERE p.`id_product` = pa.`id_product` AND pa.`default_on` = 1; UPDATE `ps_product_shop` AS p, `ps_product_attribute` AS pa SET p.`cache_default_attribute` = pa.`id_product_attribute` WHERE p.`id_product` = pa.`id_product` AND pa.`default_on` = 1; This worked for me to make sure that the prices are present in the productlistings. So "Thanks!" But... it's still not working for the new "popular" products on the main-page, it still says "0,00 euro". In the mean time I shut down the module, but I would like to show the new products with the correct price, or even with no price at all, just a small title and photo will do. Who can help with that? Link to comment Share on other sites More sharing options...
joseantgv Posted November 19, 2014 Share Posted November 19, 2014 This worked for me to make sure that the prices are present in the productlistings. So "Thanks!" But... it's still not working for the new "popular" products on the main-page, it still says "0,00 euro". In the mean time I shut down the module, but I would like to show the new products with the correct price, or even with no price at all, just a small title and photo will do. Who can help with that? Have you tried to clear cache? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now