You are here:  » delivery costs added on total price

Support Forum



delivery costs added on total price

Submitted by ICH on Mon, 2010-09-27 01:31 in

there was a thread that i cant find where there was a solution regarding "complex" delivery costs.

for example when the delivery cost depends on the cost of the product and/or the category product and where it was added accordingly to the total price of the product on the product price

ie
delivery cost product price
10 0-100
20 101-200
30 201-300

and

delivery cost product category
10 cat1
20 cat2
30 cat3

Submitted by support on Mon, 2010-09-27 09:29

Hi,

Complex delivery cost calculations I would have suggested are applied at import time within the import record handler function.

Assuming that you don't have a separate "delivery" field in your database, and simply want to add a known delivery charge to the "price" field, within includes/admin.php, look for the following code at line 292:

    if (!$merchant) return;

...and REPLACE with (for delivery cost by price):

    if (!$merchant) return;
    if ($merchant == "Merchant Name") // Merchant Name to add delivery cost
    {
      $delivery = 0.00;
      if ($importRecord["price"] < 100)
      {
        $delivery = 10.00;
      }
      elseif($importRecord["price"] < 200)
      {
        $delivery = 20.00;
      }
      else
      {
        $delivery = 30.00;
      }
      $importRecord["price"] = $importRecord["price"] + $delivery;
    }

...or REPLACE with (for delivery cost by category):

    if (!$merchant) return;
    if ($merchant == "Merchant Name") // Merchant Name to add delivery cost
    {
      $delivery = 0.00;
      switch ($importRecord["category"])
      {
        case "Category 1":
        case "Category 2":
        case "Category 3":
          $delivery = 10.00;
          break;
        case "Category 4":
        case "Category 5":
          $delivery = 20.00;
          break;
        default:
          $delivery = 30.00;
          break;
      }
      $importRecord["price"] = $importRecord["price"] + $delivery;
    }

Hope this helps!

Cheers,
David.
--
PriceTapestry.com