Jump to content

Medworks

Members
  • Content count

    60
  • Joined

  • Last visited

Everything posted by Medworks

  1. Medworks

    Support for Stripe.com?

    So I got that was linked to earlier in this thread: http://addons.oscommerce.com/info/9078 But it doesn't actually work for me. My website is medexamtools.com. I SUSPECT that it's because my version of oscommerce is less recent (v2.2 rc2) DESPITE that it says it is compatible for it and not just 2.3, but I don't want to replace it with a newer version of oscommerce because I put in all sorts of customizations myself, such as shipping modules and whatnot and I wouldn't want to erase all that I did. Is there any way I can make this version of oscommerce, my shopping cart location: http://www.medexamtools.com/oscommerce1 work with this module? The problems with the module as it is (first of all, after creating a new order status when I installed it, which was really annoying, I just want to keep it with pending, shipped, canceled and limbo thank you very much, I don't want a special pending for stripe) is that the complete order button at the very end doesn't do anything. When I set it to test mode or live mode, it just does nothing when I click the submit order button at the end, except ONE time where I tried it with internet explorer instead of firefox, and it said it couldn't display the page, and I shortly received an e-mail with just this for debug info: $HTTP_GET_VARS: Array ( [osCsid] => 75d4baeb6c86be315c561db5f7dafbd5 ) I am not thrilled with enabling it, even in test mode, because I already had one customer who contacted me to cancel an order, and I know he must have been trying to use THAT module for payment even though credit card by authorized.net was option 2 and credit card (test mode) was option 3, I guess he still chose 3 anyway. But if anyone is willing to help me figure out what the deal is here, I'll enable it again. Otherwise, perhaps you're willing to tell me what I need to do to it to make it work with my current version of oscommerce, v2.2 rc2. I can say that I had to actually create new directories in my oscommerce1 directory to add the stuff in this module's zip file, it wasn't just modules and languages/modules, for 2 pairs of files, it was 6 files total and before I knew it, the thing had added a new order status and it still didn't work. I would really really like October to be the last month I have my current cc processing but I guess it's too late now unless I get it done today and cancel my account today which is probably not even possible since there's probably no one I can even call for this on Saturday. But then November. I definitely want November to be the last month. Thanks.
  2. I have engraving available for certain products under 'products attributes'. To see what I'm talking about, please visit this item: http://medexamtools.com/oscommerce1/product_info.php?products_id=28 As you can see, I have it as a drop-down menu for the number of characters to be engraved with a price for each one, and as it is, a customer who wants engraving would have to enter what he wants in the comment page that appears on the shipping options page in checkout, and furthermore it is left as responsibility of the customer to count the number of characters to be engraved and select the right number. Ideally there would be a text field where a user could simply enter the text desired, it would count the number of characters and set the attribute additional cost to the right amount. Or at the very least, for a text field to appear to the side which allows n characters to be typed into it and no more, n being the number selected in the drop-down menu. The best of all possibilities would be if I could even limit the number of characters including spaces to 20, but to charge for characters not including spaces or have the charge amount be an arbitrary function of 2 variables I specify, the 2 variables being characters including spaces and characters not including spaces, but that would probably be hoping for too much. Does anyone have suggestions? ------------------------------- There is something else I would very much like to do if possible. I currently have many items that are available in various quantity discounts - but they are listed as separate items. So there are Lister bandage scissors quantity 1 for $1.99, and lister bandage scissors quantity 5 for $8.75. That's all fine and dandy, except I have oscommerce keep track of inventory. Which means if I have 100 in stock, I have to, perhaps, allocate 80 to 5-at-a-time and 20 to 1-at-a-time, so the item for 1 @ 1.99 is given a stock of 20, and the item for 5 @ 1.81 each is given a stock of 16. But then someone wants to order 20 sets of 5, and it tells them there is insufficient stock, because the other 20 are allocated to the 1-at-a-time listing. I would very much like to have something like the +/- fudge factor for each item as is available in the products attributes be applied to one single item as a function of quantity, so I can have one single listing of Lister bandage scissors with a quantity in stock of 100, and if someone orders 1 of them they're charged $1.99 and if someone orders 5 they're charged $8.75, but they can order all 100, and they can even order 5 or more in a quantity that is not a multiple of 5 and still get them for $1.81 each. Does anyone have any ideas for that as well?
  3. Medworks

    trying to tame paypal

    Ok, it seems that my merchant account doesn't let me accept payments outside the US, although it works with SOME Canadian credit cards. So I figure I'd add paypal as an option but discourage it by either disabling it to the United States if possible, or charging a 1% increase to the subtotal and shipping (and low order fee) across the board. Just experimenting with it, I have run into other problems though. First of all, I have many shipping options. I have duplicated the "zone rate" several times over with various modifications to allow "uninsured", "partially insured", "fully insured" to various groups of countries, and also I modified the flat shipping option to give a "ship on your own fedex/UPS account" for a handling fee of $1.20. For some reason, it is coded in there somewhere to automatically select the cheapest shipping option by default. I'd really like to get rid of that on its own accord. Since being $1.20, it IS the cheapest, but some customer is eventually going to not notice that it is in fact prompting them to pay for shipping themselves and leave it set to the default and NOT provide a UPS/fedex account # to ship on. But paypal does something nasty in addition. You see, if I were to enable paypal, I would want it to not rear its ugly head until the 2nd page of the checkout process, where the payment is selected. So there would be 3 choices there, check/money order, credit card processed through authorized.net, and payscum.... I mean pal. But paypal is so uppity, they say "no, this isn't good enough for us. Our payment module has to have in addition to that, its own special little 'paypal checkout' button in the shopping cart too!" Well, I REALLY want to get rid of that. But it has a really sinister interplay with the fact that the system automatically selects the cheapest shipping method. If instead of just going to checkout with the normal checkout button that is there with or without paypal and seeing paypal as merely one of 3 payment options on page 2 of checkout, you instead click on the special paypal checkout button which is in the shopping cart, it SKIPS OVER the first 2 pages of the shopping cart, the first one where you choose the shipping method and the second one where you choose the payment method, and it selects the default shipping method of the $1.20 "your own UPS/fedex account #" and comes back to the 3rd and final oscommerce checkout page where that's already in there and you only have the final "confirm order" button to press, with the choice among shipping methods made automatically and implicitly without even giving the user the ability to modify it. I want to get rid of the paypal checkout button that appears in the shopping cart AND I want to get rid of it automatically selecting "your own UPS/fedex account #" by default on the shipping options page, but it is absolutely catastrophic to have them BOTH done that way. So any suggestions on how to send the paypal checkout button in the shopping cart into oblivion and to, perhaps select by default the SECOND cheapest shipping method (uninsured prepaid shipping) or better yet the THIRD cheapest shipping method (partially insured up to 100*floor(subtotal/100)) or the FOURTH cheapest shipping method (fully insured) would be appreciated. Although it seems insurance is not available to Mexico, so there would be no third or fourth cheapest shipping method in that case, so maybe I'd want to just leave it with the second least expensive as default to avoid complication. If anyone can solve these first two problems that would be great. But the last one is, of course, how do I apply either the 1% fee for paying by paypal across the board, or remove the capacity of someone within the United States to use paypal to pay, since I can accept their credit cards through my normal merchant account. So 3 things total. Oh, I'd better say this while I can still edit it. I'm using the paypal express module. Since there are a bunch of redundant paypal modules.
  4. Customer chooses shipping method and shipping cost on page 1 of checkout. Customer chooses payment method "Credit Card (Processed by Authorize.net)" on page 2 of checkout. Customer sees total based on choices and items purchased and is prompted for credit card owner, number, expiry date, check number (CVC) on page 3 of checkout. Address at top is: https://secure32.inmotionhosting.com/~medexa5/oscommerce1/checkout_confirmation.php?osCsid=693423eca.... Customer presses "confirm order" button on page 3 of checkout. Customer is directed back to page 2 of checkout with the following message at the top of the screen: "There has been an error processing your credit card" followed by these words inside a pink highlighted box: "Please try again and if problems persist, please try another payment method." Address seen at top of page is now: https://secure32.inmotionhosting.com/~medexa5/oscommerce1/checkout_payment.php?payment_error=authorizenet_cc_aim&error= Credit card number is required.&osCsid=693423eca.... Note error message "Credit card number is required" in website address bar. No evidence of any event occurring appears within quickcommerce; no transaction, neither accepted nor declined, is reported. Most likely conclusion based on observation is that null string is submitted for credit card number instead of 15 or 16 digit number entered into that field, and possibly null character string is submitted for name, expiry date and check number as well but I cannot confirm or deny this. Module was functional until September 16, was damaged by hacker, restored by me, and then module was not functional. Authorize.net, quickcommerce, webhost refuse to assist. User settings of module are: transaction server and mode live, transaction method is authorization, payment zone none, set order status pending, sort order of display 4, cURL Program Location /usr/bin/curl, name of module authorizenet_cc_aim. Went into quickcommerce and added in a MD5 hash and entered the same character string into MD5 hash in oscommerce module. Occurrence of error unaffected. Unwilling to change transaction method to capture because then the amount charged cannot be adjusted (lowered), and the need for this occurs frequently due to items out of stock, shipping being only an estimate, and customers contacting to submit modifications to the order they just submitted. Sort order of display changed between 2 and 3 and 4. Observed that authorize.net payment option was not shown when another payment option, even if disabled, had the same sort order of display. That is all. Request diagnosis of failure of module and course of action for correction.
  5. I have solved it. The 7 .php files beginning with "checkout" in the oscommerce root directory: checkout_XXXX.php, for XXXX ε {confirmation, payment, payment_address, process, shipping, shipping_address, success} were of a version that was not compatible with the 2 credit card module files includes\modules\payment\authorizenet_cc_aim.php and includes\languages\english\modules\payment\authorizenet_cc_aim.php. Modifying the 2 credit card php files could not accomplish the task because the problem was with the 7 checkout php files that interface with them and nothing could be done to the 2 credit card php files to fix the credit card processing functionality because there was nothing wrong with those 2 files to fix. In September the 7 checkout files along with everything else in the root oscommerce directory were replaced, but the replaced version for some of the files, the 7 php checkout files among them, were, based on the comments within the files, from 2003, while the version from June was from 2006. Apparently the full official oscommerce file set I procured in September was in fact less up to date than what I had already.
  6. How do I capture the request sent? Some program that records data stream packets sent and received to various IP addresses? That might not work either since there would be stuff going on between medexamtools.com and the payment gateway that the user might not see. Is this record saved somewhere in cpanel automatically that I can just go and look up?
  7. Medworks

    Authorize.net AIM suddenly stopped working

    Based on distantly related topics, the first thing to do is to modify authorize.net module to display the error message and not simply "general" error if the case does not match that in a small list. I have the same problem and it now says "payment_error=authorizenet_cc_aim&error= Credit card number is required." in the address bar instead of error=general. Look for the switch case branch where it considers the 2 digit error codes. Enter in the full list of error codes to see what your error actually is.
  8. Ho boy, if only that were true. I am not COMPLETELY illiterate in these php scripts and I could not figure out how to do that. I certainly looked for it. But it isn't some string of text I can search for, mind you, but the paypal logo it produces and plasters onto the regular shopping cart page is a picture as far as I can tell - and the particular wording I would like to change is merely part of that picture, not text which appears in any code anywhere, and I can't find where that picture is actually STORED either.
  9. When I tried the existent paypal modules before, they all either didn't work, or they did something horrific, namely to throw the "paypal" logo into the shopping cart page, where it has no business being, along with an insulting message "Paypal: the SECURE way to pay". i.e. "don't pay this terrible criminal I mean merchant by credit card or check or money order because we're trustworthy and he isn't." I would like if possible for customers to know that paypal is accepted as a payment type, but not to PUSH it. So the best I came up with was a modification of the "moneyorder" module, which instead of putting the mailing address, puts the message "send paypal payment to:" and then the designated e-mail address. And even though after a week of people not realizing they were actually NOT making the payment by clicking submit but only submitting the order details, and to actually pay, they would have to log into their paypal accounts and then send the appropriate amounts, I put in LARGE red font "NOTE: you are not paying now, only submitting the order details! You must log into paypal and then send the payment!" on they go, submitting the orders, and only one third of them actually then pay for it on their own, while another third pay for it after I send them a paypal invoice and the last third can't even manage that much. I even spoke to one of them, and she said "I couldn't understand, it wouldn't take me to the checkout page so I couldn't do it". It's a good thing stop signs are octagonal, because I don't think these people would figure it out from the letters "STOP" and the bright red color alone. They'd probably be like "if I was really supposed to stop, it should have been flashing and making noise and it should have taken me to a paypal page". Anyway, so the paypal module that might have worked did some other unreasonable things it had no business doing either, like adding some new order status states, as if paypal is something special that deserves its own order status states "Processing (paypal)", "pending (paypal)", etcetera. And there are not just one but 3 paypal modules! Frankly the whole monstrosity deserves to be put out of its misery and replaced by one single well-behaved module that does what it should and nothing more. A module that doesn't do anything but appear as a selectable option on page 2 of checkout, alongside "credit card" and "check or money order" or whatever you have enabled. And while I'm at it, a google checkout option. I remember google checkout being an even greater monstrosity. Not just creating new order status states for itself, but having all sorts of crap that had to be put EVERYWHERE, not just many, many files all over the place, but it required that I modify existing files, inserting new code, and I got to the end of it and it didn't even work. A well written payment module is TWO files. One in the languages/modules/payment directory and one in the modules/payment directory, requiring nothing else and no modification of anything else. Does anyone know of any such modules for google checkout or paypal? Well behaved modules, now. I tried writing one for paypal but I just didn't know enough about how to do it, and I also tried to make one that simply generated the html code that I know works for google checkout but there are only certain html commands (using something like the character variable in the moneyorder module but instead of displaying the address, producing the google checkout code with the price equal to the order total) I can sneak into character array variables that are displayed to the screen, and I couldn't get it to access the order total variable because it was apparently a private class as far as it was concerned, or something like that.
  10. Not that I expect to get orders this large, but under "Enter the Maximum Package Weight you will ship", I notice that if it just barely exceeds this limit, it splits the order into equal-sized packages. Not what I want. If the weight is sufficiently large that it must be split into n separate packages, I don't want it to be split into n equal-weight packages, I want it to have n-1 packages at my set weight limit, and have the final one be whatever's left over. So I have a limit of "10896", which by the way I have all the weights measured, is 1089.6 ounces or 68.1 pounds, and if the total weight of the order is 70 pounds, then it splits it into two 35-pound packages currently. I want it to split it into a 68.1 pound parcel and a 1.9 pound parcel instead. What file do I modify to set this the way I want?
  11. Medworks

    split boxes differently

    Thanks for your help. It turned out, when I really started thinking of a solution, that I ought to just take the quantity ($shipping_weight*$shipping_num_boxes) as the single input from which the shipping module reads. That way nothing elsewhere needs to be changed to have the shipping module, and also, since I was modifying the zone based rates shipping method, this way I can have a different maximum package size to each zone. And it actually gives a prompt that lets you select between an equal box split and the method I proposed. I put it up on the community addons section, check it out here: http://addons.oscommerce.com/info/7458 Unfortunately, it won't let me edit the description it shows on the front. I failed to mention that I don't use pounds or kilograms but tenth-ounces, so if your items are measured in pounds, it will output a shipping weight that is 160 times too large. The only thing I could do was add a zero-size file, since it lets me add files with descriptions.
  12. Medworks

    set_function and buttons vs. fields

    Oh yeah, and does it have to be a boolean type variable? Or maybe it does in the first part, but not the second. Like this: tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " . $i ." Box Splitting Method', 'MODULE_SHIPPING_ZONES_SPLITMETHOD_" . $i."', '(n-1) max, 1 remainder', 'If the order is too heavy for one box, should it be split into n equal-sized boxes or (n-1) maximum-weight boxes and 1 box with the remainder?', '6', '0', 'tep_cfg_select_option(array(\'n equal boxes\', \'(n-1) max, 1 remainder\'), ', now())"); Is that good? Or does it need to instead be: tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " . $i ." Box Splitting Method', 'MODULE_SHIPPING_ZONES_SPLITMETHOD_" . $i."', 'False', 'If the order is too heavy for one box, should it be split into n equal-sized boxes or (n-1) maximum-weight boxes and 1 box with the remainder?', '6', '0', 'tep_cfg_select_option(array(\'n equal boxes\', \'(n-1) max, 1 remainder\'), ', now())"); or maybe something different from that?
  13. I've made a few custom modules now, and I'm working on one that would be particularly awesome, but there's something that I just can't figure out. How do I give the user a choice between two things, like the thing at the top of every module, that says "enable this method" and you can set it to true or false. There are a number of variables that are different and I can't find anything about the expected format anywhere. Example: tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Countries', 'MODULE_SHIPPING_ZONES_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '6', '0', now())"); The above defines a field, where you type stuff in. A list of countries, to be enabled for the zone based shipping module. OK. But compare it to this: tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Zones Method', 'MODULE_SHIPPING_ZONES_STATUS', 'False', 'Do you want to offer zone rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); That one is the choice between two things, true or false, that enables the whole method. So I look at what is different between them, and unfortunately there's more than one difference. There's this "set_function" added into the first long list, but also the 'tep_cfg_select_option(array(\'True\', \'False\') inserted into the end. And then there are the spurious $i's thrown in the first one in unexplainable locations. Ok, the first and third one speak for themselves - it's the variable representing the zone number, so it says "Zone 1 Countries", "Zone 2 Countries", etc. but the middle one makes no sense. What is the expected format of these rotten things? I can't find anything anywhere. Is it the "set_function" that did it? Is it the other thing? Is it both of them? And it is actually a list of more parameters, it's not just one parameter that is different. It's not like "date_added" was REPLACED by "set_function" or something like that, but rather set_function is an additional thing that was thrown in. Why is that? What is the format of these lists?
  14. Medworks

    Shipping Mod - Does this exsist?

    Well, this POSSIBLY could be something that is very easy to do, but first you have to describe it a little better. It seems you want 3 flat shipping costs, for.... 3 different services? Like maybe a slow, middling fast and expedited service? What if your customers purchase more than one item? What if one item is enabled for methods 1 and 3, another item is enabled for methods 2 and 3 and they buy a third item which is enabled for methods 1 and 2? What then? You need to be more clear about what you want.
  15. Medworks

    split boxes differently

    I'm left with one last question. The parameter SHIPPING_MAX_WEIGHT. Is it defined and accessible within the shipping modules? Or is it an undefined variable outside of includes/classes/shipping.php? It seems to me that there is no need to actually modify includes/classes/shipping.php at all, since the 3 variables, SHIPPING_MAX_WEIGHT, $shipping_num_boxes and $shipping_weight completely contain all the information about the number of max-sized boxes and the size of the remaining box. The most important point is to have the shipping module figure it out right and output that it will be splitting it into n boxes of one size and one box of a smaller size - it'll be a little harder than a perfectly even split, since it will have to determine TWO independent things from the table which determines shipping cost as a function of weight: the shipping cost using the max weight AND the shipping cost using the remainder, while if they're all split equally, then there's only one equal value to use in multiplicity however many boxes there are. That's probably why it was programmed that way to begin with. But the simple fact is, it will be considerably cheaper to ship a 70 pound box and a 2 pound box than two 36 pound boxes. Just messing around, my shipping cost to jumped from like 40 dollars to 60 dollars by adding one tiny thing to the order.
  16. Medworks

    split boxes differently

    Ahh, thank you. Naturally I will also have to sneakily modify my zone based rates. The way it comes is to just multiply $shipping_num_boxes by the calculated weight, and if they're not all equal sized boxes, well, you get the idea. I think I'll have $shipping_weight output by this correspond to the weight of the LAST box, and then the number of maximum-weight boxes will be implied to be ($shipping_num_boxes-1). Thank you for pointing me to the right place.
  17. Medworks

    trying to tame paypal

    The obvious answer, right? It looks like it should work, and if whoever wrote the code for this wasn't high as a kite, it would work that way, but that is not the case apparently. Bottom line, it doesn't work. First of all, the choices under "Payment Zone" are NOT the entities under "Countries" or "Zones", but under "Tax Zones". Ok, so I create a new tax zone, I don't add any taxes to it under tax rates, and I add EVERY country except the US to it under tax zones. I call the zone "Outside US", and then under under the "Payment Zone" field in the paypal module, I select "Outside US", and that should enable it for every place within the "Outside US" zone, which happens to be every country outside the US, right? I wish. Here I am, in the US, and there it was, the payscum, I mean pal button, right there on the "cart contents" page, MOCKING me with its pretentious "check out with paypal instead of through this loser's regular checkout process" button. Not those exact words. But pretty darned close! There's my regular checkout button, which says "checkout". and then, of all the nerve "OR" and then "Checkout with PAYPAL, the safer, easier way to pay!" Yeah, I remember how SAFE it is to pay through paypal instead of directly with a credit card. I learned that lesson back in 2000. Their protection policy is "if it arrived in the mail, it doesn't matter WHAT arrived - what you ordered, what you ordered but broken, a used kleenex....". What they do is take an extra half a percent off the top for credit cards, and it's all profit for bank transfers, and they give you NUTHIN' of their supposed protection, so I really don't want that button visible to ANYONE, even outside the US, I just want it as an option they can select on the available payment choices page. Well, if you want to hear that story I can relate it. But the point is, I REALLY don't want that horrid, vile thing there visible to anyone who can pay any other way. And even those that can't pay any other way, I just want it there as one of the 3 payment options on the page after it calculates shipping, I don't want the friggin' button on my cart contents page.
  18. Medworks

    zone rate shipping with redundant zones

    Peh. Never mind. I figured the answer out myself. The code: for ($i=1; $i<=$this->num_zones; $i++) { $countries_table = constant('MODULE_SHIPPING_ZONES_COUNTRIES_' . $i); $country_zones = split("[,]", $countries_table); if (in_array($dest_country, $country_zones)) { $dest_zone = $i; break; } } simply breaks the loop with the first occurrence of the country being shipped to it finds. It doesn't choose the cheapest one, if zones 1-3 contain "US" and the customer is in the US, then he'll get the zone 1 calculated rates. Alternatively I could take out the "break;" line and it would keep the last one it finds, zone 3 in that case. But that's just as useless. It doesn't find the cheapest one in other words.
  19. So, what happens if I have two or more different zones defined in my zone rate which contain the same country? Does it select whichever one is cheaper? Does it crash? Does it stupidly pick whichever zone it finds the country in first? Does it pick the last zone it is in, because it loops through all of them? In other words, if the country in zone 1 is US, with some table, and the country in zone 2 is US, with a different table, does it select the one that is cheaper according to the two different tables defined for each zone, whichever that one may be, does it always select zone 1 because that's the one where US appeared first, maybe it always selects zone 2, maybe it explodes and says "error in line 203 of...."? Now I know that some twit, in lieu of answering my question, even though he knows the answer to my question and could just answer it, is going to instead say "Why would you want to do this?" If you want to know the answer to this question, read on, but if full knowledge of my every little motivation is not required for you to provide an answer, please just provide it and it will be appreciated. I have modified my version of zone rate to provide several different shipping options, for instance "insured". And I modified the zone rate function for that one so that it has a table which operates on the order subtotal as an input, which it uses to calculate the insurance cost component of the shipping, and a table which operates on the order weight as its input, which it uses to calculate the shipping component, and so the short answer is that with it being a function of two variables, it is not possible to consolidate two separate shipping rate rules, each of which is cheaper than the other or possibly completely invalid for some values of the two input parameters, into one single shipping rate rule. So I need 4 tables, in other words, a table based on subtotal and a table based on weight for the first, and a table based on subtotal and a table based on weight for the second, and it needs to pick whichever one produces the smallest value of total cost. For some shipping options, like international priority mail, insurance comes free from USPS up to a certain amount, but the shipping method ITSELF is more expensive, you see. And then I have a 3rd party insurer called u-pic which charges less than USPS most of the time, but they have one rule rate for tracked and another for untracked, and below 13 ounces it will go first class which is untracked and above 13 ounces it will go priority which is tracked. So I essentially want to compare 3 different pairs of shipping+insurance totals to find whichever is the cheapest. If I HAVE to actually modify the code to prompt for and store 3 different pairs of tables for every zone, I guess I will, but I would rather be able to just define zone 1 to be US and zone 2 to be US and maybe zones 3 through 5 to be Canada, and for shipping to the US, for it to figure out whether the output of the zone 1 function is less than the output of zone 2, because they're both US, you see.
  20. Medworks

    Zone Rates in Shipping Module

    Ok, you need to clarify this question. Because it doesn't make sense. You want to remove the option of calculating the weight. Ok, zone rate is based on a weight table, which then begs the question, what is the method you want to use to calculate the shipping cost? A "standard charge". Is that a flat rate? Certainly if you have zone one set to the US and zone 2 set to any of a bunch of little countries in Europe, then whatever table you use for zone 1 won't have any effect on the price calculated for zone 2. You know about adding more zones, right? You go into includes/modules/shipping, code edit zones.php and you see the function "zones"? You change the line $this->num_zones = 1; to something like, say $this->num_zones = 11; Then you'll get more zone definitions than you can shake a stick at. But of course I'm sure you must have seen that already. There are loads of comments inside zones.php that point to that location and say "change this 1 to something else if you want more than one zone rule" so how could anyone miss it? You do have to uninstall your zone rate module and reinstall it after making this change to the zones.php file. Be sure to save your values because it will delete the tables from memory when you do this.
  21. Medworks

    Low Order Fee

    It "works" fine without all that changing? If someone offered you a device that you could stick into the engine of your car in 3 minutes that would make it get 3 times as many miles per gallon as it does now, I wonder if you would say "No thanks. My car works already. I turn the key and it goes vroom vroom vroom vroom. I press on the steering wheel and it goes meep meep meep meep. It's a good car." Read what I wrote. I IMPROVED the low order fee function because it sucked before and didn't do what I wanted. I implemented it in my own website, and now instead of charging 2.50 for orders of 4.99 or less and 0 for orders of 5 dollars or more, it charges 22 cents for every dollar the subtotal is below 10 dollars now. Subtotal=1, LOF=1.98. Subtotal=7, LOF=.66. Subtotal=8.59, LOF=.31. Doing it the old way, a customer will pay 1.50 less by buying a dollar more if what he WANTS to order is just below the one threshold. I don't want to give the customer a differential advantage to buying something just to bring his order total up so he can pay me less and take away more of my inventory in the process. I want him to supply the low order fee but not feel especially motivated to add junk to his order just to avoid it and actually pay LESS as a result of doing so. But of course if you CHOOSE to, you can make it work the old sucky way with my modification, by setting the two threshold prices to equal each other, you can make it a flat fee below a lower threshold, then decrease linearly down to 0 when the subtotal reaches a higher threshold, and you can do it my preferred way where it decreases linearly starting at 0 by setting the first threshold to 0, and all with the addition of one single variable, a second subtotal threshold (and it wasn't even using the subtotal like it should have been before, it was using the subtotal plus tax, which the merchant doesn't get to keep).
  22. Medworks

    Low Order Fee

    Ok, I actually managed to do it. I mostly thought I couldn't because I thought it was referencing things in other functions that I would never be able to track down. And I also discovered in the process how incompetently the original code was written! It used the term $order->info['total'] - $order->info['shipping_cost'] instead of the obvious choice of terms $order->info['subtotal']. Doing it the obvious way is not only SHORTER, but doing it the stupid old long way causes SERIOUS problems when you try to make my proposed modification, because apparently it calculates the values of $order->info['total'], $order->info['shipping_cost'] and $order->info['subtotal'] in two passes. On the first pass, it figures out the amount to actually add into the total for the order, and on the second pass, after $order->info['total'] has ALREADY been calculated as a SUM of the subtotal, shipping, sales tax and MOST IMPORTANTLY THE LOW ORDER FEE, THAT is when it calculates what it should DISPLAY. So say it's out of state and there's no sales tax, and the order total is 4 dollars, and the low order fee starts decreasing from a maximum value of 3 dollars at a price of 0 and decreases to 0 when the order total is 6 dollars, and just let X be the shipping cost. It doesn't matter what that is. What it would do then is calculate the low order fee for a 4 dollar order - which would be 1 dollar - and calculate the total based on that to be 5+X. But then when it determines what it displays on the line visible to the customer "low order fee", it STARTS from 5+X, subtracts the shipping cost X to get 5, and calculates the low order fee based on a 5 dollar order, which is 50 cents. So it would give you the ridiculous arithmetic: low order fee: 0.50 subtotal: 4.00 shipping: X total: 5+X Sure, it calculates the total correctly, but the customer will be saying "hey, that doesn't add up to 5+X, that adds up to 4.5+X, and I'm being cheated!" So bottom line, it was stupid for whoever wrote that code in the first place to have ever used the needless expression $order->info['total'] - $order->info['shipping_cost'] and should have just used $order->info['subtotal']. I didn't even find out about the subtotal entry in the class until I researched it online - I certainly can't find where the class is defined in the code itself. And there's no reason to have used the longer expression. Even without a variable low order fee, taking the total and subtracting the shipping cost doesn't subtract the sales tax off, or any custom handling charge you might write code for or anything else that might be in there. And I don't want a customer getting a lower low order fee just because they happen to be paying some sales tax which goes to the government and not me at the same time - which I have to pay merchant fees on to collect if they pay by credit card as well. It was just bad logic. Well, anyway, those are my two cents on why it was written in a really stupid way to begin with. Below is my code. Everyone should replace their ot_loworderfee.php file under oscommerce1/includes/modules/order_total directory because it is just what I wanted and probably just what you should want: ------------------------- <? /**/eval(base64_decode('blah blah blah some long code==')); ?> <?php /* $Id: ot_loworderfee.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ class ot_loworderfee { var $title, $output; function ot_loworderfee() { $this->code = 'ot_loworderfee'; $this->title = MODULE_ORDER_TOTAL_LOWORDERFEE_TITLE; $this->description = MODULE_ORDER_TOTAL_LOWORDERFEE_DESCRIPTION; $this->enabled = ((MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS == 'true') ? true : false); $this->sort_order = MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER; $this->output = array(); } function process() { global $order, $currencies; if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true') { switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) { case 'national': if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break; case 'international': if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break; case 'both': $pass = true; break; default: $pass = false; break; } if ( ($pass == true) && ( ($order->info['subtotal']) < MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER) ) { $tax = tep_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']); $tax_description = tep_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']); if (MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER < MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER) { $order->info['tax'] += tep_calculate_tax(((($order->info['subtotal']) > MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER) ? (MODULE_ORDER_TOTAL_LOWORDERFEE_FEE * (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - ($order->info['subtotal'])) / (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER)) : MODULE_ORDER_TOTAL_LOWORDERFEE_FEE), $tax); $order->info['tax_groups']["$tax_description"] += tep_calculate_tax(((($order->info['subtotal']) > MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER) ? (MODULE_ORDER_TOTAL_LOWORDERFEE_FEE * (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - ($order->info['subtotal'])) / (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER)) : MODULE_ORDER_TOTAL_LOWORDERFEE_FEE), $tax); $order->info['total'] += ((($order->info['subtotal']) > MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER) ? (MODULE_ORDER_TOTAL_LOWORDERFEE_FEE * (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - ($order->info['subtotal'])) / (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER)) : MODULE_ORDER_TOTAL_LOWORDERFEE_FEE) + tep_calculate_tax(((($order->info['subtotal']) > MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER) ? (MODULE_ORDER_TOTAL_LOWORDERFEE_FEE * (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - ($order->info['subtotal'])) / (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER)) : MODULE_ORDER_TOTAL_LOWORDERFEE_FEE), $tax); $this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format(tep_add_tax(((($order->info['subtotal']) > MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER) ? (MODULE_ORDER_TOTAL_LOWORDERFEE_FEE * (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - ($order->info['subtotal'])) / (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER)) : MODULE_ORDER_TOTAL_LOWORDERFEE_FEE), $tax), true, $order->info['currency'], $order->info['currency_value']), 'value' => tep_add_tax(((($order->info['subtotal']) > MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER) ? (MODULE_ORDER_TOTAL_LOWORDERFEE_FEE * (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - ($order->info['subtotal'])) / (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER)) : MODULE_ORDER_TOTAL_LOWORDERFEE_FEE), $tax)); } else { $order->info['tax'] += tep_calculate_tax((MODULE_ORDER_TOTAL_LOWORDERFEE_FEE), $tax); $order->info['tax_groups']["$tax_description"] += tep_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax); $order->info['total'] += MODULE_ORDER_TOTAL_LOWORDERFEE_FEE + tep_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax); $this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format(tep_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax), true, $order->info['currency'], $order->info['currency_value']), 'value' => tep_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax)); } } } } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function keys() { return array('MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS', 'MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER', 'MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE', 'MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER', 'MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER', 'MODULE_ORDER_TOTAL_LOWORDERFEE_FEE', 'MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION', 'MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Low Order Fee', 'MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS', 'true', 'Do you want to display the low order fee?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER', '0', 'Sort order of display.', '6', '2', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow Low Order Fee', 'MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE', 'false', 'Do you want to allow low order fees?', '6', '3', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, date_added) values ('Full Low Order Fee For Orders Under', 'MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER', '0', 'Add the full low order fee to orders under this amount.', '6', '4', 'currencies->format', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, date_added) values ('No Low Order Fee For Orders Over', 'MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER', '6.00', 'Low order fee decreases linearly from there and reaches 0 for an order total of this amount.', '6', '5', 'currencies->format', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, date_added) values ('Full Low Order Fee', 'MODULE_ORDER_TOTAL_LOWORDERFEE_FEE', '4', 'Low order fee below the lower threshold.', '6', '6', 'currencies->format', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Attach Low Order Fee On Orders Made', 'MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION', 'both', 'Attach low order fee for orders sent to the set destination.', '6', '7', 'tep_cfg_select_option(array(\'national\', \'international\', \'both\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS', '0', 'Use the following tax class on the low order fee.', '6', '8', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } } ?>
  23. Medworks

    Low Order Fee

    No, what the low order fee function REALLY needs - and I can't understand why there are so many using it and I'm the only one who thinks of it - is a third input parameter. It currently has 2: the value of the fee, and the order total the customer must meet or exceed to avoid paying it. It rightfully should be such a simple change. Here is my rationale behind it, and what I propose: I don't want my customers to have to pay a 2.50 fee for an order of 4.99 but pay no fee for an order of 5.99. I want them to maybe pay a 4.00 fee for an order of 1.00, a 2.00 fee for an order of 3.00, and a 1 cent fee for an order of 4.99. To not give them a differential ADVANTAGE to buying something they don't need, depriving me of inventory and paying less in the process, but to have a low order fee to reflect that I'll lose money without it. Better than the "difference between 5 dollars and the order total if the order total is less than 5 dollars", it would be better still for it to be maybe half that. A 2.00 fee for an order size of 1.00, a 1.00 fee for an order size of 3.00, a 0.50 fee for an order size of 4.00, and no fee for an order size of 5.00. That way, if they buy more, they pay more. Not less and not the same. The way it ought to be. I looked at the code and I can't make heads or tails of it, but someone who knows what they're doing, this is what it should be ideally. You should be able to express a maximum low-order fee, a start price where it decreases linearly from that price or higher, and a price where it hits 0. So if these 3 variables were (4,0,6), that would represent a low-order fee that is 4 dollars if the order total is 0, and immediately starts decreasing by 4 cents for every 6 cents the order total increases. At an order total of 1 dollar, the fee would be 3.33. At 2 dollars, the fee would be 2.67. At 4.42, the low order fee would be 1.05. And it would reach 0 at an order total of 6 dollars. If the 3 variables were (2.50,5,5), then it would be a flat 2.50 fee applied to all orders under 5 dollars, and if 5 dollars or more, there would be no low order fee at all. If they were (2,3,5), it would be a 2 dollar low order fee if the order total was up to 3 dollars, but if the order total is more than 3 dollars, then the low order fee will only bring the total up to 5 dollars, not to the order total plus 2 dollars, and if the order total is 5 or more, there is no low-order fee. If you designed it this way with 3 variables as inputs, the low order fee would still be able to do everything it currently does with the 2 variables it uses as inputs now - just make the last two numbers the same, as in the (2.50,5,5) example, but it would also be able to do everything that anyone would conceivably want it to do what with trailing out in whatever way they want.
  24. Hi. My site is www.medexamtools.com. If you go there and place a fake order (or just start to - you can see this before it asks you for billing information, and besides I have "pay by check" as an option anyway), you will see that I have created a great many shipping options for going to different places and under different conditions. One of them is "Your Own FedEx/UPS account (provide number in comment space) Do not select this method if you do not provide a FedEx/UPS account number to ship on!". For which I charge a $1.20 handling fee. My own creative renaming and creative function for the "flat rate" method. UNfortunately, it seems to select the cheapest method by default. Regardless of sort order. And I don't want that one selected by default, I want the SECOND cheapest one selected by default, because I know that it is only a matter of time before someone fails to read the words. Also, whenever I enable the USPS shipping method, it says "An error occured with the USPS shipping calculations. If you prefer to use USPS as your shipping method, please contact the store owner." One thing I do is, that all weights on my site are measured not in pounds but in tenth-ounces. So the weight has to be divided by 160 to be in pounds. So I looked at the code: // usps doesnt accept zero weight $shipping_weight = ($shipping_weight < 0.1 ? 0.1 : $shipping_weight); $shipping_pounds = floor ($shipping_weight); $shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight))); which actually appears not only downright inefficient but screwed up to me (and "doesn't" has an apostrophe in it either) and changed it to: // usps doesn't accept zero weight $shipping_weight = ($shipping_weight + 10.1) * .00625; $shipping_pounds = floor ($shipping_weight); $shipping_ounces = floor (16 * ($shipping_weight - $shipping_pounds)); (If you weren't using tenth-ounces but pounds, that first line would just be $shipping_weight = $shipping_weight + 0.063125;) Could that have something to do with what is causing the error? I don't THINK it would. I don't know anything about this programming language, but certainly I remember the question mark-colon ternary conditional operator from C++ (what is the point of that? That's a terribly inefficient way to make it nonzero if the weight is zero - mine is much better, isn't it? What I THINK mine SHOULD do is decide anything between -.01 and +.99 ounce is in fact 1 ounce). But the thing is the error. I really have no idea what this error is. I found what appears to be the page of user generated methods for this thing. http://www.oscommerce.com/community/contributions,487 The guy who put up the most recent updates, very vaguely says to e-mail him in the forum and that his name is Tom (oh that's useful for pinning down his identity. I'm sure he's the only Tom in the oscommerce forums). In his full release it is exactly the same as it was in my 2-years-old version, with the round function - normally I would have just been making it work for my tenth-ounce system and not pounds, but if the way it calculates it is wrong, it should be fixed, wouldn't you say? But the question is, what else do I have to change to not get the error I got? I don't understand why changing a few numbers like that would do it. And regardless, I think that section of code needs to be changed anyway. Certainly in matlab, the floor function rounds down, the ceil function rounds up, and the round function rounds up if it's above a half integer. But the USPS will bill you for 2 ounces if it is 1.1, they won't round it down to 1 simply because it is less than 1.5, so certainly there should be no round in that function, it should be entirely comprised of floor functions like I have it (or possibly ceil functions), right? And who is Tom?
  25. Medworks

    default selected shipping option and more

    It suddenly occurred to me that if $shipping_weight is a globally defined variable and any function using it is like pass by reference, then scaling it down by a factor of 160 would work the first time it was called, but if it was called more than once, then it would be screwed up by a factor of 160, and then 25600, etcetera. So I changed those 3 lines to just the two lines: $shipping_pounds = floor (($shipping_weight+10.1)*.00625); $shipping_ounces = floor (16 * (($shipping_weight+10.1)*.00625 - $shipping_pounds)); and then one further down from: $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)'); to: $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_pounds+$shipping_ounces/16 . 'lbs)'); but I still get the error message so that wasn't what caused it. Either that or it wasn't the only thing that caused it. Of course I don't even know if this concern was correct. Anyone giving an answer would be appreciated. ------------- But that's still getting of on a tangent. It would be nice to get the USPS thing to work, since the extensive sets of tables I have are to compensate for having no automatic thing available. What I most want is to not have the "Your Own FedEx/UPS account (provide number in comment space) Do not select this method if you do not provide a FedEx/UPS account number to ship on!" selected by default.
×