parklane1819 Posted February 8, 2007 Posted February 8, 2007 Hi, This is my first post so I hope that I am posting correctly. Am still new to Oscommerce and a newbie in php too. Hoping to change the calculation formula now used for shipping in catalog/includes/classes/shipping.php but require the data for the total item count (total quantity in the shopping cart) in order to do this. Can someone tell me what is the " string " (?) for this ? Is it like this : count_contents() or is it something else. Further, do I need to add any other codes in the catalog/includes/classes/shipping.php files in order to make reference to this "string" in this file ? Any guidance and advice is appreciated. Thanks Andrew
Guest Posted February 9, 2007 Posted February 9, 2007 The count_contents member function of the cart class returns the number of cart contents. But why you need to change the shipping class? You should install or write a shipping module to support your needs. The shipping module returns the shipping cost so its what you should be looking for.
parklane1819 Posted February 9, 2007 Author Posted February 9, 2007 Hi Enigma1, Thank you for your kind response. The solution that would fit my needs is probably a modified version of add-weight-to-product-attributes where 2 variables instead of 1 is enabled (ie weight and volume or weight and something else K). I have written out the details on this webpage : http://www.fineprintzasia.com/Kfield.htm In the absence of finding such a solution, then I have to figure out an alternative that would let me charge the correct tare weight if product weight is within the max allowed for the box but quantity count exceeds that allowed for the box. Because of that I need to use the total item count in the shipping formula as a comparator. I can only use Zone shipping and not other flate rate or table rate etc. I am sure many have encountered the same situation before. If there is a better solution that anyone has found, please point me to it. Thank You Andrew
Guest Posted February 9, 2007 Posted February 9, 2007 Yes you basically need 2 things. 1. to be able to add the weight at the attribute level. Which I guess the contribution does that. 2. a shipping module that will be able to create separate boxes based on volume or weight. If you check few other shipping modules (not necessarily table-driven) they perform the splitting on the items by checking the products weight. So you can do a similar approach for the volume. And apply the tare weight too. Since you want it at the attribute level you retrieve the attribute values using code within the shipping module. Pretty much like some of the available modules retrieve each product's weight. All this info is available from the cart class. And the main shipping class should stay as is. I remember one contribution was doing something like that was http://www.oscommerce.com/community/contributions,1201 See how it manipulates the cart class and retrieves the products with their parameters (function quote). At the same place you could retrieve the product attributes and then you have everything for your calculations.
parklane1819 Posted February 9, 2007 Author Posted February 9, 2007 Hi Enigma1, Thanks for your reply :) Had a look at the contrib 1201 and downloaded to have a peek but it dosen't appeal and the codes look extremely complex (and frightful (w00t) as I am only at entry level now). While on that download page, I just searched for item count in "shipping" and came across this contrib/patch which appears to be ideal : Table shipping based on number of items v1.0 This table shipping module is a compatible enhancement of the standard table module. It adds a "count" option to base the calculation of the shipping, so now there are three: - total weight of the items in the cart - total price - count of items in the cart I think my required solution is somewhere in there and if I could get it to work alongside zones or better still extract chunks of relevant codes to replace those relevant lines in my current shipping.php then all is set. Sincere thanks, AL BTW, what's the rating at the top of post for ?? Newbie asking
Guest Posted February 9, 2007 Posted February 9, 2007 BTW, what's the rating at the top of post for ?? Newbie asking hmm, never used it really suppose to give a rating to post. Seen it after one of the IPB upgrades they did last year I think. Some ppl use it but I always check the post content.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.