Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Different shipping price

Different shipping price

Views: 1,482

Results 1 to 14 of 14
27 Mar 2013, 12:56 PM
#1
cenkki avatar

cenkki

New Zenner

Join Date:
Sep 2010
Location:
Finland
Posts:
59
Plugin Contributions:
0

Different shipping price

Is it possible to change shipping price automatically day and night different? For example an additional charge after 10:00 o'clock at night ...

27 Mar 2013, 1:28 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Different shipping price

Cenkki:

Is it possible to change shipping price automatically day and night different? For example an additional charge after 10:00 o'clock at night ...

You could create COPIES (clones) of your shipping modules, and configure the CLONE modules to indicate that they apply to NIGHT deliveries (you will edit the LANGUAGE PHP files for the cloned modules to change the title and descriptions of the shipping option).

Then you insert the RATES for night delivery.

When the customer checks out they will be offered BOTH options - Day delivery, and Night delivery. Whichever they choose will add the required rate to their order total.

20 years a Zencart User

27 Mar 2013, 2:08 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Different shipping price

What shipping module(s) are you using and what is the extra charge that you want to add?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

27 Mar 2013, 9:28 PM
#4
cenkki avatar

cenkki

New Zenner

Join Date:
Sep 2010
Location:
Finland
Posts:
59
Plugin Contributions:
0

Re: Different shipping price

Per item ore flat shipping modules. Ore any shipping module which works. I just want, after 10:00am add 1.5€ to normal shipping price. Possible automatically.

27 Mar 2013, 9:36 PM
#5
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Different shipping price

Ajeh:

What shipping module(s) are you using and what is the extra charge that you want to add?

To me it seems Cenkki wants to give shoppers the opportunity to choose between TWO different delivery windows:

  1. Normal Hours
  2. After 10pm

So you would want these two options available to the shopper at checkout as radio button selections.

If the delivery methodology and procedure is the SAME for either option (the only difference being TIME), then I think the easiest solution is to CLONE the module being used, and then to price one module differently from the other. The TEXT DESCRIPTIONS are easily edited in the modules' language files.

If Cenkki chooses to use FLAT RATE shipping, then use TWO flat_rate modules.

20 years a Zencart User

27 Mar 2013, 10:26 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Different shipping price

You could add something like the code in RED, for example in Per Item item:
/includes/modules/shipping/item.php

      // adjusted count for free shipping
      $item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();

[B]// bof: charge extra for after 10pm
$hour = 22;
if (date('H') >= $hour) {
  $prehour = true;
} else {
  $prehour = false;
}
if ($prehour) {
  $extra_charge = 5.00;
} else {
  $extra_charge = 0.00;
}
//echo 'Is it after ' . $hour . '?' . ($prehour ? ' YES!' : ' NO!') . ' Extra Charge: ' . $extra_charge . '<br>';

[/B]      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
                                                     'cost' => (MODULE_SHIPPING_ITEM_COST * $item_total_count) + MODULE_SHIPPING_ITEM_HANDLING[B] + $extra_charge[/B])));
// eof: charge extra for after 10pm

      if ($this->tax_class > 0) {
 

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

27 Mar 2013, 11:48 PM
#7
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Different shipping price

Ajeh:

You could add something like the code in RED, for example in Per Item item:
/includes/modules/shipping/item.php

  // adjusted count for free shipping
  $item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();

[B]// bof: charge extra for after 10pm
$hour = 22;
if (date('H') >= $hour) {
$prehour = true;
} else {
$prehour = false;
}
if ($prehour) {
$extra_charge = 5.00;
} else {
$extra_charge = 0.00;
}
//echo 'Is it after ' . $hour . '?' . ($prehour ? ' YES!' : ' NO!') . ' Extra Charge: ' . $extra_charge . '<br>';

[/B] $this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
'cost' => (MODULE_SHIPPING_ITEM_COST * $item_total_count) + MODULE_SHIPPING_ITEM_HANDLING[B] + $extra_charge[/B])));
// eof: charge extra for after 10pm

  if ($this->tax_class > 0) {

Hmmmm... quite neat! (I may have a use for this myself)

20 years a Zencart User

28 Mar 2013, 1:05 AM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Different shipping price

Nifty, eh? :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

28 Mar 2013, 10:41 AM
#9
cenkki avatar

cenkki

New Zenner

Join Date:
Sep 2010
Location:
Finland
Posts:
59
Plugin Contributions:
0

Re: Different shipping price

thanks :)

28 Mar 2013, 11:06 AM
#10
cenkki avatar

cenkki

New Zenner

Join Date:
Sep 2010
Location:
Finland
Posts:
59
Plugin Contributions:
0

Re: Different shipping price

is it between 22:00 - 02:00. or? must turn back day time normally shipping price. normal shipping price 3.50€. night (22:00-02:00) 5.00€

28 Mar 2013, 12:52 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Different shipping price

You could use something like this ...

// bof: charge extra for after 10pm until 2am
$start_hour = 22;
$end_hour = 2;
$offset = -4;
switch (true) {
case ((date('H') + $offset) >= $start_hour):
  $prehour = true;
  break;
case ((date('H') + $offset) <= $end_hour):
  $prehour = true;
  break;
default:
  $prehour = false;
}
if ($prehour) {
  $extra_charge = 5.00;
} else {
  $extra_charge = 0.00;
}
// eof: charge extra for after 10pm until 2am

NOTE: The $offset is set to -4 for my server due to the server time ... be sure to set it to the right value for your server ... if you do not need it, set to 0

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

28 Mar 2013, 1:43 PM
#12
cenkki avatar

cenkki

New Zenner

Join Date:
Sep 2010
Location:
Finland
Posts:
59
Plugin Contributions:
0

Re: Different shipping price

Thanks a lot. its works nice. But i need also total price and one shipping price. Not per item separately. I don't know which module could be. Important please.

28 Mar 2013, 2:00 PM
#13
cenkki avatar

cenkki

New Zenner

Join Date:
Sep 2010
Location:
Finland
Posts:
59
Plugin Contributions:
0

Re: Different shipping price

I made flat module like this. its works. But I'm not sure :)

// class methods
function quote($method = '') {
global $order;

  // bof: charge extra for after 10pm until 2am

$start_hour = 22;
$end_hour = 2;
$offset = 0;
switch (true) {
case ((date('H') + $offset) >= $start_hour):
$prehour = true;
break;
case ((date('H') + $offset) <= $end_hour):
$prehour = true;
break;
default:
$prehour = false;
}
if ($prehour) {
$extra_charge = 1.50;
} else {
$extra_charge = 0.00;
}
// eof: charge extra for after 10pm until 2am

  $this->quotes = array('id' => $this->code,
                        'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
                        'methods' => array(array('id' => $this->code,
                                                 'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
                                                 'cost' => MODULE_SHIPPING_FLAT_COST + $extra_charge)));
28 Mar 2013, 2:17 PM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Different shipping price

In theory it looks right ... but you will need to test it ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!