Default Region/State to None -- Singapore
18 posts
• Page 1 of 1
Default Region/State to None -- Singapore
Hi,
Is there any way to Default the Region/State to None when Singapore is chosen? So that my customers don't have to click on the dropdown box for the Region/State.
Edit:
In the Registration Forms -- Account / Checkout
So I guess also have to change the code in the Address file.
Thank you.
Regards
Faustine
Is there any way to Default the Region/State to None when Singapore is chosen? So that my customers don't have to click on the dropdown box for the Region/State.
Edit:
In the Registration Forms -- Account / Checkout
So I guess also have to change the code in the Address file.
Thank you.
Regards
Faustine
Last edited by thegeekz on Mon Jun 18, 2012 2:55 am, edited 1 time in total.
Production Cart @ http://eshop.kgshop-sg.com -- OC 1.5.4.1 -- pending
No more using Apsona, as they are not updated.
No more using Apsona, as they are not updated.
- Every upgrade -- rem. 2 reinstall vqmod & mindful of modules w/ VQmod -- E.g Import / Export Tool by MHC
- thegeekz
- Posts: 326
- Joined: Tue Nov 02, 2010 2:24 am
Re: Default Region/State to None -- Singapore
The default is selected for v1.5.3.1. Not sure what version you are running on, but the codes below is the correct one that ensures 'none' is selected by default.
- Code: Select all
html += '<option value="0" selected="selected"><?php echo $text_none; ?></option>';
-

MarketInSG - Posts: 2607
- Joined: Wed Nov 16, 2011 3:53 am
- Location: Singapore
Re: Default Region/State to None -- Singapore
Thank you..
I'm using 1.5.2.1 though.. where can I find this code?
in register.tpl?
I'm using 1.5.2.1 though.. where can I find this code?
in register.tpl?
Production Cart @ http://eshop.kgshop-sg.com -- OC 1.5.4.1 -- pending
No more using Apsona, as they are not updated.
No more using Apsona, as they are not updated.
- Every upgrade -- rem. 2 reinstall vqmod & mindful of modules w/ VQmod -- E.g Import / Export Tool by MHC
- thegeekz
- Posts: 326
- Joined: Tue Nov 02, 2010 2:24 am
Re: Default Region/State to None -- Singapore
Ok, if you are on v1.5.2.1, they are different. You will have to access catalog/controller/account/register.php
Find
chnage to
Find
- Code: Select all
$output .= '<option value="0">' . $this->language->get('text_none') . '</option>';
chnage to
- Code: Select all
$output .= '<option selected="selected" value="0">' . $this->language->get('text_none') . '</option>';
-

MarketInSG - Posts: 2607
- Joined: Wed Nov 16, 2011 3:53 am
- Location: Singapore
Re: Default Region/State to None -- Singapore
MarketInSG wrote:Ok, if you are on v1.5.2.1, they are different. You will have to access catalog/controller/account/register.php
Find
- Code: Select all
$output .= '<option value="0">' . $this->language->get('text_none') . '</option>';
chnage to
- Code: Select all
$output .= '<option selected="selected" value="0">' . $this->language->get('text_none') . '</option>';
Strange.. doesn't seem to work.. though... When using VQMOD..
** Currently the Registration form's Region / State -- have the default shown as Please Select, not the Text -- > None.. Customers will still have to select the None in drop down menu.
With this code change will the dropdown box show "None" directly, rather than needing to select the Region still?
I'll try updating the file directly..
Production Cart @ http://eshop.kgshop-sg.com -- OC 1.5.4.1 -- pending
No more using Apsona, as they are not updated.
No more using Apsona, as they are not updated.
- Every upgrade -- rem. 2 reinstall vqmod & mindful of modules w/ VQmod -- E.g Import / Export Tool by MHC
- thegeekz
- Posts: 326
- Joined: Tue Nov 02, 2010 2:24 am
Re: Default Region/State to None -- Singapore
I read :
viewtopic.php?t=49232 -- Default Country, Default Zone
And followed the examples to the tee, but using VQMOD.
However doesn't seem to have any effect.
Shall attach the XML file here.... For help...
** I'm also trying to change the Post code text to Postal code using VQMOD, also doesn't seem to work.... (Language file)
viewtopic.php?t=49232 -- Default Country, Default Zone
And followed the examples to the tee, but using VQMOD.
However doesn't seem to have any effect.
Shall attach the XML file here.... For help...

** I'm also trying to change the Post code text to Postal code using VQMOD, also doesn't seem to work.... (Language file)
- Attachments
-
default_region_country.xml- (6.06 KiB) Downloaded 35 times
Production Cart @ http://eshop.kgshop-sg.com -- OC 1.5.4.1 -- pending
No more using Apsona, as they are not updated.
No more using Apsona, as they are not updated.
- Every upgrade -- rem. 2 reinstall vqmod & mindful of modules w/ VQmod -- E.g Import / Export Tool by MHC
- thegeekz
- Posts: 326
- Joined: Tue Nov 02, 2010 2:24 am
Re: Default Region/State to None -- Singapore
Anyone?
Help?
Help?
Production Cart @ http://eshop.kgshop-sg.com -- OC 1.5.4.1 -- pending
No more using Apsona, as they are not updated.
No more using Apsona, as they are not updated.
- Every upgrade -- rem. 2 reinstall vqmod & mindful of modules w/ VQmod -- E.g Import / Export Tool by MHC
- thegeekz
- Posts: 326
- Joined: Tue Nov 02, 2010 2:24 am
Re: Default Region/State to None -- Singapore
it doesnt work because you don't know how to use vqmod. search for the whole line would be good. if you really dont get vqmod, you can just directly change the file.
-

MarketInSG - Posts: 2607
- Joined: Wed Nov 16, 2011 3:53 am
- Location: Singapore
Re: Default Region/State to None -- Singapore
MarketinSG:
Ok, now actually I had set a SG None as the Zone, Zone ID 3968.
So I guess I should just change TPL files suggested in the Default Zone thread?
My Case is slightly different, I would like to maintain the Countries Listing while the Zone will default to SG None when Singapore is selected.
I see Kim's is only one country... one zone....
Is that possible?
Ok, now actually I had set a SG None as the Zone, Zone ID 3968.
So I guess I should just change TPL files suggested in the Default Zone thread?
My Case is slightly different, I would like to maintain the Countries Listing while the Zone will default to SG None when Singapore is selected.
I see Kim's is only one country... one zone....
Is that possible?
thegeekz wrote:MarketInSG wrote:Ok, if you are on v1.5.2.1, they are different. You will have to access catalog/controller/account/register.php
Find
- Code: Select all
$output .= '<option value="0">' . $this->language->get('text_none') . '</option>';
chnage to
- Code: Select all
$output .= '<option selected="selected" value="0">' . $this->language->get('text_none') . '</option>';
Strange.. doesn't seem to work.. though... When using VQMOD..
** Currently the Registration form's Region / State -- have the default shown as Please Select, not the Text -- > None.. Customers will still have to select the None in drop down menu.
With this code change will the dropdown box show "None" directly, rather than needing to select the Region still?
I'll try updating the file directly..
Production Cart @ http://eshop.kgshop-sg.com -- OC 1.5.4.1 -- pending
No more using Apsona, as they are not updated.
No more using Apsona, as they are not updated.
- Every upgrade -- rem. 2 reinstall vqmod & mindful of modules w/ VQmod -- E.g Import / Export Tool by MHC
- thegeekz
- Posts: 326
- Joined: Tue Nov 02, 2010 2:24 am
Re: Default Region/State to None -- Singapore
don't really get you this time round. if you want to default zones that is 'none', just do as what I listed above. If you want zone with a specific id, you will need to edit template file
- Code: Select all
<?php if (id = 'xxxx') { ?><option select="selected" ......><?php } else { ?>original codes <?php { ?>
-

MarketInSG - Posts: 2607
- Joined: Wed Nov 16, 2011 3:53 am
- Location: Singapore
Re: Default Region/State to None -- Singapore
MarketInSG wrote:don't really get you this time round. if you want to default zones that is 'none', just do as what I listed above. If you want zone with a specific id, you will need to edit template file
- Code: Select all
<?php if (id = 'xxxx') { ?><option select="selected" ......><?php } else { ?>original codes <?php { ?>
OK. I try...
I wanted the customer to :
a) select Singapore from the list
b) don't have to select region - already defaulted to my set choice : SG NONE
I'll see if the above code works.
(As Kim's is only one country .. one zone... which is not what I want - so I can't follow that thread's solution)
Production Cart @ http://eshop.kgshop-sg.com -- OC 1.5.4.1 -- pending
No more using Apsona, as they are not updated.
No more using Apsona, as they are not updated.
- Every upgrade -- rem. 2 reinstall vqmod & mindful of modules w/ VQmod -- E.g Import / Export Tool by MHC
- thegeekz
- Posts: 326
- Joined: Tue Nov 02, 2010 2:24 am
Re: Default Region/State to None -- Singapore
MarketInSG wrote:Ok, if you are on v1.5.2.1, they are different. You will have to access catalog/controller/account/register.php
Find
- Code: Select all
$output .= '<option value="0">' . $this->language->get('text_none') . '</option>';
chnage to
- Code: Select all
$output .= '<option selected="selected" value="0">' . $this->language->get('text_none') . '</option>';
Use this will do. Nothing else you need to do. Remove the new zone you added to Singapore. That's not needed
-

MarketInSG - Posts: 2607
- Joined: Wed Nov 16, 2011 3:53 am
- Location: Singapore
Re: Default Region/State to None -- Singapore
OK.
I tried that earlier but it didn't work..
still default to :
please select
Will try again later.
THANKS!
I tried that earlier but it didn't work..
still default to :
please select
Will try again later.
THANKS!
Production Cart @ http://eshop.kgshop-sg.com -- OC 1.5.4.1 -- pending
No more using Apsona, as they are not updated.
No more using Apsona, as they are not updated.
- Every upgrade -- rem. 2 reinstall vqmod & mindful of modules w/ VQmod -- E.g Import / Export Tool by MHC
- thegeekz
- Posts: 326
- Joined: Tue Nov 02, 2010 2:24 am
Re: Default Region/State to None -- Singapore
Ok I tested with your suggestion earlier..
It didn't work out.
Still defaults to -- Please Select --
Still have to select the Zone!
It didn't work out.
Still defaults to -- Please Select --
Still have to select the Zone!
Production Cart @ http://eshop.kgshop-sg.com -- OC 1.5.4.1 -- pending
No more using Apsona, as they are not updated.
No more using Apsona, as they are not updated.
- Every upgrade -- rem. 2 reinstall vqmod & mindful of modules w/ VQmod -- E.g Import / Export Tool by MHC
- thegeekz
- Posts: 326
- Joined: Tue Nov 02, 2010 2:24 am
Re: Default Region/State to None -- Singapore
Well, then something is wrong with your cart. That is the piece of code that is responsible for outputting the option
-

MarketInSG - Posts: 2607
- Joined: Wed Nov 16, 2011 3:53 am
- Location: Singapore
Re: Default Region/State to None -- Singapore
ok.. Will try with my other installations and see how it turns out...
Afterall I'm using a custom theme -- Basico...
But shouldn't affect the basic functionality of the cart.
Edit : I just checked -- using Opera, and the Default to None works, but in Firefox it shows the - Please select - as default, but I suspect it also works just did not display correctly... Can anyone using Firefox confirm this?
Oc3.cybermind.com.sg - Register form
Afterall I'm using a custom theme -- Basico...
But shouldn't affect the basic functionality of the cart.
Edit : I just checked -- using Opera, and the Default to None works, but in Firefox it shows the - Please select - as default, but I suspect it also works just did not display correctly... Can anyone using Firefox confirm this?
Oc3.cybermind.com.sg - Register form
Production Cart @ http://eshop.kgshop-sg.com -- OC 1.5.4.1 -- pending
No more using Apsona, as they are not updated.
No more using Apsona, as they are not updated.
- Every upgrade -- rem. 2 reinstall vqmod & mindful of modules w/ VQmod -- E.g Import / Export Tool by MHC
- thegeekz
- Posts: 326
- Joined: Tue Nov 02, 2010 2:24 am
Re: Default Region/State to None -- Singapore
Inside the Store Settings -> Local you are required to select the default "Region / State:"
If you dont want this to be set as default you need to add:
So vqmod file would look like this:
The method suggested by: @MarketInSG would break the form from remembering the users data, if there was a error after submitting the checkout.
Digging into the Opencart code you can see that in catalog/controller/checkout/manual.php it uses the config_zone_id to setup the default address for the customer.
And: system/library/tax.php
If you dont want this to be set as default you need to add:
- Code: Select all
($this->config->get('config_zone_id') != $result['zone_id'])
So vqmod file would look like this:
- Code: Select all
<file name="catalog/controller/checkout/guest.php">
<operation>
<search position="replace"><![CDATA[
if (isset($this->request->get['zone_id']) && ($this->request->get['zone_id'] == $result['zone_id'])) {
]]></search>
<add><![CDATA[
if (isset($this->request->get['zone_id']) && ($this->config->get('config_zone_id') != $result['zone_id']) && ($this->request->get['zone_id'] == $result['zone_id'])) {
]]></add>
</operation>
</file>
The method suggested by: @MarketInSG would break the form from remembering the users data, if there was a error after submitting the checkout.
Digging into the Opencart code you can see that in catalog/controller/checkout/manual.php it uses the config_zone_id to setup the default address for the customer.
- Code: Select all
// Tax
if ($this->cart->hasShipping()) {
$this->tax->setShippingAddress($this->request->post['shipping_country_id'], $this->request->post['shipping_zone_id']);
} else {
$this->tax->setShippingAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
}
$this->tax->setPaymentAddress($this->request->post['payment_country_id'], $this->request->post['payment_zone_id']);
$this->tax->setStoreAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
And: system/library/tax.php
- Code: Select all
<?php
final class Tax {
private $shipping_address;
private $payment_address;
private $store_address;
public function __construct($registry) {
$this->config = $registry->get('config');
$this->customer = $registry->get('customer');
$this->db = $registry->get('db');
$this->session = $registry->get('session');
if (isset($this->session->data['shipping_country_id']) || isset($this->session->data['shipping_zone_id'])) {
$this->setShippingAddress($this->session->data['shipping_country_id'], $this->session->data['shipping_zone_id']);
} elseif ($this->config->get('config_tax_default') == 'shipping') {
$this->setShippingAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
}
if (isset($this->session->data['payment_country_id']) || isset($this->session->data['payment_zone_id'])) {
$this->setPaymentAddress($this->session->data['payment_country_id'], $this->session->data['payment_zone_id']);
} elseif ($this->config->get('config_tax_default') == 'payment') {
$this->setPaymentAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
}
$this->setStoreAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
}
-

opencart-templates - Posts: 107
- Joined: Mon May 16, 2011 11:24 am
- Location: UK
Re: Default Region/State to None -- Singapore
opencart-templates wrote:Inside the Store Settings -> Local you are required to select the default "Region / State:"
If you dont want this to be set as default you need to add:
- Code: Select all
($this->config->get('config_zone_id') != $result['zone_id'])
So vqmod file would look like this:
- Code: Select all
<file name="catalog/controller/checkout/guest.php">
<operation>
<search position="replace"><![CDATA[
if (isset($this->request->get['zone_id']) && ($this->request->get['zone_id'] == $result['zone_id'])) {
]]></search>
<add><![CDATA[
if (isset($this->request->get['zone_id']) && ($this->config->get('config_zone_id') != $result['zone_id']) && ($this->request->get['zone_id'] == $result['zone_id'])) {
]]></add>
</operation>
</file>
The method suggested by: @MarketInSG would break the form from remembering the users data, if there was a error after submitting the checkout.
Digging into the Opencart code you can see that in catalog/controller/checkout/manual.php it uses the config_zone_id to setup the default address for the customer.
- Code: Select all
// Tax
if ($this->cart->hasShipping()) {
$this->tax->setShippingAddress($this->request->post['shipping_country_id'], $this->request->post['shipping_zone_id']);
} else {
$this->tax->setShippingAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
}
$this->tax->setPaymentAddress($this->request->post['payment_country_id'], $this->request->post['payment_zone_id']);
$this->tax->setStoreAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
And: system/library/tax.php
- Code: Select all
<?php
final class Tax {
private $shipping_address;
private $payment_address;
private $store_address;
public function __construct($registry) {
$this->config = $registry->get('config');
$this->customer = $registry->get('customer');
$this->db = $registry->get('db');
$this->session = $registry->get('session');
if (isset($this->session->data['shipping_country_id']) || isset($this->session->data['shipping_zone_id'])) {
$this->setShippingAddress($this->session->data['shipping_country_id'], $this->session->data['shipping_zone_id']);
} elseif ($this->config->get('config_tax_default') == 'shipping') {
$this->setShippingAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
}
if (isset($this->session->data['payment_country_id']) || isset($this->session->data['payment_zone_id'])) {
$this->setPaymentAddress($this->session->data['payment_country_id'], $this->session->data['payment_zone_id']);
} elseif ($this->config->get('config_tax_default') == 'payment') {
$this->setPaymentAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
}
$this->setStoreAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
}
Hmm.. Thank you for your reply.
I have already set the default to Singapore, and the region was defaulted to None.
However, in the registration page, it still shows:
So I'm back to square one again... Only thing is to remove the Basico theme's part of the code here:
From this...
catalog/view/theme/Basico/template/account/register.tpl
- Code: Select all
<div class="selectdiv">
<select class="prod" name="zone_id" style="z-index: 10; opacity: 0;">
</select>
To ...
[code]<div class="selectdiv">
<select name="zone_id">
[/code]
Also have to change the coding in Controller/account/register.php to this (OC1.5.2.1, I'm now using OC1.5.4.1)
:
From this
[code]public function zone() {
$output = '<option value="">' . $this->language->get('text_select') . '</option>';
$this->load->model('localisation/zone');
$results = $this->model_localisation_zone->getZonesByCountryId($this->request->get['country_id']);
foreach ($results as $result) {
$output .= '<option value="' . $result['zone_id'] . '"';
if (isset($this->request->get['zone_id']) && ($this->request->get['zone_id'] == $result['zone_id'])) {
$output .= ' selected="selected"';
}
$output .= '>' . $result['name'] . '</option>';
}
if (!$results) {
$output .= '<option value="0">' . $this->language->get('text_none') . '</option>';
}
$this->response->setOutput($output);
} [/code]
To this
[code]public function zone() {
$this->load->model('localisation/zone');
$results = $this->model_localisation_zone->getZonesByCountryId($this->request->get['country_id']);
if (!$results) {
$output = '<option value="0">' . $this->language->get('text_none') . '</option>';
} else {
$output = '<option value="">' . $this->language->get('text_select') . '</option>';
}
foreach ($results as $result) {
$output .= '<option value="' . $result['zone_id'] . '"';
if (isset($this->request->get['zone_id']) && ($this->request->get['zone_id'] == $result['zone_id'])) {
$output .= ' selected="selected"';
}
$output .= '>' . $result['name'] . '</option>';
}
$this->response->setOutput($output);
}
However I noted that this will break Basico's theme and revert the styling of the dropdown box to the default OC format....
And OC1.5.4.1 doesn't have the above public function zone code set anymore.... so how can I default to None now?
Any further help on this?
Production Cart @ http://eshop.kgshop-sg.com -- OC 1.5.4.1 -- pending
No more using Apsona, as they are not updated.
No more using Apsona, as they are not updated.
- Every upgrade -- rem. 2 reinstall vqmod & mindful of modules w/ VQmod -- E.g Import / Export Tool by MHC
- thegeekz
- Posts: 326
- Joined: Tue Nov 02, 2010 2:24 am
18 posts
• Page 1 of 1
Who is online
Users browsing this forum: sammysomerset, Xyph3r and 15 guests















