Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Remove country drop down


noahzenzen

Recommended Posts

I need to remove the country drop down from all account pages. I was able to remove them from the main account creation page but it still shows up when you edit your addressbook. I see there a lot of pages that have instances of country oriented code. I don't know if I am supposed to remove all the code (comment it out) or if there is just one or two pages that I can comment out the key elements to make the country drop down option possible.

 

If there is anyone other there that can help me I would greatly appreciate it. If I am not making any sense please let me know, one of my manufacturers won't work with me until I get rid of the country drop downs.

 

Thanks!

Link to comment
Share on other sites

I might want to be more specific as to the pages I am primarily talking about. There are two main pages that come to mind.

 

1. address_book.php

2. address_book_process.php.

 

The address_book_process.php page has the country drop down menu. the address_book.php just has country stated in the top right under "Primary Address".

 

Hopefully this helps specify things a bit more.

Link to comment
Share on other sites

Now this is a question and a half. I would love to know the answer myself. Just today I managed to solve the problem on the create account page, with the help of you fantastic people out there, but while testing I did notice the old pull down menu back in the update address book entry... I've checked out the address_book.php and the address_book_process.php files in both catalog and catalog/includes/languages/english/ but I can't find it anywhere.

 

So any tips on this would be greatly appreciated by both noahzenzen and myself. Oh and by the way Siavash: I don't know about noahzenzen, but for me getting rid of all mention of country in all files is not an option. It still needs to visably printed on the pages, not removed all together. Like I have in the create account at the moment is simply echo's United Kingdom. No fields, no pulldown. A simple echo. So it's still visable but the customers can't do anything with it. This needs to done in the address book update as well, but I don't know how. If it was a simular section in those files it would be easy to do - simply follow the same instructions as with the create account - but there is no simular section.

 

Hopefully someone out there can help us along.

 

Thanks!

RojanUK

Link to comment
Share on other sites

i suggested deleting the country instances ONLY IF you wouldn't want to have country field at all!

 

i have no idea about PHP and db and stuff but lets see:

 

let's find the country dropdown instance. e.g :

 

<td class="main"><?php echo ENTRY_COUNTRY; ?></td>
               <td class="main"><?php echo tep_get_country_list('country') . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>

 

i can imagine defining a tep_customer_country_id and putting it instead of tep_get_country_list in the above code (and of course some other modifications to the code will be required) could solve the problem.

 

i'm pretty new to this php and stuff but if i had time i'd be able to sort it out!

 

keep experimenting and you'll figure out soon.

Did you try? Did you fail? No matter! Try again. Fail again! But fail better!

Link to comment
Share on other sites

I would agree with you if it wasn't for the fact that that piece of coding is not anywhere in the address_book.php or Address_book_process.php... That's why I asked, because otherwise I would've tried commenting it out first to see what happens or even replace it with the same code used for the create_account.php file. But I can't find any reference to replace. That's the problem. I don't know where to attempt any changes to the address_book country listing.

RojanUK

Link to comment
Share on other sites

NOTE: Just experimenting!

 

let's clarify this a bit! do you want to have a text field like name field to be able to enter the country? or do you want to keep the drop down in the account creation page for new customers but wold like to olny show their country (not a field but only country TEXT called in from their registration info) in other section for currect customers?

 

if the latter is the case then i guess (with my limited php) you need to go to all pages that have the country drop down list and change those to perhaps something like this:

 

<?php
 $addresses_query = tep_db_query("select address_book_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' ");
 while ($addresses = tep_db_fetch_array($addresses_query)) {
   $format_id = tep_get_address_format_id($addresses['country_id']);
?>

Did you try? Did you fail? No matter! Try again. Fail again! But fail better!

Link to comment
Share on other sites

I want neither. I want a static echo of 'United Kingdom' behind Country. Now I've got this already setup for the create account, but I can't seem to find where to set it up for the address_book. That one is still set to the original setting of the pull down menu, which I removed from the create account page.

 

And the PHP coding you are refering to can be found on the create account page, but I haven't anything like it in the address book page. That's my problem... :(

RojanUK

Link to comment
Share on other sites

To make things a tad clearer I've taken some screenshots.

 

This is what it looks like in Create Account:

create.jpg

 

And this is what it looks like in Address Book Process:

address.jpg

 

And I would like to achieve the same as I have for create account also on the address book process. And that goes for the switching city and post code places too. I managed it in create account, but can't find it anywhere in address book process.

RojanUK

Link to comment
Share on other sites

i reckon the files you need to look into are:

 

catalog/address_book_process.php

catalog/checkout_shipping_address.php

catalog/checkout_payment_address.php

catalog/includes/modules/checkout_new_address.php

 

and perhaps this one as well:

 

catalog/includes/modules/address_book_details.php

Did you try? Did you fail? No matter! Try again. Fail again! But fail better!

Link to comment
Share on other sites

I finally found it. It's actually in catalog/includes/modules/address_book_details.php (go figure...) Managed to make all the changes I wanted now and they work.

 

Thanks guys.

RojanUK

Link to comment
Share on other sites

I did the same as I did for the create account - my question about that was answered here.

 

I replaced this code in catalog/includes/modules/address_book_details.php:

 ? ? ? ? ? ? <tr>
? ? ? ? ? ? ? <td class="main"><?php echo ENTRY_COUNTRY; ?></td>
? ? ? ? ? ? ? <td class="main"><?php echo tep_get_country_list('country') . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
? ? ? ? ? ? </tr>

 

with this code:

 ? ? ? ? ? ?<tr>
? ? ? ? ? ? ?<td class="main"><?php echo ENTRY_COUNTRY; ?></td>
? ? ? ? ? ? ?<td class="main">United Kingdom</td>
? ? ? ? ? ?</tr

 

Also I've changed around the post code and city fields in the same file like so:

 ? ? ? ? ?<tr>
? ? ? ? ? ?<td class="main"><?php echo ENTRY_CITY; ?></td>
? ? ? ? ? ?<td class="main"><?php echo tep_draw_input_field('city', $entry['entry_city']) . ' ' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>
? ? ? ? ?</tr>
? ? ? ? ?<tr>
? ? ? ? ? ?<td class="main"><?php echo ENTRY_POST_CODE; ?></td>
? ? ? ? ? ?<td class="main"><?php echo tep_draw_input_field('postcode', $entry['entry_postcode']) . ' ' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>
? ? ? ? ?</tr>

 

Also when you do this change, don't forget to switch off the 'required' error, otherwise the fact that you didn't actually choose a country - as it was there already - will cause an error to appear.

 

You do that by commenting out:

 ? ?if (!is_numeric($country)) {
? ? ?$error = true;

? ? ?$messageStack->add('addressbook', ENTRY_COUNTRY_ERROR);

in catalog/address_book_process.php.

 

And Robert is very much your mothers brother... :D

RojanUK

Link to comment
Share on other sites

Thanks for all the comments. I am going to go to the details file and look for that code. For my situation, I think I am just going to comment it out because I don't want any instance of Country in there. One of my manufacturers won't deal with me unless it is gone and I really want to do business with them.

 

Now..... keep in mind that there are two places that had an instance of some type of country. There was the drop down to let the customer edit their choice. Then there was also, for lack of a better term, "display" area stating what their current address is. That is found on the address_book.php page in the upper right section. More specifically in the Primary Address table.

 

Like I said, I will look at the details file, make the changes and see what happens. I can let everyone know what happens. Thanks for all the help and suggestions.

Link to comment
Share on other sites

I just got done making the adjustment and it worked! I commented out those lines and it updated everything.

 

Now there is only one small thing that needs to be adjusted. There is a comma after the "state" being displayed. This is located on the address_book.php page. I am going to look through that code and find out where there is a comma so I can remove it. Just something to clean it up a bit.

 

If anyone has any specifics on where that comma is located so I can delete it I would be greatly appreciative.

 

Thanks again for everyone's help!

Link to comment
Share on other sites

I haven't been able to find where I can remove the comma after the state. I went into a couple of different files including the english.php file. I saw where the state function is defined and required but I didn't see a comma to remove.

 

If someone knows that would be awesome. Not the most important thing in the world but I think it will make the page look more professional.

Link to comment
Share on other sites

Guys, just to give those of you who haven't been following my 'error message' thread in 'general support' I need to tell you that changing the country the way I did it creates a problem. It does NOT send a country_id to the database, automatically setting it to country_id=0, even though there is no such thing. This will create at the very least a problem on the order_confirmation page, not displaying the address but an error instead.

 

Just a warning. I haven't come up with a better solution for the country in these files but keep your eyes on the forum, as it will pop up either here or in the error message thread in General Support.

RojanUK

Link to comment
Share on other sites

Read the post before this. The solution is there.

Almost, but not quite.

 

I've implemented your solution and put everything back to the way it was in the other files and Create Account works fine now, but editing address book is still acting up. Almost there, not quite though...

 

There is another thing as well: even though your solution will work it's not the solution that we were after. The point was to get rid of the pulldown box altogether, but your way still leaves the one country in a pulldown box. But there are people already working on that, including yourself I think, to make that happen. :D

 

As an interim solution I would be happy with a working site, which means that my main priority is solving the editing address book issue. If that doesn't work, this site isn't going anywhere.

RojanUK

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...