Config shop.php different for each shop

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!
krzysiekp
Posts: 85
Joined: 05 Nov 2021, 16:19

Config shop.php different for each shop

Post by krzysiekp » 10 May 2022, 16:54

I have multi shop application.

I have defined validation fields for billing and delivery address in config/shop.php and I have defined decorators etc.. How to do another configuration for each shop/themes ?

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

Re: Config shop.php different for each shop

Post by aimeos » 11 May 2022, 06:32

Add the configuration to the Option/Value table of the sites in the Locale > Site panel. This will apply the configuration to that site only. The option must be the configuration key with slashes, e.g. "client/html/checkout/standard/address/billing/..."
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

krzysiekp
Posts: 85
Joined: 05 Nov 2021, 16:19

Re: Config shop.php different for each shop

Post by krzysiekp » 11 May 2022, 07:55

I added to config locale site below variable

Code: Select all

client/html/checkout/standard/address/billing/mandatory
Value is

Code: Select all

["order.base.address.firstname","order.base.address.lastname","order.base.address.address1","order.base.address.address2","order.base.address.postal","order.base.address.city","order.base.address.languageid","order.base.address.telephone","order.base.address.tel_prefix","order.base.address.email","order.base.regulations"]
In database is:

Code: Select all

{"resource":{"email":{"from-email":"test@domain.com","from-name":"Test \/ SK"}},"client":{"html":{"checkout":{"standard":{"address":{"billing":{"mandatory":"[\"order.base.address.firstname\",    \"order.base.address.lastname\",    \"order.base.address.address1\",    \"order.base.address.address2\",    \"order.base.address.postal\",    \"order.base.address.city\",    \"order.base.address.languageid\",    \"order.base.address.telephone\",    \"order.base.address.tel_prefix\",    \"order.base.address.email\",\"order.base.regulations\"]"}}}}}}}
I have error:

Code: Select all

foreach() argument must be of type array|object, string given
 #0 C:\xampp\htdocs\giftcard\vendor\aimeos-extensions\new-ext\client\html\src\Client\Html\Checkout\Standard\Address\Billing\Billing.php(301)
Line where mandatory field are got;

Code: Select all

$mandatory = $view->config('client/html/checkout/standard/address/billing/mandatory', $this->mandatory);

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

Re: Config shop.php different for each shop

Post by aimeos » 11 May 2022, 08:15

Only scalar values are allowed (no arrays) so you have to add one line per value:

Code: Select all

client/html/checkout/standard/address/billing/mandatory/0 : order.base.address.firstname
client/html/checkout/standard/address/billing/mandatory/1 : order.base.address.lastname
...
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

krzysiekp
Posts: 85
Joined: 05 Nov 2021, 16:19

Re: Config shop.php different for each shop

Post by krzysiekp » 11 May 2022, 08:39

Ok, thanks

Post Reply