Basket custom data
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 1
- Joined: 03 Jun 2021, 17:29
Basket custom data
Hi Aimeos Team,
Aimeos Version: 2020.10
PHP Version: 7.4
Project: Laravel
Environment: Windows
I would like to ask if its possible to add custom data in the Basket session like channels = "email/sms", remarks = "test remarks", tags = "tag1, tag2, tag3", etc..?
Currently, we are using the \Aimeos\Shop\Facades\Basket class to access the Basket but can't find how to add or attach these custom data.
Thank you in advance.
Aimeos Version: 2020.10
PHP Version: 7.4
Project: Laravel
Environment: Windows
I would like to ask if its possible to add custom data in the Basket session like channels = "email/sms", remarks = "test remarks", tags = "tag1, tag2, tag3", etc..?
Currently, we are using the \Aimeos\Shop\Facades\Basket class to access the Basket but can't find how to add or attach these custom data.
Thank you in advance.
Re: Basket custom data
Aimeos checks if custom data is allowed so an attacker can't add arbitrary amounts of data to the basket.
You have to add a "custom" attribute to each product where you want to allow custom data in the admin backend, i.e. create three new attribute types (channels, remarks, tags) and three attributes with code "custom" and the types you've created. Afterwards, add those attributes to each product where you want to allow adding that data.
When using the Basket facade, you can pass your custom data as fifth parameter to the addProduct() method:
https://github.com/aimeos/ai-controller ... hp#L92-L94
The parameter must be an array like:
Replace the '<... attr ID>' by the ID of the custom attribute for channels, remarks and tags.
You have to add a "custom" attribute to each product where you want to allow custom data in the admin backend, i.e. create three new attribute types (channels, remarks, tags) and three attributes with code "custom" and the types you've created. Afterwards, add those attributes to each product where you want to allow adding that data.
When using the Basket facade, you can pass your custom data as fifth parameter to the addProduct() method:
https://github.com/aimeos/ai-controller ... hp#L92-L94
The parameter must be an array like:
Code: Select all
['<channel attr ID>' => 'email/sms', '<remarks attr ID>' => 'test remarks', '<tags attr ID>' => ['tag1', 'tag2', 'tag3']]
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,
