Forums / Built-in Shipping and Payment Modules / S & H extra charge for some items

S & H extra charge for some items

Views: 4,124

Results 1 to 20 of 31
20 Dec 2015, 10:27 PM
#1
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

S & H extra charge for some items

I have several items that are heavier than all my other items and I want to charge an additional $1.00 per item for shipping.
I am using a table rate based on merchandise total:
Up to $40.00 $6.49
$40.01 to $75.00 $7.49
$75.01 to $100.00 $8.49

The extra charge should be per HEAVY item ordered: 3 x 1.00= 3.00 + table rate.

Have searched the forum but can't find what I need.

Please help.

Thanks

21 Dec 2015, 2:57 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: S & H extra charge for some items

About how many of these Heavy items do you have?

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!

21 Dec 2015, 3:37 PM
#3
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

Re: S & H extra charge for some items

Hi,

About 8 - 12 depending on inventory levels.

Thanks

21 Dec 2015, 3:55 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: S & H extra charge for some items

You could check the cart and calculate the extra charge adding the code in RED:
/includes/modules/shipping/table.php

[B]// bof: Add extra charge for heavy items in cart
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','57');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','112');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','10');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');
$extra_charge = $chk_cart * 1.00;
[/B]
    $this->quotes = array('id' => $this->code,
    'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE . $show_box_weight,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,
    'cost' => [B]$extra_charge + [/B]$shipping + (MODULE_SHIPPING_TABLE_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_TABLE_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_TABLE_HANDLING) ) ));
[B]// eof: Add extra charge for heavy items in cart
[/B]
    if ($this->tax_class > 0) {

Just set the products_id on the lines for:

[B]$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');[/B]

and change the number example 12 to what ever products_id you need ... for additional products just continue to add additional lines of:

[B]$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');[/B]

Then, set the amount to charge per item where 1.00 is the charge I put in:

[B]$extra_charge = $chk_cart * 1.00;
[/B]

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!

21 Dec 2015, 4:00 PM
#5
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

Re: S & H extra charge for some items

Thank you that's simple enough.

But is all code added to the /includes/modules/shipping/table.php file?

21 Dec 2015, 4:08 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: S & H extra charge for some items

The first section of code is the changes for table.php ...

The other sections just explain how that code is used to identify the products_id that need to be checked or counted to calculate the extra charge ...

The code I posted shows 4 products_id being checked and then the total number of products in the cart for those products_id are multiplied by 1.00 to get the extra charge which is added to the Table Rate charges ...

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!

21 Dec 2015, 4:15 PM
#7
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

Re: S & H extra charge for some items

Oops for my dense head.
Thanks a million for your help.

21 Dec 2015, 4:20 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: S & H extra charge for some items

You are most welcome ... let us know if you have success or any other problems with this ...

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 Dec 2015, 2:37 PM
#9
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

Re: S & H extra charge for some items

Hi Ajeh,

Just got back from a week away and have tried your suggestion. But it does not work. No errors detected. Code is below.
Where did I go wrong?

    $show_box_weight = ' (' . $shipping_num_boxes . ' x ' . number_format($shipping_weight,2) . TEXT_SHIPPING_WEIGHT . ')';
    break;
  }
}

// bof: Add extra charge for heavy items in cart
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','540');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','3772');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','3734');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','3736');
$extra_charge = $chk_cart * .75;

$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE . $show_box_weight,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,
'cost' => $extra_charge + $shipping + (MODULE_SHIPPING_TABLE_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_TABLE_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_TABLE_HANDLING) ) ));

// eof: Add extra charge for heavy items in cart

if ($this->tax_class > 0) {
  $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
28 Dec 2015, 2:48 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: S & H extra charge for some items

As a test, add this echo line in Red:

// bof: Add extra charge for heavy items in cart
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','540');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','3772');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','3734');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','3736');
$extra_charge = $chk_cart * .75;
[B]echo 'Table Extra charges $chk_cart: ' . $chk_cart . ' $extra_charge: ' . $extra_charge . '<br>';[/B]

When you test your cart in the shipping, you should see that line on the screen, what is in the cart and what does the line read?

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 Dec 2015, 3:10 PM
#11
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

Re: S & H extra charge for some items

Here is the shipping screen: No echo of that line. There are 2 of this item in the cart.

Step 1 of 3 - Delivery Information
Shipping Information:
Change Address
marvin schwarzber
48 morgan dr
edison, NJ 08817
United States
Your order will be shipped to the address at the left or you may change the shipping address by clicking the Change Address button.

Shipping Method:
Please select the preferred shipping method to use on this order.
Table Rate
$6.49
Best Way
Zone Rates
$6.49
Shipping to US
Special Instructions or Comments About Your Order
Continue to Step 2

  • choose your payment method.
28 Dec 2015, 3:18 PM
#12
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

Re: S & H extra charge for some items

Below is what is on the shipping selection screen. NO echo. The next screen - Payment Selection - has no echo either.


Step 1 of 3 - Delivery Information
Shipping Information:
Change Address
marvin schwarzber
48 morgan dr
edison, NJ 08817
United States
Your order will be shipped to the address at the left or you may change the shipping address by clicking the Change Address button.

Shipping Method:
Please select the preferred shipping method to use on this order.
Table Rate
$6.49
Best Way
Zone Rates
$6.49
Shipping to US
Special Instructions or Comments About Your Order
Continue to Step 2

  • choose your payment method.
28 Dec 2015, 3:28 PM
#13
ajeh avatar

ajeh

Oba-san

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

Re: S & H extra charge for some items

Are you sure that file is getting copied to:
/includes/shipping/table.php

on the server?

I see the echo both in the Shipping estimator and the checkout_shipping page ...

Make sure your FTP is working on the site where you are testing as this does not make a lot of sense ... :lookaroun

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 Dec 2015, 6:29 PM
#14
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

Re: S & H extra charge for some items

Just discovered that the line shows up in my page source above the head tag in my - https://www.herbschina.com/zen/index.php?main_page=checkout_shipping - but does not show on the page itself. Very confusing. Seems I'm missing something in my coding.

Table Extra charges $chk_cart: 0 $extra_charge: 0<br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en"> <head>
28 Dec 2015, 6:47 PM
#15
ajeh avatar

ajeh

Oba-san

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

Re: S & H extra charge for some items

What is your code?

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 Dec 2015, 8:52 PM
#16
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

Re: S & H extra charge for some items

Do you want to see the code for the COMPLETE table.php file?

28 Dec 2015, 9:06 PM
#17
ajeh avatar

ajeh

Oba-san

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

Re: S & H extra charge for some items

More or less just this section of code:

        default:
        $show_box_weight = ' (' . $shipping_num_boxes . ' x ' . number_format($shipping_weight,2) . TEXT_SHIPPING_WEIGHT . ')';
        break;
      }
    }

// bof: Add extra charge for heavy items in cart
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','10');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','15');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','3736');
$extra_charge = $chk_cart * .75;
echo 'Table Extra charges $chk_cart: ' . $chk_cart . ' $extra_charge: ' . $extra_charge . '<br>';

    $this->quotes = array('id' => $this->code,
    'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE . $show_box_weight,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,
    'cost' => $extra_charge + $shipping + (MODULE_SHIPPING_TABLE_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_TABLE_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_TABLE_HANDLING) ) ));

    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!

28 Dec 2015, 9:38 PM
#18
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

Re: S & H extra charge for some items

default:
$show_box_weight = ' (' . $shipping_num_boxes . ' x ' . number_format($shipping_weight,2) . TEXT_SHIPPING_WEIGHT . ')';
break;
}
}

// bof: Add extra charge for heavy items in cart
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','540');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','3772');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','3734');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','3736');
$extra_charge = $chk_cart * .75;
echo 'Table Extra charges $chk_cart: ' . $chk_cart . ' $extra_charge: ' . $extra_charge . '<br>';

$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE . $show_box_weight,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,
'cost' => $extra_charge + $shipping + (MODULE_SHIPPING_TABLE_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_TABLE_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_TABLE_HANDLING) ) ));

// eof: Add extra charge for heavy items in cart

if ($this->tax_class > 0) {
28 Dec 2015, 9:53 PM
#19
ajeh avatar

ajeh

Oba-san

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

Re: S & H extra charge for some items

Do any of these products exist:

$chk_cart += $_SESSION['cart']->in_cart_check('products_id','540');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','3772');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','3734');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','3736');

on your site?

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 Dec 2015, 9:58 PM
#20
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

Re: S & H extra charge for some items

Items 540 and 3734 are currently on site (I have inventory)