Page 37 of 38 FirstFirst ... 2735363738 LastLast
Results 361 to 370 of 379
  1. #361
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Re: USPS Shipping Module [Support Thread]

    Quote Originally Posted by lat9 View Post
    ... and what are "the statements that should be able to find it"?
    I'm still using the old usps.php module, since it includes filters that I set up years ago. I have not been able to figure out how to add those filters to the new code, or I'd have already done that. I'll list a couple of lines of the code below, but it is working just fine for every single product id that I add, except for one. The only thing I can think of is that there is some invisible character in the product id that's causing it not to be recognized. I've confirmed that I can substitute any other product id in our inventory, and the code does as it always has done for those id's, just not for this one particular item.

    Code:
    //bof: example to block USPS PriorityMailTM Flat Rate Padded Envelope when certain products are in the cart
    if (true) {
      $chk_cart_env = 0;
      $chk_cart_env += $_SESSION['cart']->in_cart_check('master_categories_id','1'); // Golden paste
      $chk_cart_env += $_SESSION['cart']->in_cart_check('master_categories_id','2'); // spices
      $chk_cart_env += $_SESSION['cart']->in_cart_check('master_categories_id','3'); // accessories
      $chk_cart_env += $_SESSION['cart']->in_cart_check('master_categories_id','5'); // livestock feed  
      $chk_cart_env += $_SESSION['cart']->in_cart_check('master_categories_id','10'); // oils
      $chk_cart_env += $_SESSION['cart']->get_quantity('76') > 0;  // original bar
      $chk_cart_env += $_SESSION['cart']->get_quantity('78') > 0;  // ginger bars
      $chk_cart_env += $_SESSION['cart']->get_quantity('150') > 0;  // One of each of the turmeric bars
      $chk_cart_env += $_SESSION['cart']->get_quantity('166') > 0;  // ChickiBams box of 20 
      $chk_cart_env += $_SESSION['cart']->get_quantity('167') > 0;  // WhamBams box of 20
      $chk_cart_env += $_SESSION['cart']->get_quantity('168') > 0;  // GingiBams box of 20  
      $chk_cart_env += $_SESSION['cart']->get_quantity('161') > 0;  // PawSkin   
      $chk_cart_env += $_SESSION['cart']->get_quantity('171') > 0;  // Snack Pack
    This works to prevent the customer from choosing a flat rate padded envelope for every single product code except the last one in the list. No matter what I do, that one is being ignored. I need to know what product id the code is actually finding there so hopefully I can tell why it's falling through the last statement with a zero value when the quantity is greater than zero. And yes, I'm aware that there is no ending curly brace, This is just a snippet.

  2. #362
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,466
    Plugin Contributions
    88

    Default Re: USPS Shipping Module [Support Thread]

    That functionality, in more current versions of USPS, is available via a site-specific observer's processing. See https://github.com/lat9/usps/blob/K1..._overrides.php for an example

  3. #363
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Re: USPS Shipping Module [Support Thread]

    Quote Originally Posted by lat9 View Post
    That functionality, in more current versions of USPS, is available via a site-specific observer's processing. See https://github.com/lat9/usps/blob/K1..._overrides.php for an example
    Yes, I know that, but I have never been able to make it work. The only way I've been able to manage the appropriate size shipping service for our products is to stay with the existing working code. I just need to know what variable to look at to see what Zencart thinks the product ID is here.

  4. #364
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,466
    Plugin Contributions
    88

    Default Re: USPS Shipping Module [Support Thread]

    Quote Originally Posted by HeleneWallis View Post
    Yes, I know that, but I have never been able to make it work. The only way I've been able to manage the appropriate size shipping service for our products is to stay with the existing working code. I just need to know what variable to look at to see what Zencart thinks the product ID is here.
    You'd just follow the "pattern" in that extras file, using (most likely)
    Code:
    $_SESSION['cart']->in_cart_check('master_categories_id', {product-id to be checked});

  5. #365
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Re: USPS Shipping Module [Support Thread]

    Quote Originally Posted by lat9 View Post
    You'd just follow the "pattern" in that extras file, using (most likely)
    Code:
    $_SESSION['cart']->in_cart_check('master_categories_id', {product-id to be checked});
    That just returns a zero, since there is no master category with that number. I don't see how it could work, since I'm not looking at a master category of 171, but a product id of 171.

  6. #366
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,682
    Plugin Contributions
    9

    Default Re: USPS Shipping Module [Support Thread]

    Quote Originally Posted by HeleneWallis View Post
    That just returns a zero, since there is no master category with that number. I don't see how it could work, since I'm not looking at a master category of 171, but a product id of 171.
    try:

    PHP Code:
    $_SESSION['cart']->in_cart_check('products_id', {product-id to be checked}); 
    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  7. #367
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Re: USPS Shipping Module [Support Thread]

    Quote Originally Posted by carlwhat View Post
    try:

    PHP Code:
    $_SESSION['cart']->in_cart_check('products_id', {product-id to be checked}); 
    best.
    That is giving me the quantity of that product number in the cart, which I also needed to know. But not the actual product number itself. But it does confirm that the software is seeing '171' as the product ID, because it returns the correct quantity. So I am still totally stumped as to why this is happening:

    Code:
      echo $_SESSION['cart']->get_quantity('171');  // RETURNS ZERO
      echo $_SESSION['cart']->in_cart_check('products_id', '171');   // RETURNS 1, WHICH IS CORRECT
    The first comparison works for every single other product id in our inventory, but not for the one with an id of 171. That's why I was trying to find out what the code was actually seeing there. The second statement confirms that it is seeing 171. I can use the second comparison as a workaround, but the first one ought to work.

  8. #368
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,682
    Plugin Contributions
    9

    Default Re: USPS Shipping Module [Support Thread]

    looking at the code is always a good idea. in this case, there is useful info in the documentation of the code.

    the following snippet is from:

    includes/classes/shopping_cart.php


    PHP Code:
    /**
         * Get the quantity of an item in the cart
         * NOTE: This accepts attribute hash as $products_id, such as: 12:a35de52391fcb3134
         * ... and treats 12 as unique from 12:a35de52391fcb3134
         * To lookup based only on prid (ie: 12 here) regardless of the attribute hash, use another method: in_cart_product_total_quantity()
         *
         * @param int|string $uprid product ID of item to check
         * @return int|float the quantity of the item
         */
        
    public function get_quantity($uprid
    i would use the method:

    in_cart_product_total_quantity()

    instead of

    get_quantity()

    and see if that provides the desired results.

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  9. #369
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Re: USPS Shipping Module [Support Thread]

    Quote Originally Posted by carlwhat View Post
    looking at the code is always a good idea. in this case, there is useful info in the documentation of the code.

    the following snippet is from:

    includes/classes/shopping_cart.php


    PHP Code:
    /**
         * Get the quantity of an item in the cart
         * NOTE: This accepts attribute hash as $products_id, such as: 12:a35de52391fcb3134
         * ... and treats 12 as unique from 12:a35de52391fcb3134
         * To lookup based only on prid (ie: 12 here) regardless of the attribute hash, use another method: in_cart_product_total_quantity()
         *
         * @param int|string $uprid product ID of item to check
         * @return int|float the quantity of the item
         */
        
    public function get_quantity($uprid
    i would use the method:

    in_cart_product_total_quantity()

    instead of

    get_quantity()

    and see if that provides the desired results.

    best.
    Thank you, that is working.

    I know I have to get the newer code set up, but I simply do not have time to do it, and as long as this is working for now, it will have to do.

  10. #370
    Join Date
    Jun 2005
    Posts
    309
    Plugin Contributions
    0

    Default Re: USPS Shipping Module [Support Thread]

    Today we noticed intermittent issues of getting: "Your order's details have changed. Please review the current values and re-submit." Reloading the page or changing the shipping method will let the order go through. Only recent changes were upgrading USPS from K11i to K11j (I typed in the password), sitemap from 3.99 to 4, GPSF from 1.0.0 to 1.0.1, and edit orders from 4.7.0beta2 to 4.7.0 released. It happens using cashiers check / money order, so not a payment module issue.

    Guessing USPS API issue? Anyone else seeing this?
    2 + 2 = 5 for extremely large values of 2

    Pez Collectors Store

 

 
Page 37 of 38 FirstFirst ... 2735363738 LastLast

Similar Threads

  1. MultiSite Module Support Thread
    By Gerome in forum All Other Contributions/Addons
    Replies: 2220
    Last Post: 13 Mar 2024, 01:24 PM
  2. Optional Shipping Insurance Module [Support Thread]
    By jettrue in forum Addon Shipping Modules
    Replies: 396
    Last Post: 31 Mar 2023, 05:35 PM
  3. Replies: 29
    Last Post: 24 Sep 2014, 09:59 PM
  4. Replies: 335
    Last Post: 1 Aug 2013, 08:54 PM
  5. PC Configurator Module [Support Thread]
    By lebrand2006 in forum All Other Contributions/Addons
    Replies: 254
    Last Post: 22 Aug 2012, 03:52 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