price of pre selected variant not displayed on catalog

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
columbo
Posts: 21
Joined: 09 Oct 2019, 09:42

price of pre selected variant not displayed on catalog

Post by columbo » 16 Jan 2020, 14:14

Hi,

I'm using selection products and defined a pre-selection (client/html/catalog/selection/preselect) for my catalog page.
(as explained on https://aimeos.org/docs/Configuration/C ... /preselect)

The preselection works fine, but the price of the preselected variant is not displayed. I have first to select another variant and then back the preselected variant. Then the price is shown.

How can I fix it, that the price of the (pre)selected variant is displayed?

thank you

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

Re: price of pre selected variant not displayed on catalog

Post by aimeos » 17 Jan 2020, 11:12

You should assign the price of the pre-selected variant to the selection product so it's displayed by default. If the customer changes the variant attribute pre-selection, the price should be updated by JS/CSS.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

columbo
Posts: 21
Joined: 09 Oct 2019, 09:42

Re: price of pre selected variant not displayed on catalog

Post by columbo » 22 Jan 2020, 19:29

Is it also possible to find in items-body-list.php which productitem is pre-selected and add the "price-actual" class to "articleitem price"? - so that this pre-selected price is displayed on the frontend?

Code: Select all

<?php foreach( $productItem->getRefItems( 'product', 'default', 'default' ) as $prodid => $product ) : ?>												
	<?php if( $productItems[$prodid] ) { $product = $productItems[$prodid]; } ?>
	<?php if( ( $prices = $product->getRefItems( 'price', null, 'default' ) ) !== [] ) : ?>
		<div class="articleitem price"
			data-prodid="<?= $enc->attr( $prodid ); ?>"
			data-prodcode="<?= $enc->attr( $product->getCode() ); ?>">
			<?= $this->partial(
				$this->config( 'client/html/common/partials/price', 'common/partials/price-standard' ),
				array( 'prices' => $prices )
			); ?>
		</div>
	<?php endif; ?>
<?php endforeach; ?>

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

Re: price of pre selected variant not displayed on catalog

Post by aimeos » 23 Jan 2020, 10:16

Yes, but that requires looping over all product and check if the variant attributes match with the pre-selected.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply