If this is your first visit, check our documentation. To post, register or login.
Forums / Configuring the Zen Cart Admin / Built-in Shipping and Payment Modules / Shipping combined categories - I am confused

Shipping combined categories - I am confused

Started by mhollibush on 30 Jan 2014, 9:49 AM · Views: 1,049

Results 1 to 11 of 11
30 Jan 2014, 9:49 AM
#1
mhollibush avatar

mhollibush

New Zenner

Join Date:
Jan 2014
Posts:
18
Plugin Contributions:
0

Post #1 by mhollibush

I have a category "category 4" that needs to be flat rate shipping.

all the other categories are normal USPS shipping.

Here is my issue,

if they have multiple items in their cart, from the "category 4" and items from the other categories, it show the flat rate option.

I need "flat rate" not to show up if their cart has items from other categories.

I am new to the Zen Cart - and by no means am I a php person.

any help would be appreciated.

30 Jan 2014, 11:32 PM
#2
ajeh avatar

ajeh

Oba-san

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

Post #2 by ajeh

You have me confused ...

You say:

mhollibush:

if they have multiple items in their cart, from the "category 4" and items from the other categories, it show the flat rate option.

I need "flat rate" not to show up if their cart has items from other categories.

So, please define what you want for:
1 ALL products are from categories_id 4

2 NO products are from categories_id 4

3 Some products are from categories_id 4 and some products are from other categories_id other than 4

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!

31 Jan 2014, 11:08 AM
#3
mhollibush avatar

mhollibush

New Zenner

Join Date:
Jan 2014
Posts:
18
Plugin Contributions:
0

Post #3 by mhollibush

Ajeh:

You have me confused ...

You say:

So, please define what you want for:
1 ALL products are from categories_id 4

2 NO products are from categories_id 4

3 Some products are from categories_id 4 and some products are from other categories_id other than 4

here is how I need it -
ALL products from categories_id 4 are FLAT RATE
ALL other categories normal shipping rates apply ( USPS )

If a cart contains items from catergories_id 4 and items from ANY OTHER categories, then FLAT RATE is not an option and normal shipping rates apply..

Does that make sense?

31 Jan 2014, 11:44 AM
#4
mhollibush avatar

mhollibush

New Zenner

Join Date:
Jan 2014
Posts:
18
Plugin Contributions:
0

Post #4 by mhollibush

Ajeh:

You have me confused ...

You say:

So, please define what you want for:
1 ALL products are from categories_id 4

2 NO products are from categories_id 4

3 Some products are from categories_id 4 and some products are from other categories_id other than 4

ALL products are from categories_id 4 = FLAT RATE SHIPPING

NO products are from categories_id 4 = NORMAL SHIPPING

Some products are from categories_id 4 and some products are from other categories_id other than 4 = NORMAL SHIPPING ( NO FLAT RATE OPTION )

Hope that helps

31 Jan 2014, 3:04 PM
#5
ajeh avatar

ajeh

Oba-san

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

Post #5 by ajeh

To manage the shipping so that you only see Flat Rate when all Products are from categories_id 4 and when a mixed cart or no products are from categories_id 4 show USPS you can use the code in RED:
/includes/modules/flat.php

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

[B]// bof: only show shipping if all products in the cart are from category 4
$chk_cat = $_SESSION['cart']->in_cart_check('master_categories_id','4');
if ($chk_cat != $_SESSION['cart']->count_contents()) {
  $this->enabled = false;
}
// eof: only show shipping if all products in the cart are from category 4
[/B]
      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {

and in the USPS module use the code in RED:

    // disable only when entire cart is free shipping
    if (zen_get_shipping_enabled($this->code) == FALSE) $this->enabled = FALSE;
[B]
// bof: only show shipping if all products in the cart are not from category 4
$chk_cat = $_SESSION['cart']->in_cart_check('master_categories_id','4');
if ($chk_cat == $_SESSION['cart']->count_contents()) {
  $this->enabled = false;
}
// eof: only show shipping if all products in the cart are not from category 4
[/B]
    if ($this->enabled == true) {

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!

31 Jan 2014, 9:58 PM
#6
mhollibush avatar

mhollibush

New Zenner

Join Date:
Jan 2014
Posts:
18
Plugin Contributions:
0

Post #6 by mhollibush

inserted new code as described...

When I go to the admin area and click on shipping in the modules, I get a blank page?

Not able to configure or edit any shipping modules

I really appreciate you trying to help me -

31 Jan 2014, 10:54 PM
#7
ajeh avatar

ajeh

Oba-san

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

Post #7 by ajeh

Silly me, I forgot to put in the safeties for the Admin ... add an IF around each section of the new code for:

if (!IS_ADMIN_FLAG) {
// new code 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!

1 Feb 2014, 12:07 AM
#8
mhollibush avatar

mhollibush

New Zenner

Join Date:
Jan 2014
Posts:
18
Plugin Contributions:
0

Post #8 by mhollibush

Ajeh:

Silly me, I forgot to put in the safeties for the Admin ... add an IF around each section of the new code for:

if (!IS_ADMIN_FLAG) {
// new code here
}


Did as described - still get a blank page?

HERE IS HOW I HAVE IT:
flat.php
  // disable only when entire cart is free shipping
  if (zen_get_shipping_enabled($this->code)) {
    $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
  }

if (!IS_ADMIN_FLAG) {
// new code here
// bof: only show shipping if all products in the cart are from category 4
$chk_cat = $_SESSION['cart']->in_cart_check('master_categories_id','4');
if ($chk_cat != $_SESSION['cart']->count_contents()) {
$this->enabled = false;
}
// eof: only show shipping if all products in the cart are from category 4


usps.php
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code) == FALSE) $this->enabled = FALSE;

if (!IS_ADMIN_FLAG) {
// new code here
// bof: only show shipping if all products in the cart are not from category 4
$chk_cat = $_SESSION['cart']->in_cart_check('master_categories_id','4');
if ($chk_cat == $_SESSION['cart']->count_contents()) {
$this->enabled = false;
}
// eof: only show shipping if all products in the cart are not from category 4

1 Feb 2014, 12:18 AM
#9
ajeh avatar

ajeh

Oba-san

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

Post #9 by ajeh

You did not do the code right ...

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

// bof: only show shipping if all products in the cart are from category 4
if (!IS_ADMIN_FLAG) {
  $chk_cat = $_SESSION['cart']->in_cart_check('master_categories_id','4');
  if ($chk_cat != $_SESSION['cart']->count_contents()) {
    $this->enabled = false;
  }
}
// eof: only show shipping if all products in the cart are from category 4

      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {
    // disable only when entire cart is free shipping
    if (zen_get_shipping_enabled($this->code) == FALSE) $this->enabled = FALSE;

// bof: only show shipping if all products in the cart are not from category 4
if (!IS_ADMIN_FLAG) {
  $chk_cat = $_SESSION['cart']->in_cart_check('master_categories_id','4');
  if ($chk_cat == $_SESSION['cart']->count_contents()) {
    $this->enabled = false;
  }
}
// eof: only show shipping if all products in the cart are not from category 4

    if ($this->enabled == true) {

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!

1 Feb 2014, 7:32 AM
#10
mhollibush avatar

mhollibush

New Zenner

Join Date:
Jan 2014
Posts:
18
Plugin Contributions:
0

Post #10 by mhollibush

:blush:
Like I stated, I am no php person....

Thank you very much - got it working....

You are the greatest - donation to zen cart coming :cool:

1 Feb 2014, 1:59 PM
#11
ajeh avatar

ajeh

Oba-san

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

Post #11 by ajeh

Thanks for the update that this is now working for you ...

And we really thank you for the donation ... it helps us greatly in furthering out help to you and our other Zen Cart users ... :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!