they will not be able to check out period
then in your cart/check logic toss a check in to make sure that the zone they are in by your pick of billing/shipping address check or both as to weather they can move forward
Jonathon
This can be done by adding the following to your "catalog/controller/account_create.php" file:-
Code: Select all
if ($request->get('country_id', 'post') != 223) {
$this->error['country_id'] = $language->get('error_country');
}
Code: Select all
if (!$this->error) {
return TRUE;
} else {
return FALSE;
}
Code: Select all
$_['error_country'] = 'Since you are from outside the USA, you must place your order through the contact page. Apologies for any inconvenience this may cause.';
Find the section
Code: Select all
<td><select name="country_id" onchange="$('#zone').load('index.php?controller=account_create&action=zone&country_id='+this.value+'&zone_id=<?php echo $zone_id; ?>');">
<?php foreach ($countries as $country) { ?>
<?php if ($country['country_id'] == $country_id) { ?>
<option value="<?php echo $country['country_id']; ?>" SELECTED><?php echo $country['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $country['country_id']; ?>"><?php echo $country['name']; ?></option>
<?php } ?>
<?php } ?>
</select></td>
Code: Select all
</select><?php if ($error_country) { ?><span class="error"><?php echo $error_country; ?></span><?php } ?></td>
Regards, Fido-X.
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
Fido-X.
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
This might sound like a stupid question or even a really simple one. But, if I wanted to include more than one country, would I do eitherfido-x wrote: This can be done by adding the following to your "catalog/controller/account_create.php" file:-beforeCode: Select all
if ($request->get('country_id', 'post') != 223) { $this->error['country_id'] = $language->get('error_country'); }
Code: Select all
if (!$this->error) { return TRUE; } else { return FALSE; }
Code: Select all
if ($request->get('country_id', 'post') != 38 or 223 ) {
$this->error['country_id'] = $language->get('error_country');
}
Code: Select all
if ($request->get('country_id', 'post') != 38 || 223) {
$this->error['country_id'] = $language->get('error_country');
}
Code: Select all
if ($request->get('country_id', 'post') != 38 xor 223) {
$this->error['country_id'] = $language->get('error_country');
}
You could do it using the "if" method as you suggested, the correct code would be-
Code: Select all
if ($request->get('country_id') != 38 || $request->get('country_id') != 223) {
$this->error['country_id'] = $language->get('error_country');
}
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
Yes, but I plan to implement as many countries into my store as possible, once I work out the international shipping costs and everything.Qphoria wrote: Couldn't you just delete all countries from the db except for the ones you want. Then the drop down would limit u
That might be something that jimmywb might be wanting to do eventually as well. As long as they are all there, why delete them when if
you plan and idea is like what I would like to do or that you plan to eventually use them in some way.
Thanks for the correction for me. I appreciate the help.fido-x wrote: Hi TekRaj,
You could do it using the "if" method as you suggested, the correct code would be-Regards, Fido-X.Code: Select all
if ($request->get('country_id') != 38 || $request->get('country_id') != 223) { $this->error['country_id'] = $language->get('error_country'); }
account creation page. The error that I receive is "
Notice: Undefined variable: error_country in .../catalog/template/default/content/account_create.tpl on line 87"
right under the country select box.
My code looks like this:
Code: Select all
');">
" SELECTED>
">
Line 87->
Code: Select all
if ($request->get('country_id') != 38 || $request->get('country_id') != 223) {
$this->error['country_id'] = $language->get('error_country');
}
Code: Select all
$_['error_country'] = 'Since you are from outside the USA, you must place your order through the contact page. Apologies for any inconvenience this may cause.';
Code: Select all
<?php if ($error_country) { ?>
Code: Select all
<?php if (isset($error_country) { ?>
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
Well, that cleared up the undefined variable error, but the country error does not show if 38 or 223 is not selected.fido-x wrote: You could try changing your line 87 fromtoCode: Select all
<?php if ($error_country) { ?>
Regards, Fido-X.Code: Select all
<?php if (isset($error_country) { ?>
Edit:
Problem solved.
In order to fix the error, you have to add:
Code: Select all
$view->set('error_city', @$this->error['city']);
Code: Select all
$view->set('error_country', @$this->error['country']);
Then you have to change your code further on down the page. So, instead of
Code: Select all
if ($request->get('country_id') != 38 || $request->get('country_id') != 223) {
$this->error['country_id'] = $language->get('error_country');
}
Code: Select all
if ($request->get('country') != 38 || $request->get('country') != 223) {
$this->error['country'] = $language->get('error_country');
}
Users browsing this forum: No registered users and 5 guests