Forums / Templates, Stylesheets, Page Layout / Where is the page that controls country drop down

Where is the page that controls country drop down

Locked

Views: 4,102

Results 1 to 20 of 22
This thread is locked. New replies are disabled.
15 Oct 2007, 10:37 AM
#1
multichild avatar

multichild

Zen Follower

Join Date:
Sep 2007
Location:
Chepstow, SE Wales
Posts:
101
Plugin Contributions:
0

Where is the page that controls country drop down

I am looking to customise the country drop down list in the 'Change Shipping Address' page, can anybody point me to it.

I dont need all those countries for the time being, so will try and change it so I only draw out certain ones.

We'll see when i get there I suppose.

Cheers

Lee

Are we there yet?

Just one more line of code and im done...

15 Oct 2007, 10:44 AM
#2
section1 avatar

section1

New Zenner

Join Date:
Oct 2007
Posts:
99
Plugin Contributions:
0

Re: Where is the page that controls country drop down

look in locations/taxes then countries there you can edit or add

15 Oct 2007, 10:47 AM
#3
multichild avatar

multichild

Zen Follower

Join Date:
Sep 2007
Location:
Chepstow, SE Wales
Posts:
101
Plugin Contributions:
0

Re: Where is the page that controls country drop down

Hi section1, that will be a generic action wouldnt it.

What I need is to only restrict the countries on the 'Change Shipping Address' page, the other country drop down lists need to output the full country list.

So I thought the best course of action would be too just modify that one drop down, and thats why I was looking for that page in the folders.

Cheers

Are we there yet?

Just one more line of code and im done...

15 Oct 2007, 10:54 AM
#4
section1 avatar

section1

New Zenner

Join Date:
Oct 2007
Posts:
99
Plugin Contributions:
0

Re: Where is the page that controls country drop down

Sorry I couldn't be much help as I'm learning myself

16 Oct 2007, 9:47 AM
#5
multichild avatar

multichild

Zen Follower

Join Date:
Sep 2007
Location:
Chepstow, SE Wales
Posts:
101
Plugin Contributions:
0

Re: Where is the page that controls country drop down

Hi,

I have found another page which when changed does impact on the page im working on, and its this:

includes\classes\order.php

It seems to be controlling what I want changed, but Ive been playing and dont seem to be able to figure it out.

As before, I dont want the full list of countries in the drop down on the 'Change Shipping Address' page, but instead only want UK, Spain, Portugal, Mexico, Dominican Republic, Turkey, Egypt, Tunisia, Morocco, Saudi Arabia, Germany, Canada and Gibraltar.

This is driving me crazy, as Im not sure Im even looking in the right place to customise the function that is outputting the countries to that drop down

Can anybody help me

Lee

Are we there yet?

Just one more line of code and im done...

16 Oct 2007, 12:41 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Where is the page that controls country drop down

That's built by this function: zen_get_country_list(), via this part of the tpl_modules_checkout_new_address.php template file:```
<label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>

<?php echo zen_get_country_list('zone_country_id', $selected_country, 'id="country" ' . ($flag_show_pulldown_states == true ? 'onchange="update_zone(this.form);"' : '')) . (zen_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="alert">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?>

It pulls all the countries from the database. If you want to do something else with it, you'll have to write your own new function or new code to create your own pulldown list.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Oct 2007, 12:50 PM
#7
multichild avatar

multichild

Zen Follower

Join Date:
Sep 2007
Location:
Chepstow, SE Wales
Posts:
101
Plugin Contributions:
0

Re: Where is the page that controls country drop down

Wicked thanks DR.

Thats the easy bit i suppose, now im going to try and restrict what it pulls out.

:huh:

Cheers

Lee

Are we there yet?

Just one more line of code and im done...

16 Oct 2007, 12:53 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Where is the page that controls country drop down

Remember, that same function is used for creating new accounts as well.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Oct 2007, 12:55 PM
#9
multichild avatar

multichild

Zen Follower

Join Date:
Sep 2007
Location:
Chepstow, SE Wales
Posts:
101
Plugin Contributions:
0

Re: Where is the page that controls country drop down

Oh damn!

Umm, although I want to restrict the shipping address. I dont want to actually restrict the billing address.

So a new customer coming in will not be able to register without being restricted country wise, is that right?

Lee

Are we there yet?

Just one more line of code and im done...

16 Oct 2007, 1:01 PM
#10
multichild avatar

multichild

Zen Follower

Join Date:
Sep 2007
Location:
Chepstow, SE Wales
Posts:
101
Plugin Contributions:
0

Re: Where is the page that controls country drop down

Hi,

I just opened up a new dummy account, and it seems fine, up until I try to change the billing address, and thats where it pull sout the same function.

mmmm :cry:

Are we there yet?

Just one more line of code and im done...

16 Oct 2007, 1:11 PM
#11
multichild avatar

multichild

Zen Follower

Join Date:
Sep 2007
Location:
Chepstow, SE Wales
Posts:
101
Plugin Contributions:
0

Re: Where is the page that controls country drop down

Just noticed a possible work around though.

The value of the variable '?main_page' changes from checkout_shipping_address to checkout_payment_address, so could try and make an if statement looking at this.

What you think?

Are we there yet?

Just one more line of code and im done...

16 Oct 2007, 1:27 PM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Where is the page that controls country drop down

Yes, you'll have to customize the function based on something relevant to your needs.
If it's page-specific, you can global the $current_page_base variable and use that, or you could write a different function to produce the desired list, and call that function conditional on your criteria.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Oct 2007, 1:28 PM
#13
multichild avatar

multichild

Zen Follower

Join Date:
Sep 2007
Location:
Chepstow, SE Wales
Posts:
101
Plugin Contributions:
0

Re: Where is the page that controls country drop down

Ok the if statement is working, as its not creating an y errors

<?php if ($main_page == checkout_shipping_address) { ?>
<label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>
<?php echo zen_get_country_list('zone_country_id', $selected_country, 'id="country" ' . ($flag_show_pulldown_states == true ? 'onchange="update_zone(this.form);"' : '')) . (zen_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="alert">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?>
<?php
}
?>

The if statement doesnt seem to recognise $main_page though, so if I can remember, do I reference the variable like this for example in the page:

$main_page = ;

Are we there yet?

Just one more line of code and im done...

16 Oct 2007, 1:34 PM
#14
multichild avatar

multichild

Zen Follower

Join Date:
Sep 2007
Location:
Chepstow, SE Wales
Posts:
101
Plugin Contributions:
0

Re: Where is the page that controls country drop down

Sorry to keep posting, but im getting excited now.

I put this at the top of that page, and it worked, so all i got to try and get it to do now, is to read that variable '$main_page', without having to push the value in like below:

$main_page="checkout_shipping_address";

Lee

Are we there yet?

Just one more line of code and im done...

16 Oct 2007, 1:52 PM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Where is the page that controls country drop down

You missed my previous post ...

$current_page_base is the variable that tells you what main_page=xxxxx is set to

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Oct 2007, 2:46 PM
#16
multichild avatar

multichild

Zen Follower

Join Date:
Sep 2007
Location:
Chepstow, SE Wales
Posts:
101
Plugin Contributions:
0

Re: Where is the page that controls country drop down

Thanks DrByte, thats it...

Got that working fine now, so now to only pulling out those specific countries.

Thanks for everything.

Lee

Are we there yet?

Just one more line of code and im done...

16 Oct 2007, 3:20 PM
#17
multichild avatar

multichild

Zen Follower

Join Date:
Sep 2007
Location:
Chepstow, SE Wales
Posts:
101
Plugin Contributions:
0

Re: Where is the page that controls country drop down

Hi again,

zen_get_country_list is whats pulling out the full list I see, everything inside of that is working with the list.

Where can I fins where its calling that from, so I can trace back or re-engineer to try and achieve what I need.

Thanks

Are we there yet?

Just one more line of code and im done...

16 Oct 2007, 3:23 PM
#18
multichild avatar

multichild

Zen Follower

Join Date:
Sep 2007
Location:
Chepstow, SE Wales
Posts:
101
Plugin Contributions:
0

Re: Where is the page that controls country drop down

ok think i found it here in html_output.php:

function zen_get_country_list($name, $selected = '', $parameters = '') {
    $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
    $countries = zen_get_countries();

    for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
      $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
    }

    return zen_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
  }

I need to create another one of these calling it something else, and try and get it to do what i need.

I love all this, its bloody great.

Are we there yet?

Just one more line of code and im done...

16 Oct 2007, 4:00 PM
#19
multichild avatar

multichild

Zen Follower

Join Date:
Sep 2007
Location:
Chepstow, SE Wales
Posts:
101
Plugin Contributions:
0

Re: Where is the page that controls country drop down

I really enjoyed today with all this, and now im off home.

Overnight I would love it if somebody who knows this system and php better than me, would could give me some pointers as to get this working the way im trying it too.

Thanks

Lee

Are we there yet?

Just one more line of code and im done...

16 Oct 2007, 9:41 PM
#20
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Where is the page that controls country drop down

Why not just draw the <select> and <option> fields manually for the few countries you do want to support?
"if on certain page, use my custom html, but if on other pages, use the normal function"

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.