boylibre Posted October 29, 2010 Share Posted October 29, 2010 Tried to search but I can't find the solution. There is one posting asking the same question but no answer.If doing it the right way is not possible, can we do it the left way? :-)What I mean is planting it in the code?I want to add 0.07 Kg per order. Is this possible? if yes, which file?I know a bit of programming, I think I can do it.I'm using PS1.3.2Thanks,boy Link to comment Share on other sites More sharing options...
rocky Posted October 29, 2010 Share Posted October 29, 2010 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...
boylibre Posted October 29, 2010 Author Share Posted October 29, 2010 Thanks Rocky, I will try it out.~boy Link to comment Share on other sites More sharing options...
boylibre Posted October 29, 2010 Author Share Posted October 29, 2010 Hi Rocky, it works, thank you so much. It's just one small thing, I don't why but I changed $this->_totalWeight .= 0.07 to $this->_totalWeight = $this->_totalWeight + 0.07The one with the dot doesn't work.~boy Link to comment Share on other sites More sharing options...
rocky Posted October 29, 2010 Share Posted October 29, 2010 Oops, that should have been +=. I've corrected my code above. Link to comment Share on other sites More sharing options...
array064 Posted February 27, 2011 Share Posted February 27, 2011 This is great. Thank you very much. And in my opinion, this should be accommodated by the BackOffice of Prestashop latest version. I have submitted this as a "Feature Request" on the link below:http://www.prestashop.com/bug_tracker/view/7971/ Link to comment Share on other sites More sharing options...
bloodmusic Posted January 25, 2012 Share Posted January 25, 2012 Hello! This code no longer seems to exist in v1.4 Can someone please help shed a light on how to achieve this nowadays? The way the PS system is set up does not integrate well with the way the post works here, so I would need to add a packaging weight to each order. Thanks much! Link to comment Share on other sites More sharing options...
bloodmusic Posted January 25, 2012 Share Posted January 25, 2012 Whoo! Solved it on my own... Link to comment Share on other sites More sharing options...
lucass Posted April 9, 2012 Share Posted April 9, 2012 could you share your solution for v1.4? Also, does anyone have an idea how to set flat "every additional item" weight? Link to comment Share on other sites More sharing options...
tdr170 Posted April 9, 2012 Share Posted April 9, 2012 Yes share your fix with others just as someone would have shared theres with you. Link to comment Share on other sites More sharing options...
lucass Posted April 9, 2012 Share Posted April 9, 2012 im now having fun with cart.php, so far results: cart ceased to show up.... Link to comment Share on other sites More sharing options...
lucass Posted April 9, 2012 Share Posted April 9, 2012 alright, figured it out. personally, I still do have 1.4.2.5, though I believe all v1.4 should have the same structure. You gotta change this: self::$_totalWeight[$this->id] = round((float)($result['nb']) + (float)($result2['nb']), 3); to self::$_totalWeight[$this->id] = round((float)($result['nb']) + (float)($result2['nb']), 3); self::$_totalWeight[$this->id] += 0.05; where in my case, I added 50 grams to every order for packaging purposes. (0.05) In terms of Order.php, code is the same in v1.4, therefore I'm not reposting it once again. hope this helps 1 Link to comment Share on other sites More sharing options...
curtisblackwell Posted July 31, 2013 Share Posted July 31, 2013 Any solution for 1.5.4.1? Link to comment Share on other sites More sharing options...
hedie Posted March 23, 2014 Share Posted March 23, 2014 Can someone please help us? Link to comment Share on other sites More sharing options...
vekia Posted March 25, 2014 Share Posted March 25, 2014 help you with... ? 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