Page 1 of 1

"Add to basket" in product list

Posted: 25 Nov 2015, 08:43
by afernandez
Hi,

I currently try to implement a feature that allows me to add products into the basket while browsing the product list. It works for products that don't have additional attributes required for selection (e.g. color). If I have such product I obviously can't add it, as the required attribute was not selected. The issue I have now is that such attributes are not loaded in the product list. I've put the following code into my own items-body-default.html, only getting an empty array:

Code: Select all

<?php foreach( $this->get( 'attributeConfigItems', array() ) as $code => $attributes ) : ?>
    <!--  Layout stuff... -->
<?php endforeach; ?>
Which PHP file do I have to modify to get those attributes into the product list?

Re: "Add to basket" in product list

Posted: 25 Nov 2015, 11:10
by aimeos
afernandez wrote:Which PHP file do I have to modify to get those attributes into the product list?
That's a matter of configuration :-)

You should add "attribute" to the list of domains that should be fetched:
https://aimeos.org/docs/Configuration/C ... st/domains

We would like to get that feature into the core too. Could you create a PR for this?

Re: "Add to basket" in product list

Posted: 25 Nov 2015, 11:41
by afernandez
Sorry, I mixed up things. I want to show the variants of a product, not the attributes.

Re: "Add to basket" in product list

Posted: 25 Nov 2015, 11:47
by aimeos
afernandez wrote:Sorry, I mixed up things. I want to show the variants of a product, not the attributes.
Add "product" to get the associated products as well. The downside is that if you need images, prices, texts, etc. of the variants as well, you need to fetch them in a second searchItems() call in the setViewParams() method of the subpart.