Forums / Built-in Shipping and Payment Modules / table rate + base rate for few larger items?

table rate + base rate for few larger items?

Locked

Views: 1,790

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
21 Aug 2010, 3:36 AM
#1
sancho avatar

sancho

New Zenner

Join Date:
Jun 2009
Posts:
39
Plugin Contributions:
0

table rate + base rate for few larger items?

table rate + base rate for few larger items - is this possible?

I have configured table rate for shipping and for 90% of our items it works out about right, however we have some larger items that I need to add a base charge onto of say $5 - $7 + the table rate if one of these items is added to the cart, is this possible? Any pointers much appreciated.

Mark

21 Aug 2010, 4:35 AM
#2
ajeh avatar

ajeh

Oba-san

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

Re: table rate + base rate for few larger items?

You can check the cart to see if products_id are in there ...

Do you need to base it on:

Product A qty 1 is plus 5.00 * 1 = $5.00
Product A qty 2 is plus 5.00 * 2 = $10.00

Or ... does it need to just be $5.00 because 1 or more of Product A is in the order?

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 Aug 2010, 5:29 AM
#3
sancho avatar

sancho

New Zenner

Join Date:
Jun 2009
Posts:
39
Plugin Contributions:
0

Re: table rate + base rate for few larger items?

Yeah the first one really, so the table rate which is 6,8,10,12 etc so the first shipping is $6 and $2 per extra item.

Then if any of my larger items are added it will put an additional $5 (on top of the table rate)- does that make sense :|

21 Aug 2010, 12:14 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: table rate + base rate for few larger items?

You could check for the products_id in the table.php shipping module ...

One method would be, to check for products_id 10 and 12 and if 1 or more of them is in the cart then add $5.00 to shipping:

// bof: add $5.00 if products_id 10 or 12 are in the cart
    global $cart;
    $chk_products = $_SESSION['cart']->get_product_id_list();

    if (in_array($chk_products,explode(",",'10,12'))) {
      $add_extra_base = 55.00;
    }
// eof: add $5.00 if products_id 10 or 12 are in the cart

    $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' => $add_extra_base + $shipping + (MODULE_SHIPPING_TABLE_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_TABLE_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_TABLE_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!

21 Aug 2010, 1:17 PM
#5
ajeh avatar

ajeh

Oba-san

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

Re: table rate + base rate for few larger items?

See if this works for you to customize the Table Rate table shipping module:
/includes/modules/shipping/table.php

// bof: add $5.00 if products_id 10 or 12 are in the cart add $7.00 if products_id 112 or 117 are in the cart
    global $cart;
    $chk_products = $_SESSION['cart']->get_product_id_list();

    $chk_products_array = preg_split("/[,]/" , $chk_products);

    echo print_r($chk_products_array);

    for($i=0; $i<sizeof($chk_products_array); $i++) {
      // add additional $5.00 if any of these are in the cart
      if (in_array($chk_products_array[$i], array('10', '12'))) {
        $add_extra_base = 5.00;
      }
      // add additional $7.00 if any of these are in the cart
      if (in_array($chk_products_array[$i], array('112', '117'))) {
        $add_extra_base2 = 7.00;
      }
    }

    $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' => $add_extra_base + $add_extra_base2 + $shipping + (MODULE_SHIPPING_TABLE_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_TABLE_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_TABLE_HANDLING) ) ));
// eof: add $5.00 if products_id 10 or 12 are in the cart add $7.00 if products_id 112 or 117 are in the cart

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 Aug 2010, 7:05 AM
#6
sancho avatar

sancho

New Zenner

Join Date:
Jun 2009
Posts:
39
Plugin Contributions:
0

Re: table rate + base rate for few larger items?

Ok thanks I'll try it, 1 thing... how do I tell it which items please?

22 Aug 2010, 2:24 PM
#7
ajeh avatar

ajeh

Oba-san

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

Re: table rate + base rate for few larger items?

You can see the products_id if you either in your Admin in the Catalog/Products which is next to the Products Name in the list ... or go to the Product _info page ...

You can also see it in listings and sideboxes by running your mouse over it and looking at the URL ...

Look at the comments in the code I posted to see how these examples work ...

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 Aug 2010, 3:43 AM
#8
sancho avatar

sancho

New Zenner

Join Date:
Jun 2009
Posts:
39
Plugin Contributions:
0

Re: table rate + base rate for few larger items?

Hmm, not having much luck with that code, the shipping option won't work.. I am pretty lame with code, does this replace a certain chunk of code or does it simply slot in anywhere?

Sorry for the n00bness - I certainly do appreciate all your help!

23 Aug 2010, 4:18 AM
#9
ajeh avatar

ajeh

Oba-san

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

Re: table rate + base rate for few larger items?

You are replacing the original piece of code in the table.php that reads:

    $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' => $shipping + (MODULE_SHIPPING_TABLE_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_TABLE_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_TABLE_HANDLING) ) ));

with the new 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!

23 Aug 2010, 4:20 AM
#10
sancho avatar

sancho

New Zenner

Join Date:
Jun 2009
Posts:
39
Plugin Contributions:
0

Re: table rate + base rate for few larger items?

Fatal error: Call to a member function get_product_id_list() on a non-object

I am getting this inside zen-cart modules/shipping

23 Aug 2010, 4:34 AM
#11
sancho avatar

sancho

New Zenner

Join Date:
Jun 2009
Posts:
39
Plugin Contributions:
0

Re: table rate + base rate for few larger items?

Hey, thanks very much, getting somewhere now :)

although it is printing the array at the top...

23 Aug 2010, 4:58 AM
#12
ajeh avatar

ajeh

Oba-san

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

Re: table rate + base rate for few larger items?

Oops ... little debug code left in there ... :blink:

Comment out this line:

    echo print_r($chk_products_array);

with:

//    echo print_r($chk_products_array);

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 Aug 2010, 5:55 AM
#13
sancho avatar

sancho

New Zenner

Join Date:
Jun 2009
Posts:
39
Plugin Contributions:
0

Re: table rate + base rate for few larger items?

Yeah, I recognised the print command and commented it out and its working perfectly, thank you so much!

In the past I just had flat rate and it was simply adding the same shipping for each item, I suspect I was losing customers over that! This makes it a LOT more accurate.. :)

Very much appreciated! :clap::hug:

23 Aug 2010, 12:35 PM
#14
ajeh avatar

ajeh

Oba-san

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

Re: table rate + base rate for few larger items?

Thanks for the update that this is 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!

9 Sep 2010, 6:23 PM
#15
rainestudios avatar

rainestudios

New Zenner

Join Date:
Jan 2010
Posts:
21
Plugin Contributions:
0

Re: table rate + base rate for few larger items?

Hi -- I was searching for a way to do special shipping rates on just a few items and found this thread. I think it is exactly what I need -- my shop uses multiple cloned zones rather than the table rate module.

my first zone module is for USPS first class shipping, and it is flat rate based on the order total, ie: under $50=$2 shipping, $50-$99 =$3 shipping, over $100=free.

The next zone module is for Priority shipping, and finally, I have a 3rd one for Express.

However, I sell a few tools (pliers) that can't use these rates as I have to ship them priority. in the US, $5 flat-rate priority, ouside the US, $13 flat rate priority.

Is the solution outlined here what I would need, or would I need something else entirely?

http://rainestudios.net

thanks so much!
amy