I started with quantity.inc as my partner but found that some items need to be adjusted (small items slightly less, large items slightly more), so I created adjustedquantity.inc (see attachment).
Each product has the option to create an additional charge for each product. For less shipping, use a negative number, for additional shipping, use a positive number. If there is more than one item in the cart, the negative numbers are not factored in.
Also, the settings have a threshold setting, so it will charge the base rate unless the quantity is above the threshold, at which point it will charge the set amount for each multiple of that threshold. For example, say your threshold is set to 5, the base rate is $4 and the additional rate is $2. If you have a quantity of 1-5, the shipping would be $4, the base rate. If you have a quantity of 6-10, the shipping would be $6, base rate + additional. If you have a quantity of 11-15, the shipping would be $8, base rate + $2 + $2, for going over the threshold twice.
It also has three region settings as per quantity.inc
try it out
alynner
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | q_adjust.inc | 14.18 KB | alynner |
| #1 | adjustedquantity_0.inc | 13.76 KB | alynner |
| adjustedquantity.inc | 13.74 KB | alynner |
Comments
Comment #1
alynner commentedSorry that one didn't work out the threshold properly, please see use the one attached to this post instead.
I just realized there are some problems with this though, it doesn't actually factor in the adjustments when the threshold is exceeded. I'll keep working on it.
Comment #2
alynner commentedSorry, I realized there are a lot more problems with this file. Please ignore this post for now, I will post the file when I have it working properly.
alynner
Comment #3
alynner commentedOkay, it is working now, please test it out.
Here is an example configuration:
A store sells DVD's, T-Shirt and Backpacks
regular(base) rates:
US=$5
CA=$15
INT'L=$20
- DVD's get charged $5 less when shipped to CA and INT"L if it is the only item in the cart, or it is part of a dynamic_parcel.
- Backpacks always charge $5 more to US and CA
- If there is a DVD and an item of clothing, the regular rate would apply.
- If there are more than 5 items in the cart, an extra $5 will be charged in Canada and US. Essentially, for every 5 items, and extra $5 will be applied, so if someone orders 12 items, they would be charged an extra $10.
I don't know if this makes sense, if you have any questions please post them here.
alynner
Comment #4
alynner commentedBase Rate +/- extra charges for each product and quantity threshold
has anyone tried this?
Comment #5
lunas commentedI recently implemented your code and it looks like what I need. However, I am having a problem getting it to pick the right region. It seems to pick region 3 even though I'm trying to ship to Canada. The shipping address is to Canada, however Canada is region 1 and it is seeing it as region 3. Any idea why?
Comment #6
lunas commentedFurther testing shows that it doesn't matter what country it is I'm trying to ship to, it always defaults to region 3.
Comment #7
alynner commentedI can't seem to find the problem or re-create it, the only thing I can think is if somehow the transaction country code is different than the region codes. Have you changed the country codes in any way in your address module or this module?
Another option is perhaps the regions aren't getting saved. You can see what is saved in the variables by creating a page with this php code:
let me know what you get.
-alynner
Comment #8
lunas commentedHi, made a page with that in it - php input filter and it doesn't return anything. There is no content. I have the devel module installed and checked the object structure on the checkout page. The shipping and billing country is listed as ca (Canada) in the array.
Comment #9
lunas commentedAnd no, I haven't changed anything in your module or the ecommerce/address module in general...
Comment #10
lunas commentedAlrighty, figured out a couple of things, first being the function you gave me was wrong...changing it to
then gives me the following:
Array ( [ca] => ca ) Array ( [us] => us )
So, it looks like the regions are getting saved correctly and ca is the same as what is given in the address module...
Comment #11
lunas commentedI figured out the problem...for anyone else who is having problems with shipping modules, and it may not just be this one, but ensure that shipping is after the address collection in the store/settings/cart section. Kind of obvious, it needs to know what the country is before the shipping gets calculated, but that was my stupid mistake for the last couple of days. Damn, so much wasted time.
Comment #12
simehousekeeping
Comment #13
(not verified) commentedComment #14
alynner commentedsorry to reopen after you have done your housekeeping, but I am just curious why this wouldn't get considered for CVS, its a really good partner for shipcalc, I think people might find it handy...
cheers
alynner
Comment #15
simeHi. Sorry I get quite brief when I'm going through lots of tickets.
Nedjo's original conception of shipcalc is that it should be solely for API-based shipping partners. Initially I disagreed until I actually worked up the code to go in shipcalc. Clearly, to me, this is suited to flexicharge.
I encourage you to look at Flexicharge's progress, there are some docs here: http://drupal.org/node/122769
Comment #16
alynner commentedthanks for the explanation. I probably won't look at flexicharge at this point in time, because this does the job for me and I don't actually have the time, but I understand what you are saying.
cheers
alynner