Jump to content


  • Content count

  • Joined

  • Last visited

About judebert

  • Birthday 02/29/1968

Profile Information

  • Real Name
  • Location
    Orlando, FL
  • Interests
    Java, Electric Vehicles, parenting
  • Website
  1. Ralph, I actually found this myself last night and edited my post. I don't know where the edit went, though; if it had actually worked, you wouldn't have wasted any more time on this. The problem was a misplaced single quote. (I don't know where it came from; perhaps I was careless while adding all those contributions, but I don't think so. Maybe it was something I did while debugging.) When tep_get_products_stock() builds its SQL query, there's a bit that looks like: ... and language_id='" . $languages[whatever] . "order by products_option_id'" Note the single ending quote at the very end. (I don't have my computer on-hand, or this would be much more accurate. Like last night's edit. :P ) Note also that there's no space before the "order". That built a query like: ... and language_id='englishorder by products_option_id' But I didn't notice for two and a half hours. I added debugging print statements, which consistently told me that "4,8" got sorted properly, but "4,8,9" got sorted in reverse. Throwing in ASC and DESC didn't have any effect at all (of course). Frankly, I'm surprised it returned anything, since that language_id clause shouldn't have matched anything. But it did. When I moved the single quote before the "order" and added a space, everything automagically started working. Amazing: SQL actually performs as expected when you create a syntactically correct query. Incidentally, is there some reason we don't add " and products_option_track_stock=1" to the query, and just eliminate all the non-tracked attributes there? That would allow us to remove the "all_non_tracked" variable, too. I understand -- it's just that recursive stuff can make your (particularly my) head spin. My level of PHP familiarity just compounds the problem. If this was Java, now... It is in stock, it was just being returned as "8-25,4-55" instead of the right way round -- in the shopping cart only, since it was passing all three attributes, while the pad_sequenced_dropdowns only passes the stocked ones. Incidentally, marvelous work with the class hierarchy thing. I've already extended it to include a quantity box (although of course a customer could then enter more stock than I have available), and I'm planning on extending it with pictures and stuff. Easy as pie. :thumbsup:
  2. Yeah, that's not even part of my problem. tep_check_stock() calls tep_get_products_stock(), which does its own tep_get_prid(). It even does the SQL I was trying to figure out. I think I have manged to trace it down, though: the products page calls the function in attribute ID order: (4-25,8-43),(4-25,8-39)... while the cart is calling it in reverse order (8-39,4-25).
  3. Sigh. I'm back at it again. My wife still hasn't gone live with her store, thank Heaven. We seem to find little anomalies every time we try to do something. This time, QTPro (using my slightly-modified pad_sequenced_dropdowns_qty.php) allows us to add an available quantity of product. When I look at it in the shopping cart, however, it's marked out of stock. This particular product has a non-tracked addon; when I comment out the code for the non-tracked option, the shopping cart shows that the product is in stock. (Eri just added it to a stocked product that's been working well for a while.) I tracked down part of the problem: in the pad_*, it's calling tep_check_stock("40", 1, array(25,55)). At the shopping cart, it's calling tep_check_stock("40{8}25{4}55{9}56", 1, array(25,55,56)). I modified the call so it uses tep_get_prid(), changing it to tep_check_stock("40", 1, array(25,55,56)). The problem persists. I've checked the pad_base.php, and it does some wild stuff to retrieve all the stocked-attribute combinations. Can somebody tell me the magic SQL/php incantation to remove the non-stocked attribute(s) from a list of attributes?
  4. judebert

    Official PayPal IPN Support Thread

    Greetings, everyone. I'd like to direct a suggestion to the dev team, and perhaps achieve some enlightenment for myself at the same time. I'm interested in using the PayPal_IPN module... enough to have actually attempted a bit of work on it. Now I'm looking at the design, and it strikes me as incompatible with just about everything else in the system. In particular, the PWA, MVS, and CCGV contributions break rather badly with PayPal_IPN installed. (Gift Certificates can be approved before we ever go to PayPal, for instance.) After looking at the code, and reading the forums, it is reasonable that this is because the PayPal module duplicates portions of checkout_process.php. But why duplicate code? I believe it's because we don't have access to the osCommerce cart or session when PayPal responds to us. This seems reasonable. And when I compared the PayPal_IPN to the Plug-n-Pay SmartScreens module, which performs a verification similar to IPN, I found that Plug-n-Pay echoes the original POST variables, including osCsid. Since PayPal doesn't do this echo, the PayPal_IPN module actually accepts orders into the database *before* they're sent to PayPal. (It only approves them after the IPN returns, though.) So why not pass the session id through PayPal's 'custom' variable? I thought that would allow us get the contents of the cart. (This is the part where I'm looking for enlightenment.) We currently use the custom variable to store the customer id; isn't that in the session, too? Heck, if you can show me how to get the appropriate variables out of the session id, I'll go revise my module and resubmit it. If that won't work, I'd like to suggest encapsulating the code from checkout_process.php into functions. Then the PayPal_IPN module could simply include checkout_process.php and call the appropriate methods; any contribution code would be called as well.
  5. judebert

    Paypay ipn 1.2 ?

    Glad someone else noticed it. I made a few modifications to PayPal_IPN_v1.2 and recontributed them; I also added it to the dev team's version, since it was just their stuff with a few patches added. Now it's mysteriously gone, my user info has lost all mention of my contributions, and I'm afraid I've pissed someone off. I hope it's not the case. I wasn't trying to anger you, OSC gods! I was just trying to give something back to the community! :(
  6. I was having a similar problem with my store; turned out I had merged in a chunk of code from some other version of osCommerce (maybe from CVS?) when I merged the rest of the CCGV stuff. Luckily, I had annotated it, so it was easy to find and replace. My particular offending code looked like this, in checkout_process.php: } else { $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } Mine was located at line 190, but I also have the Quantity Tracker Pro (QTPro) contribution installed, which messes up my line counts. It looks like the stock/CVS checkout_process.php -- included with CCGV -- is trying to say: "if this product is downloadable, skip quantity check; otherwise, use $stock_query to find out how many there are." QTPro is replacing that with a huge query for attribute combinations and such. Anywho. If you installed QTPro, then CCGV, you might have made the same mistake, and your code may include this mishmash of osCommerce and QTPro stock checking. In that case, removing it should allow your customers to use their gift certificate balances without having to enter credit card info. At least, it does for me.
  7. BUG: timeout / infinite loop and missing file I kept getting a timeout when sending gift certificates in my store. I'd exceed the time limit for query completion. Logs showed that create_coupon_code was infinite looping. Additional logging showed that includes/functions/general.php was trying to use the bare string SECURITY_CODE_LENGTH as a number. >_< To fix this bug, open your includes/application_top.php and add this code: //#### Added CCGV bugfix #### define('SECURITY_CODE_LENGTH', 6); //#### Added CCGV bugfix ends #### I added mine right after define('PROJECT_VERSION', 'osCommerce 2.2-MS2'); that's where the admin version adds it, so it only seemed right. Additionally, there's the (miniscule) chance that the coupon code you create will match a code already in the coupon table. A loop already exists to choose a new number if this occurs; however, it always chooses the same number, leading to an infinite loop, and therefore a timeout. :blush: To fix this bug, find this code in admin/includes/functions/general.php and in includes/functions/general.php: $random_start = @rand(0, (128-$length)); $good_result = 0; while ($good_result == 0) { $id1=substr($ccid, $random_start,$length); $query = tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_code = '" . $id1 . "'"); if (tep_db_num_rows($query) == 0) $good_result = 1; } return $id1; and move the $random_start calculation inside the while loop, thusly: $good_result = 0; while ($good_result == 0) { $random_start = @rand(0, (128-$length)); $id1=substr($ccid, $random_start,$length); $query = tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_code = '" . $id1 . "'"); if (tep_db_num_rows($query) == 0) $good_result = 1; } return $id1; All will be right with the world. Next, I'll tackle the Purchase Without Account problems.
  8. judebert

    Multi_Vendor_Shipping new thread

    Incidentally, (chironae in particular, but others might be interested,) I've fixed the sort_order thing in code. Every vendors_shipping module needs to be modified. The easiest way would be to change the calls from constant(x) to @constant(x). But that leaves a '0' in the Sort Order column, which (a) is different from the other osCommerce modules and (B) leaves you without any way to tell which modules are installed and not installed. The better way (in my not-so-humble opinion) is to replace the sort_order functions in each module with something else. Here's what I did in catalog/includes/modules/vendors_shipping/item.php, for example: function sort_order($vendors_id='1') { $sort_order = constant ('MODULE_SHIPPING_ITEM_SORT_ORDER_' . $vendors_id); if (isset ($sort_order)) { $this->sort_order = $sort_order; } else { $this->sort_order = '0'; } return $this->sort_order; } changed to: function sort_order($vendors_id='1') { $sort_order = 'MODULE_SHIPPING_ITEM_SORT_ORDER_' . $vendors_id; if (defined($sort_order)) { $this->sort_order = constant($sort_order); } else { $this->sort_order = '-'; } return $this->sort_order; } See, instead of taking constant() blindly, we set up a variable name (so we don't have to do the concatenation multiple times), then check to see if it's defined. If not, we use a non-numeric sort order, which will result in a blank in the Sort Order column, just like the standard modules. It's not a tough change, from a coding standpoint. You've just got to make sure you hit every module. Jude
  9. judebert

    Multi_Vendor_Shipping new thread

    GOT IT! (w00t) If you can't use USPS with RC5, don't despair! There's just three little typos you need to clear up and it'll all work again. Go to catalog/includes/modules/vendors_shipping and edit usps.php. Find: $status = @constant('MODULE_SHIPPING_USPS_RATES_STATUS_' . $vendors_id); And change the _USPS_RATES_ to _USPS_, like so: $status = @constant('MODULE_SHIPPING_USPS_STATUS_' . $vendors_id); There are two other instances of this typo, just two lines below. For these, you change MODULE_SHIPPING_USPS_RATES_ZONE_ to MODULE_SHIPPING_USPS_ZONE_ instead. I don't think you'll need me to paste those lines in; you're undoubtedly capable of deleting five characters without my hand-holding. :lol: Anyway, it's working again in my test store, and I'm happy. Hurray for echo! (If only there were some logging facility...) :huh:
  10. judebert

    Multi_Vendor_Shipping new thread

    I'm really having trouble. I just installed RC5 on a somewhat-modified shop (USPS Methods had a duplicated method, the only other thing that came close to a conflict was Credit Class/Gift Vouchers). I've been debugging for hours and I can't figure out why my USPS shipping won't show on the checkout page. I've managed the Vendor for "Local Inventory" (vendor_id == 1). I've installed the USPS module. The Sort Order warning went away (as did UPSXML, surprisingly). I copied the same username/password that I use in the standard USPS module. I verified that usps.php is in the vendor_configuration table. I get "This is currently the only shipping method available to use on this order." And it's empty. I added Flat Rate in admin. I get "This is currently the only shipping method available to use on this order." And only Flat Rate is displayed. I removed Flat Rate in admin. I get "This is currently the only shipping method available to use on this order." And it's empty. I disabled Vendor Shipping in admin. My normal shipping modules (Flat Rate, USPS, FedEx Tables) show up as expected. I re-enabled Vendor Shipping in admin. I get "This is currently the only shipping method available to use on this order." And it's empty. Rinse, Later, Repeat. Better yet, I can check out and get free shipping! :x I pulled out some hair and started adding debugging statements. I nearly fell asleep. I've gotta go to bed; I must go to work tomorrow. When I wake up, maybe this will all have been a terrible nightmare... Or maybe you'll have my answer?
  11. judebert

    Multi_Vendor_Shipping new thread

    It's not you. It's your web server. I was just having the exact same problem. I fixed it by turning off display_errors in my php.ini. Apparently PHP will be happy to warn you -- in the HTML -- if this option is on. When I turned it off, all my 'Sort Order' items went straight to 0. B) If I figure out some easy (as in one-line) way to fix this in the code, I'll let you know. Jude
  12. judebert

    OOB OSC 2.2 MS 2 + MVS

    Same problem here. When I install any module, it then reports a sort order. Otherwise I get the big fat error.
  13. judebert

    Fedex Zone Contrib version 2.0 ready

    :blush: OMG. I hate it when I do stupid things. I didn't set it to "Enabled". Please disregard previous post. :-"
  14. judebert

    Fedex Zone Contrib version 2.0 ready

    I just can't get FedEx to show up. I know the docs say sort order is buggy, but I've tried most of the values from 0 to 10 and nothing is working. Sometimes it even screws up my "flat rate shipping" display. On my admin page, I've got: Flat Rate: 1 USPS : 2 Federal Express : 3 On the checkout page, I get: Flat Rate: $5.00 USPS: EXPRESS: $22.05 Priority : $5.75 ...and that's it. I'm running a modified MS2.2; it's got QTPro, the USPS Method, thumbnailing and some other small contributions. I've even tried setting them all to Sort Order = 0. Anybody got some help for me?
  15. judebert

    Help on Paypal IPN module

    Diego, I'm not really an expert at any of this; I'm winging it as I go. I've never even done Payment Pro, so parts of this is just speculation. The comments indicate that those key files should be *.pem; I'd rename them to cert_key.pem and paypal_cert.pem. Put the path to paypal_cert.pem in the PayPal public key; I don't know what the other file is. For this module to work, you'll need to input the location of your public key and the location of your private key. I'd be surprised if you didn't already have to tell PayPal at least your public key. Those two fields are also paths to *.pem files. The code indicates that PayPal's public key, your public key, and your private key are all used as files, while the PayPal certificate ID is used as a value. Perhaps that's what the other file is? If so, you'd expect the contents of cert_key.pem to be a single, short identifier, and you'd put that identifier in the PayPal certificate ID field. If not, it could be the public key that PayPal used to generate the public key it gave you. In that case, it corresponds to your public key, and its path should go in the "Your Public Certificate" field. I don't know what it contains, so my usefulness is running quickly to an end. You'll need all four fields to get this to work. I don't know where everything comes from or how to get them. You can use any writeable and readable directory as your temp directory. Since the encrypted files will be very briefly visible to anyone who can read that directory, I recommend moving it somewhere only your software can read it. The OpenSSL location is the path to the directory containing the OpenSSL files, such as smime. It's a path on your server, not at PayPal. Sorry I couldn't help any more. Jude