Forums / Setting Up Categories, Products, Attributes / Can I have a handling fee for ONE product or category?

Can I have a handling fee for ONE product or category?

Started by dawnmartinello on 7 Apr 2011, 7:29 PM · Views: 12,299

Results 1 to 20 of 24
7 Apr 2011, 7:29 PM
#1
dawnmartinello avatar

dawnmartinello

New Zenner

Join Date:
Apr 2011
Posts:
8
Plugin Contributions:
0

Can I have a handling fee for ONE product or category?

My client is going to have a flat fee shipping system for her zen cart but there is one item that is extremely heavy that she wants to have a handling fee (to bring the shipping costs for that item more in line with what she'll need to pay).

How do I apply a handling fee for just one product or all products in one category?

Thanks!

7 Apr 2011, 7:57 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Can I have a handling fee for ONE product or category?

My client is going to have a flat fee shipping system
Flat rate is per order if that is what is desired
Other modules can be per item if that fits better

If flat rate would work for all but the one item then

Do not display item weights
Use the table rate shipping module
Enter item weights as light like 1lb for all items except the one item to charge more and make it like 1000lbs
Make the table to encompass all light weight items
Set the Table Method to weight

Table could look like

999:5.50,1000:30.00

Zen-Venom Get Bitten

7 Apr 2011, 9:13 PM
#3
dawnmartinello avatar

dawnmartinello

New Zenner

Join Date:
Apr 2011
Posts:
8
Plugin Contributions:
0

Re: Can I have a handling fee for ONE product or category?

So this would also work if we had 3 different weight classes for her products too, yes?

thank you SO much for your help :)!

7 Apr 2011, 9:20 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Can I have a handling fee for ONE product or category?

So this would also work if we had 3 different weight classes for her products
As long as you "fake" the weights and make them distinct enough

You need to test the condition if a customer buys several low weight items and one or both of the higher weight items in the same order and adjust until you obtain the desired result

Zen-Venom Get Bitten

8 Apr 2011, 12:54 AM
#5
ajeh avatar

ajeh

Oba-san

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

Re: Can I have a handling fee for ONE product or category?

You could test for how many of a products_id are in the cart:

// how many Products for products_id 19 are in the cart
global $cart;
$chk_product_19 = $_SESSION['cart']->in_cart_check('products_id','19');

// how many Products for products_id 19 are in the cart
$chk_product_32 = $_SESSION['cart']->in_cart_check('products_id','32');

$extra_charge = ($chk_product_19 * 7.50) + ($chk_product_32 * 2.50);

Then add the $extra_charge to the cost in the shipping module ...

NOTE: the global $cart; is needed if the function of the shipping module you are in does not already have that in it ...

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!

19 May 2012, 11:58 PM
#6
tracey avatar

tracey

New Zenner

Join Date:
Jan 2008
Location:
Switzerland
Posts:
38
Plugin Contributions:
0

Re: Can I have a handling fee for ONE product or category?

Ajeh:

You could test for how many of a products_id are in the cart:

// how many Products for products_id 19 are in the cart
global $cart;
$chk_product_19 = $_SESSION['cart']->in_cart_check('products_id','19');

// how many Products for products_id 19 are in the cart
$chk_product_32 = $_SESSION['cart']->in_cart_check('products_id','32');

$extra_charge = ($chk_product_19 * 7.50) + ($chk_product_32 * 2.50);

> 
> Then add the $extra_charge to the cost in the shipping module ...
> 
> NOTE: the **global $cart;** is needed if the function of the shipping module you are in does not already have that in it ...

I need to do a similar thing. I have products which are large, but even though the weight is low for these items, I need to charge a higher rate (as the postage costs more due to their bulkiness).

My normal shipping is Zone Rates based on weight and I would like to add a variable for certain product IDs that will add an extra amount (but only when these products are in the shopping cart).

The above post looks like exactly what I need, but I'm not sure what files to edit and where to put the code exactly.

I have two products, in which if either of them are in the cart, I need to charge the extra fee. Their IDs are 1393 and 1394.

Any help would be greatly appreciated. Thanks!

Tracey Haas
Temporary Tattoos

20 May 2012, 6:49 PM
#7
tracey avatar

tracey

New Zenner

Join Date:
Jan 2008
Location:
Switzerland
Posts:
38
Plugin Contributions:
0

Re: Can I have a handling fee for ONE product or category?

Hi, does anybody know where to put this code? :smile:

Tracey Haas
Temporary Tattoos

21 May 2012, 12:58 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Can I have a handling fee for ONE product or category?

You would add the code in RED to this code in the:
/includes/modules/shipping/zones.php

    $order_total_amount = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;

// how many Products for products_id 19 are in the cart
global $cart;
$chk_product_19 = $_SESSION['cart']->in_cart_check('products_id','19');

// how many Products for products_id 19 are in the cart
$chk_product_32 = $_SESSION['cart']->in_cart_check('products_id','32');

$extra_charge = ($chk_product_19 * 7.50) + ($chk_product_32 * 2.50);

Then add the $extra_charge to this code:

      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_ZONES_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => $shipping_method,
                                                     'cost' => $extra_charge + $shipping_cost)));

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!

23 May 2012, 2:28 PM
#9
tracey avatar

tracey

New Zenner

Join Date:
Jan 2008
Location:
Switzerland
Posts:
38
Plugin Contributions:
0

Re: Can I have a handling fee for ONE product or category?

Ajeh:

You would add the code in RED to this code in the:
/includes/modules/shipping/zones.php

$order_total_amount = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;

// how many Products for products_id 19 are in the cart
global $cart;
$chk_product_19 = $_SESSION['cart']->in_cart_check('products_id','19');

// how many Products for products_id 19 are in the cart
$chk_product_32 = $_SESSION['cart']->in_cart_check('products_id','32');

$extra_charge = ($chk_product_19 * 7.50) + ($chk_product_32 * 2.50);

> 
> Then add the $extra_charge to this code:
> ```
      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_ZONES_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => $shipping_method,
                                                     'cost' => $extra_charge + $shipping_cost)));

Thanks so much Ajeh! That was really easy and worked perfectly :D

Just wondering if there's a work-around in the code to charge an additional 7.50 if either, OR both, are in the cart and only 7.50, as opposed to charging both 7.50 and then 2.50 when both are in the cart?

Thanks!

Tracey Haas
Temporary Tattoos

23 May 2012, 2:47 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Can I have a handling fee for ONE product or category?

You can change the formula to anything you want for what is charged ...

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!

23 May 2012, 3:28 PM
#11
tracey avatar

tracey

New Zenner

Join Date:
Jan 2008
Location:
Switzerland
Posts:
38
Plugin Contributions:
0

Re: Can I have a handling fee for ONE product or category?

Great! :D

I don't know PHP that well, just a little from looking at the code in my site. Do you know what I need to change so that the syntax is correct for either/or products as opposed to both (+)...

$extra_charge = ($chk_product_1393 * 7.50) + ($chk_product_1394 * 7.50);

Tracey Haas
Temporary Tattoos

23 May 2012, 3:49 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: Can I have a handling fee for ONE product or category?

You could use instead of:

$extra_charge = ($chk_product_1393 * 7.50) + ($chk_product_1394 * 7.50); 
if ($chk_product_19 > 0  || $chk_product_32 > 0) {
  $extra_charge = 7.50;
} else {
  $extra_charge = 0.00;
}

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!

23 May 2012, 4:09 PM
#13
tracey avatar

tracey

New Zenner

Join Date:
Jan 2008
Location:
Switzerland
Posts:
38
Plugin Contributions:
0

Re: Can I have a handling fee for ONE product or category?

Thanks so much Linda, I really appreciate it! It works perfectly now :D

Tracey Haas
Temporary Tattoos

23 May 2012, 4:16 PM
#14
ajeh avatar

ajeh

Oba-san

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

Re: Can I have a handling fee for ONE product or category?

Thanks for the update that this is now working for you ... :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!

21 Nov 2014, 3:36 AM
#15
jenchord avatar

jenchord

New Zenner

Join Date:
May 2011
Posts:
68
Plugin Contributions:
0

Re: Can I have a handling fee for ONE product or category?

Hey Ajeh,

I'd like to do the same thing but with the ups module. If any products from category 2 are in the shopping cart, I'd like to add an extra charge of $10.
I don't really know what I'm doing but I tried the following code. My changes are in red.

$cost = preg_replace('/[^0-9.]/', '', $cost);
// bof: add accessories charge
$chk_categories = $_SESSION['cart']->in_cart_check('master_categories_id','2');
$extra_charge = ($chk_categories * 10.00);

    $methods[] = array('id' => $type,
                       'title' => $this->types[$type],
                       'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING + $extra_charge) );

This didn't change anything on the shipping totals even when I had products from category 2 in the shopping cart.
Any suggestions?

All your posts in various threads have been very helpful-- thanks for that!

21 Nov 2014, 1:21 PM
#16
ajeh avatar

ajeh

Oba-san

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

Re: Can I have a handling fee for ONE product or category?

Is categories_id 2 the master_categories_id or is it the parent_id for the Products/Categories that need the extra fee?

A link to your site might also be helpful to be able to check the layout of your shop ...

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!

22 Nov 2014, 4:28 AM
#17
jenchord avatar

jenchord

New Zenner

Join Date:
May 2011
Posts:
68
Plugin Contributions:
0

Re: Can I have a handling fee for ONE product or category?

Sorry, I'm not sure what you mean. The categories id 2 is the category id for my accessories. I want all products within this category to have the extra shipping charge when UPS is used as the shipping method.

My website is ---premierwagons.com---

Thank you!

22 Nov 2014, 1:55 PM
#18
ajeh avatar

ajeh

Oba-san

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

Re: Can I have a handling fee for ONE product or category?

What happens if you change the cost calculation to:

'cost' => ($cost * $shipping_num_boxes)[B]  + $extra_charge[/B] + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) );

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!

22 Nov 2014, 5:05 PM
#19
jenchord avatar

jenchord

New Zenner

Join Date:
May 2011
Posts:
68
Plugin Contributions:
0

Re: Can I have a handling fee for ONE product or category?

That worked! That is, when products from category two are shipped via UPS, an extra $10 are added to shipping cost.

Would there be a way to apply this extra charge only once (even if multiple quantities of products from category two are in cart)?
Perhaps the coding would be something like this? (albeit my code in red seems a little redundant) :

$cost = preg_replace('/[^0-9.]/', '', $cost);
// bof: add accessories charge
$chk_categories = $_SESSION['cart']->in_cart_check('master_categories_id','2');
$extra_charge = ($chk_categories * 10.00);
if ($chk_categories > 0) {
$extra_charge = 10.00;
}

Ideally, (but not totally essential) I'd like to have it set up so that the extra charge is only applied once for a quantity of 3 accessories. If the quantity goes over three, add extra charge again. If it goes over 6, the charge would have been added three times...

Is the coding for this simple enough?

Thanks again for your time.

22 Nov 2014, 5:18 PM
#20
ajeh avatar

ajeh

Oba-san

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

Re: Can I have a handling fee for ONE product or category?

You could try:

$cost = preg_replace('/[^0-9.]/', '', $cost);
// bof: add accessories charge
$chk_categories = $_SESSION['cart']->in_cart_check('master_categories_id','2');
$extra_charge = (ceil($chk_categories/3) * 10.00);

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!