Access product properties in basket
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 6
- Joined: 06 Dec 2018, 12:33
Access product properties in basket
Dear aimeos Team
How can I access product properties inside the basket view?
As I can see the properties values are not available inside the array the $this->summaryBasket->getProducts() is returning
in the file /html/templates/common/summary/detail-standard.php
Or as an alternative is it easier to access a «Article specific configuration options» (Setup at the basic tab of a product / key/value pair ) inside the basket?
I just need a value that I can use specific for every product inside the basket (and also on the product detail page).
I'm using Typo3 8.7.20 with aimeos 18.10.2 / PHP 7.2.1 / Apache (Local on Mac OS with MAMP).
Thank you!
How can I access product properties inside the basket view?
As I can see the properties values are not available inside the array the $this->summaryBasket->getProducts() is returning
in the file /html/templates/common/summary/detail-standard.php
Or as an alternative is it easier to access a «Article specific configuration options» (Setup at the basic tab of a product / key/value pair ) inside the basket?
I just need a value that I can use specific for every product inside the basket (and also on the product detail page).
I'm using Typo3 8.7.20 with aimeos 18.10.2 / PHP 7.2.1 / Apache (Local on Mac OS with MAMP).
Thank you!
Re: Access product properties in basket
If you only need a single, specific property, you can add it to the basket product by configuring the "PropertyAdd" basket plugin: https://github.com/aimeos/aimeos-core/b ... dd.php#L16
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 6
- Joined: 06 Dec 2018, 12:33
Re: Access product properties in basket
Thank you for your fast support!
Can you please tell me more about how I can configure the PropertyAdd basket plugin...
As I can see the file PropertyAdd.php is already part of your aimeos core. At the top of the file I can see the example configuration. Where do I have to add this configuration - by TypoScript Setup?
Example configuration:
* - product.property.parentid: ['length', 'width', 'heigth', 'weigth']
Can you please tell me more about how I can configure the PropertyAdd basket plugin...
As I can see the file PropertyAdd.php is already part of your aimeos core. At the top of the file I can see the example configuration. Where do I have to add this configuration - by TypoScript Setup?
Example configuration:
* - product.property.parentid: ['length', 'width', 'heigth', 'weigth']
Re: Access product properties in basket
The configuration needs to be added to the config section of the basket plugin in the admin interface
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 6
- Joined: 06 Dec 2018, 12:33
Re: Access product properties in basket
I could set up the PropertyAdd Plugin now. The property I want to add to the basket has the code 'pp-dim-width' in my case. I tried different configurations but no one is working. Depending on my setup I get the following error:
Argument 3 passed to Aimeos\MShop\Plugin\Provider\Order\PropertyAdd::addAttributes() must be of the type array, string given,
Or I just get no error message but I cant see the given value at the basket product object anyway.
To test if I get the value I need inside the basket I just use at the file detail-standard.php and then search for my pp-dim-width attribute. But I cant see it there.
Can you please tell me how exactly the plugin configuration must look like?
Thank you.
Argument 3 passed to Aimeos\MShop\Plugin\Provider\Order\PropertyAdd::addAttributes() must be of the type array, string given,
Or I just get no error message but I cant see the given value at the basket product object anyway.
To test if I get the value I need inside the basket I just use
Code: Select all
<?php var_dump($product); ?>
Can you please tell me how exactly the plugin configuration must look like?
Thank you.
- Attachments
-
- aimeos-add-product-property-to-basket.png (68.44 KiB) Viewed 2352 times
Re: Access product properties in basket
Think, the value must be
as it's interpreted as JSON. Can you try?
Code: Select all
["pp-dim-width"]
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 6
- Joined: 06 Dec 2018, 12:33
Re: Access product properties in basket
I tried out different configurations / different strings to pass the value to the basket. But without success. I can not see the value in the product object inside the basket. Some of the JSON-string values I entered directly into the database, because the backend did not accept my values (the save button does not react - without error message).
Now I did a completely other solution with JavaScript and LocalStorage outside aimeos. This is working for me because I don't really need the basket in this project (we dont need the order part on this project - instead we have a favourite / collection-box function). But for a future project, solving this issues here may become important again...
Now I did a completely other solution with JavaScript and LocalStorage outside aimeos. This is working for me because I don't really need the basket in this project (we dont need the order part on this project - instead we have a favourite / collection-box function). But for a future project, solving this issues here may become important again...
Re: Access product properties in basket
A rewrite of the plugin is on the list: https://github.com/aimeos/aimeos-core/issues/133
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star