Page 1 of 1

price of pre selected variant not displayed on catalog

Posted: 16 Jan 2020, 14:14
by columbo
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

Re: price of pre selected variant not displayed on catalog

Posted: 17 Jan 2020, 11:12
by aimeos
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.

Re: price of pre selected variant not displayed on catalog

Posted: 22 Jan 2020, 19:29
by columbo
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; ?>

Re: price of pre selected variant not displayed on catalog

Posted: 23 Jan 2020, 10:16
by aimeos
Yes, but that requires looping over all product and check if the variant attributes match with the pre-selected.