Post by Qphoria » Thu Jan 15, 2009 1:16 am

Normal Zone Shipping currently is limited to:
- weight-based only
- based on incremental pricing only, so as weight goes up, price also has to go up (which means no volume discounts)


My thoughts:
Add a new configuration option in the admin that specifies which calculation method to be used:

incremental - (current default way) - increase the shipping cost as the volume increases
a value of 5:10, 10:20 means
volume of 0-5 = $10 shipping
volume of 6-10 = $20 shipping

decremental - decrease the shipping cost as the volume increases
a value of 10:10, 20:5 means
volume of 0-10 = $10 shipping
volume of 11-20 = $5 shipping

This could also be expanded to include an option that is price, weight, or item-count based. This would effectively merge the subtotal zone shipping contrib as well.

Price-based example:
incremental - increase the shipping cost as the volume increases
a value of 5:10, 10:20 means
cost of $0-$5  = $10 shipping
cost of $6-$10 = $20 shipping

Item-count based example:
incremental - increase the shipping cost as the volume increases
a value of 5:10, 10:20 means
0-5 items in the cart  = $10 shipping
6-10 items in the cart = $20 shipping

Any other thoughts?
Last edited by Qphoria on Tue Jan 27, 2009 11:52 am, edited 1 time in total.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Tue Jan 27, 2009 11:47 am

Ok, it's done :)

Working perfectly :)
What does it do:
============
This module expands on the original zone shipping module to allow calculate zone shipping based not only on the weight, but also the subtotal or item count of the entire order. It also supports incremental and decremental ranges, useful for breaks on shipping costs if the customer purchases a large order.

Main features:
==============
* Zone Shipping can be based on Weight, Subtotal, or ItemCount
* Calculation ranges can be set to increase or decrease
* Hides option when rates are out-of-range instead of showing 0.00
DOWNLOAD

Attachments

???
zoneplus_admin.jpg
???
zoneplus_catalog.jpg
Last edited by Qphoria on Tue Jan 27, 2009 12:00 pm, edited 1 time in total.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Geek » Tue Jan 27, 2009 8:07 pm

Just wondering...does this work with percentages as well or no?

ie:

10:5,200:8%

~Simplygeek.net


New member

Posts

Joined
Sat May 17, 2008 1:00 pm
Location - Cyberspace, the final frontier...

Post by Qphoria » Tue Jan 27, 2009 9:43 pm

no but could probably be easily added

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Wed Jan 28, 2009 3:06 am

Done! :)

v079.2 - 2009-JAN-27 - Qphoria
- Added support for % based costs. For example, a subtotal zone with 10:25% means that a $10 cart total charges $2.50 shipping.

Good call Geek :)


Summary:
itemcount/incremental: 4:10%,8:20% - If there is 1-4 items in your cart, it takes 10% of the cart subtotal for the shipping cost. If there are 5-8 items, it takes 20% of the cart subtotal. If there are more than 8 items, it won't show this shipping option.

weight/incremental: 4:10%,8:20% - If the cart weight is 1-4 units, it takes 10% of the cart subtotal for the shipping cost. If the cart weight is 5-8 units, it takes 20% of the cart subtotal. If there are more than 8 units, it won't show this shipping option.

subtotal/decremental: 4:20%,8:10% - If the cart subtotal is 4-7 (dollars), it takes 20% of the cart subtotal for the shipping cost. If the cart weight is 8+ (dollars), it takes 10% of the cart subtotal. If there are less than 4 (dollars), it won't show this shipping option.
Last edited by Qphoria on Wed Jan 28, 2009 3:12 am, edited 1 time in total.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Geek » Wed Jan 28, 2009 7:04 am

No prob, Qphoria.

A lot of the modules, so far that I have seen, don't include the ability for percentage. And
most of the retail industry deals with percentages. lol

edit:
It appears though that you have to use either you use a set dollar amount or percentages.
But, what if you wanted to added both in the cost field? I have been working on a module
to try and do that, but with my limited knowledge of PHP I am having a hard time doing that.
Still learning a lot with PHP though.

edit:
It appears that I was wrong. You can use both, I just had it setup wrong. HA!

But, now I have another problem. On the checkout page, I receive a parsing error at the top of the page.
Could it have been something I did to the code? Doubtful, cause I recopied the original module files into
the locations on the site and I still get the error. Any thoughts?

Error:

Code: Select all

Parse error: syntax error, unexpected ')' in ../catalog/extension/shipping/zoneplus.php(58) : eval()'d code on line 1
I am running OpenCart 0.7.9-RC6.
Last edited by Anonymous on Fri Jan 30, 2009 5:53 am, edited 1 time in total.

~Simplygeek.net


New member

Posts

Joined
Sat May 17, 2008 1:00 pm
Location - Cyberspace, the final frontier...

Post by Geek » Fri Jan 30, 2009 3:01 pm

Qphoria? Anybody?

It all looks right to me in the code, but I need another set of eyes if possible.

~Simplygeek.net


New member

Posts

Joined
Sat May 17, 2008 1:00 pm
Location - Cyberspace, the final frontier...

Post by Qphoria » Fri Jan 30, 2009 3:19 pm

ah i didnt see your edits. They don't show up as new posts. I'll research this issue more.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Fri Jan 30, 2009 3:32 pm

Maybe the return stuff isn't needed.

Can you edit the file in the error above and try
replacing:

Code: Select all

if (eval("return($value $op $array[0]);")) {
with

Code: Select all

if (eval("$value $op $array[0]")) {
If that don't work try:

Code: Select all

if (eval("return $value $op $array[0];")) {
If that don't work try:

Code: Select all

if (eval('return $value $op $array[0];')) {
Last edited by Qphoria on Fri Jan 30, 2009 3:39 pm, edited 1 time in total.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Geek » Fri Jan 30, 2009 4:44 pm

Well, here are the results of the edit changes:

Replaced:

Code: Select all

if (eval("return($value $op $array[0]);")) {
With:

Code: Select all

if (eval("$value $op $array[0]")) {
Results:

Code: Select all

Parse error: syntax error, unexpected $end in /mnt/w0205/d18/s13/b02dbab8/www/dev/opencart/catalog/extension/shipping/zoneplus.php(58) : eval()'d code on line 1

Parse error: syntax error, unexpected $end in /mnt/w0205/d18/s13/b02dbab8/www/dev/opencart/catalog/extension/shipping/zoneplus.php(58) : eval()'d code on line 1

Parse error: syntax error, unexpected $end in /mnt/w0205/d18/s13/b02dbab8/www/dev/opencart/catalog/extension/shipping/zoneplus.php(58) : eval()'d code on line 1

Parse error: syntax error, unexpected $end in /mnt/w0205/d18/s13/b02dbab8/www/dev/opencart/catalog/extension/shipping/zoneplus.php(58) : eval()'d code on line 1

Parse error: syntax error, unexpected $end in /mnt/w0205/d18/s13/b02dbab8/www/dev/opencart/catalog/extension/shipping/zoneplus.php(58) : eval()'d code on line 1

Parse error: syntax error, unexpected $end in /mnt/w0205/d18/s13/b02dbab8/www/dev/opencart/catalog/extension/shipping/zoneplus.php(58) : eval()'d code on line 1
So, that didn't work then I replaced it with:

Code: Select all

if (eval("return $value $op $array[0];")) {
Results:

Code: Select all

Parse error: syntax error, unexpected ';' in /mnt/w0205/d18/s13/b02dbab8/www/dev/opencart/catalog/extension/shipping/zoneplus.php(58) : eval()'d code on line 1
Then I replaced that with:

Code: Select all

if (eval('return $value $op $array[0];')) {
Results of that:

Code: Select all

Parse error: syntax error, unexpected T_VARIABLE in /mnt/w0205/d18/s13/b02dbab8/www/dev/opencart/catalog/extension/shipping/zoneplus.php(58) : eval()'d code on line 1

Parse error: syntax error, unexpected T_VARIABLE in /mnt/w0205/d18/s13/b02dbab8/www/dev/opencart/catalog/extension/shipping/zoneplus.php(58) : eval()'d code on line 1

Parse error: syntax error, unexpected T_VARIABLE in /mnt/w0205/d18/s13/b02dbab8/www/dev/opencart/catalog/extension/shipping/zoneplus.php(58) : eval()'d code on line 1

Parse error: syntax error, unexpected T_VARIABLE in /mnt/w0205/d18/s13/b02dbab8/www/dev/opencart/catalog/extension/shipping/zoneplus.php(58) : eval()'d code on line 1

Parse error: syntax error, unexpected T_VARIABLE in /mnt/w0205/d18/s13/b02dbab8/www/dev/opencart/catalog/extension/shipping/zoneplus.php(58) : eval()'d code on line 1

Parse error: syntax error, unexpected T_VARIABLE in /mnt/w0205/d18/s13/b02dbab8/www/dev/opencart/catalog/extension/shipping/zoneplus.php(58) : eval()'d code on line 1
Any other ideas?

~Simplygeek.net


New member

Posts

Joined
Sat May 17, 2008 1:00 pm
Location - Cyberspace, the final frontier...

Post by Qphoria » Fri Jan 30, 2009 7:30 pm

can you show me your admin config for the value:cost

I think i know where the problem is but would be helpful to use your data

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Fri Jan 30, 2009 10:37 pm

I'm unable to reproduce your error so if you could try uploading this attached version of the extension file to:
catalog/extension/shipping/
overwrite the existing zoneplus.php file

Let me know if that works. I think the problem is that sometimes array[0] could be "" and it is trying to evaluate (1 >= )
Now I check that array is populated before trying to run the equation

The thing is, array[0] should be populated assuming the admin stuff is set up correctly in "value:cost" pairs
Last edited by Qphoria on Fri Jan 30, 2009 10:50 pm, edited 1 time in total.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Tue Feb 03, 2009 9:54 am

any update on this?

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Geek » Tue Feb 03, 2009 10:32 am

Sorry for the delayed reply, please don't dock my pay as well. lol

I figured out it was the settings that was causing the problem. I had it set as decremental instead of incremental.

But, I was wondering, is there a way to set it up for a handling fee so it will display it in the checkout?

~Simplygeek.net


New member

Posts

Joined
Sat May 17, 2008 1:00 pm
Location - Cyberspace, the final frontier...

Post by Qphoria » Tue Feb 03, 2009 10:54 am

handling fee? you mean like an additional fee?

There is the Calculate Surcharge contrib that I made that adds a surcharge based on weight and/or subtotal

You can add that as a separate calculation that will show on the checkout page.

I will be updating that one to include itemcount as well.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 10 guests