Jump to content
stevel

Country-State Selector

Recommended Posts

And where i can find how to do that?

I search in the README file but i can't found how to edit admin/includes/functions/general.php

Share this post


Link to post
Share on other sites

Hey all !

 

I've got an error on my html_output with this mod T_ENCAPSED_STRING :(

 

on this line =>

 

$field .= '>' .tep_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>';

 

from

 

////

// Output a form pull down menu

function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {

$field = '<select name="' . tep_output_string($name) . '"';

 

if (tep_not_null($parameters)) $field .= ' ' . $parameters;

 

$field .= '>';

 

if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);

 

for ($i=0, $n=sizeof($values); $i<$n; $i++) {

$field .= '<option value="' . tep_output_string($values[$i]['id']) . '"';

if ($default == $values[$i]['id']) {

$field .= ' SELECTED';

}

 

$field .= '>' . tep_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>';

}

$field .= '</select>';

 

if ($required == true) $field .= TEXT_FIELD_REQUIRED;

 

return $field;

}

 

I've got FCKeditor installed

 

I really need your help !

Edited by exocom2

Share this post


Link to post
Share on other sites

I'm not sure why you think the error is related to this contribution, but...

 

In the code:

 

'\'' => '''

 

That text at the end is three apostrophes, so you get mismatched quotes.

 

Now it may be that you posted something else, but the forum is displaying it incorrectly. I can't manage to post what SHOULD be there directly, instead of ''' it should be '& #039;' without the space.

 

This code is not part of the Country-State Selector contribution.

 

Are you perhaps using some sort of web-based editor to edit the code? Don't. Edit the source on your local computer, ideally with a PHP-aware editor (I use Dreamweaver), then upload. Otherwise you haven't the faintest clue what is being put on your server.

Edited by stevel

Share this post


Link to post
Share on other sites

um...

 

I used webexpert 6 and when I save the html_output and upload the file I obtain an error :( so that may not be a conflict with your contrib and fckeditor ;)

 

I tried with my notepad and everything works

 

sorry for inconveniences

 

Thx for your reply that help me to find ;) have a nice day ;)

Share this post


Link to post
Share on other sites

If you get a blank page, then you have a PHP syntax error which you need to fix. Look in your PHP error log, if you have one, or re-enable PHP error reporting to see what the error is.

 

I have no idea if this contribution is "compatible" with osc2nuke, but I haven't yet encountered an issue where it was incompatible with a 2.2MS2 or derivative version of osC.

Share this post


Link to post
Share on other sites
If you get a blank page, then you have a PHP syntax error which you need to fix. Look in your PHP error log, if you have one, or re-enable PHP error reporting to see what the error is.

 

I have no idea if this contribution is "compatible" with osc2nuke, but I haven't yet encountered an issue where it was incompatible with a 2.2MS2 or derivative version of osC.

 

Though only so far I've noticed it's only in "modules.php?name=catalog&file=create_account" i get an blank screen.

Share this post


Link to post
Share on other sites

Doesn't matter - you have a PHP syntax error somewhere. You'll have to find it and fix it. The blank screen is the symptom when PHP exits before writing any HTML output. If you have PHP error reporting on, you'll see the error message, but otherwise you won't. If your web server has a CGI error log you can examine, the error may be shown there.

 

Assuming that this osc2nuke is a layer on top of normal osC, you could start by comparing create_account.php with the pre-edited version supplied in the contribution, using a good file difference tool such as BeyondCompare.

Share this post


Link to post
Share on other sites
Doesn't matter - you have a PHP syntax error somewhere. You'll have to find it and fix it. The blank screen is the symptom when PHP exits before writing any HTML output. If you have PHP error reporting on, you'll see the error message, but otherwise you won't. If your web server has a CGI error log you can examine, the error may be shown there.

 

Assuming that this osc2nuke is a layer on top of normal osC, you could start by comparing create_account.php with the pre-edited version supplied in the contribution, using a good file difference tool such as BeyondCompare.

 

Alright i made it work......partially at least, got some problems (as expected). The drop-down/text field is placed at the wrong place, up in the left corner instead being in the form and i just fail to find the html/table tags for the whole form. Also, the page/site doesn't refresh when a country is selected even though i followed the instructions, the refresh code entry should be in another file?

 

Here's a picture of it in action:

 

( Note: I'm still using osc2nuke )

 

statecountrywd0.th.jpg

Share this post


Link to post
Share on other sites

The bad placement indicates a problem with table (or tr/td) tags. When I have a problem like this I add text tags in various places of the page and then view the HTML source of the rendered page to see what came from where. Opening the page source in an HTML editor or even the source view of Firefox can highlight HTML errors.

 

Also look at the rendered HTML to see if the refresh function is present and check for JavaScript errors that would prevent it from being run. (Firefox's error console is what I look at.)

Share this post


Link to post
Share on other sites
The bad placement indicates a problem with table (or tr/td) tags. When I have a problem like this I add text tags in various places of the page and then view the HTML source of the rendered page to see what came from where. Opening the page source in an HTML editor or even the source view of Firefox can highlight HTML errors.

 

Also look at the rendered HTML to see if the refresh function is present and check for JavaScript errors that would prevent it from being run. (Firefox's error console is what I look at.)

 

Hi

 

I am trying to integrate this with FEC and having probs with the FEC create_account2.php file. That file shows 2 address forms side by side. I have got the drop downs populated but when I select from the list, the page doesn't refresh and I get the yellow triangle, bottom left, saying "line 309 char 4 action is null or not an object".

 

I have managed to fix other probs so if someone could point me in the right direction it would be appreciated.

 

Many thanks

 

Ian

Share this post


Link to post
Share on other sites

I love the contribution and have been using it for quite a while, but... I think it (or, more likely, a mistake I made installing it) may have broken the ability for customers to edit their addresses or to add new addresses.

 

When someone clicks edit, add, or delete, they just get a blank screen.

 

It calls this:

 

https://secure.nameservers.com/megostore.co...c43e321218ed87e

 

And just shows a blank web page.

 

Can anyone help?

 

Thanks,

Joe DeRouen

Share this post


Link to post
Share on other sites

Ian,

 

View the web page in a browser and see what is at line 309. Any JavaScript errors will prevent the page from refreshing.

 

Joe, you have introduced a PHP syntax error. Examine your CGI error logs, if the server has them, or turn on PHP error reporting to see what it is.

Share this post


Link to post
Share on other sites
Ian,

 

View the web page in a browser and see what is at line 309. Any JavaScript errors will prevent the page from refreshing.

 

Joe, you have introduced a PHP syntax error. Examine your CGI error logs, if the server has them, or turn on PHP error reporting to see what it is.

Hi Stevel

 

Thanks for the reply. I've redone the coding part and experimented. The form in the FEC contrib is split in half. the left half is for the billing addy and the right is for the shipping addy. This column also has a checkbox to copy the billing info to the shipping info.

 

if I change the country drop down on the billing side first I get the error at 309

 

<script type="text/javascript">

function refresh_form(form_name) {
  form_name.action.value = 'refresh';   //this is 309
  form_name.submit();
  return true;
  }
</script>

 

If I start from name going down all is OK, the states don't refresh by country at this stage, I pick the checkbox to copy the info to the shipping side and ALL the data apart from state is transfered. I get an error here at line 286 state.value is null or not an object

 

function ShipToBillPerson(form) {
if (form.copy.checked) {
InitSaveVariables(form);
form.ShipFirstName.value = form.firstname.value;
form.ShipLastName.value = form.lastname.value;
form.shipcountry.value = form.country.value;
//form.shipcompany.value = form.company.value;
form.ShipAddress.value = form.street_address.value;
form.shipsuburb.value = form.suburb.value;
form.ShipCity.value = form.City.value;
form.shippostcode.value = form.postcode.value;
form.shippingstate.value = form.state.value;  //this is line 286
//form.ShipState.selectedIndex = form.state.selectedIndex;
//form.ShipConfirm.checked = form.BillConfirm.checked;
}
else {

 

Hope this makes sense and is easy to follow.

 

Cheers

 

Ian

Share this post


Link to post
Share on other sites

Ian,

 

Can you give me a URL to look at for myself?

 

Joe,

 

This is typically done by creating a text file called php.ini in your store directory with the following two lines:

error_reporting  =  E_ALL
display_errors = On

 

See http://www.phpfreaks.com/tutorials/72/0.php for more information on php.ini files. When you are done debugging, remove the file.

 

You could also see if your web host provides a "CGI error log" that records such errors. Some do.

Share this post


Link to post
Share on other sites
Ian,

 

Can you give me a URL to look at for myself?

 

Joe,

 

This is typically done by creating a text file called php.ini in your store directory with the following two lines:

error_reporting  =  E_ALL
display_errors = On

 

See http://www.phpfreaks.com/tutorials/72/0.php for more information on php.ini files. When you are done debugging, remove the file.

 

You could also see if your web host provides a "CGI error log" that records such errors. Some do.

 

Stevel

 

here is the url www.icr-records.co.uk Add an item to the cart and pick checkout. The FEC "problem" page kicks in then.

 

Cheers

 

Ian

Share this post


Link to post
Share on other sites
Stevel

 

here is the url www.icr-records.co.uk Add an item to the cart and pick checkout. The FEC "problem" page kicks in then.

 

Cheers

 

Ian

Oops! That should be www.icr-records.co.uk/oscommerce

 

Cheers

 

Ian

:blush:

Share this post


Link to post
Share on other sites

Ian,

 

I see a couple of problems. First, on the left column select tag for country, you have

 

onChange="return refresh_form(createaccount);"

 

However, the name of the form on that page is not createaccount, it is checkout.

 

Second, the field for the shipping country does not include the onChange action. That needs to be added.

 

A third problem, unrelated to this, is that your img tag for the "visual verifier" is malformed, missing the closing bracket.

 

I can't see your PHP code so you need to make sure that it properly establishes the country for both fields on a refresh.

Share this post


Link to post
Share on other sites

Okay, I created the php.ini w/ the lines you said and put it into the store directory, but nothing had changed. address_book_process.php still just comes up with a blank page, and no error messages show up. Am I doing something wrong?

Share this post


Link to post
Share on other sites

I installed this yesterday and thought I had been successful. (Ie. the state selector worked as expected)

 

However, when doing some testing earlier today, I found that the address book function seems to have messed up. Whenever I try to edit an address, or add a new one, I get;

 

Parse error: syntax error, unexpected $end in /home/sweeties/public_html/address_book_process.php on line 427

 

HELP! :blink:

 

Can anybody advise what is causing the problem? (Initially the error was an unexpected } at line 120, which I removed, then this error took it's place)

 

Thanks,

Share this post


Link to post
Share on other sites
Oops! That should be www.icr-records.co.uk/oscommerce

 

Cheers

 

Ian

:blush:

 

Hi Stevel

 

Thanks for looking. I'll have a look tomorrow.

 

Many thanks

 

Ian

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

×