variant attributes for selection not displayed on FE
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!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
variant attributes for selection not displayed on FE
Hi Aimeos )
When I add variant attributes to selection product - they not displayed on FE inside single product page.. Is it correct behavior ?
When I add variant attributes to selection product - they not displayed on FE inside single product page.. Is it correct behavior ?
Re: variant attributes for selection not displayed on FE
Can you post screenshots?
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
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Re: variant attributes for selection not displayed on FE
Sure,
Here you see attributes for variants https://prnt.sc/26f439e
And they are displayed on FE https://prnt.sc/26f43s6
And here you see variant attributes for main selection product https://prnt.sc/26f449p
And pink color not shown on FE, only colors from variants are displayed.. The template code I did not change, only css.
Here you see attributes for variants https://prnt.sc/26f439e
And they are displayed on FE https://prnt.sc/26f43s6
And here you see variant attributes for main selection product https://prnt.sc/26f449p
And pink color not shown on FE, only colors from variants are displayed.. The template code I did not change, only css.
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Re: variant attributes for selection not displayed on FE
My target is something like this: I want to have 2 variants of product. So I want to create selection product and 1 variant product. Then I assign variant attributes for selection and for variant. Then when I go inside product on FE the attributes should be preselected as for selection product, or possible to select attributes from variant... Should it work like this ?
Thank you a lot !
Thank you a lot !
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Re: variant attributes for selection not displayed on FE
From what I see here ext/ai-client-html/client/html/templates/common/partials/selection-standard.php variant attributes from selection product not used..
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Re: variant attributes for selection not displayed on FE
Seems such a code is missing in the file I specified above:
with this code from first look it should work..
Code: Select all
foreach ($this->get('productItem')->getRefItems( 'attribute', null, 'variant' ) as $attrId => $attrItem) {
$attrTypeDeps[$attrItem->getType()][$attrId] = $attrItem->getPosition();
$attributeItems[$attrId] = $attrItem;
$attrDeps[$attrId][] = $this->get('productItem')->getId();
$prodDeps[$this->get('productItem')->getId()][] = $attrId;
}
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Re: variant attributes for selection not displayed on FE
but now when I choose var attributes from selection product - product is not added to basked. When I choose var attributes from variant product - product is added to basked.. Seems missed something
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Re: variant attributes for selection not displayed on FE
I did not check deep but seems after adding the following code:
before the line:
method getArticle()
in the file /vendor/aimeos/ai-controller-frontend/controller/frontend/src/Controller/Frontend/Basket/Decorator/Select.php
it works. I mean when I select variant attributes from selection product - the product added to basked with correct attributes!
Please look at the code I provided and tell me if it is right solution ?
Thank you !
Code: Select all
$isSelectionAttrSelected = true;
foreach( $variant as $id )
{
if( $productItem->getListItem( 'attribute', 'variant', $id ) === null ) {
$isSelectionAttrSelected = false;
break;
}
}
if($isSelectionAttrSelected) {
$items[] = $productItem;
}
Code: Select all
foreach( $productItem->getRefItems( 'product', null, 'default' ) as $item )
in the file /vendor/aimeos/ai-controller-frontend/controller/frontend/src/Controller/Frontend/Basket/Decorator/Select.php
it works. I mean when I select variant attributes from selection product - the product added to basked with correct attributes!
Please look at the code I provided and tell me if it is right solution ?
Thank you !
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Re: variant attributes for selection not displayed on FE
Sorry forgot specify the components version:
Code: Select all
aimeos/ai-admin-jqadm 2021.10.4 Aimeos Vue.js+Bootstrap admin interface
aimeos/ai-admin-jsonadm 2021.10.2 Aimeos ai-admin-jsonadm extension
aimeos/ai-client-html 2021.10.5 Aimeos ai-client-html extension
aimeos/ai-client-jsonapi 2021.10.2 Aimeos JSON API extension
aimeos/ai-cms-grapesjs 2021.10.1 Aimeos GrapesJS CMS extension
aimeos/ai-controller-frontend 2021.10.2 Aimeos ai-controller-frontend extension
aimeos/ai-controller-jobs 2021.10.3 Aimeos ai-controller-jobs extension
aimeos/ai-gettext 2021.10.1 Aimeos Gettext extension
aimeos/ai-laravel 2021.10.1 Laravel adapter for Aimeos web shops and e-commerce solutions
aimeos/ai-swiftmailer 2021.10.1 SwiftMailer adapter for Aimeos web shops and e-commerce solutions
aimeos/aimeos-core 2021.10.6 Full-featured e-commerce components for high performance online shops
aimeos/aimeos-laravel 2021.10.3 Professional, full-featured and high performance Laravel e-commerce package for online shops and complex B2B projects
aimeos/map 2.4.0 Easy and elegant handling of PHP arrays as array-like map objects similar to jQuery and Laravel Collections
-
- Expert
- Posts: 274
- Joined: 27 Jun 2019, 16:19
Re: variant attributes for selection not displayed on FE
I don't understand now how to extend /vendor/aimeos/ai-controller-frontend/controller/frontend/src/Controller/Frontend/Basket/Decorator/Select.php this decorator