heliophobe Posted December 27, 2005 Share Posted December 27, 2005 Ok, I have a unique (i think) weight issue. Many of my products have a fixed weight (1x.25lbs=.25lbs and 2x.25=.5lbs) I also sell live fish. Depending on the fish, you can fit several in the same bag. Therein lies my problem. If I can fit 6 fish in a bag of water, the weight of the water is the same for 1 or 6 fish although the weight of the actual fish does increase per qty. The seventh fish means another bag of water and drastically changes the shipping from 6 to 7 fish. Is there a tare weight per quantity contribution? I've searched like mad to find an existing solution and unfortunately don't have the necessary skills to create a contribution on my own unless someone can point me to a good tutorial...hehe. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted December 28, 2005 Share Posted December 28, 2005 Is there a tare weight per quantity contribution? I'm not aware of it, but haven't searched either. The shipping weight takes the $total_weight that is set in checkout_shipping and adds the tare. $total_weight gets its number from the class shopping_cart and if you follow the trail long enough you will find it is calculated by the function calculate in catalog/includes/classes/shopping_cart.php (starts around line 203 in an unmodified file). In that function you will find the line: $this->weight += ($qty * $products_weight); I assume that you could work in code for your fish problem here. You could read in a file with comma separated products_id's (somewhere along the lines I posted in the SPPC thread). And if the (int)$prid is in that array you check what the quantity is and do your calculations else use the original line of code. Quote Link to comment Share on other sites More sharing options...
Guest Posted December 28, 2005 Share Posted December 28, 2005 best way is to modify whatever shipping module you are using and do a little maths. the shipping price is : (int)quantity / 6 * SHIPPING_PRICE_FOR_6 + (quantity % 6) * INDIVIDUAL_FISH_SHIPPING_PRICE if that doesn't make sense post the part of your shipping module that calculates the price and I can do it for you. Quote Link to comment Share on other sites More sharing options...
Guest Posted December 28, 2005 Share Posted December 28, 2005 thinking about it slightly more it would be better to do something like $bag_weight = (int)ceil($quantity / 6) * TARE_WEIGHT; $fish_weight = $quantity * FISH_WEIGHT; and the total weight is obviously the sum. Quote Link to comment Share on other sites More sharing options...
heliophobe Posted December 28, 2005 Author Share Posted December 28, 2005 Thanks for the replies. I use multiple shipping modules. DHL, UPS and USPS. Is there a way to add those fields to the actual product entry page, say below the item weight, that would add a quantity per bag and bag weight specific to that product? Something like this can be entered when adding a product: Weight: .10 lbs Bag Weight: .75lbs Qty/bag: 6 Have the code calc the number of bags required and add it to the product weight before it gets sent to UPS/USPS/DHL for a quote. Basically my issue is the 6 fish is an example since all fish aren't the same size. it could be 3 or 10 fish in the same size bag. And i have different size shipping bags with different weights. thanks again. I really need to learn how to do this myself...hehe. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted December 28, 2005 Share Posted December 28, 2005 Is there a way to add those fields to the actual product entry page, say below the item weight, that would add a quantity per bag and bag weight specific to that product? Sure you could do that, would be a good way to have all that stuff together. However, it would mean writing your own contribution because it is a fair amount of work and you seem to be the only one needing it. Quote Link to comment Share on other sites More sharing options...
satish Posted December 28, 2005 Share Posted December 28, 2005 Thanks for the replies. I use multiple shipping modules. DHL, UPS and USPS. Is there a way to add those fields to the actual product entry page, say below the item weight, that would add a quantity per bag and bag weight specific to that product? Something like this can be entered when adding a product: Weight: .10 lbs Bag Weight: .75lbs Qty/bag: 6 Have the code calc the number of bags required and add it to the product weight before it gets sent to UPS/USPS/DHL for a quote. Basically my issue is the 6 fish is an example since all fish aren't the same size. it could be 3 or 10 fish in the same size bag. And i have different size shipping bags with different weights. thanks again. I really need to learn how to do this myself...hehe. place a code that calculates bag qty as bag_qty = int(fish_qty/6) and you will get the bag qty.Use this qty along with other products to come to the total shipping estimate. Satish Quote Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does. Link to comment Share on other sites More sharing options...
heliophobe Posted December 28, 2005 Author Share Posted December 28, 2005 Just from your replies I think I know where to put what code, just not how to add fields to a page or define the variables. I'd be more than happy to write my own contribution. Guess I'll do a bit more research on that. Maybe rip apart a contribution that added a field to see how they did it. Thanks all. I really do appreciate it. Sorry if the request for info annoyed you Janz. Wasn't meant to. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted December 28, 2005 Share Posted December 28, 2005 Just from your replies I think I know where to put what code, just not how to add fields to a page or define the variables. I think (from the description, haven't used this myself) you could use Product Extra Fields to add your two necessary fields to the database and admin/categories.php page. Make sure the quantity is an integer or a small integer and weight like the other weights in the database. Then all that is left is add the code to the function calculate in includes/classes/shopping_cart.php. You would need to add those two fields to the sql query: // products price $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight, bag_quantity, bag_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); Then use if else logic: if (tep_not_null(product['bag_quantity']) && tep_not_null(product['bag_weight'] ) { do your thing } else { original code for weight } Sorry if the request for info annoyed you Janz. Wasn't meant to. Sorry if you think I was annoyed, I wasn't. I guess I was trying to discourage you from asking me to code it for you :) Quote Link to comment Share on other sites More sharing options...
heliophobe Posted December 28, 2005 Author Share Posted December 28, 2005 I probably should have been more clear that I would have preferred pointers or a tutorial so I could deal with any future issues on my own and add contributions for others. And I just found that product extra fields contribution not 5 minutes ago...LOL. Of course my server is being moved so I have to wait a couple hours till I can install everything. I am not a programmer but I know enough to be dangerous and learn quickly. Everything you all have posted has taught me a lot believe it or not. Thanks. I truly appreciate it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.