Search the Community
Showing results for tags 'specific_price'.
-
Undefined variable specific_price_output in Cart override
pl.sabotinov posted a topic in Bug reports
Hello, in Prestashop 8.1.4 i have made an override of the Cart.php file. I have done this override many times in different older versions of PS. So i am overriding the function getPackageShippingCost(). The goal is to add an aditional shipping cost for each product, calculated during cart execution and debending on the current price and discount of any product in the cart. So here the calculation i made: $shipping_cost += (($product['price'] * (1 - (float)$specific_price_output['reduction'])) * $product['cart_quantity']); And all the calculation is done correctly and added to shipping cost. But in error_log (or in Debug mode) i receive the error: "Undefined variable $specific_price_output in /home/mipiseuz/shop/override/classes/Cart.php on line 466 PHP Warning: Trying to access array offset on value of type null in /home/mipiseuz/shop/override/classes/Cart.php on line 466" If I am not in Debug mode everything works correctly - competing the order. But if in debug mode - the final confirmation of order ("Place order") is not possible. Button is not working. As i have written i have done the exactly same override many times in PS 1.6 PS 1.7 - without any problem. And I see this var $specific_price_output is used (defined and filled with value, also checked for not empty specific_price_output['reduction']) in function applyProductCalculations() which is executed before getPackageShippingCost(). I have checked - when the product has a discount - this calculation of $shippin_cost is calculated correctly with the reduction. So why I get this error in the error_log?-
- specific_price
- undefined
-
(and 3 more)
Tagged with:
-
Hi! Please help, I'm very frustrated with this: We have decent shop (hundreds of products) and we lately upgraded from 1.6.1.0 to 1.6.1.4 When saving now (within the BO edit product) many products, not all, but those who gets a lot of Specific Prices, we're getting this error: Duplicate entry '39-0-0-0-2015-11-29 00:00:00-2015-12-02 00:00:00-1-0-0-0-0-1-47' for key 'id_product_2' Which is indeed an UNIQUE KEY in the specific_price table. I tried digging in the code, and I found that the process of saving the product tirggers this function call: SpecificPriceRule::applyAllRules(array((int)$this->id)); Which indeed inserting the specific prices coming from Catalog Price Rules for that product, to the specific_price table in database! Plus, Looking into this sql error it seems that prestashop just try to insert the same specific price rule for the same product, where prestashop try at all to prevent this duplicate for unique key? I'm well aware of that topic: https://www.prestashop.com/forums/topic/467748-solved-specific-price-error-after-update-from-1609-to-1611/ And of that issues: http://forge.prestashop.com/browse/PSCSX-6535 http://forge.prestashop.com/browse/PSCSX-6346 None of the solutions mentioned there solved my error, none of it should, if prestashop indeed tries to insert duplicate values when unique key restriction exists. My issue is different though, my specific prices are working, only the process of Saving changes to my products is cancelled because of that error. Thank you for any help, Nati, Web developer
-
Bonjour, sur ps 1.5.4.1 j'ai déplacé un site d'un serveur dédié à un autre, en gardant le meme ndd. dans l'ensemble ca s'est plutot bien passé, après quelques petites corrections. mais la je bloque.... lorsque je veux modifier/créer un produit, compris dans une regle de prix catalogue, il essaie d'insérer un prix spécifique pour ce produit, meme si un existe déja... donc page blanche, erreur 500. en affichant les erreurs: [PrestaShopDatabaseException] Duplicate entry '41-2-0-0-0-37-0-0-1-0000-00-00 00:00:00-0000-00-00 00:00:00' for key 'id_product_2' INSERT INTO `ps_specific_price` (`id_shop_group`, `id_shop`, `id_cart`, `id_product`, `id_product_attribute`, `id_currency`, `id_specific_price_rule`, `id_country`, `id_group`, `id_customer`, `price`, `from_quantity`, `reduction`, `reduction_type`, `from`, `to`) VALUES ('0', '2', '0', '41', '0', '0', '20', '0', '37', '0', '-1', '1', '0.29', 'percentage', '0000-00-00 00:00:00', '0000-00-00 00:00:00') si je supprime ce prix dans la table ps_specific_price, l'ajout/modif se fait bien, mais seulement jusqu a la fois d'apres, ou le meme problème revient, le prix existe et il veut en créer un... avant la migration, il n'y avait aucun problème.... quelqu'un aurait une idée? une piste? merci d'avance
-
- specific_price
- duplicate
-
(and 2 more)
Tagged with: