Jump to content
stevel

Country-State Selector

Recommended Posts

Well, vendors.php is not a standard osC file so all I can suggest is that you "check your work" carefully against another standard page where I supply the edits. The pre-edited sources can be useful for this.

Share this post


Link to post
Share on other sites

Hi Steve,

 

I have added the Human Confirmation contribution successfully but the top part of it's code clashes with the CSS code in catalog/create_account.php. These were the instructions:

 

REPLACE:

$process = false;

if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {

$process = true;

WITH:

$process = false;

 

// BOF // Contrib: Human confirmation v1.2

 

$thecode_okay = false;

$process_okay = false;

$noautomationcode = $HTTP_SESSION_VARS["noautamationcode"];

 

// -> v1.1 // Changed to work w/ random image names

$img_dir = $HTTP_SESSION_VARS["noautamationdir"];

$img_name = $HTTP_SESSION_VARS["noautamationname"];

// Find and delete old images

if (strlen($img_name) >= 6) {

$dirHandle = dir($img_dir);

while($fileHandle = $dirHandle->read()) {

if (substr($fileHandle,0,strlen($img_name)) == $img_name)

@unlink($img_dir.$fileHandle);

}

$dirHandle->close();

}

// <- v1.1 // Changed to work w/ random image names

 

$thecode_okay = (isset($HTTP_POST_VARS['thecode']) && ($HTTP_POST_VARS['thecode'] == $noautomationcode ));

$process_okay = (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process'));

 

if ( ($process_okay == true) && ($thecode_okay == true) ) {

// EOF // Contrib: Human confirmation v1.2

 

$process = true;

 

 

----------------------------------------------------------------------------------------------------------------

The CSS code has changes the first part already:

 

$process = false;

// +Country-State Selector

$refresh = false;

if (isset($HTTP_POST_VARS['action']) && (($HTTP_POST_VARS['action'] == 'process') || ($HTTP_POST_VARS['action'] == 'refresh'))) {

if ($HTTP_POST_VARS['action'] == 'process') $process = true;

if ($HTTP_POST_VARS['action'] == 'refresh') $refresh = true;

// -Country-State Selector

 

-----------------------------------------------------------------------------------------------------------------

 

For some reason the Human Confirmation contribution seems to work perfectly well without that code, but as it was supposed to be added for some reason in create_account.php I tried to add it.

 

Steve, could you please give some pointers on how to get that piece of code to be compatiable with yours please?

 

Many thanks as always

 

Chooch


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites

That code is setting an additional condition which must be met in order for $process to be true. What I think would work is this. Take the code from the //BOF through the assignment to $thecode_okay and insert it just before the $process=false that starts your excerpt of CSS code.

 

Then change:

 

if ($HTTP_POST_VARS['action'] == 'process') $process = true;

 

to:

 

if (($HTTP_POST_VARS['action'] == 'process') && $thecode_okay) $process = true;

 

I'm a bit uncertain of this - would have to look at the later code. Perhaps if the action would have been process but $thecode_okay is false, set $refresh to true?

Edited by stevel

Share this post


Link to post
Share on other sites

Hi Steve,

 

Many thanks for the reply and the tips.

 

I have tried your suggestion and alongside it various other ways to putting the BOF code in the mix with CSS but haven't had any luck. All I get is a white blank page.

 

Thanks for your help, if you get a brainwave please let me know and I'll try to test it immediately. Or in the unlikely event that I manage to find a fix I'll post it here.

 

Thanks as always - Chooch


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites

If you get a blank page, that means you have a PHP syntax error somewhere. Turn on PHP error reporting or check your CGI error log if you have one.

 

You can turn on error reporting with a php.ini file with:

 

display_errors = true;

Share this post


Link to post
Share on other sites
If you get a blank page, that means you have a PHP syntax error somewhere. Turn on PHP error reporting or check your CGI error log if you have one.

 

You can turn on error reporting with a php.ini file with:

 

display_errors = true;

not sure how to do it but am trying as I type - thanks


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites
not sure how to do it but am trying as I type - thanks

error log shows nothing.

 

Steve, do you think not applying the bof code will be harmful to the site? it does actually work without having to add it in create account in the first place?


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites

The code you posted is what prevents the account creation from being processed if the user did not correctly match the image. I don't know why you decided to add this to your site, but if you want it, you need the extra code.

 

You need to be looking at a CGI error log, a standard HTTP error log won't show it. Normally, PHP errors will show up on the page unless you have display_errors set to false (it might be the default for your host.)

 

Try creating a text file called php.ini with the line:

 

display_errors =true;

 

and upload it to your site's home directory (in ASCII mode). With luck, that will override your host's default and you'll see the error message. There may be a mismatched brace or missing semicolon or...

Share this post


Link to post
Share on other sites

I did look at the error log but even though the create account page shows up blank/white the error log which has my log of pages visited and so on doesn't show an error on that particular page.

 

As for adding the human confirmation code, it's just a precaution to bots.

 

I will try checking the code and re-working it tomorrow and using the php.ini etc (it's 1.15am in London)

 

Thanks for your time Steve :thumbsup:


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites

Thanks for your help Steve... I am going to use a different Validation Code contribution as it doesn't conflict with the CSS code. Cheers


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites

Hello,

 

I got

Error "action" is null or not an object.
Below are the related code. I don't know what's wrong and what to do, please help.

 

Thanks

 

David

 

 

 

 $process = false;
 // +Country-State Selector
 $refresh = false;
 if (isset($HTTP_POST_VARS['action']) && (($HTTP_POST_VARS['action'] == 'process') || ($HTTP_POST_VARS['action'] == 'refresh'))) {
if ($HTTP_POST_VARS['action'] == 'process')  $process = true;
if ($HTTP_POST_VARS['action'] == 'refresh') $refresh = true;
 // -Country-State Selector

...

<html>
<head>
...
<?php require('includes/form_check_js.php'); ?>

</head>
<body>

......

echo tep_draw_form('f_shipto', tep_href_link('sm_shipping.php', '', 'SSL'), 'post', 'onSubmit="return check_form(f_shipto);"') . tep_draw_hidden_field('action', 'process'); 

.....

echo tep_get_sm_country_list('shipto_country',$desti_area,'onChange="return refresh_form();"');

......

Edited by dzhang

David

We support osCommerce

Share this post


Link to post
Share on other sites
On what line of your PHP was this message reported? Showing just some assorted lines is not useful in diagnosing the problem.

 

Thanks Steve.

 

It's in

 

function refresh_form(form_name) {

form_name.action.value = 'refresh';

form_name.submit();

return true;

}

 

the line

 

form_name.action.value = 'refresh';

 

I followed you Debugging Tips, turn on "Display a notification of every script error". in IE, and it said that error. With firefox, it says, "form_name has no properties", and points to the same line.

 

 

David

 

 

 

.


David

We support osCommerce

Share this post


Link to post
Share on other sites

Steve:

 

Your question let me notice the line

 

tep_get_sm_country_list('shipto_country',$desti_area,'onChange="return refresh_form();"')

 

Now, I add the form name in return refresh_form():

 

tep_get_sm_country_list('shipto_country',$desti_area,'onChange="return refresh_form(f_shipto);"')

 

 

It seems to be working now. I see it's refleshing, instead of no refleshing, but error

 

 

David


David

We support osCommerce

Share this post


Link to post
Share on other sites

Yes, it's working now.

 

Thanks, Steve.

 

 

David


David

We support osCommerce

Share this post


Link to post
Share on other sites

Steve, i was wondering if you had any views on what the patch was meant to do in the new update.

 

As the the thread link mentions it is the country and state that gets replaced with the letter 'U' in account history info - the best way around the problem is not to apply this part of the patch but just wnted to ask if you had any views as anyone who applies the patch will see the 'U' in account_history_info.php

 

Post regarding Country/State 'U'

 

Thanks


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites

I remember reading about that at the time but I don't remember what I decided to do about it, can't find evidence in my store that I made the "reset" fix (though I remember looking at that), and don't see evidence of a problem in my store (to which I did apply the 0817 update), so I'm not of much help here.

Share this post


Link to post
Share on other sites
I remember reading about that at the time but I don't remember what I decided to do about it, can't find evidence in my store that I made the "reset" fix (though I remember looking at that), and don't see evidence of a problem in my store (to which I did apply the 0817 update), so I'm not of much help here.

No problem, I just wanted your opinion on [title] part of the update - I like evryone else simply have to not add that part of the patch.

 

Thanks


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites

Having a problem, it was working fine back when i first added it, but now for some reason when they select there country, the state box doesnt change. Ive got the full country and world zones lists, and ive checked and rechecked the code from this contribution, as well as from the others ive added, and i cant find a single confrontation of code, or anything thats been added wrong.

 

Ill proivde anything ya need to help me, links code whatnot, just seems weird its stopped working, and right on the day of the launch of the site.

Share this post


Link to post
Share on other sites

Looking around a bit more while waiting, and found that in admin, the contribution works, when i change the country on the customer edit page, the page refreshes with the new zones. Its just not working on the create_account.php page, and the address book. Ill continue trying to figure it out on my own XD

Share this post


Link to post
Share on other sites

nvm, forget my problem. Im stupid is what i am. Didn't even think to check if STS was giving it problems. I wasnt using the sts function to use the default header info, i was doing my own, that was in turn not letting some things that needed to be at the top in the header to be there. Fixed it now :D

Share this post


Link to post
Share on other sites

The page not refreshing is a symptom of a Javascript problem. The easiest way to diagnose this is to enable Javascript error logging in your browser. In Firefox, just select Tools..Error Console. In MSIE you have to enable reporting of script errors under Internet Options..Advanced.

 

The common issues are:

1. The refresh_form Javascript function is not being included

2. An error earlier on the page prevents the refresh_form function from running

3. An object in the refresh_form function isn't defined

Share this post


Link to post
Share on other sites

first of all i would like to thank you all for the nice discussion and the author 4 the nice coontribution..

i installed the contrib successfully and its working as described smothly for all languages except arabic, when you select arabic the page stops refresh.

any help..

hope you al;l had a warm christ/ new year.

Edited by fabricmall

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

×