Supertex Posted August 4, 2016 Share Posted August 4, 2016 I find myself needing to come up with a solution for situations like this: Taiwan...no zip, no 'state'. If I set minimum values to nil, then a bizarre amount of US customers will omit their zip, etc, and have issues during checkout. So I need to switch the form based on whether or not the address is US. I plan on moving the country field to the top of the page, but I need to also disable the other fields until the country id is set. I'm capable of of doing most of what needs to be done, but I need to set and post the country variable first. I'm sketchy about how to do that. I don't want to reinvent the wheel, so I'm asking: Has anyone already done something similar, or have any input on the matter? Concerns? And as far as I can tell, it will require changes to 4 files: create_account.php address_book_process.php checkout_shipping_address.php checkout_payment_address.php Thoughts? Tips? osC v2.3.1 MySQL v8.0.32 PHP v5.6.40 Installed addons: . Attribute Sets Plus .. Create Account & Manual Order Maker .. Customer Testimonials 2.3.4 .. Customer Blacklist .. Dynamic Info Pages .. FedEx Web Svcs v9 .. Filtered Sales Report .. Generic Box .. Google XML Sitemap SEO .. Maximum Order Value .. Modular Front Page .. Monthly Sales & Tax Report .. Multiple Products Manager .. Must Accept Terms & Conditions .. Order Editior .. PDF Customer Invoice .. Price in Cart Only .. Product Sort/Order .. Product Sort in Cart .. Quantity Discounts .. Restrict Delivery Methods .. SEO Header Tags - Reloaded .. Separate Pricing Per Customer .. Simpler Admin Session Length Control .. Sitemap SEO .. Show Free Ship + Modules .. Specials by Category for SPPC .. Store Mode (open|closed|maintenance) .. Store Pickup Shipping .. Theme Switcher .. Ultimate SEO URLs 5 Pro .. UPS XML Rates & Svcs 1.4 .. USPS methods 7.3.1 .. Who's Online Dashboard . Fixes: Add to cart -> 'product not found' : FIX Login issues with IE 11 : FIX Tools: Incredibly Handy: osC Xref Link to comment Share on other sites More sharing options...
Jack_mcs Posted August 4, 2016 Share Posted August 4, 2016 There are addons for this. What version of oscommerce are you using? Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Supertex Posted August 4, 2016 Author Share Posted August 4, 2016 Hi Jack, and thanks for getting back with me. I'm using 2.3.1. All the info in my sig is accurate. I did look through the addons section and didnt see anything except for one or two that force a predetermined country to be selected by default. Of course, I'm probably searching the wrong keyword... osC v2.3.1 MySQL v8.0.32 PHP v5.6.40 Installed addons: . Attribute Sets Plus .. Create Account & Manual Order Maker .. Customer Testimonials 2.3.4 .. Customer Blacklist .. Dynamic Info Pages .. FedEx Web Svcs v9 .. Filtered Sales Report .. Generic Box .. Google XML Sitemap SEO .. Maximum Order Value .. Modular Front Page .. Monthly Sales & Tax Report .. Multiple Products Manager .. Must Accept Terms & Conditions .. Order Editior .. PDF Customer Invoice .. Price in Cart Only .. Product Sort/Order .. Product Sort in Cart .. Quantity Discounts .. Restrict Delivery Methods .. SEO Header Tags - Reloaded .. Separate Pricing Per Customer .. Simpler Admin Session Length Control .. Sitemap SEO .. Show Free Ship + Modules .. Specials by Category for SPPC .. Store Mode (open|closed|maintenance) .. Store Pickup Shipping .. Theme Switcher .. Ultimate SEO URLs 5 Pro .. UPS XML Rates & Svcs 1.4 .. USPS methods 7.3.1 .. Who's Online Dashboard . Fixes: Add to cart -> 'product not found' : FIX Login issues with IE 11 : FIX Tools: Incredibly Handy: osC Xref Link to comment Share on other sites More sharing options...
Jack_mcs Posted August 5, 2016 Share Posted August 5, 2016 Any of the country state addons will do it but some editing may be needed. This one is the best of them, in my opinion. But you will probably need to also use the world zones. You will need to make a small change to default to a country, if you want. But I don't think that is needed with one of these since they force the correct entries for the chosen country. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Supertex Posted August 10, 2016 Author Share Posted August 10, 2016 @@Jack_mcs Thanks for the reply. Sounds like I need to condense down what it is that I need. I need to use an 'if-else' (switched on country ID) to change the form itself. As in, I want to retain "required" status on state and zip for domestic shipments, else have it optional for international orders. None of the addons I've tried out have done this - they just set a default country, and populate the state drop-down list. Originally, I thought about just putting a country selection page ahead of any other address entry pages, but that seems messy. Right now, I have THIS addon in place and working. It uses AJAX to query the states list for a given country, but it doesn't actually set or change $country when the user selects or changes their country. In addition, I have reordered the fields so that name, email, password, and country are at the top of the page, and the rest of the address fields are disabled until $country is set. I dont know anything about AJAX, but after looking at it, it seems to have its own subroutine for posting data, so I'm assuming that's what I need to modify in order to get the country variable set before the form is submitted...? Regardless...I need to figure out the best way to set $country prior to form submission. osC v2.3.1 MySQL v8.0.32 PHP v5.6.40 Installed addons: . Attribute Sets Plus .. Create Account & Manual Order Maker .. Customer Testimonials 2.3.4 .. Customer Blacklist .. Dynamic Info Pages .. FedEx Web Svcs v9 .. Filtered Sales Report .. Generic Box .. Google XML Sitemap SEO .. Maximum Order Value .. Modular Front Page .. Monthly Sales & Tax Report .. Multiple Products Manager .. Must Accept Terms & Conditions .. Order Editior .. PDF Customer Invoice .. Price in Cart Only .. Product Sort/Order .. Product Sort in Cart .. Quantity Discounts .. Restrict Delivery Methods .. SEO Header Tags - Reloaded .. Separate Pricing Per Customer .. Simpler Admin Session Length Control .. Sitemap SEO .. Show Free Ship + Modules .. Specials by Category for SPPC .. Store Mode (open|closed|maintenance) .. Store Pickup Shipping .. Theme Switcher .. Ultimate SEO URLs 5 Pro .. UPS XML Rates & Svcs 1.4 .. USPS methods 7.3.1 .. Who's Online Dashboard . Fixes: Add to cart -> 'product not found' : FIX Login issues with IE 11 : FIX Tools: Incredibly Handy: osC Xref Link to comment Share on other sites More sharing options...
Jack_mcs Posted August 10, 2016 Share Posted August 10, 2016 I haven't tried the one you mentioned so I can't say how it is supposed to work. The one I mentioned has a dropdown for the country and the state. Then the country is chosen the state list is changed to match that country. So the customer can't select a wrong pair, like a US state when the country is Canada. For any of the country code, even the stock, the code will look something like this: tep_get_country_list('country') . '' If you change it to tep_get_country_list('country') . '223' if will have the US selected on page load. The code for the countries is in the countries database table. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Supertex Posted August 10, 2016 Author Share Posted August 10, 2016 @@Jack_mcs I'm with you on the state list matching the country selected. That's not my problem. I want to "require" input on the post code field for US addresses, and leave it optional for international addresses. I also want to enable an additional address line (like 'address 2' or something similar) for international addresses only. I plan on doing it by using something like: if ($country) != 223 { -add extra field- }else{ -do not add field- } But I can't do that until the country variable is set, and right now that only happens when the form data is submitted. I can set a default country but the form itself still needs to change if the customer selects a different country. osC v2.3.1 MySQL v8.0.32 PHP v5.6.40 Installed addons: . Attribute Sets Plus .. Create Account & Manual Order Maker .. Customer Testimonials 2.3.4 .. Customer Blacklist .. Dynamic Info Pages .. FedEx Web Svcs v9 .. Filtered Sales Report .. Generic Box .. Google XML Sitemap SEO .. Maximum Order Value .. Modular Front Page .. Monthly Sales & Tax Report .. Multiple Products Manager .. Must Accept Terms & Conditions .. Order Editior .. PDF Customer Invoice .. Price in Cart Only .. Product Sort/Order .. Product Sort in Cart .. Quantity Discounts .. Restrict Delivery Methods .. SEO Header Tags - Reloaded .. Separate Pricing Per Customer .. Simpler Admin Session Length Control .. Sitemap SEO .. Show Free Ship + Modules .. Specials by Category for SPPC .. Store Mode (open|closed|maintenance) .. Store Pickup Shipping .. Theme Switcher .. Ultimate SEO URLs 5 Pro .. UPS XML Rates & Svcs 1.4 .. USPS methods 7.3.1 .. Who's Online Dashboard . Fixes: Add to cart -> 'product not found' : FIX Login issues with IE 11 : FIX Tools: Incredibly Handy: osC Xref Link to comment Share on other sites More sharing options...
Jack_mcs Posted August 10, 2016 Share Posted August 10, 2016 Somewhere before the posts are checked, add $country = '223'; That will preset the country to the US (change as desired) and increase the scope of that variable. When the page gets to your code, it should have the selected country. If the customer then selects another country, the page will refresh and that variable will be changed. You may also need to add code to change the state that is recorded if the ACCOUNT_STATE is set to true; This would be handled better with jquery but that might require changes I can't see if your file has been edited. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.