Describe the bug
You are in multistore and have zones, countries enabled for all shops
Carriers are limited to a specific zone
You set _Restrict country selections in front office to those covered by active carriers_ to yes
In front office of both shop while creating a customer address, you will see all countries instead of only ones covered by carriers of the shop.
To Reproduce
Suggested fix
The listed countiers should only be what is applicable to the current shop? Proposed change:
line 143 of:
/classes/Carrier.php
to:
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT cl.*,c.*, cl.nameAS country, zz.nameAS zone, cs.id_shop
FROM'._DB_PREFIX_.'countryc'.
Shop::addSqlAssociation('country', 'c').'
LEFT JOIN'._DB_PREFIX_.'country_langcl ON (c.id_country= cl.id_countryAND cl.id_lang= '.(int) $id_lang.')
INNER JOIN ('._DB_PREFIX_.'carrier_zonecz INNER JOIN'._DB_PREFIX_.'carriercr ON ( cr.id_carrier = cz.id_carrier AND cr.deleted = 0 '.
($active_carriers ? 'AND cr.active = 1) ' : ') ').'
LEFT JOIN'._DB_PREFIX_.'zonezz ON cz.id_zone = zz.id_zone) ON zz.id_zone= c.id_zone
LEFT JOIN'._DB_PREFIX_.'carrier_shopcs ON cr.id_carrier = cs.id_carrier
WHERE 1
AND cs.id_shop= ' . $id_shop . '
'.($active_countries ? 'AND c.active = 1' : '').'
'.(!is_null($contain_states) ? 'AND c.contains_states= '.(int) $contain_states : '').'
ORDER BY cl.name ASC');
Hi @tonypartridge,
Could you please confirm these steps:

Thanks!
Hello,
Not quite. All countries are enabled by default and we set: Country Options as:

So at this point we have now said only countries which are assigned to the shops shipping carriers should be shown.
However, if you have two carriers i.e.
When you edit your address you can select from all countries, this is because the function getDeliveredCountries() is not restricting them to a single shop. The above code change does that.
Many thanks
Tony
@tonypartridge,
I attached a video record.
https://drive.google.com/file/d/1neR2HTcR_AdPVs6i2q0QK_JLJ9iD_0gM/view
Thanks to check & feedback.
Thank you for taking the time to look into this, the issue is you have edited each country and assigned counties to a shop!
We haven’t done that and neither want to, since some shops can ship anywhere in the world it needs to be defined by the carriers zone and not the countries allocated shop then zone. This is why my change above fixes the issue by selecting the shop allocation for the carriers, since you do not want to get shop 1’s carrier countries in shop 2.
@tonypartridge, in your case, all countries are displayed because they are enabled in all shops, which is normal behavior.
But, in my case, I edited the access of countries for each shop => so, in the FO not all the shops are displayed.
@marionf, what do you think?
Thanks!
It’s not normal behaviour as we set ‘restrict countries to carrier countries’ 😜yet we are including carriers from ALL shops. We should only include carriers from this shop.
Get Outlook for iOShttps://aka.ms/o0ukef
From: khouloudbelguith notifications@github.com
Sent: Wednesday, February 27, 2019 2:31 pm
To: PrestaShop/PrestaShop
Cc: Tony Partridge; Mention
Subject: Re: [PrestaShop/PrestaShop] Country list includes all countries from all shop carriers (#12732)
@tonypartridgehttps://github.com/tonypartridge, in your case, all countries are displayed because they are enabled in all shops, which is normal behavior.
But, in my case, I edited the access of countries for each shop => so, in the FO not all the shops are displayed.
@marionfhttps://github.com/marionf, what do you think?
Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/PrestaShop/PrestaShop/issues/12732#issuecomment-467882954, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABVgloFVkSMmfbt87hJeerTc78_IGBBYks5vRpatgaJpZM4bTag3.
@tonypartridge yes, you are right it's a multistore issue.
Indeed, you can avoid this issue with the workaround given by @khouloudbelguith
Or you could apply my bug fix as above? If you have ALL countries over different stores that’s a lot of editing you need to do!!
Get Outlook for iOShttps://aka.ms/o0ukef
From: marionf notifications@github.com
Sent: Thursday, February 28, 2019 11:04 am
To: PrestaShop/PrestaShop
Cc: Tony Partridge; Mention
Subject: Re: [PrestaShop/PrestaShop] Country list includes all countries from all shop carriers (#12732)
@tonypartridgehttps://github.com/tonypartridge yes, you are right, this is a multistore issue.
Indeed, you can avoid this issue with the workaround given by @khouloudbelguithhttps://github.com/khouloudbelguith
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/PrestaShop/PrestaShop/issues/12732#issuecomment-468231973, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABVglr1N4zte27b2FSVGsdhecAMY5XK0ks5vR7fDgaJpZM4bTag3.