Jump to content

Recommended Posts

17 hours ago, raiwa said:

I don't know why it doesn't show the error. Maybe it's because the script is accessed via javascript? But if 'state_name' is not in the array listed, it is not set and doesn't exist.

Meanwhile it's always better to echo variables where they are used:


  require('includes/application_top.php');

  echo '$_POST' . print_r($_POST);
  $country_id = $_POST['country_id'];
  $state_name = $_POST['state_name'];

  $check_query = tep_db_query("select count(*) as total from zones where zone_country_id = '" . (int)$country_id . "'");

 

echo '$_POST' shows $_POST as text (I think you have made a mistake).
echo $_POST shows Array

Eventually, echo $_POST['state_name'] shows the variable selected result (13).

print_r($_POST) shows the array : Array ( [country_id] => 21 [state_name] => 13 )

NB: print_r($_POST) don't need echo to be displayed.

 

Frankly it's a lot of quibbles for not much ...

If I write it this way it looks better for you ? :

echo tep_draw_input_field('state', (isset($state_name) ? $state_name : ''), 'id="inputState" placeholder="' . ENTRY_STATE_TEXT . '"');

 


Osc v2.3.4 BS "custom"

Share this post


Link to post
Share on other sites

I do the text echo to see where it is displayed even there is no variable content, it's just my habit.

I would say correct is to apply the isset check where the ·POST variable is used:

  $state_name = (isset($_POST['state_name']) ? $_POST['state_name'] : '');

$state name is always defined in your code, no need to check it in the menu.

Share this post


Link to post
Share on other sites
Quote

1. For those who has got 2.3.4.1 CE Frozen version and/or fontawesome 5 :

Edit includes/modules/header_tags/ht_country_state_jquery.php file and find this code :

I have no such file.  I am using 2.3.4.1 CE

Downloaded and installed on May 26th.  Do I need to upgrade already?  :ohmy:

I've installed this contribution and I have no dropdown box for the state field at all.  Only the country.

Please advise!

- Andrea

Share this post


Link to post
Share on other sites

Hello Milerwan - great little contribution .... almost solved my requirement out of the box .... but ... works fine in create_account.php but when I try to add a new address to an account ie using address_book_process.php the spinner runs but I get no states pull down, only an empty input box. Not sure where to start looking for the problem but I have installed a mint version of address_book_process.php and address_book_details.php from osCommerce 234 Bootstrap Master. Any ideas?

Thanks

Share this post


Link to post
Share on other sites
On 5/16/2019 at 12:19 PM, kdenby said:

Hello Milerwan - great little contribution .... almost solved my requirement out of the box .... but ... works fine in create_account.php but when I try to add a new address to an account ie using address_book_process.php the spinner runs but I get no states pull down, only an empty input box. Not sure where to start looking for the problem but I have installed a mint version of address_book_process.php and address_book_details.php from osCommerce 234 Bootstrap Master. Any ideas?

Thanks

From "admin -> Modules -> Header Tags -> Country/States Selector", you have to edit the module and tick the missing page(s) to apply the script :
address_book_process.php
checkout_payment_address.php
checkout_shipping_address.php
create_account.php

Edited by milerwan

Osc v2.3.4 BS "custom"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×