pl.sabotinov Posted October 2 Share Posted October 2 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? 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