Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Strange problem for PHP expert.


greree

Recommended Posts

Posted

This is a strange problem, I know.

 

I edited several files so that "Gender" was optional rather than required. Now the field "Gender" appears, and accepts input if someone chooses "Male" or "Female" , and doesn't require an input if the customer doesn't choose one. Everything works perfectly, except for one thing.

 

If the customer doesn't enter State/Province correctly, or if he enters an email address that already exists, and then clicks the "Continue" button, the pop-up doesn't appear that tells him he made a mistake. Instead, the "My Account Information" page comes up again, with the correct information printed out and unchangable, and with the incorrect information in a "fill in the box" with his mistake beside it in red. It's hard to explain. You'll have to try it yourself. I understand that this is normal operation. This isn't the problem.

 

The problem is if a customer doesn't choose "Male" or "Female" in the "Gender" field, and makes a mistake in one of the fields I described above, and he's taken to the second "My Account Information" page, the "Gender" gets filled in as "Female" automatically. This is the only place it shows up. It isn't in the database in customers_gender, and it isn't in the Admin panel under Customers. It doesn't get saved anywhere. It just appears on this one page. I'd like to know where it's coming from.

 

I looked at the source code for the page that loads in the browser. The letters on the page come from this line: If no gender is selected, I get Female<input type="hidden" name="gender" value=""></td>. If I select Female I get Female<input type="hidden" name="gender" value="f"></td>. If I select Male I get Male<input type="hidden" name="gender" value="m"></td>. This tells me if the value equals m, I get Male, if the value equals f, I get Female, and if the value is nothing I get Female. I can't figure out where to go to change this.

 

I know this will probably never occur in the real world, but it might. Besides, it irritates me because I can't figure it out. Can anyone help?

I'm sorry if it's difficult to understand.

Posted

Progress. In /catalog/includes/modules/account_details.php, line 41, changing FEMALE to MALE in echo ($gender == 'm') ? MALE : FEMALE; changes the "Female" that automatically appears to a "Male" that automatically appears. I don't know what this means, but I know it means something. This is what you have to do if you don't know anything about PHP. Make changes and see what happens.

Posted
($gender == 'm') ? MALE : FEMALE;

 

means:

 

if we have value $gender and it is exactly the same as 'm' print

the defined value MALE. Else print the defined FEMALE.

 

So the problem indeed comes from NOT having the variable $gender at that stage. It automatically will go for FEMALE, because there is no $gender.

 

HTH

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Archived

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

×
×
  • Create New...