0

A quick question with regards to the csv which needs to be created for implementing these rules.

I have a basic rule where for example shipping to Belgium for one item starts at £3.00 Then for every extra item the total goes up by £1.00

So in the csv the item # of items field would be:

  1. Then shipping price is £3.00
  2. Then shipping price is £4.00
  3. Then shipping price is £5.00

And so fourth. However when the quantity is met in the check out (the user have item number over 3 in this example) the shipping price will stay at £5.00

What I need is this £1.00 per item rule on however many items are added to the order. Is there any way to achieve this rather than just adding many more rows to the csv file with a high cap?

1 Answer 1

2

You cannot do that using the table rates.
The table rates will always use the last available value if there is no record in the taabase for a specific configuration.
What you can do is to create your own shipping method. This is not that hard.
See a tutorial here on how to do it..
The only thing you need to customize is the collectRates method in the shipping model.
Here is how it can look in your case.

public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
    // skip if not enabled
    if (!Mage::getStoreConfig('carriers/'.$this->_code.'/active')) {
        return false;
    }


    // this object will be returned as result of this method
    // containing all the shipping rates of this method
    $result = Mage::getModel('shipping/rate_result');
    $method = Mage::getModel('shipping/rate_result_method');
    $method->setCarrier($this->_code);
    $method->setCarrierTitle('Some title here');
    $method->setMethod($this->_code);
    $method->setMethodTitle($this->getConfigData('name'));
    //get qty in cart
    $qty = $request->getPackageQty()
    //calculate the price
    $price = 2 + $qty; //3 for 1 item, 4 for 2 items and so on. You can even insert here a calculation algorithm based on config values or what ever comes to mind.
    $method->setPrice($price);
    $result->append($method);
    return $result;

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.