Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 11-29-2008 11:35:30

Graham
Member
Registered: 09-30-2004
Posts: 892
Website

Adding weight based shipping to mini cart

I have changed my custom shipping method to a calculation based on the weight of the items ordered (unfortunately it's not a simple multiplier), but I want to be able to include the shipping cost in the mini cart so people don't have to go through to the checkout page to find out how much this will be.

I figure I need to alter ste_cart.pl because that's where the mini cart routine is, the problem is I'm not sure how to get the total item weights which in my ste_shipcus.txt routine is found in $item_total_weight

In "sub ste_cart_mini" (found in ste_cart.pl) there's this section:

Code:

$sql_statement = "

SELECT cart_prodquantity,cart_amtprod,cart_amtrecur
FROM cart

";

So can I just add in something like "cart_weight" or whatever the variable would be to get the total weight of items ordered?

Offline

 

#2 11-29-2008 13:47:44

Graham
Member
Registered: 09-30-2004
Posts: 892
Website

Re: Adding weight based shipping to mini cart

Alternatively, would it be easier if I upgraded to 6.0?!

I hadn't before because I don't like upgrading when things are working ok ie if it ain't broke, don't fix it ;-) but maybe it's time for a change now...?

Offline

 

#3 11-30-2008 09:08:56

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Adding weight based shipping to mini cart

The total weight is something that would have to be calculated - it's not all as easy as just adding it into a SQL call.  Even if you got the weight calculated in that routine, it doesn't execute the shipping script at that point, so you really have a lot of customization to get it to do what you want.  ATS (aatechservices.com) has a shipping estimator module for 5.1, but you should definitely have a look at 6.0... would be a lot better to spend the money on the version that will be around a while rather than the one that's already past end of life.


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#4 11-30-2008 21:16:21

Graham
Member
Registered: 09-30-2004
Posts: 892
Website

Re: Adding weight based shipping to mini cart

I have the code for calculating the weight based shipping all worked out, it's already present in the checkout routine where I have the total weight of all the items easily available.

What I don't know is how to get the weight of each item in the cart whilst the customer is still shopping so I can add them up and calculate the shipping cost in the mini cart

Basically I can hack around bits of perl code to do simple stuff, but I don't know how to get it to read data from the product.csv file.

PS I appreciate what you're saying about 6.0, but 5.1 is still working fine for me at the moment and I wouldn't be able to upgrade until after the New Year anyway smile

PPS and even if I did upgrade, I doubt it would do what I want "straight out of the box" anyway which is why I'd like to get some help on this mod instead...

Offline

 

#5 12-01-2008 12:32:20

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Adding weight based shipping to mini cart

Well, I'll do what I can to point you in the right direction, but the specifics of a mod that large are definitely beyond the scope of current forum support for v5.1.  Anyway, you'll be calculating the weight based on what's stored in the cart, not pulling it from the product table.  The weight for each item is stored in the field cart_prodshipweight.  You would need to get the weight for each line item, multiply by the quantity, add them up, and store the value in the variable to be accessed by the logic that determines the shipping cost.  Of course, even that already assumes that all the products will go in one box to the same location... which you might have specified in the admin or not.  So this mod will limit your cart to a pretty specific set of rules going forward and remove a lot of the versatility CCP ships with.  It will also hard-code a lot of stuff that will all have to be changed if you move away from your current weight based custom shipping script.  At any rate, that's the basic process and if you want to see how it is normally done, have a look at the subroutine ste_chkout_meth in ste_chkout.pl - that's where the shipping logic is normally accomplished.


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#6 12-04-2008 19:45:22

Graham
Member
Registered: 09-30-2004
Posts: 892
Website

Re: Adding weight based shipping to mini cart

Ok, thanks for this.

As I mentioned, I'm already doing all of this at the checkout stage, my shipping rules are specific (and simple), so that's not a problem.

I just want to let people know how much the shipping should be before they get to that point because it should hopefully stop people bailing out at the checkout if they suddenly decide they don't like the P&P charges (personally I find it very annoying when you've got to go to the checkout to find out how much someone is going to charge me for shipping, so I don't like doing it to others!)

Offline

 

#7 12-05-2008 13:03:30

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Adding weight based shipping to mini cart

Well good luck with it, and if you have any specific questions about problems you might encounter, let me know and I will try to help.


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#8 12-06-2008 11:22:06

Graham
Member
Registered: 09-30-2004
Posts: 892
Website

Re: Adding weight based shipping to mini cart

Thanks, your help is much appreciated.

Offline

 

Board footer