Post by raquel » Thu Mar 25, 2010 10:58 pm

How can I implement a shipping cost of a flat rate plus a cost per item? For example, if I want to charge $5.95 plus $1 per item, how can I implement that? Is there a way to setup the modules already available, or is there a special download/programming needed?

Newbie

Posts

Joined
Fri Mar 12, 2010 12:56 am

Post by Qphoria » Tue Mar 30, 2010 11:28 pm

1. EDIT: catalog/model/shipping/item.php

2. FIND:

Code: Select all

'cost'         => $this->config->get('item_cost') * $this->cart->countProducts(),
3. REPLACE WITH:

Code: Select all

'cost'         => 5.95 + $this->config->get('item_cost') * $this->cart->countProducts(),
4. FIND:

Code: Select all

'text'         => $this->currency->format($this->tax->calculate($this->config->get('item_cost') * $this->cart->countProducts(), $this->config->get('item_tax_class_id'), $this->config->get('config_tax')))
5. REPLACE WITH:

Code: Select all

'text'         => $this->currency->format($this->tax->calculate(5.95 + $this->config->get('item_cost') * $this->cart->countProducts(), $this->config->get('item_tax_class_id'), $this->config->get('config_tax')))

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by logicalinsanity » Sat Jul 24, 2010 3:41 am

This post was helpful to me, though I ended up going about it a little differently. Here's how I set a flat rate shipping cost for one item, with $1 added for each subsequent item:

1. Ensure Flat Rate Shipping is Enabled in 'Extensions > Shipping > Flat Rate'

2. Set flat rate shipping to $1 LESS than what you want your flat rate to be
(example: if you want a 5.95 flat rate, set the value to 4.95)

2. Open 'catalog > model > shipping > flat.php'

FIND:

Code: Select all

'cost'         => $this->config->get('flat_cost'),
 
REPLACE WITH:

Code: Select all

'cost'         => $this->config->get('flat_cost') + $this->cart->countProducts(),
 
FIND:

Code: Select all

'text'         => $this->currency->format($this->tax->calculate($this->config->get('flat_cost'), $this->config->get('flat_tax_class_id'), $this->config->get('config_tax')))
 
REPLACE WITH:

Code: Select all

'text'         => $this->currency->format($this->tax->calculate($this->config->get('flat_cost') + $this->cart->countProducts(), $this->config->get('flat_tax_class_id'), $this->config->get('config_tax')))
 
What This Does:

It takes your flat shipping rate value and adds the number of total items in your cart. So for example, if you want to charge a flat $5.95 plus $1 per each additional item, you set 'Extensions > Shipping > Flat Rate' to $4.95 (which is $1 less than your actual flat rate.

If a shopper has 1 item in their cart at checkout, it will calculate $4.95 (Flat Shipping Rate ) PLUS 1 (which is the quantity of items in cart) = $5.95 (correct shipping total for one item)

If a shopper has 2 items in their cart at checkout, it will calculate $4.95 + 2 (number of items in cart) = $6.95 (correct shipping total for two items).

The above code only works if you're specifically only charging $1 more for each additional item shipped. It wouldn't work if you wanted to charge, say, $2.50 for each additional item.


Posts

Joined
Sat Jul 24, 2010 3:22 am

Post by mastastealth » Sat Jul 31, 2010 7:47 am

Is there a way to do this with the weight based shipping? I need both shipping costs and additional item costs to be different for my different zones.

Newbie

Posts

Joined
Sat Jul 31, 2010 7:44 am

Post by Qphoria » Wed Aug 04, 2010 2:06 am

mastastealth wrote:Is there a way to do this with the weight based shipping? I need both shipping costs and additional item costs to be different for my different zones.
not at this time but add it to the feature requests forum for future inclusion

Image


User avatar
Administrator

Posts

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

Users browsing this forum: No registered users and 12 guests