-
Per Item shipping for 1 category
I've looked the past few days, I don't see exactly what I'm looking for. I want to offer flat rate shipping, per item, for just 1 category.
Example: All Operation Homebrew beer kits ship for just 5.99 each!! Choose 1 kit, it ships for 5.99; choose 2 kits, they ship for 11.98...
I'm certain all I have to do is add a few lines of code to the per item shipping module...just need a little help on that code. Again, this would apply to all items under a category.
Thanks!!
Andrew
-
Re: Per Item shipping for 1 category
What Shipping Module(s) are you using for all other Products that are not in this 1 Category?
-
Re: Per Item shipping for 1 category
Hello Ajeh,
I've enjoyed reading your helpful responses to others. Thanks for the quick reply!
I'm using the following shipping modules:
UPS
USPS
Freeshipper
Storepickup
Andrew
-
Re: Per Item shipping for 1 category
How is the freeshipper being used? Is this for Products that are marked as Always Free Shipping or is this for Products with 0 weight?
-
Re: Per Item shipping for 1 category
Just for our Gift Cards - so products marked as "Always Free Shipping".
-
Re: Per Item shipping for 1 category
Are your Gift Cards actually the Gift Certificates? That once purchased, a customer can then send all or part of their GV Balance to another person?
These are setup as Products with the Model starting with:
GIFT
and anything after that can be used ...
If so, these are do not need to be marked as Always Free Shipping, just set them up as a Virtual Product and have the Module start with, in caps:
GIFT
I'd like to clarify this and have them working right before we go on to make changes for these Products that have a special shipping rate ...
-
Re: Per Item shipping for 1 category
No, these gift cards are plastic cards we program in the store with our card reader, have our logo on them and stuff. I haven't really given much thought to doing the gift card option that's built into the zen cart....
-
Re: Per Item shipping for 1 category
Do any of your other Products use the Always Free Shipping?
Do you have any other Product that uses a 0 weight?
-
Re: Per Item shipping for 1 category
-
Re: Per Item shipping for 1 category
Check that your setting in Configuration ... Shipping/Packaging ... is set to 0:
Quote:
Order Free Shipping 0 Weight Status
If there is no weight to the order, does the order have Free Shipping?
0= no
1= yes
What is the master_categories_id for the Products that you need to have the Per Item charge on?
-
Re: Per Item shipping for 1 category
Confirmed, it is set to 0 (no).
master_categories_id: 316
-
Re: Per Item shipping for 1 category
These are the changes that you need for your shipping files just add the code in RED ...
/includes/modules/shipping/ups.php
Quote:
$qsize = sizeof($upsQuote);
// bof: seperate item cost 1 category
$chk_cart = $_SESSION['cart']->in_cart_check('master_categories_id','65');
$extra_shipping_charge = $chk_cart * 5.99;
// eof: seperate item cost 1 category
for ($i=0; $i<$qsize; $i++) {
Code:
$cost = preg_replace('/[^0-9.]/', '', $cost);
// bof: seperate item cost 1 category
global $total_count;
if ($chk_cart == $total_count) {
// skip shipping
} else {
$methods[] = array('id' => $type,
'title' => $this->types[$type],
'cost' => ($cost * $shipping_num_boxes) + $extra_shipping_charge + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) );
}
}
$this->quotes['methods'] = $methods;
/includes/modules/shipping/usps.php
Code:
// eof: example to block USPS Priority MailTM Small Flat Rate Box when anything from master_categories_id 12 or 15 are in the cart
// bof: seperate item cost 1 category
$chk_cart = $_SESSION['cart']->in_cart_check('master_categories_id','65');
$extra_shipping_charge = $chk_cart * 5.99;
// eof: seperate item cost 1 category
for ($i=0; $i<$PackageSize; $i++) {
Code:
$show_hiddenCost = '';
// bof: seperate item cost 1 category
global $total_count;
if ($chk_cart == $total_count) {
// skip shipping
} else {
$methods[] = array('id' => $type_rebuilt,
'title' => $title . $show_hiddenCost,
'cost' => $cost + $extra_shipping_charge,
'insurance' => $usps_insurance_charge,
);
}
// eof: seperate item cost 1 category
//echo 'setting insurance: ' . $usps_insurance_charge . '<br>';
/includes/modules/shipping/item.php
Code:
$item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();
// bof: seperate item cost 1 category
$chk_cart = $_SESSION['cart']->in_cart_check('master_categories_id','65');
$extra_shipping_charge = $chk_cart * 5.99;
echo '$total_count: ' . $total_count . ' $chk_cart: ' . $chk_cart . '<br>';
if ($extra_shipping_charge == 0 || $chk_cart != $total_count) {
// skip shipping
} else {
$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' => $extra_shipping_charge)));
}
// eof: seperate item cost 1 category
if ($this->tax_class > 0) {
On all three of these, set the master_categories_id to your value, as I used 65:
Code:
$chk_cart = $_SESSION['cart']->in_cart_check('master_categories_id','65');
On the Modules ... Shipping ... set the Shipping Cost to 5.99 ...
This should make the cart add for UPS and USPS a $5.99 charge per item in the shipping costs for any Products in the cart for your 1 category ...
When Products from the 1 category are the only thing in the cart, then UPS and USPS will not show and only the Item Rate will show ...
Finally, be sure to test when a Gift Card is the only Product in the cart or when a Gift Card is added with other Products to ensure all is still working ...
-
Re: Per Item shipping for 1 category
thank you. I will test and let you know!
Andrew
-
Re: Per Item shipping for 1 category
i'm afraid it didn't work.
I noticed when trying to update the USPS file, I didn't have the latest module. I upgraded it, then made the correct changes, but now I have only 3 shipping modules showing in my admin: flat rate, free shipping options, and free shipping.
-
Re: Per Item shipping for 1 category
also getting this error across the top of my admin page: Warning Shipping Configuration errors!
Warning: USPS shipping module is either missing the username, or it is set to TEST rather than PRODUCTION and will not work.
If you cannot retrieve USPS Shipping Quotes, contact USPS to activate your Web Tools account on their production server. 1-800-344-7779 or icustomercare@usps.com
-
Re: Per Item shipping for 1 category
Sounds like you have errors in the file(s) ...
If you look in the directory /logs (this is /cache on older versions of Zen Cart) do you see any debug logs? If so, could you post the content on your next post please?
-
Re: Per Item shipping for 1 category
duh, thanks for reminding me... it's easy to get frustrated when your website quits working like it's supposed to...
I messed up the item.php file. I left the extra ( in part of the code. as soon as I took it out, fixed.
i'll let you know how it goes from here...
-
Re: Per Item shipping for 1 category
seems to be working, however, the following things are happening:
in the shopping cart, the following is displayed just above the "Estimate Shipping": $total_count: 1 $chk_cart: 1
Also, when checking out (shipping method screen) on just the 1 category, USPS doesn't show, but UPS does. Not the whole thing, just the UPS box with nothing in it:
UPS
Store Pickup
Per Item
Gift card: I added a gift card to the order with 1 item from the 5.99 category, and it jacked the shipping cost up instead of leaving it at 5.99. by itself, gift card ships free.
I tested some very lightweight items, and maybe I didn't notice it before...example: I have weight set for a pack of yeast to .01 lbs and the quote for USPS shipping is 8.10 just for that 1 item.
-
Re: Per Item shipping for 1 category
A slightly more pressing issue: when I click over to the "choose your payment method", screen goes blank and I get the "$total_count: 3 $chk_cart: 3" message at the top...
Those are 3 of the kits.
When I add a non-kit item, it doesn't do it...meaning it works fine. I can select my payment method.
-
Re: Per Item shipping for 1 category
Have you an URL to your shop that we could perhaps peek at?
-
Re: Per Item shipping for 1 category
Also, find this line of code and comment it out:
Code:
echo '$total_count: ' . $total_count . ' $chk_cart: ' . $chk_cart . '<br>';
using:
Code:
// echo '$total_count: ' . $total_count . ' $chk_cart: ' . $chk_cart . '<br>';
-
Re: Per Item shipping for 1 category
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
Ajeh
Also, find this line of code and comment it out:
Code:
echo '$total_count: ' . $total_count . ' $chk_cart: ' . $chk_cart . '<br>';
using:
Code:
// echo '$total_count: ' . $total_count . ' $chk_cart: ' . $chk_cart . '<br>';
This seems to have fixed it! I will continue testing and report back.
-
Re: Per Item shipping for 1 category
i'm thinking we don't need to tell the UPS and USPS modules to add 5.99 for those kits if they are being purchased with other items. Can't we just let the UPS/USPS modules figure out the shipping based on total weight (like before)? and then we just shut off the peritem option in the cart if the customer is buying anything above and beyond the kits. eh?
so customer pays 5.99 for shipping per kit, which wouldn't count additional items should they decide to purchase at the same time.
-
Re: Per Item shipping for 1 category
Cool! so I can buy 1 of these:
/store/beer/ingredients/grains/base-grains/2-row-brewers
and 3 of these:
/store/beer/beer-recipe-kits/operation-homebrew-beer-kits/b52-barleywine
for the same shipping?! Neato!! :lookaroun
-
Re: Per Item shipping for 1 category
hmmmm....not so much? so it won't work that way?
-
Re: Per Item shipping for 1 category
You tell me ... this is your store ... what shipping costs are you wanting to charge?
-
Re: Per Item shipping for 1 category
I know, I know... I am going to compare a couple of things and let you know. Is it possible to have a gift card ship for free and only pay 5.99 per kit? Right now it won't do that.
Thanks again!
-
Re: Per Item shipping for 1 category
You check things out and I will fool around on your site as I am not seeing why this would not work as first defined ...
-
Re: Per Item shipping for 1 category
If I add this to the cart:
/store/fun-stuff/gift-cards/gift-card
as the only Product I get the choices of:
Quote:
FREE SHIPPING! (No Delivery Charge) |
$0.00 |
Store Pickup (Walk In) |
$0.00 |
what isn't working on that?
-
Re: Per Item shipping for 1 category
I have some trouble navigating your site and seeing the categories_id due to your url rewrites ...
Are your sure all Products that are Kits have the master_categories_id of 316?
And you appear to have installed Flat Rate, but before you said you wanted to use Item Rate as the charge for Products in the categories_id 316 ...
Flat Rate flat is a static charge regardless of the number of items in the cart and Item Rate item is to charge an specific charge per item in the cart ... which are you really meaning?
You had said at the start, you wanted:
Quote:
Example: All Operation Homebrew beer kits ship for just 5.99 each!! Choose 1 kit, it ships for 5.99; choose 2 kits, they ship for 11.98...
-
Re: Per Item shipping for 1 category
On your Products in categories_id 316, do you have Product weight set to 0 on all of those?
-
Re: Per Item shipping for 1 category
Yes, that works. however, if I add a 5.99 kit to the cart, shipping should only be 5.99 since the gift card is free. instead, UPS and USPS show up during checkout and the shipping cost is 15.85.
Also, if I order a /store/beer/beer-ingredient-kits/1-light-lager/lawnmower-lager by itself, shipping is 9.74. When I add a kit from the 5.99 group, shipping should be (9.74+5.99) 15.73. instead, it shows 21.06.
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
Ajeh
I have some trouble navigating your site and seeing the categories_id due to your url rewrites ...
Are your sure all Products that are Kits have the master_categories_id of 316?
And you appear to have installed Flat Rate, but before you said you wanted to use Item Rate as the charge for Products in the categories_id 316 ...
Flat Rate flat is a static charge regardless of the number of items in the cart and Item Rate item is to charge an specific charge per item in the cart ... which are you really meaning?
You had said at the start, you wanted:
I will double check and make sure flat rate is off (uninstalled).
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
Ajeh
On your Products in categories_id 316, do you have Product weight set to 0 on all of those?
no, I will do that now and see what happens.
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
bigandrew
I will double check and make sure flat rate is off (uninstalled).
Flat rate is indeed uninstalled.
-
Re: Per Item shipping for 1 category
Is this a Kit?
/store/beer/beer-ingredient-kits/5-bock/american-bock-true-brew-ingredient-kit
If so, what is the Product Weight on it?
If not, what is a valid Kit for the $5.99 shipping?
What is the Product Weight on it?
If any Attributes, do any of the Attributes have weight?
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
bigandrew
no, I will do that now and see what happens.
Okay, after changing weight to 0, shipping charges are adding up like they should. however, the gift card thing still has the same issue.
We are getting closer!
-
Re: Per Item shipping for 1 category
What is the weight on the Gift Cart?
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
Ajeh
Is this a Kit?
/store/beer/beer-ingredient-kits/5-bock/american-bock-true-brew-ingredient-kit
If so, what is the Product Weight on it?
If not, what is a valid Kit for the $5.99 shipping?
What is the Product Weight on it?
If any Attributes, do any of the Attributes have weight?
It is a beer kit, but not one of the Operation Homebrew Beer kits that qualify for per item shipping. Only these kits would qualify for the per item shipping: http://www.operationhomebrew.com/sto...brew-beer-kits
Our recipes that we put together, not a box kit from our vendors...
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
Ajeh
What is the weight on the Gift Cart?
The weight on the gift card is set to 0.
-
Re: Per Item shipping for 1 category
What is the master_categories_id on the Gift Card?
Does it match what is on the Gift Card if you edit it?
On the Attributes on the Gift Card, do any of the Attributes have weight?
And the Gift Card is marked as:
Quote:
Always Free Shipping: Yes, Always Free Shipping
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
Ajeh
What is the master_categories_id on the Gift Card?
Does it match what is on the Gift Card if you edit it?
On the Attributes on the Gift Card, do any of the Attributes have weight?
And the Gift Card is marked as:
Product Master Category: ID# 193 Gift Cards
Always Free Shipping: xYes, Always Free Shipping
Gift Card Product ID: 1646
No weights assigned to any of the attributes for the gift card
-
Re: Per Item shipping for 1 category
Aha! I think I figured it out ...
You have Gift Cards setup totally different from the norm as your Gift Cards are not treated like normal Zen Cart Gift Certificates nor configured in the same manner ...
So, all of these changes to the Item Rate, UPS and USPS shipping have to take into account the Gift Certificate as a different kind of Product, so to speak ...
Give me a few to give this some thought ... and while I am going out to dinner, I just got a call changing the time for everything, so hopefully I can get this done in the next few minutes to the next hour or so ... :lookaroun
-
Re: Per Item shipping for 1 category
Okay, let's try this new code:
/includes/modules/shipping/ups.php
Code:
$qsize = sizeof($upsQuote);
// bof: seperate item cost 1 category
$chk_cart = $_SESSION['cart']->in_cart_check('master_categories_id','65');
$chk_cart_always_free_shipping = $_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1');
$extra_shipping_charge = $chk_cart * 5.99;
//echo 'UPS $total_count: ' . $total_count . ' $chk_cart: ' . $chk_cart . ' $extra_shipping_charge: ' . $extra_shipping_charge . ' Always + chk_cart: ' . ($chk_cart + $chk_cart_always_free_shipping) . '<br>';
// eof: seperate item cost 1 category
for ($i=0; $i<$qsize; $i++) {
Code:
$cost = preg_replace('/[^0-9.]/', '', $cost);
// bof: seperate item cost 1 category
global $total_count;
if (($chk_cart + $chk_cart_always_free_shipping) == $total_count) {
// skip shipping
} else {
$methods[] = array('id' => $type,
'title' => $this->types[$type],
'cost' => ($cost * $shipping_num_boxes) + $extra_shipping_charge + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) );
}
}
$this->quotes['methods'] = $methods;
/includes/modules/shipping/usps.php
Code:
// eof: example to block USPS Priority MailTM Small Flat Rate Box when anything from master_categories_id 12 or 15 are in the cart
// bof: seperate item cost 1 category
$chk_cart = $_SESSION['cart']->in_cart_check('master_categories_id','65');
$chk_cart_always_free_shipping = $_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1');
$extra_shipping_charge = $chk_cart * 5.99;
//echo 'USPS $total_count: ' . $total_count . ' $chk_cart: ' . $chk_cart . ' $extra_shipping_charge: ' . $extra_shipping_charge . ' Always + chk_cart: ' . ($chk_cart + $chk_cart_always_free_shipping) . '<br>';
// eof: seperate item cost 1 category
for ($i=0; $i<$PackageSize; $i++) {
Code:
$show_hiddenCost = '';
// bof: seperate item cost 1 category
global $total_count;
if (($chk_cart + $chk_cart_always_free_shipping) == $total_count) {
// skip shipping
} else {
$methods[] = array('id' => $type_rebuilt,
'title' => $title . $show_hiddenCost,
'cost' => $cost + $extra_shipping_charge,
'insurance' => $usps_insurance_charge,
);
}
// eof: seperate item cost 1 category
//echo 'setting insurance: ' . $usps_insurance_charge . '<br>';
} else {
/includes/modules/shipping/item.php
Code:
$item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();
// bof: seperate item cost 1 category
$chk_cart = $_SESSION['cart']->in_cart_check('master_categories_id','65');
$chk_cart_always_free_shipping = $_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1');
//echo 'ITEM $total_count: ' . $total_count . ' $chk_cart: ' . $chk_cart . ' $extra_shipping_charge: ' . $extra_shipping_charge . ' Always + chk_cart: ' . ($chk_cart + $chk_cart_always_free_shipping) . '<br>';
$extra_shipping_charge = $chk_cart * 5.99;
if ($extra_shipping_charge == 0 || ($chk_cart + $chk_cart_always_free_shipping) != $total_count) {
// skip shipping
} else {
$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' => $extra_shipping_charge)));
}
// eof: seperate item cost 1 category
if ($this->tax_class > 0) {
Let's see if this works better for you ...
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
Ajeh
Okay, let's try this new code:
/includes/modules/shipping/ups.php
Code:
$qsize = sizeof($upsQuote);
// bof: seperate item cost 1 category
$chk_cart = $_SESSION['cart']->in_cart_check('master_categories_id','65');
$chk_cart_always_free_shipping = $_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1');
$extra_shipping_charge = $chk_cart * 5.99;
//echo 'UPS $total_count: ' . $total_count . ' $chk_cart: ' . $chk_cart . ' $extra_shipping_charge: ' . $extra_shipping_charge . ' Always + chk_cart: ' . ($chk_cart + $chk_cart_always_free_shipping) . '<br>';
// eof: seperate item cost 1 category
for ($i=0; $i<$qsize; $i++) {
Code:
$cost = preg_replace('/[^0-9.]/', '', $cost);
// bof: seperate item cost 1 category
global $total_count;
if (($chk_cart + $chk_cart_always_free_shipping) == $total_count) {
// skip shipping
} else {
$methods[] = array('id' => $type,
'title' => $this->types[$type],
'cost' => ($cost * $shipping_num_boxes) + $extra_shipping_charge + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) );
}
}
$this->quotes['methods'] = $methods;
/includes/modules/shipping/usps.php
Code:
// eof: example to block USPS Priority MailTM Small Flat Rate Box when anything from master_categories_id 12 or 15 are in the cart
// bof: seperate item cost 1 category
$chk_cart = $_SESSION['cart']->in_cart_check('master_categories_id','65');
$chk_cart_always_free_shipping = $_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1');
$extra_shipping_charge = $chk_cart * 5.99;
//echo 'USPS $total_count: ' . $total_count . ' $chk_cart: ' . $chk_cart . ' $extra_shipping_charge: ' . $extra_shipping_charge . ' Always + chk_cart: ' . ($chk_cart + $chk_cart_always_free_shipping) . '<br>';
// eof: seperate item cost 1 category
for ($i=0; $i<$PackageSize; $i++) {
Code:
$show_hiddenCost = '';
// bof: seperate item cost 1 category
global $total_count;
if (($chk_cart + $chk_cart_always_free_shipping) == $total_count) {
// skip shipping
} else {
$methods[] = array('id' => $type_rebuilt,
'title' => $title . $show_hiddenCost,
'cost' => $cost + $extra_shipping_charge,
'insurance' => $usps_insurance_charge,
);
}
// eof: seperate item cost 1 category
//echo 'setting insurance: ' . $usps_insurance_charge . '<br>';
} else {
/includes/modules/shipping/item.php
Code:
$item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();
// bof: seperate item cost 1 category
$chk_cart = $_SESSION['cart']->in_cart_check('master_categories_id','65');
$chk_cart_always_free_shipping = $_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1');
//echo 'ITEM $total_count: ' . $total_count . ' $chk_cart: ' . $chk_cart . ' $extra_shipping_charge: ' . $extra_shipping_charge . ' Always + chk_cart: ' . ($chk_cart + $chk_cart_always_free_shipping) . '<br>';
$extra_shipping_charge = $chk_cart * 5.99;
if ($extra_shipping_charge == 0 || ($chk_cart + $chk_cart_always_free_shipping) != $total_count) {
// skip shipping
} else {
$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' => $extra_shipping_charge)));
}
// eof: seperate item cost 1 category
if ($this->tax_class > 0) {
Let's see if this works better for you ...
getting http 500 error at checkout now. no error logs.
-
Re: Per Item shipping for 1 category
Can you see the shipping modules Item Rate, USPS and UPS in your Zen Cart Admin in the Modules ... Shipping ...
When you add just a normal Product to the shopping cart, do you see any debug logs in the /logs directory (/cache in older Zen Cart Versions)?
If so, can you post the content?
-
1 Attachment(s)
Re: Per Item shipping for 1 category
This is a Zip of these files to compare to what you have used ...
-
Re: Per Item shipping for 1 category
Looks like you are getting somewhere but I have to get off to dinner ... I will check back later tonight ...
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
Ajeh
This is a Zip of these files to compare to what you have used ...
Thanks for that. I must have messed something up with the USPS file. That one was missing from my admin shipping module. Looks like it's working now, except for the ups shipping option tries to show during checkout. i'm trying to attach a screen shot, but I can't figure this thing out either.
-
Re: Per Item shipping for 1 category
Hit Reply and then look for the Go Advanced and you will see the Attached ...
-
Re: Per Item shipping for 1 category
sorry, it won't upload my png file.
if you go to the shipping options page during checkout, do you see the UPS module showing? select a 5.99 kit, go to checkout, and you will see UPS, Store Pickup, 5.99 per kit as options. Store pickup and 5.99 should be the only options showing, eh?
-
Re: Per Item shipping for 1 category
Go change the code in the ups.php to include:
Code:
// bof: seperate item cost 1 category
global $total_count;
if (($chk_cart + $chk_cart_always_free_shipping) == $total_count) {
// skip shipping
return array();
} else {
$methods[] = array('id' => $type,
'title' => $this->types[$type],
'cost' => ($cost * $shipping_num_boxes) + $extra_shipping_charge + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) );
}
}
that will teach me always, always test both shipping estimator *and* checkout_shipping, regardless of being in a hurry ... :cool:
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
Ajeh
Go change the code in the ups.php to include:
Code:
// bof: seperate item cost 1 category
global $total_count;
if (($chk_cart + $chk_cart_always_free_shipping) == $total_count) {
// skip shipping
return array();
} else {
$methods[] = array('id' => $type,
'title' => $this->types[$type],
'cost' => ($cost * $shipping_num_boxes) + $extra_shipping_charge + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) );
}
}
that will teach me always, always test both shipping estimator *and* checkout_shipping, regardless of being in a hurry ... :cool:
That seems to have done it! Thank you again. We will not forget you when we make the big time!
-
Re: Per Item shipping for 1 category
Thanks for the update that this is working for you now ... :smile:
Good luck with your cart!
-
Re: Per Item shipping for 1 category
Linda,
I'm back. I wasn't sure if I should start a new post or continue this one. I've done quite a bit of searching in the forums for what I want to accomplish, and I've found a lot of promising info...just not sure how to apply it. Here's the summary:
I want to offer a flat rate shipping option, regardless of how much a customer spends, but I will need to exclude several products (I've already gathered the product IDs).
- I'm still Using USPS, UPS, Free Shipping (The Gift Card product thing, as well as some new items), Store Pickup, and soon Fed Ex
- I'm looking to simplify this by removing the $5.99 per item beer kit thing, they will just fall under the flat rate fee.
I'm assuming that it's as easy as making modifications to the flat rate module to "exclude" the items I need excluded. The Flat Rate option should not be available if someone buys an "excluded" item.
And all the other shipping modules will continue to show, just incase someone wants an expedited or special shipping option.
This is easy, eh?
Thanks,
Andrew
-
Re: Per Item shipping for 1 category
Customer buys 1 excluded item what is shipping?
Customer buys 2 excluded item what is shipping?
Customer buys 3 excluded item what is shipping?
Customer buys 1 anything *except* excluded item what is shipping?
Customer buys 2 anything *except* excluded item what is shipping?
Customer buys 3 anything *except* excluded item what is shipping?
Customer buys 1 exclude item and 1 NOT excluded item what is shipping?
Customer buys 1 exclude item and 2 NOT excluded item what is shipping?
Customer buys 2 exclude item and 1 NOT excluded item what is shipping?
Customer buys 2 exclude item and 2 NOT excluded item what is shipping?
Customer buys 1 exclude item and 3 NOT excluded item what is shipping?
Customer buys 3 exclude item and 2 NOT excluded item what is shipping?
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
Ajeh
Customer buys 1 excluded item what is shipping?
Customer buys 2 excluded item what is shipping?
Customer buys 3 excluded item what is shipping?
Customer buys 1 anything *except* excluded item what is shipping?
Customer buys 2 anything *except* excluded item what is shipping?
Customer buys 3 anything *except* excluded item what is shipping?
Customer buys 1 exclude item and 1 NOT excluded item what is shipping?
Customer buys 1 exclude item and 2 NOT excluded item what is shipping?
Customer buys 2 exclude item and 1 NOT excluded item what is shipping?
Customer buys 2 exclude item and 2 NOT excluded item what is shipping?
Customer buys 1 exclude item and 3 NOT excluded item what is shipping?
Customer buys 3 exclude item and 2 NOT excluded item what is shipping?
1st section = excluded items will be treated as normal and based on weight
2nd section = flat rate shipping (leaning towards $8.99) no matter how many items
3rd section = shipping would default back to same as section 1, based on weight
-
Re: Per Item shipping for 1 category
See if this works for you ...
Edit the file:
/includes/modules/shipping/usps.php
and add the code in RED:
Code:
function quote($method = '')
{
global $order, $shipping_weight, $shipping_num_boxes, $currencies, $shipping;
// bof: Allow individual Products to use Flat disable USPS
// set allowed products_id 12, 13, 15
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','13');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','15');
if ($chk_cart == $_SESSION['cart']->count_contents()) {
// allow flat rate only disable USPS
return;
}
// eof: Allow individual Products to use Flat disable USPS
//echo 'USPS function quote BEFORE IF $this->enabled $this->uspsQuote $this->enabled: ' . ($this->enabled ? ' ON' : ' OFF') . ' $shipping_weight: ' . $shipping_weight . '<br>';
$usps_shipping_quotes = '';
Then edit the code:
/includes/modules/shipping/flat.php
and add the code in RED:
Code:
function quote($method = '') {
global $order;
// bof: Allow individual Products to use Flat
// set allowed products_id 12, 13, 15
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','13');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','15');
if ($chk_cart == $_SESSION['cart']->count_contents()) {
// allow flat rate
$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)));
} else {
// skip flat rate
}
// eof: Allow individual Products to use Flat
if ($this->tax_class > 0) {
Just change the products_id 12, 13, 15 to the products_id values that you need and you can add extra products_id values ...
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
Ajeh
See if this works for you ...
Edit the file:
/includes/modules/shipping/usps.php
and add the code in
RED:
Code:
function quote($method = '')
{
global $order, $shipping_weight, $shipping_num_boxes, $currencies, $shipping;
// bof: Allow individual Products to use Flat disable USPS
// set allowed products_id 12, 13, 15
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','13');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','15');
if ($chk_cart == $_SESSION['cart']->count_contents()) {
// allow flat rate only disable USPS
return;
}
// eof: Allow individual Products to use Flat disable USPS
//echo 'USPS function quote BEFORE IF $this->enabled $this->uspsQuote $this->enabled: ' . ($this->enabled ? ' ON' : ' OFF') . ' $shipping_weight: ' . $shipping_weight . '<br>';
$usps_shipping_quotes = '';
Then edit the code:
/includes/modules/shipping/flat.php
and add the code in
RED:
Code:
function quote($method = '') {
global $order;
// bof: Allow individual Products to use Flat
// set allowed products_id 12, 13, 15
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','13');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','15');
if ($chk_cart == $_SESSION['cart']->count_contents()) {
// allow flat rate
$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)));
} else {
// skip flat rate
}
// eof: Allow individual Products to use Flat
if ($this->tax_class > 0) {
Just change the products_id 12, 13, 15 to the products_id values that you need and you can add extra products_id values ...
I'm wondering if this is set to allow rather than disallow. I have about 30 items that will not be allowed to use Flat Rate, and more than 1000 that will.
-
Re: Per Item shipping for 1 category
Are you saying that the tested products_id should NOT be allowed for Flat Rate and should using the other shipping modules only?
-
Re: Per Item shipping for 1 category
Correct. I would rather block 30 items than allow over 1000...know what I mean? So I'm just blocking the big, bulky, heavy items from flat rate shipping. They can still ship, just using the other modules (USPS, UPS, and in store pickup).
-
Re: Per Item shipping for 1 category
To make this have the checked products_id NOT allow Flat and only allow USPS use the code in RED:
/includes/modules/shipping/flat.php
Code:
function quote($method = '') {
global $order;
// bof: NOT Allow individual Products to use Flat
// set allowed products_id 12, 13, 15
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','13');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','15');
if ($chk_cart == 0) {
// allow flat rate
$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)));
} else {
// skip flat rate
}
// eof: Allow individual Products to use Flat
if ($this->tax_class > 0) {
and for USPS use:
Code:
function quote($method = '')
{
global $order, $shipping_weight, $shipping_num_boxes, $currencies, $shipping;
// bof: NOT Allow individual Products to use Flat enable USPS
// set allowed products_id 12, 13, 15
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','13');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','15');
if ($chk_cart > 0) {
// NOT allow flat rate only allow USPS
} else {
return;
}
// eof: NOT Allow individual Products to use Flat enable USPS
//echo 'USPS function quote BEFORE IF $this->enabled $this->uspsQuote $this->enabled: ' . ($this->enabled ? ' ON' : ' OFF') . ' $shipping_weight: ' . $shipping_weight . '<br>';
$usps_shipping_quotes = '';
and then use something similar on FedEx and UPS ...
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
Ajeh
To make this have the checked products_id NOT allow Flat and only allow USPS use the code in
RED:
/includes/modules/shipping/flat.php
Code:
function quote($method = '') {
global $order;
// bof: NOT Allow individual Products to use Flat
// set allowed products_id 12, 13, 15
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','13');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','15');
if ($chk_cart == 0) {
// allow flat rate
$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)));
} else {
// skip flat rate
}
// eof: Allow individual Products to use Flat
if ($this->tax_class > 0) {
and for USPS use:
Code:
function quote($method = '')
{
global $order, $shipping_weight, $shipping_num_boxes, $currencies, $shipping;
// bof: NOT Allow individual Products to use Flat enable USPS
// set allowed products_id 12, 13, 15
$chk_cart = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','12');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','13');
$chk_cart += $_SESSION['cart']->in_cart_check('products_id','15');
if ($chk_cart > 0) {
// NOT allow flat rate only allow USPS
} else {
return;
}
// eof: NOT Allow individual Products to use Flat enable USPS
//echo 'USPS function quote BEFORE IF $this->enabled $this->uspsQuote $this->enabled: ' . ($this->enabled ? ' ON' : ' OFF') . ' $shipping_weight: ' . $shipping_weight . '<br>';
$usps_shipping_quotes = '';
and then use something similar on FedEx and UPS ...
I updated the Flat Rate and USPS and lost the shipping module in the admin, and those shipping options don't show at all on the site during checkout. It seems to be the Flat Rate file that makes the admin shipping module crash. When I undid the USPS, no change. Undid the Flat Rate, back to normal.
-
Re: Per Item shipping for 1 category
You have an error then in the file ... if you check in the /logs (or /cache in older versions of Zen Cart) you will see a log file that explains the problem ...
Check and read the debug log file and post its contents and we can help you figure out the problem ...
-
Re: Per Item shipping for 1 category
[23-Oct-2015 15:48:38 America/New_York] PHP Parse error: syntax error, unexpected 'else' (T_ELSE) in .../store/includes/modules/shipping/flat.php on line 95
-
1 Attachment(s)
Re: Per Item shipping for 1 category
Sounds like a typo on the new code ... I am using this:
-
Re: Per Item shipping for 1 category
Not sure why the attachment has jibberish, however, I think I found my issue. testing now...
-
Re: Per Item shipping for 1 category
My coding error in the Flat Rate file was due to placing the edits too high in the file. I moved it to just behind the class methods and it worked. It just didn't look right when I placed it behind the class constructor. It seems to be working. I will continue testing and report back with any issues.
Donation on the way.
Thanks!
Andrew
-
Re: Per Item shipping for 1 category
Thanks for the update that this appears to be working for you now and the explination on the problem you had ... Let us know if you run into any issues ...
Thanks also for the donation to the Zen Cart Team, that is always of great help to us! :cool:
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
Ajeh
Thanks for the update that this appears to be working for you now and the explination on the problem you had ... Let us know if you run into any issues ...
Thanks also for the donation to the Zen Cart Team, that is always of great help to us! :cool:
1 last clarification: some of those product IDs that I'm using are actually category IDs. Can I just do this:
$chk_cart += $_SESSION['cart']->in_cart_check('categories_id','96');
Thanks,
Andrew
-
Re: Per Item shipping for 1 category
You would need the master_categories_id for the Category with the products:
Code:
$chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','96');
-
Re: Per Item shipping for 1 category
-
Re: Per Item shipping for 1 category
Thanks!! Summary:
I enabled flat rate shipping, excluded some items/categories (I chose based on weight, size, ect), so if those excluded items are added to the cart, the flat rate shipping option is not available. This works as expected (thanks Linda!!!).
I decided to leave the USPS and UPS modules alone, since I still want them to show as available shipping options.
I ran into the issue of my flat rate charge being higher than USPS Priority on some items, so I adjusted the USPS rate by adding a few bucks for "handling" on priority only. After all, the idea behind flat rate shipping is to encourage customers to buy more stuff.
Thanks again for your help!
Andrew
-
Re: Per Item shipping for 1 category
You are most welcome ... thanks for the update that this is working for you with both products_id and master_categories_id ... :smile:
-
Re: Per Item shipping for 1 category
Hi, me again.
I want to turn on Freeoptions for orders that total $100 or more. The issue is that I need to exclude certain items just like I did for the Flat Rate shipping module. I tried modifying the freeoptions file under the /includes/modules/shipping, but it was a fail.
Please help.
Thanks!
Andrew
-
Re: Per Item shipping for 1 category
Quote:
Originally Posted by
bigandrew
Hi, me again.
I want to turn on Freeoptions for orders that total $100 or more. The issue is that I need to exclude certain items just like I did for the Flat Rate shipping module. I tried modifying the freeoptions file under the /includes/modules/shipping, but it was a fail.
Please help.
Thanks!
Andrew
Disregard, I found this in another post:
" // disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
}
// BOF: Not allow products to qualify for Free Shipping
// set not allowed products_id numbers and master_categories_id numbers
if (!IS_ADMIN_FLAG) {
global $cart;
$chk_cat = 0;
$chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','01');
$chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','02');
if ($chk_cat > 0) {
$this->enabled = false;
}
}