Remove countries from checkout in config/shop.php

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Arthur Tarasov
Posts: 3
Joined: 28 Aug 2016, 13:16

Remove countries from checkout in config/shop.php

Post by Arthur Tarasov » 28 Aug 2016, 13:24

Hi, I am trying to remove all countries except for a few from checkout address option. I do not want to tamper with core configuration and I am wondering if it is possible to do it in config/shop.php.

If I try the following, it just changes the first two countries in the list:

Code: Select all

'client' => array(
		'html' => array(
			'checkout' => array(
	            'standard' => array(
	                'address' => array(
	                    'countries' => array(
	                    	'[0]' => 'US',
	                    	'[1]' => 'GB',
	                    ),
	                ),
	            ),
	        ),
		),
	),
The following code appears to do nothing at all:

Code: Select all

'client' => array(
		'html' => array(
			'checkout' => array(
	            'standard' => array(
	                'address' => array(
	                    'countries' => array(
	                    	'US',
	                    	'GB',
	                    ),
	                ),
	            ),
	        ),
		),
	),
What can I do if I just want those two countries to be available for users to select from?

User avatar
aimeos
Administrator
Posts: 7865
Joined: 01 Jan 1970, 00:00

Re: Remove countries from checkout in config/shop.php

Post by aimeos » 28 Aug 2016, 13:57

This works with the latest stable Aimeos core (2016.07.5)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Arthur Tarasov
Posts: 3
Joined: 28 Aug 2016, 13:16

Re: Remove countries from checkout in config/shop.php

Post by Arthur Tarasov » 29 Aug 2016, 08:49

I updated my shop to 2016.07 version but it still behaves the same way. The documentation shows it to be the latest stable version and it seems to risky to use dev versions for me.

What are my other options rather than altering `client/html/checkout/standard/address/countries`?

If I want to remove those countries within core library, where do I find the list of countries? The only file I found that has any list of countries is `..\vendor\aimeos\aimeos-core\client\i18n\country\core-client-country.pot`. Is this the file that I am trying to configure through shop.php? I was looking through the database for a table with countries, but I couldn't find it either.

Arthur Tarasov
Posts: 3
Joined: 28 Aug 2016, 13:16

Re: Remove countries from checkout in config/shop.php

Post by Arthur Tarasov » 30 Aug 2016, 02:36

I ended up changing the list of countries in

Code: Select all

..\vendor\aimeos\aimeos-core\client\html\config\client.php
This only works in v 2016.04. I couldn't figure out how to do it in v 2016.07

User avatar
aimeos
Administrator
Posts: 7865
Joined: 01 Jan 1970, 00:00

Re: Remove countries from checkout in config/shop.php

Post by aimeos » 31 Aug 2016, 17:43

The problem is the "[0]" and "[1]":
Arthur Tarasov wrote:

Code: Select all

'client' => array(
		'html' => array(
			'checkout' => array(
	            'standard' => array(
	                'address' => array(
	                    'countries' => array(
	                    	'[0]' => 'US',
	                    	'[1]' => 'GB',
	                    ),
	                ),
	            ),
	        ),
		),
	),
As it's a PHP array it must be

Code: Select all

	                    	0 => 'US',
	                    	1 => 'GB',
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
aimeos
Administrator
Posts: 7865
Joined: 01 Jan 1970, 00:00

Re: Remove countries from checkout in config/shop.php

Post by aimeos » 02 Sep 2016, 09:25

The Laravel integration didn't allow to overwrite a setting that contains a list of values up to now. They have been merged instead.
The latest release (2017.07.3) offers the same functionality as Symfony. You can add your countries to the config/shop.php file and only those will be displayed.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply