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
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?
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 :|
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
Code:
// 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
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?
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 ...
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!
Re: table rate + base rate for few larger items?
You are replacing the original piece of code in the table.php that reads:
Code:
$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 ...
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
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...
http://www.camera-shop.co.nz/images/array_error.jpg