Jump to content

Supertex

Members
  • Content count

    299
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Supertex

  1. Supertex

    [Development] USPS Shipping Module

    Sometime I'm going to get up to WA, and when I do, I'm buying you a steak dinner. Thank you.
  2. Supertex

    [Development] USPS Shipping Module

    @kymation Hey Jim, In chasing my need, I've duplicated the (outdated, I know) USPS module I've been using. It installs fine, including the defaults for package dimensions, so I've had partial success with it. However, it seems everytime I try to save settings in the admin, I get "Array" in 'package dimensions' and 'handling fees'. To clone it, I took the working USPS module files and duplicated them and renamed them. There were only 2 files: usps.php for the modules/shipping, and the same for the languages directory. Then I found every 'usps' and changed it to 'usps2'...constants, functions, variables, etc., along with filenames. I've put the old and new in WinMerge and ensured that the only differences are the aforementioned. Any idea what I might have missed? I think these are the functions associated with the problem: // Required configuration functions // USPS Methods. Added by Greg Deeth // Alias function for Store configuration values in the Administration Tool function usps2_cfg_select_multioption($select_array, $key_value, $key = '') { for ($i=0; $i<sizeof($select_array); $i++) { $name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value'); $string .= '<br /><input type="checkbox" name="' . $name . '" value="' . $select_array[$i] . '"'; $key_values = explode( ", ", $key_value); if ( in_array($select_array[$i], $key_values) ) $string .= ' CHECKED'; $string .= '> ' . $select_array[$i]; } $string .= '<input type="hidden" name="' . $name . '" value="--none--">'; return $string; } // Alias function for Store configuration values in the Administration Tool. function usps2_cfg_multiinput_list($select_array, $key_value, $key = '') { $key_values = explode( ", ", $key_value); for ($i=0; $i<sizeof($select_array); $i++) { $name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value'); $string .= '<br /><input type="text" name="' . $name . '" value="' . $key_values[$i] . '" size="7"> ' . $select_array[$i]; } $string .= '<input type="hidden" name="' . $name . '" value="--none--">'; return $string; } /** * displays a json string as a list * * @param (string) $cfg_value */ function usps2_cfg_display_json_as_list( $cfg_value ){ $array = json_decode($cfg_value, true); $string = '<ul>'; foreach( $array as $li ){ $string .= '<li><pre>' . $li . '</pre></li>'; } $string .= '</ul>'; return $string; }
  3. Supertex

    [Development] USPS Shipping Module

    Thank you Jim.
  4. Supertex

    [Development] USPS Shipping Module

    Heya Jim, Still working on this much at all, or kinda letting it go? I have kind of a special need that could be solved by having a second USPS module for per-zone application, and rather than trying to rename/duplicate an ancient module...
  5. Supertex

    [CONTRIBUTION] Max Orders

    Well..for anyone else that needs something like this, in create_account_success.php add: $max_order_query = tep_db_query("SELECT max_order FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . $_SESSION['customer_id'] ."'"); $max_order_result = tep_db_fetch_array($max_order_query); $max_order = $max_order_result['max_order']; tep_session_register('max_order'); Just below: require(DIR_WS_INCLUDES . 'template_top.php'); And in checkout_shipping.php, add: if (isset($_SESSION['max_order'])) { $max_order = $_SESSION['max_order']; } just above: if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } This fixed it for me...or some part of it did =P
  6. Supertex

    [CONTRIBUTION] Max Orders

    @Johnson Old thread...and pretty simple mod, but I installed this yesterday and today, 2 out of 5 customers so far, have had issues with completing a transaction with far less than the max_value entry in the DB (I currently have it set to 2499.99). One customer's cart was only ~$150, but he was still directed from checkout_shipping to the max_order page. Both were new customers, and had just set up their accounts. But I tested new account functionality immediately after installation, with no issues whatsoever. In addition, other transactions went through just fine. I'm waiting to hear back from the customers on device type, OS, and browser, but I can't understand what might have happened...thoughts?
  7. Supertex

    USPS Rate V4, Intl Rate V2 (official support thread)

    I have $pkg_val as a session variable. Can I use that in the class constructor, or do I have to make that a global somehow? - and thank you for the reply. I love this community!
  8. Supertex

    USPS Rate V4, Intl Rate V2 (official support thread)

    Anyone happen to know where the test for whether the shipping module is enabled occurs, and if I can add a condition in that test that would disable the module if the subtotal is over a certain value?
  9. With PayPal, I think we're missing a step with regard to the store's order status. The store is assigning "new order" status to orders that PayPal has not yet approved. To be clear - this has nothing to do with the osCommerce order status level of "Pending", but rather a PAYPAL status of 'pending.' I see it under order comments, and there are entries for both order completion by the customer, and for arrival of the IPN. In most cases this says "Complete," but in some cases shows up as "Pending" (those that show up as "under review" in the PayPal website's account summary, for example). This is later updated via IPN when the payment actually goes through. This has occurred more and more often as business picks up. Here's a screenshot of exactly what I'm talking about: Note the times - payment submitted (customer didnt return to the store, but IPN handled completing the order) at 17:39 on the 21'st...but Payment Status is "Pending." I read that as payment submitted but not yet approved. My site applies Then the next day, the 22nd at 4:36 am, payment approval notification arrives, and Payment Status now shows "Completed." The problem comes in when you have a list of orders in the admin that all appear to be paid orders per the status the store assigns, but one or more of them are apparently hanging in limbo. Is there something that I've missed, that details a way to apply a different status to such orders?
  10. Supertex

    USPS Rate V4, Intl Rate V2 (official support thread)

    Yep, tried that. I don't think $subtotal exists at this point, and I didn't want to chance screwing something up down the line that might use it so I added this to shopping_cart.php: $pkg_val = $cart->show_total(); tep_session_register ('pkg_val'); and then used $pkg_val in place of $subtotal in the shipping class. Now it works. Thanks Jim :)
  11. Supertex

    USPS Rate V4, Intl Rate V2 (official support thread)

    Problem was between the seat and the keyboard. function cheapest() { global $is_cont48, $shipping_weight... I never added the bold. Now it works. Just have to figure out what to use for the cart value. I thought maybe: (($is_cont48 != 1) && ($shipping_weight < 0.8125) && ($subtotal < 400.00)) but that's not worked so far.
  12. Supertex

    USPS Rate V4, Intl Rate V2 (official support thread)

    I actually used 0.8125 first, and it didn't work. The '.8125' was kind of a hail Mary. Any other ideas?
  13. Supertex

    USPS Rate V4, Intl Rate V2 (official support thread)

    @kymation I wonder if you might have a solution for a couple of things. I'm trying to choose the 'second' USPS quote as default if: 1) international 2) under 13 oz. 3) under $400 My code: $cheapest = false; for ($i=0, $n=sizeof($rates); $i<$n; $i++) { if (is_array($cheapest)) { if ($rates[$i]['cost'] < $cheapest['cost']) { $cheapest = $rates[$i]; } } else { $cheapest = $rates[$i]; } } if($is_cont48 == 1){ $cheapest = $rates[0]; } if(($is_cont48 != 1) && ($shipping_weight < '.8125')){ $cheapest = $rates[1]; //Set default USPS method to "2nd" in array. Add exception for orders with value over $400, or weight over 13oz } return $cheapest; First I added the $is_cont48 test. It works. Then I added the $shipping_weight (which is used elsewhere in the file) but it doesn't work. Regardless of whether the weight is over or under .8125, the test returns true, and I get $rates[1]. Not sure what I'm doing wrong. And what would I use to test cart value? I see $pkgvalue used in the usps module file, but don't I need to make that a global before the class file can use it in a test?
  14. Supertex

    upsxml randomly dropping insurance

    Still having issues with UPS dropping insurance, and this time it's not a customer playing around with navigation...at least not that I can find. I've combed over the UPSXML.log and at least part of this appears to be a hiccup at UPS. I've got log entries for the same customer, 9 seconds apart, that ONLY differ in the negotiated rates price for the various services. Everything else - account info, delivery address, cart value, service options charges, transportation charges, etc., is the exact same. It's just that one quote has insurance added, and one does not. Any thoughts on this?
  15. Apologies...at first I thought this had to do with insurance, but now I'm not so sure. I tried to edit the title but can't, so... I've noticed a few lower than normal UPS quotes lately...one of which was about half what it should be - especially with insurance. So I started digging through the request/response log, located the actual response for the transaction, and I find this: <RatedPackage> <TransportationCharges> <CurrencyCode>USD</CurrencyCode> <MonetaryValue>10.49</MonetaryValue> </TransportationCharges> <ServiceOptionsCharges> <CurrencyCode>USD</CurrencyCode> <MonetaryValue>6.30</MonetaryValue> </ServiceOptionsCharges> <TotalCharges> <CurrencyCode>USD</CurrencyCode> <MonetaryValue>16.79</MonetaryValue> </TotalCharges> <Weight>1.0</Weight> <BillingWeight> <UnitOfMeasurement> <Code>LBS</Code> </UnitOfMeasurement> <Weight>1.0</Weight> </BillingWeight> </RatedPackage> <NegotiatedRates> <NetSummaryCharges> <GrandTotal> <CurrencyCode>USD</CurrencyCode> <MonetaryValue>13.61</MonetaryValue> </GrandTotal> </NetSummaryCharges> </NegotiatedRates> That says this quote "should" be $13.61 (per negotiated rate), and if I go to the site, and enter the customer's address info and weight, I do indeed see $13.61. However, this customer was only charged $7.55. $7.55 Does not show up anywhere in the entire response...I've no idea where it got this figure. I do know that this isn't the only time this has happened. I've caught this same type of thing a few times over the last month or so, and I have ZERO idea what's causing it. Any ideas where to start looking for this, or what it is I'm looking for?
  16. Twice now, my store has had the customer's return from PP and the IPN both land at the exact same time. When this happens, stock is deducted twice. I'm no code whiz, but it -appears- that the catalog/ext/modules/payment/paypal/standard_ipn.php is missing the check that I find in catalog/includes/modules/payment/paypal_standard.php: // Before the stock quantity check is performed in checkout_process.php, detect if the quantity // has already beed deducated in the IPN to avoid a quantity == 0 redirect if ( $this->enabled === true ) { if ( defined('FILENAME_CHECKOUT_PROCESS') && (basename($PHP_SELF) == FILENAME_CHECKOUT_PROCESS) ) { if ( tep_session_is_registered('payment') && ($payment == $this->code) ) { $this->pre_before_check(); } } } I only noticed this because I happened to be watching when a customer purchased a quantity of 4 of one item. We had 7 in stock prior to his purchase. When his order completed, we had "-1". Then again yesterday, I looked at the orders section and found a large order (many line items) in which every line item's stock count was double decremented. I ended up having 4 products with negative quantities. I have the store set NOT to allow checkout while out of stock. And as I already mentioned, this ONLY happens when the customer's return and the IPN land at the exact same time. Also, I feel sure this is in the IPN file, as I have both catalog/includes/modules/payment/paypal_standard.php and catalog/checkout_process.php commented out in order to leave products "active" when stock reaches zero, instead of disabling them completely. I have not yet done this to the IPN file. Since I'm getting negative quantities, it seems the culprit must be the IPN file: //if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) { //tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); //} This has only happened twice so far, that I know of. But if it ever slips one past me, my inventory will be wrecked. I could sure use a hand here - I have no idea how this is happening.
  17. Supertex

    PayPal App v4.039 - double stock decrement

    Perhaps. However, I don't think I've ever gotten emails when an order is submitted...I wouldn't want any more emails than I'm getting already. So either I saw that option very early on, and turned it off, or 2.3.1 doesn't have that option.
  18. Supertex

    PayPal App v4.039 - double stock decrement

    The customer does get 2x the emails. I don't get emails when an order is processed.
  19. Supertex

    PayPal App v4.039 - double stock decrement

    Going to try some things like this: SELECT * FROM `orders_status_history` WHERE `orders_id` IN ( SELECT `orders_id` FROM `orders_status_history` WHERE `customer_notified` =1 AND `orders_status_id`=2 HAVING count (`orders_id`) >1 ) ORDER BY `orders_id` Didn't work as I threw it together...got a #1630 'function db.count' does not exist. I'll work on it more tomorrow.
  20. Supertex

    PayPal App v4.039 - double stock decrement

    @Dan Cole It is coincidence. The site is integrated with Stamps.com, and it auto-updates status once a shipping label has printed, but I don't have it emailing the customer the status update automatically. So in that case, in order for the customer to know the order shipped, a second 'shipped' status was issued with an email notification condition...note the checkmarks. And yes, it's troublesome. I'd seen it early on, but figured the chances of both events occurring that close to each other very often was slim. I was wrong. I've had issues with inventory for some time, and now I see why. Like I said...the nasty part of this issue, is that you'd never know it was happening until you see something odd like a "-1" for an item quantity. Now...the odds of the return and the IPN both landing in the same second, I would have thought was low. The odds of it happening on an order where a quantity of 1 was ordered, and a quantity of only 1 was available...even lower...almost like getting hit by lightning twice. So, that should indicate, at least to some degree, just how frequently this has to be occurring and NOT being noticed. So far, just skimming over the DB tables, I see it occurring once a month, and one of those orders was 27 line items with quantities varying between 4 and 50. This is a very real problem.
  21. Supertex

    PayPal App v4.039 - double stock decrement

    @kymation @burt @Harald Ponce de Leon This thread has gotten a bit off topic, but I'd like to pull back to the subject of the OP, and get the problem back on the table. I'm still seeing events where the customer return from PayPal, and the IPN land at the exact same time, or close enough that BOTH events trigger a stock decrement. Problem is, I only become aware when I see something odd, like a negative stock number, which shouldn't be possible - at least as a result of order completion. This time, once I realized it happened again, I went back through the orders_status_history table, and looked for consecutive duplicate lines. I only went back 6 months, but I found 5 instances where stock was hit for double...and only one of the 5 resulted in a negative number, or I'd never have known. This is wreaking havoc on inventory numbers. How can this be combated? I could see perhaps requesting a delay on the IPN dispatch from PP, but that would only really reduce the potential for this to happen...it's not really a 'fix'. Like I mentioned...you can see this in the orders_status_history, because you get a double entry for "payment completed" for the same order ID/status. If a query can be structured that will compare lines from the table and find any that match with the exception of the order_status_history_id, then a flag can be set and something added to the error/message stack on the admin that would at least provide an alert that it's occurred. For the record, the left and right half of the image are from different orders, but it still creates a clear picture of what's going on.
  22. Supertex

    upsxml randomly dropping insurance

    This seems to have fixed the problem entirely. Thank you Jim...yet again.
  23. Supertex

    PayPal App for osCommerce Online Merchant

    @@Harald Ponce de Leon Lately, I've had two instances of an order being placed, and it shows up at paypal as a paid order, but there's no record of the order in the store. If I look at the PP logs (in the app) I see the '_notify-synch' for the order with "VERIFIED" in the response...shows the cart items...amount, etc. Any idea why the order is getting deleted by the store?? I haven't updated the app because it's been working ok - still at 4.039. Any ideas?
  24. Supertex

    upsxml randomly dropping insurance

    I've added: tep_session_unregister ('shipping'); to the start of shopping_cart.php, and that seems to have fixed the problem, except now I can still add products from the list, instead of the product page, and do the same thing. Is there a way to monitor quantities or product count, and clear 'shipping' if either changes?
  25. Supertex

    upsxml randomly dropping insurance

    @@John W What version are you running? I'm 2.3.1 and even with the fixes @@Harald Ponce de Leon noted, I get the same result: After logging in... 1) Create basket with subtotal under $100. 2) Begin checkout 3) Select "UPS Ground" & continue 4) Choose payment method & continue 5) Click "view cart" or "edit" (in products section of checkout confirmation) 6) Increase quantity to surpass $100 & update 7) Hit browser 'back' button twice & 'confirm resubmission'...refresh page. This lands me back on Order Confirmation page - quantities updated, but shipping remains consistent with previous quantity. In fact... after going through the steps above, I can clear the cart completely, log out, log back in, create an entirely new cart, and then instead of clicking 'checkout', I can modify the url to point to checkout_payment.php, hit enter, and it skips right over checkout shipping, and takes me to payment. I can select payment, and move ahead to checkout confirmation and checkout with the prior cart's shipping price. Seems like I need to have something that clears the shipping variables entirely whenever the "update quantity" button is hit, or anytime a new product is added.
×