If this is your first visit, check our documentation. To post, register or login.
Forums / Built-in Shipping and Payment Modules / Different shipping methods for different categories

Different shipping methods for different categories

Started by tylerd213 on 13 Mar 2008, 2:16 AM · Views: 107,885

Results 521 to 540 of 554
5 Feb 2013, 5:34 PM
#521
mack32 avatar

mack32

New Zenner

Join Date:
Nov 2007
Posts:
21
Plugin Contributions:
0

Different shipping methods for different categories

I am using ver 1.5 zencart if that makes a difference.

Want to do like the first post. I understand alittle about putting the code in the shipping options you do not want it to show in. Just not quite sure how to get it to go to table rate with a mixed cart or other items?

I have 4 different shipping methods

Jewelry Shipping - using flatrate clone called jewelry.php = This I only want categories with jewelry items to use this shipping option. Turn off if there is a combination of jewelry and other items or just other items in the cart and use the Table Rate Option

Linen Shipping - using flaterate clone called linen.php = This I only want categories with linen items to use this shipping option. Turn off if there is a combination of Linen and other items or just other items in the cart and use the Table Rate option

Shoes Shipping - using item shipping clone called shoes.php = This I only want categories with shoes items to use this shipping option. Turn off if there is a combination of shoes and other items or just other items in cart and use Table Rate option.

Table Rate Option - using the table rate clone table1.php = This I only want to use this on all other categories and mixed carts.

Any help would be appreciated.

Mack

6 Feb 2013, 7:59 PM
#522
mack32 avatar

mack32

New Zenner

Join Date:
Nov 2007
Posts:
21
Plugin Contributions:
0

Re: Different shipping methods for different categories

Anyone!

7 Feb 2013, 12:00 PM
#523
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Different shipping methods for different categories

Mack32:

Anyone!

The solution to your problem is in the examples already provided in this thread. You basically need to adapt the instructions to suit your own particular needs. There is (and cannot) be a set of instructions that will suit everyone because no two stores are alike.

The important thing to remember is that you'll need to make changes to each of your shipping modules, and then add your own tests/checks to set/unset the $this->enabled variables depending on the outcomes of the tests.

If you can't follow the examples given in this thread, there are many other threads with similar (but different) examples.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

7 Feb 2013, 5:42 PM
#524
mack32 avatar

mack32

New Zenner

Join Date:
Nov 2007
Posts:
21
Plugin Contributions:
0

Re: Different shipping methods for different categories

RodG:

The solution to your problem is in the examples already provided in this thread. You basically need to adapt the instructions to suit your own particular needs. There is (and cannot) be a set of instructions that will suit everyone because no two stores are alike.

The important thing to remember is that you'll need to make changes to each of your shipping modules, and then add your own tests/checks to set/unset the $this->enabled variables depending on the outcomes of the tests.

If you can't follow the examples given in this thread, there are many other threads with similar (but different) examples.

Cheers
Rod

Thanks anyway. Figured it out.

Mack

4 Oct 2013, 12:58 PM
#525
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: Different shipping methods for different categories

Hello everyone.
I'm having a problem with the new USPS module.

This is what we used to have that doesn't work anymore.

We ship, priority all our products throughout the US, Canada and International, but one of our products (perfumes) due to restrictions is shipped only within the US via Parcel (standard).

The way we had it set up with rules gathered from this thread, we were able to turn on or off the shipping options depending on the product ID. Now with the new usps.php file the changes didn't work any longer, so we decided to clone the usps.php file (uspsperfumes.php), but of course we have problems.

We've been trying to add the statements to turn on or off if certain products ID's are in the shopping cart, and that part works as long as the customers has a US shipping address. The moment an international customer comes along, the customer only sees the select a shipping method message and no shipping options are provided. The way it worked before, it would show an international customer a message telling them to remove the perfume from the shopping cart because perfumes are not shipped internationally. No matter what we don't get the same results and we haven't been able to figure out what's going on, so if anyone could help us visualize the problem that would be great.

I tried posting the entire uspsperfume.php file, but I get an error that my post is too long.

This is the code we added to the usps.php file

      // CUSTOMIZED CONDITIONS GO HERE
      // Optionally add additional code here to change $this->enabled to false based on whatever custom rules you require.
      // -----
		if (IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_id','116') > 0) {
		  $this->enabled = false;
		}
		if (IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_id','114') > 0) {
		  $this->enabled = false;
		}
      // -----
      // eof: optional additional code

This below is the code we added to the cloned usps file uspsperfume.php

      // CUSTOMIZED CONDITIONS GO HERE
      // Optionally add additional code here to change $this->enabled to false based on whatever custom rules you require.
      // -----
		if (IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_id','114') > 0) {
		  $this->enabled = true;
		}
		if (IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_id','116') > 0) {
		  $this->enabled = true;
		} else {
		  $this->enabled = false;
		}
      // -----
      // eof: optional additional code

It is possible we might have not cloned the usps.php file the right way, but I can't figure out where the damage might be.

Thanks for the help.

M.Valenti
Contemporary Artist - Entrepreneur
http://www.manuelavalenti.com - http://www.byvalenti.com

4 Oct 2013, 2:03 PM
#526
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Your first IF is saying IF category 14 is in the cart set to true ...

Your second IF is saying IF category 16 is in the cart set to true else set to false so that it overrules the results of the first IF for category 14 when category 16 is not in the cart ...

More or less between the two IFs you have to have both category 14 and category 16 in the cart at the same time to get true or at least category 16 in the cart to get true ...

You need to test for both conditions and based on the combined results of both conditions then determine if it should be true or false ...

Something like:

  $chk_cats = 0;
  $chk_cats = $_SESSION['cart']->in_cart_check('products_id','114');
  $chk_cats += $_SESSION['cart']->in_cart_check('products_id','116');
  if ($chk_cats > 0) {
    $this->enabled = true;
  } else {
    $this->enabled = false;
  }

NOTE: you should not need to test for IS_ADMIN_FLAG as that is tested already for you a few lines above ...

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!

4 Oct 2013, 3:02 PM
#527
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: Different shipping methods for different categories

Thank you Ajeh for the quick reply!!!!

I made the changes.

This on the usps file

$chk_cats = 0;
  $chk_cats = $_SESSION['cart']->in_cart_check('products_id','114');
  $chk_cats += $_SESSION['cart']->in_cart_check('products_id','116');
  if ($chk_cats > 0) {
    $this->enabled = false;
  } 

this on the usps clone file (uspsperfume)

		$chk_cats = 0;
		  $chk_cats = $_SESSION['cart']->in_cart_check('products_id','114');
		  $chk_cats += $_SESSION['cart']->in_cart_check('products_id','116');
		  if ($chk_cats > 0) {
		    $this->enabled = true;
		  } else {
		    $this->enabled = false;
		  }

Still not working as it should.
Local customers now see 2 shipping options although only 1 should display. P
I have not selected to show standard post on usps.php but yes on uspsperfume.php and yet it's displaying that option on the shopping cart for both (?)

International customers still don't see the error message asking them remove perfume from the cart, but the select a shipping method and no shipping method shows.
:(

M.Valenti
Contemporary Artist - Entrepreneur
http://www.manuelavalenti.com - http://www.byvalenti.com

4 Oct 2013, 3:14 PM
#528
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Could you Zip your files for:
usps.php
uspsperfume.php

and attache them here?

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!

4 Oct 2013, 5:26 PM
#530
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Which shipping module do you want to run if:
$chk_cats = 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!

4 Oct 2013, 5:41 PM
#531
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: Different shipping methods for different categories

If those two product IDs are not in the cart usps.php should run for both national and international and uspsperfume.php should not run.
If those two product IDs are in the cart for US customers, usps.php should stop running and only uspsperfume.php should run.
If those two product IDs are in the cart for international customers, uspsperfume.php should not run, and usps.php should launch TEXT_NO_SHIPPING_AVAILABLE message, which we have set up with the remove perfume from shopping cart so the shipping can be selected if, and only if, no perfumes are in the cart.

That's the logic we used to have, that's not working.

I'm wondering if we might need to clone usps.php for international as well??

Thanks for looking into it.

M.Valenti
Contemporary Artist - Entrepreneur
http://www.manuelavalenti.com - http://www.byvalenti.com

5 Oct 2013, 4:26 PM
#532
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

What setting differences are you using on:
usps

verses the settings on:
uspsperfume

Do you have any Zone Settings on either module?

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!

5 Oct 2013, 4:47 PM
#533
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: Different shipping methods for different categories

Ajeh:

What setting differences are you using on:
usps

verses the settings on:
uspsperfume

Do you have any Zone Settings on either module?

These are the settings for usps.php
Which server to use
production

Quote Sort Order
Price-LowToHigh

Handling Fee - US
0

Handling Fee - International
0

Handling Per Order or Per Box
Order

Decimal Settings
2

Tax Class
Michigan Taxes

Tax Basis
Shipping

Shipping Zone
--none--

Sort Order
4

All Packages are Machinable?
True

USPS Options
Display transit time

USPS Domestic Transit Time Calculation Mode
CUSTOM

USPS minimum Length
8.625

USPS minimum Width
5.375

USPS minimum Height
1.625

Enable USPS First-Class filter for US shipping
True

Shipping Methods (Domestic and International)
0, .21875, 0.00, 0, .8125, 0.00, First-Class Mail Parcel, 0, .8125, 0.00, 0, 70, 0.00, 0, 70, 0.00, Priority MailTM, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 15, 0.00, 0, 20, 0.00, 0, 25, 0.00, Priority Mail ExpressTM, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, .21875, 0.00, 0, 4, 0.00, 0, 4, 0.00, Priority Mail InternationalRM, 0, 66, 0.00, 0, 4, 0.00, 0, 4, 0.00, 0, 20, 0.00, 0, 20, 0.00, Priority Mail Express InternationalTM, 0, 66, 0.00, 0, 4, 0.00, 0, 20, 0.00, 0, 70, 0.00, 0, 70, 0.00

Extra Services (Domestic)
Certified MailRM, N, USPS TrackingTM, N, Insurance, Y, Adult Signature Restricted Delivery, N, Registered without Insurance, N, Registered MailTM, N, Collect on Delivery, N, Return Receipt for Merchandise, N, Return Receipt, N, Certificate of Mailing, N, Priority Mail Express Insurance, N, Delivery ConfirmationTM, N, Signature ConfirmationTM, N

Extra Services (International)
Registered Mail, N, Insurance, Y, Return Receipt, N, Electronic USPS Delivery Confirmation International, N, Certificate of Mailing, N

Retail pricing or Online pricing?
Retail

Debug Mode
Off

These are the settings for uspsperfume.php
Which server to use
production

Quote Sort Order
Price-LowToHigh

Handling Fee - US
0.50

Handling Fee - International
0

Handling Per Order or Per Box
Order

Decimal Settings
2

Tax Class
Michigan Taxes

Tax Basis
Shipping

Shipping Zone
US

Sort Order
6

All Packages are Machinable?
True

USPS Options
Display transit time

USPS Domestic Transit Time Calculation Mode
CUSTOM

USPS minimum Length
8.625

USPS minimum Width
5.375

USPS minimum Height
1.625

Enable USPS First-Class filter for US shipping
True

Shipping Methods (Domestic and International)
0, .21875, 0.00, 0, .8125, 0.00, 0, .8125, 0.00, 0, 70, 0.00, Standard PostRM, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 15, 0.00, 0, 20, 0.00, 0, 25, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, .21875, 0.00, 0, 4, 0.00, 0, 4, 0.00, 0, 66, 0.00, 0, 4, 0.00, 0, 4, 0.00, 0, 20, 0.00, 0, 20, 0.00, 0, 66, 0.00, 0, 4, 0.00, 0, 20, 0.00, 0, 70, 0.00, 0, 70, 0.00

Extra Services (Domestic)
Certified MailRM, N, USPS TrackingTM, N, Insurance, Y, Adult Signature Restricted Delivery, N, Registered without Insurance, N, Registered MailTM, N, Collect on Delivery, N, Return Receipt for Merchandise, N, Return Receipt, N, Certificate of Mailing, N, Priority Mail Express Insurance, N, Delivery ConfirmationTM, N, Signature ConfirmationTM, N

Extra Services (International)
Registered Mail, N, Insurance, N, Return Receipt, N, Electronic USPS Delivery Confirmation International, N, Certificate of Mailing, N

Retail pricing or Online pricing?
Retail

Debug Mode
Off

Only uspsperfume.php uses zone restrictions.

Thanks!

M.Valenti
Contemporary Artist - Entrepreneur
http://www.manuelavalenti.com - http://www.byvalenti.com

10 Oct 2013, 3:19 PM
#534
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: Different shipping methods for different categories

Ajeh, I've checked and rechecked the clone usps file to see if I had made a mistake.
I've even activated the clone and deactivated the original file to see if it would work as the original, and it does, but the changes, when I activate both, don't work as they should.
I'm really stumped on this one :(
Have you had any luck figuring it out?
Thanks a bunch!

M.Valenti
Contemporary Artist - Entrepreneur
http://www.manuelavalenti.com - http://www.byvalenti.com

30 Dec 2013, 3:48 AM
#535
pewe avatar

pewe

Zen Follower

Join Date:
Aug 2006
Posts:
134
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

This would work better and not make the Admin have a fit:

  // disable only when entire cart is free shipping
  if (zen_get_shipping_enabled($this->code)) {
      $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false);
  }

  // disable for one master_categories_id
  if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','17') > 0)) {
      $this->enabled = false;
  }

I have the 'Per Item' shipping disabled in Admin.

I use only Store Pickup and Per Unit.

The Per Unit is modded so I can put the shipping price for each product in the weight box (as per the mod [shown here](http://www.picaflor-azul.com/blog/easy-help-zen-cart-tutorial-how-to-set-up-per-item-shipping-rates/))

Any guidance on how to 'hide' the 'Per Unit' shipping when an item in the cart is from the 'Store Pickup' category (ID=1) would be appreciated as the above code for Per Item does not work obviously.
30 Dec 2013, 11:08 AM
#536
pewe avatar

pewe

Zen Follower

Join Date:
Aug 2006
Posts:
134
Plugin Contributions:
0

Re: Different shipping methods for different categories

For information - follow on from previous post:

I modded perweightunit.php as follows

// disable only when entire cart is free shipping

    if (zen_get_shipping_enabled($this->code)) {

      $this->enabled = ((MODULE_SHIPPING_PERWEIGHTUNIT_STATUS == 'True') ? true : false);

    }


// disable for one master_categories_id
      if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','1') > 0)) {
          $this->enabled = false;
      } 

However if the cart contains an item from category '1' it still shows the 'Best Way' shipping option as either '£0.00' if no other items are in the cart, or with '£x.xx' if there are items from other categories in the cart.

Anyone any thoughts on why it is not hiding the non Store Pickup options??

30 Dec 2013, 12:16 PM
#537
pewe avatar

pewe

Zen Follower

Join Date:
Aug 2006
Posts:
134
Plugin Contributions:
0

Re: Different shipping methods for different categories

OK, I have solved the problem.

If I enter

// disable for one master_categories_id
      if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','1') > 0)) {
          $this->enabled = false;
      }

It does not work.

However if I enter

      if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','1') > 0)) {
          $this->enabled = false;
      }

It Does??

But now I have another question.

If I have anything that is Store Pickup in the cart, when I 'checkout' the delivery options shows 'Store Pickup' only but the radio box is not ticked, and the page returns an error message stating

Attachment 13617

If there are no Store Pickup items, the message does not appear - and the 'Best Way' radio box is ticked.

Anyone any ideas??

30 Dec 2013, 1:44 PM
#538
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

What version of Zen Cart are you using?

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!

30 Dec 2013, 2:48 PM
#539
pewe avatar

pewe

Zen Follower

Join Date:
Aug 2006
Posts:
134
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

What version of Zen Cart are you using?

Sorry - I should have said!

Its V1.5.1

30 Dec 2013, 3:03 PM
#540
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Zen Cart is designed to never select the Store Pickup automatically ...

On the checkout_shipping page, do you see the radio button to select Store Pickup, when it should be available?

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!