sahilgulati5 Posted October 25, 2017 Share Posted October 25, 2017 Hi, I am new to oscommerce. How do we rectify this error We supply to pan India and when the customer enters his pincode in check availability at. It should show " the product is available in your zip code". But it's showing " the product is not available at this zip code". Please let me know how to rectify it. Link to comment Share on other sites More sharing options...
♥raiwa Posted October 25, 2017 Share Posted October 25, 2017 You would need to invert the check condition usually by adding "!" before the condition. For example if you have: if (in_array($customer_postcode, $post_code_exclude_array)) change it to: if (!in_array($customer_postcode, $post_code_exclude_array)) Or viceversa, depends if your post code array holds allowed or excluded postcodes. Note: "$customer_postcode" and "$post_code_exclude_array" are only examples, in your code the variable names and coding are different. To give you a precise answer you need to post the PHP code of this modification. It is not included in base OsC stores. About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
sahilgulati5 Posted October 26, 2017 Author Share Posted October 26, 2017 Hi, How do I get the php code? Where should I look for it in file manager Link to comment Share on other sites More sharing options...
♥raiwa Posted October 26, 2017 Share Posted October 26, 2017 product_info.php DO not edit the file directly in file manager if you are not sure what you are doing. Download a copy to your local computer, keep a copy of the original file. Then edit with a plain text editor and make your changes, save and upload and replace the file on your server. Otherwise you can use a a ftp client like file zilla to up and download the files. If you do not find the code or do not know what to do, post your product_info.php file here so we can have a look and give you more precise info. About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
sahilgulati5 Posted October 26, 2017 Author Share Posted October 26, 2017 Hi, Please help me. I have attached the file as requested product_info.php Link to comment Share on other sites More sharing options...
♥raiwa Posted October 26, 2017 Share Posted October 26, 2017 It seems there is a syntax error in your code. find this: if (tep_db_num_rows($qqry) > 0) { $ischeckstr = "This product is available in your zipcode : <b>" . $zipcode . "</b>"; } else $ischeckstr = "This product is not available in your zipcode : <b>" . $zipcode . "</b>"; } and change it to: if (tep_db_num_rows($qqry) > 0) { $ischeckstr = "This product is available in your zipcode : <b>" . $zipcode . "</b>"; } else { $ischeckstr = "This product is not available in your zipcode : <b>" . $zipcode . "</b>"; } If it still shows wrong. Invert the messages. Put the first line in the place of the second line and viceversa. About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
sahilgulati5 Posted October 26, 2017 Author Share Posted October 26, 2017 Hi, I think the error is somewhere in this portion of code <div class="clearfix"></div> <?php $ischeck = 0; $ischeckstr = ""; if ($zipcode != '') { $ischeck = 1; $qqry = tep_db_query("select * from availabletaluk a, indiazip b where b.zipcode='" . $zipcode . "' and b.taluk_id = a.taluk_id"); if (tep_db_num_rows($qqry) > 0) { $ischeckstr = "This product is available in your zipcode : <b>" . $zipcode . "</b>"; } else $ischeckstr = "This product is not available in your zipcode : <b>" . $zipcode . "</b>"; } ?> Link to comment Share on other sites More sharing options...
♥raiwa Posted October 26, 2017 Share Posted October 26, 2017 The code can't work as is. The submitted value of the input field isn't retrieved anywhere in the code. It must be catched via $_GET or $_POST. You should contact the person who coded this or post in the commercial support forum for help to get this work. About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥raiwa Posted October 26, 2017 Share Posted October 26, 2017 here is some resource if you would like to try it yourself: Hacking with PHP: HTML Forms About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
MrPhil Posted October 27, 2017 Share Posted October 27, 2017 Quote It seems there is a syntax error in your code. No, the code was valid. The last } matches up to the preceding "if" statement. The code is sloppy, but legal. Link to comment Share on other sites More sharing options...
♥raiwa Posted October 27, 2017 Share Posted October 27, 2017 1 minute ago, MrPhil said: No, the code was valid. The last } matches up to the preceding "if" statement. The code is sloppy, but legal. Problem is what said in my next message. The submitted values are not catched anywhere. See the entire file. About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
MrPhil Posted October 27, 2017 Share Posted October 27, 2017 My comment was that your fix added a new {, which unbalanced the { } nesting. Logical errors are another matter. Link to comment Share on other sites More sharing options...
♥raiwa Posted October 27, 2017 Share Posted October 27, 2017 1 hour ago, MrPhil said: My comment was that your fix added a new {, which unbalanced the { } nesting. Logical errors are another matter. Oh, sorry I checked and found that I just forgot to copy the last closing bracket. It should be: if ($zipcode != '') { $ischeck = 1; $qqry = tep_db_query("select * from availabletaluk a, indiazip b where b.zipcode='" . $zipcode . "' and b.taluk_id = a.taluk_id"); if (tep_db_num_rows($qqry) > 0) { $ischeckstr = "This product is available in your zipcode : <b>" . $zipcode . "</b>"; } else { $ischeckstr = "This product is not available in your zipcode : <b>" . $zipcode . "</b>"; } } About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
sahilgulati5 Posted November 3, 2017 Author Share Posted November 3, 2017 Hi, Thanks for reply.. Since I am new to coding.. I am not able to solve it. So temporarily I have disabled the feature. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.