### Percentage of total cost before taxes for shipping...

Hello,

I was wondering, is there a way of calculating the shipping and handling cost by taking the dollar amount total of an order and multiplying it by a percentage that is based upon a zone that uses the postal code to find the zone? I would also need to do this for multiple shipping possibilities. So, Ground would be one percentage and Rush would be another percentage that would show up on the checkout_shipping page so the customer would be able to chose which shipping method they would prefer. I have tried setting up different Zones, but I seem to get lost and confused when trying to set it up involving the postal codes. Any help would be great.

I am in the US for all those that would need to know

Example:

Say the total amount of the order is \$623.75 and the zone for the postal code requires a 10% add on to the cost for shipping and handling for ground and 15% for Rush. So, we would take .10 x 623.75 = 62.375 and .15 x 623.75 = 155.9375 and then display it on the shipping page for the customer to choose.

I hope I explained this properly. Lol

New member

Posts

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

### Re: Percentage of total cost before taxes for shipping...

You appear to be describing "subtotal combined with zone" based shipping. I am happy to be contradicted but I think you will need to roll your own shipping extension based on code in the subtotal based shipping contribution and the zone based shipping module.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

### Re: Percentage of total cost before taxes for shipping...

Okay, well is there a way to edit the "Subtotal Shipping" module to include a percentage instead of a dollar amount?

I have been looking at it for hours and I think that I would change the file 'catalog\extension\shipping\subtotal.php' and I would change the code somewhere in here:

Code: Select all

``````\$quote_data['subtotal'] = array(
&nbsp; &nbsp; &nbsp; &nbsp;         'id'&nbsp; &nbsp; => 'subtotal_subtotal',
&nbsp; &nbsp; &nbsp; &nbsp;         'title' => \$this->language->get('text_subtotal_description'),
&nbsp; &nbsp; &nbsp; &nbsp;         'cost'&nbsp; => \$cost,
&nbsp; &nbsp; &nbsp; &nbsp;         'text'&nbsp; => \$this->currency->format(\$this->tax->calculate(\$cost, \$this->config->get('subtotal_tax_class_id'), \$this->config->get('config_tax')))
&nbsp; &nbsp; &nbsp;         );

&nbsp; &nbsp; &nbsp;         \$method_data = array(
&nbsp; &nbsp; &nbsp; &nbsp;         'id'&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  => 'subtotal',
&nbsp; &nbsp; &nbsp; &nbsp;         'title'&nbsp; &nbsp; &nbsp; &nbsp; => \$this->language->get('text_subtotal_title'),
&nbsp; &nbsp; &nbsp; &nbsp;         'quote'&nbsp; &nbsp; &nbsp; &nbsp; => \$quote_data,
&nbsp; &nbsp; &nbsp; &nbsp;         'tax_class_id' => \$this->config->get('subtotal_tax_class_id'),
'sort_order'&nbsp;  => \$this->config->get('subtotal_sort_order'),
&nbsp; &nbsp; &nbsp; &nbsp;         'error'&nbsp; &nbsp; &nbsp; &nbsp; => false
``````
I am still new to PHP and any help would be great. Thanks. And I do apologize if I am a hassle or bother to anyone here.

New member

Posts

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

### Re: Percentage of total cost before taxes for shipping...

You would not want to change the subtotal.php

you would want to extend or change the actual shipping module

hope this helps to point you in the right direction

Global Moderator

Posts

Joined
Fri Mar 21, 2008 10:58 am

### Re: Percentage of total cost before taxes for shipping...

Found this -- thought i seen this

http://www.opencart.com/contribution/in ... tion_id/49

subtotal shipping mod

Global Moderator

Posts

Joined
Fri Mar 21, 2008 10:58 am

### Re: Percentage of total cost before taxes for shipping...

Luvz2drv wrote: You would not want to change the subtotal.php

you would want to extend or change the actual shipping module

hope this helps to point you in the right direction
Luvz2drv wrote: Found this -- thought i seen this

http://www.opencart.com/contribution/in ... tion_id/49

subtotal shipping mod
I am basing the changes on the "Subtotal Shipping" module.

The code that I posted is from the actual shipping module for the "Subtotal Shipping" module and all I am trying to do is add to it, the ability to use percentages in the shipping rates. I know that it is possible cause I have seen it in other modifications and modules on other CMS Cart systems. But, like I said before, I am fairly new to editing and writing modules in PHP, so any help would be wonderful.

New member

Posts

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

### Re: Percentage of total cost before taxes for shipping...

I'm very interested in this as well.

Does anyone have this PHP code of how to add shipping price based on percentage of order total in the cart and shipping option?

I am new to open cart and a PHP scripting newblet and trying to wrap my head around this is making me craZY!

Newbie

Posts

Joined
Fri Jul 18, 2008 2:42 am

### Re: Percentage of total cost before taxes for shipping...

Hi April,

You should write and provide a specification of what you want that shows the choices and results etc in detail.

Then someone could answer you better.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

### Re: Percentage of total cost before taxes for shipping...

Thank you Bruce.  I will try to explain better.

I need the shipping to be calculated in the cart.

I would like it to have two choices for shipping, Rush Delivery or Standard Ground.

Each shipping choice should apply a percentage to the total order in the cart (before tax) on a sliding scale.

For example, paypal allows me to put .01 to 100/10%, 100.01 to 300.00/12%, etc.

I can't use the paypal shipping calculation in my account because it will apply to all my websites that are different, which is why I would like a shipping module to make the cart do this before being transfered to paypal for payment processing.

So if anyone has something like this I would appreciate a copy

Newbie

Posts

Joined
Fri Jul 18, 2008 2:42 am

### Re: Percentage of total cost before taxes for shipping...

Anybody? Any help at all?

New member

Posts

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

### Re: Percentage of total cost before taxes for shipping...

yes i build a custom module for April - works just as she wanted...

if your interested feel free to pm me

Jonathon

Global Moderator

Posts

Joined
Fri Mar 21, 2008 10:58 am
Who is online

Users browsing this forum: No registered users and 3 guests