tdr170 Posted June 9, 2012 Share Posted June 9, 2012 Prestashop Ver. 1.4.7.3 Does anyone know of a way to add a packaging weight to the product weight as they are added to cart. I found a post that gave the code below for just this but it was for an older version and these lines do not seem to be part of 1.4.7. Please Help If Possible! You will need to modify a couple of functions. Change lines 939-940 of classes/Cart.php (in PrestaShop v1.3.2) from: $this->_totalWeight = round(floatval($result['nb']) + floatval($result2['nb']), 3); return $this->_totalWeight; to: $this->_totalWeight = round(floatval($result['nb']) + floatval($result2['nb']), 3); $this->_totalWeight += 0.07; return $this->_totalWeight; and line 793 of classes/Order.php from: return floatval($result['weight']); to: return 0.07 + floatval($result['weight']); Link to comment Share on other sites More sharing options...
phrasespot Posted June 12, 2012 Share Posted June 12, 2012 AFAICT that snippet adds a standard 0.07 unit of weight to the set weight of every product during checkout. You can do this w/o making changes to the core files by increasing all product weights by the appropriate amount. You could save time if you were to do that directly on the relevant DB table. Does this not work for you? Link to comment Share on other sites More sharing options...
tdr170 Posted June 12, 2012 Author Share Posted June 12, 2012 Thanks I have a code for increasing prices in the database by a % and used that modified a little and changed the weights in the DB. The problem with the code above is that the lines of code are different in 1.4.7 so this code could not be applied. Link to comment Share on other sites More sharing options...
phrasespot Posted June 13, 2012 Share Posted June 13, 2012 The problem with the code above is that the lines of code are different in 1.4.7 so this code could not be applied. True, but if changing the weights in DB is not sufficient and you wish to port the given lines to a later version post again. 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