Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Error :Check Product Availability at pincode


sahilgulati5

Recommended Posts

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. 

Screenshot_20171025-225122.png

Screenshot_20171025-225000.png

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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.

Link to comment
Share on other sites

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>";
											}
										}

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...