Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Block shipping options for certain items...?

Block shipping options for certain items...?

Views: 4,462

Results 1 to 20 of 36
6 Jun 2011, 9:34 PM
#1
doooomed avatar

doooomed

Zen Follower

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

Block shipping options for certain items...?

Hello, Most of my items ship using media mail and some others are not allowed due to postal regulations.

If someone adds two items to cart, one which is ok for media mail and another that cannot be shipped using media mail and the customer chooses media mail it makes for kind of a mess. Is there a way to disable or block the media mail option for such orders?

Thanks!

doooomed.com

7 Jun 2011, 2:20 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Block shipping options for certain items...?

You could test the shopping cart Products and see if all "qualify" for your definition of Media ...

What do these Media Mail Products have in common to identify them?

Or, what do these NON-Media Mail Products have in common to identify them?

Do they all reside in the same Category? Or several Categories that can be identified?

8 Jun 2011, 2:32 PM
#3
doooomed avatar

doooomed

Zen Follower

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

Re: Block shipping options for certain items...?

Hi!

Thanks for the reply! All of the items that cannot be shipped using media mail are under a different category than the others. Other than that they are fairly similar, but I could make them different if having them in different categories is not enough.

I think I have an idea where you are going with this but I honestly have no idea how to begin, additional advice would be highly appreciated! Thank you!!!

8 Jun 2011, 4:44 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Block shipping options for certain items...?

Do all of those NON-Media Mail Products use the same master_categories_id as that Category?

8 Jun 2011, 5:22 PM
#5
doooomed avatar

doooomed

Zen Follower

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

Re: Block shipping options for certain items...?

No they do not....

8 Jun 2011, 5:30 PM
#6
doooomed avatar

doooomed

Zen Follower

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

Re: Block shipping options for certain items...?

All the media mail items reside in their own master category...

8 Jun 2011, 9:38 PM
#7
ajeh avatar

ajeh

Oba-san

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

Re: Block shipping options for certain items...?

The master_categories_id is the immediate Category that the Product is located in that is the "owner" of the Product ...

Are you saying the NON-Media Mail Products are all in 1 Category and that is the master_categories_id ... or are you saying they are all in 1 Top level Category that has subcategories?

Or is there no relationship to the master_categories_id and the NON-Media Mail Products?

9 Jun 2011, 2:04 PM
#8
doooomed avatar

doooomed

Zen Follower

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

Re: Block shipping options for certain items...?

Hmmm... I'm honestly not sure of that! Here is a screenshot...

The folder that says "Tees & Longsleeves" is the NON media mail items...

9 Jun 2011, 2:58 PM
#9
ajeh avatar

ajeh

Oba-san

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

Re: Block shipping options for certain items...?

Does the Category for Tees & Longsleeves just hold Products or are there subdirectories in there?

9 Jun 2011, 3:17 PM
#10
doooomed avatar

doooomed

Zen Follower

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

Re: Block shipping options for certain items...?

It does contain subdirectories...

9 Jun 2011, 3:30 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: Block shipping options for certain items...?

Do the subdirectories contain Products or subdirectories?

9 Jun 2011, 4:45 PM
#12
doooomed avatar

doooomed

Zen Follower

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

Re: Block shipping options for certain items...?

products...

9 Jun 2011, 5:10 PM
#13
ajeh avatar

ajeh

Oba-san

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

Re: Block shipping options for certain items...?

IF the Categories that actually hold the Products use those Categories as their master_categories_id then you could customize the
/includes/modules/shipping/usps.php

with something like:

[B]          $cost = preg_replace('/[^0-9.]/', '',  $cost);
[/B]

// bof: do not show MEDIA MAIL for master_categories_id 10, 12 and 22
$chk_nonmedia_cat = 0;
$chk_nonmedia_cat += $_SESSION['cart']->in_cart_check('master_categories_id', '10');
$chk_nonmedia_cat += $_SESSION['cart']->in_cart_check('master_categories_id', '12');
$chk_nonmedia_cat += $_SESSION['cart']->in_cart_check('master_categories_id', '22');

if ($type == 'MEDIA' && $chk_nonmedia_cat > 0) {
  $skip_it = true;
} else {
  $skip_it = false;
}

if (!$skip_it) {
          $methods[] = array('id' => $type,
                             'title' => $title,
                             'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_USPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_USPS_HANDLING) );
}
// eof: do not show MEDIA MAIL for master_categories_id 10, 12 and 22

[B]        }

        $this->quotes['methods'] = $methods;[/B]

where you can use the code:

$chk_nonmedia_cat += $_SESSION['cart']->in_cart_check('master_categories_id', '10');

for each of the Categories with the NON-Media Mail Products ...

21 Jun 2011, 6:20 PM
#14
doooomed avatar

doooomed

Zen Follower

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

Re: Block shipping options for certain items...?

Hi Ajeh! Sorry it took me forever to get back to you, got caught up in a bunch of stuff and just now got a chance to try this out...I do appreciate your help!

When I try add the code to the usps.php it is making my shipping estimator disappear completely, no matter what I add to the cart, media mail items or not. Is there a specific place I need to add the code? What do you think I'm doing wrong? Thanks again!

21 Jun 2011, 6:31 PM
#15
ajeh avatar

ajeh

Oba-san

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

Re: Block shipping options for certain items...?

Look in your /cache and see what the debug logs read ...

21 Jun 2011, 6:51 PM
#16
doooomed avatar

doooomed

Zen Follower

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

Re: Block shipping options for certain items...?

hmmm...really don't really know where to find that?

21 Jun 2011, 7:01 PM
#17
ajeh avatar

ajeh

Oba-san

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

Re: Block shipping options for certain items...?

If you look with FTP at your server, you will see the main directory, you will see:
/includes
/images

your should also see:
/cache

that should be set to 777 and your should be able to trip your error, then refresh your FTP and you will see the debug logs if any are generated ... and if you read the debug log(s) that should give you a clue on the problem ...

21 Jun 2011, 7:22 PM
#18
doooomed avatar

doooomed

Zen Follower

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

Re: Block shipping options for certain items...?

I'm still not sure how to "trip your error, then refresh your FTP " Where will I find this error log?

I do get this error when looking at my shipping modules within Zen cart if that helps any?

syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /home/######/public_html/includes/modules/shipping/usps.php

25 Jun 2011, 1:56 PM
#19
doooomed avatar

doooomed

Zen Follower

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

Re: Block shipping options for certain items...?

I've been trying different things I still can't figure out how to get the error logs...please help!

25 Jun 2011, 2:00 PM
#20
ajeh avatar

ajeh

Oba-san

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

Re: Block shipping options for certain items...?

If you are getting errors, look in the directory:
/cache

and you will see the files by date that end in .log ...

If you view the files you will see the error ...

Do you have the USPS module working or are you getting errors right now?