Page 6 of 7 FirstFirst ... 4567 LastLast
Results 51 to 60 of 62
  1. #51
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,413
    Plugin Contributions
    94

    Default Re: USPS override help?

    Helene, that looks like it should work. There's a specific naming convention for auto-loaded observer-class modules.

    What's the name of the auto.*.php class file and the name of the class (i.e. class ClassName)?

  2. #52
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    605
    Plugin Contributions
    0

    Default Re: USPS override help?

    Quote Originally Posted by lat9 View Post
    Helene, that looks like it should work. There's a specific naming convention for auto-loaded observer-class modules.

    What's the name of the auto.*.php class file and the name of the class (i.e. class ClassName)?
    It's the overrides file for the USPS customization. The Class is zcObserverUspsOverrides and the file is auto.usps_overrides.php.

    Sorry, I thought I was asking in the thread for the USPS module, didn't notice I was elsewhere.

  3. #53
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,413
    Plugin Contributions
    94

    Default Re: USPS override help?

    Helene, edit /includes/modules/shipping/usps.php to locate its install function. You'll see a section of code like the following (which is K11i):
    Code:
            $db->Execute(
                "INSERT INTO " . TABLE_CONFIGURATION . "
                    (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added)
                 VALUES
                    ('Shipping Methods (Domestic and International)',  'MODULE_SHIPPING_USPS_TYPES',  '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, 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, 70, 0.00, 0, 70, 0.00', '<b><u>Checkbox:</u></b> Select the services to be offered<br><b><u>Minimum Weight (lbs)</u></b>first input field<br><b><u>Maximum Weight (lbs):</u></b>second input field<br><br>USPS returns methods based on cart weights.  These settings will allow further control (particularly helpful for flat rate methods) but will not override USPS limits', 6, 0, 'zen_cfg_usps_services([\'Media Mail Parcel\', \'USPS Ground AdvantageTM\', \'Priority MailRM\', \'Priority MailRM Flat Rate Envelope\', \'Priority MailRM Legal Flat Rate Envelope\', \'Priority MailRM Padded Flat Rate Envelope\', \'Priority MailRM Small Flat Rate Box\', \'Priority MailRM Medium Flat Rate Box\', \'Priority MailRM Large Flat Rate Box\', \'Priority Mail ExpressRM\', \'Priority Mail ExpressRM Flat Rate Envelope\', \'Priority Mail ExpressRM Legal Flat Rate Envelope\', \'First-Class MailRM International Letter\', \'First-Class MailRM International Large Envelope\', \'First-Class Package International ServiceTM\', \'Priority Mail InternationalRM\', \'Priority Mail InternationalRM Flat Rate Envelope\', \'Priority Mail InternationalRM Small Flat Rate Box\', \'Priority Mail InternationalRM Medium Flat Rate Box\', \'Priority Mail InternationalRM Large Flat Rate Box\', \'Priority Mail Express InternationalRM\', \'Priority Mail Express InternationalRM Flat Rate Envelope\', \'USPS GXGTM Envelopes\', \'Global Express GuaranteedRM (GXG)\'], ', now())"
            );
    Don't pay attention to the various \' elements (they're needed for the database insert), but those strings identify the various USPS shipping methods supported by the shipping module.

  4. #54
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    605
    Plugin Contributions
    0

    Default Re: USPS override help?

    Quote Originally Posted by lat9 View Post
    Helene, edit /includes/modules/shipping/usps.php to locate its install function. You'll see a section of code like the following (which is K11i):
    Code:
            $db->Execute(
                "INSERT INTO " . TABLE_CONFIGURATION . "
                    (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added)
                 VALUES
                    ('Shipping Methods (Domestic and International)',  'MODULE_SHIPPING_USPS_TYPES',  '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, 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, 70, 0.00, 0, 70, 0.00', '<b><u>Checkbox:</u></b> Select the services to be offered<br><b><u>Minimum Weight (lbs)</u></b>first input field<br><b><u>Maximum Weight (lbs):</u></b>second input field<br><br>USPS returns methods based on cart weights.  These settings will allow further control (particularly helpful for flat rate methods) but will not override USPS limits', 6, 0, 'zen_cfg_usps_services([\'Media Mail Parcel\', \'USPS Ground AdvantageTM\', \'Priority MailRM\', \'Priority MailRM Flat Rate Envelope\', \'Priority MailRM Legal Flat Rate Envelope\', \'Priority MailRM Padded Flat Rate Envelope\', \'Priority MailRM Small Flat Rate Box\', \'Priority MailRM Medium Flat Rate Box\', \'Priority MailRM Large Flat Rate Box\', \'Priority Mail ExpressRM\', \'Priority Mail ExpressRM Flat Rate Envelope\', \'Priority Mail ExpressRM Legal Flat Rate Envelope\', \'First-Class MailRM International Letter\', \'First-Class MailRM International Large Envelope\', \'First-Class Package International ServiceTM\', \'Priority Mail InternationalRM\', \'Priority Mail InternationalRM Flat Rate Envelope\', \'Priority Mail InternationalRM Small Flat Rate Box\', \'Priority Mail InternationalRM Medium Flat Rate Box\', \'Priority Mail InternationalRM Large Flat Rate Box\', \'Priority Mail Express InternationalRM\', \'Priority Mail Express InternationalRM Flat Rate Envelope\', \'USPS GXGTM Envelopes\', \'Global Express GuaranteedRM (GXG)\'], ', now())"
            );
    Don't pay attention to the various \' elements (they're needed for the database insert), but those strings identify the various USPS shipping methods supported by the shipping module.
    Thank you, that's what I needed!

  5. #55
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    605
    Plugin Contributions
    0

    Default Re: USPS override help?

    Cindy, what am I missing here? The logic is obvious but it isn't working. For example, in the sample included in auto.usps_overrides.php, $p1 should be (or at least include) the string 'Media Mail,' isn't that correct? So in my addition using 'Priority MailRM Small Flat Rate Box,' $p1 should be (or include) that string. But it clearly does not, since the conditional statement is failing.

    I corrected my code to read

    PHP Code:
           if (stripos($p1'Priority MailRM Small Flat Rate Box') !== false) {   
                      
    $chk_cart 0;
                      
    $chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','1'); // golden paste
                      
    $chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','2'); // spices
                      
    $chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','3'); // accessories
                      
    $chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','5'); // livestock feed   
                      
    $chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','10'); // oils
                      
    $chk_cart += $_SESSION['cart']->in_cart_check('master_categories_id','11'); // pet products
                      
    $chk_cart += $_SESSION['cart']->get_quantity('148') > 0// Soothamide
                      
    if ($chk_cart 0) {
                        
    $p2 false;
                      }  
                    }
                    break; 
    since I want to exclude that shipping method if anything in the cart falls in the specified categories. But this is still permitting a customer to choose a small flat rate box for items in those categories.

  6. #56
    Join Date
    Apr 2009
    Posts
    469
    Plugin Contributions
    2

    Default Re: USPS override help?

    Hi Helen,
    have you checked that $p1 is as you expect? Either using a debugging tool that will allow you to see the value of $p1 or by adding a line to the code to echo the value of $p1 so you can confirm you have the correct string.

    Also don't think it is the issue, but you could change

    Code:
    $chk_cart += $_SESSION['cart']->get_quantity('148') > 0; // Soothamide
    to

    Code:
    $chk_cart += $_SESSION['cart']->get_quantity('148'); // Soothamide
    As get_quantity, return 0 if it doesn't find the product in the cart.
    Mark Brittain
    http:\\innerlightcrystals.co.uk\sales\

  7. #57
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,413
    Plugin Contributions
    94

    Default Re: USPS override help?

    Good eyes, @brittainmark!

  8. #58
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    605
    Plugin Contributions
    0

    Default Re: USPS override help?

    Quote Originally Posted by brittainmark View Post
    Hi Helen,
    have you checked that $p1 is as you expect? Either using a debugging tool that will allow you to see the value of $p1 or by adding a line to the code to echo the value of $p1 so you can confirm you have the correct string.

    Also don't think it is the issue, but you could change

    Code:
    $chk_cart += $_SESSION['cart']->get_quantity('148') > 0; // Soothamide
    to

    Code:
    $chk_cart += $_SESSION['cart']->get_quantity('148'); // Soothamide
    As get_quantity, return 0 if it doesn't find the product in the cart.
    I attempted to use echo to see $p1, but it isn't showing up. In fact, I'm not certain the file is even being seen, because nothing I do to it, including deliberate syntax errors, make any difference.

    Thank you for the modification on the Soothamide line. But that isn't the problem. It isn't ever getting executed.

  9. #59
    Join Date
    Apr 2009
    Posts
    469
    Plugin Contributions
    2

    Default Re: USPS override help?

    I assume that if you go to the cart, the UPS postage option is there.
    If that is true, I assume that you viewed the page source to look for the echo you put in.
    To check the observer is being loaded. If you put a syntax error into auto.usps_overrides.php you should get a white screen when trying to check out. (the auto.usps_overrides.php should be present in includes/classes/observers) if you are not getting a white screen, then the file is not being loaded.

    Sorry not in the US so I do not have an account to test.
    Mark Brittain
    http:\\innerlightcrystals.co.uk\sales\

  10. #60
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,413
    Plugin Contributions
    94

    Default Re: USPS override help?

    ... and the file is present in /includes/classes/observers/auto.usps_overrides.php?

 

 
Page 6 of 7 FirstFirst ... 4567 LastLast

Similar Threads

  1. v139h USPS Media Mail problem.
    By Beau91324 in forum Addon Shipping Modules
    Replies: 4
    Last Post: 8 Jul 2014, 08:50 PM
  2. v150 USPS Module RateV3 -- trying to integrate Media Mail eligible option
    By jaheadlee in forum Addon Shipping Modules
    Replies: 1
    Last Post: 24 Jul 2012, 10:59 PM
  3. USPS-Offering Media mail on all items
    By flyred77 in forum Built-in Shipping and Payment Modules
    Replies: 7
    Last Post: 2 Dec 2009, 12:04 AM
  4. Product Customization USPS Media Mail
    By rfloyd in forum Built-in Shipping and Payment Modules
    Replies: 6
    Last Post: 30 May 2008, 09:46 PM

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