Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Nov 2011
    Posts
    22
    Plugin Contributions
    0

    Default USPS Shipping module disappeared after I customized the module

    Hello,

    I'm afraid I messed something up. I changed some coding in the usps.php file so that only one of my categories will have the option to ship via usps. This is the coding I changed:

    // bof: only show if all Products are from master_categories_id 3
    if (!IS_ADMIN_FLAG) {
    global $cart;
    $chk_category_count = 0;
    $chk_category_count += $_SESSION['cart']->in_cart_check('master_categories_id','3');
    }
    if ($_SESSION['cart']->count_contents() != $chk_category_count) {
    $this->enabled = false;
    }
    // eof: only show if all Products are from master_categories_id 3

    It worked and only category 3 has the option to ship via usps. Well when I tested the shopping cart I noticed there were a couple of shipping types that I wanted to disable (media and library). When I went into my shipping admin panel my usps shipping module is gone and I can not edit it. However it does calculate shipping in my cart. One other note is that for some reason I cannot edit any of the other shipping methods in my admin panel. What did I do???

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: USPS Shipping module disappeared

    Check the directory:
    /includes/modules/shipping

    and make sure that you do not have a backup copy in there ...
    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: v1.5.5]
    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!

  3. #3
    Join Date
    Nov 2011
    Posts
    22
    Plugin Contributions
    0

    Default Re: USPS Shipping module disappeared

    Do you mean do I have two usps php files in the includes/shipping/modules? I only have one in there.

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: USPS Shipping module disappeared

    A lot of times this happens if you have something like:
    usps.php
    usps.php.bak

    Do you see any debug logs in the /cache directory?
    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: v1.5.5]
    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. #5
    Join Date
    Nov 2011
    Posts
    22
    Plugin Contributions
    0

    Default Re: USPS Shipping module disappeared

    I don't have the .bak file you mentioned, but I did find this debug error.

    [23-Nov-2011 08:00:16] PHP Fatal error: Call to a member function count_contents() on a non-object in C:\xampp\htdocs\zen\includes\modules\shipping\usps.php on line 83

    Here is what Line 83 and 84 looks like:

    if ($_SESSION['cart']->count_contents() != $chk_category_count) {
    $this->enabled = false;
    }

  6. #6
    Join Date
    Nov 2011
    Posts
    22
    Plugin Contributions
    0

    Default Re: USPS Shipping module disappeared

    The name of the debug file looks like it is saying that it is an admin error.

    Also line 83 is part of what I change.

  7. #7
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: USPS Shipping module disappeared after I customized the module

    Looks like you have customized the shipping module ...

    1 you should have an IF around that IF

    2 you need to add a:
    global $cart;

    just above your IF ...

    Code:
    if (!IS_ADMIN_FLAG) {
    global $cart;
    // your IF here
    }
    see if that helps ...
    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: v1.5.5]
    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!

  8. #8
    Join Date
    Nov 2011
    Posts
    22
    Plugin Contributions
    0

    Default Re: USPS Shipping module disappeared after I customized the module

    Yes this is the section I modified. Here is the the whole thing. I changed what is in red. The //bof to //eof

    // disable only when entire cart is free shipping
    if (zen_get_shipping_enabled($this->code)) {
    $this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
    }
    // bof: only show if all Products are from master_categories_id 3
    if (!IS_ADMIN_FLAG) {
    global $cart;
    $chk_category_count = 0;
    $chk_category_count += $_SESSION['cart']->in_cart_check('master_categories_id','3');
    }
    if ($_SESSION['cart']->count_contents() != $chk_category_count) {
    $this->enabled = false;
    }
    // eof: only show if all Products are from master_categories_id 3


    if ($this->enabled) {

    It did what I wanted it to do. The main problem is that when I go into the zen cart admin panel under shipping modules, the usps module has disappeared and I also don't have the ability to edit the other shipping modules. I don't get it, because I didn't modify anything else. Should I just replace the whole includes/modules/shipping file?

  9. #9
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: USPS Shipping module disappeared after I customized the module

    You need the IF for the IS_ADMIN_FLAG around all of that:
    Code:
    // bof: only show if all Products are from master_categories_id 3
    if (!IS_ADMIN_FLAG) {
      global $cart;
      $chk_category_count = 0;
      $chk_category_count += $_SESSION['cart']->in_cart_check('master_categories_id','3');
      if ($_SESSION['cart']->count_contents() != $chk_category_count) {
        $this->enabled = false;
      }
    }
    // eof: only show if all Products are from master_categories_id 3
    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: v1.5.5]
    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!

  10. #10
    Join Date
    Nov 2011
    Posts
    22
    Plugin Contributions
    0

    Default Re: USPS Shipping module disappeared after I customized the module

    Sorry to be so dense, but am I supposed to put the "if (!IS_ADMIN_FLAG)" coding at the end of that whole thing? Like this?

    if ($_SESSION['cart']->count_contents() != $chk_category_count) {
    $this->enabled = false;
    if (!IS_ADMIN_FLAG)}
    // eof: only show if all Products are from master_categories_id 3

    I tried this and it didn't work. Again sorry.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v138a blank page after USPS shipping module update
    By WestcoAK in forum Addon Shipping Modules
    Replies: 7
    Last Post: 12 Aug 2013, 03:52 AM
  2. v139h Is the USPS shipping module required to ship with USPS?
    By yeahwhatever in forum Addon Shipping Modules
    Replies: 3
    Last Post: 14 Feb 2012, 12:58 AM
  3. Can't find the USPS shipping module!
    By portalmonkey in forum General Questions
    Replies: 1
    Last Post: 17 Jan 2012, 10:51 AM
  4. How do I set up the USPS shipping module?
    By kitefighter in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 23 Aug 2011, 06:51 PM
  5. USPS shipping module not working after upgrade
    By bobage24 in forum Upgrading from 1.3.x to 1.3.9
    Replies: 2
    Last Post: 14 Nov 2006, 06:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR