The price is not displayed in show_default.php

  • Posts: 427
  • Thank you received: 19
5 years 2 months ago #310525

-- HikaShop version -- : 4.2.1

Hi, I'm having trouble displaying the price in show_default.php when there are variants.
I realized that the problem comes from the method I use: Characteristics selection method: List
In listing_img_title.php shows the lowest price as it should be, but show_default.php shows empty value. How do I fix this problem?

This is the default code:

<?php $itemprop_offer = ''; if (!empty($this->element->prices)) $itemprop_offer = 'itemprop="offers" itemscope itemtype="https://schema.org/Offer"'; ?>
<span id="hikashop_product_price_main" class="hikashop_product_price_main" <?php echo $itemprop_offer; ?>>
<?php $main =& $this->element; if(!empty($this->element->main)) $main =& $this->element->main; if(!empty($main->product_condition) && !empty($this->element->prices)) { ?>
<meta itemprop="itemCondition" itemtype="https://schema.org/OfferItemCondition" content="https://schema.org/<?php echo $main->product_condition; ?>" />
<?php } if($this->params->get('show_price') && (empty($this->displayVariants['prices']) || $this->params->get('characteristic_display') != 'list')) { $this->row =& $this->element; $this->setLayout('listing_price'); echo $this->loadTemplate(); if (!empty($this->element->prices)) { ?>
<meta itemprop="availability" content="https://schema.org/<?php echo ($this->row->product_quantity != 0) ? 'InStock' : 'OutOfstock' ;?>" />
<meta itemprop="priceCurrency" content="<?php echo $this->currency->currency_code; ?>" />
<?php	} } ?>
</span>

Last edit: 5 years 2 months ago by neo191987.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 2 months ago #310533

Hi,

On the product page, in "list" mode, the price of the main product is not displayed if variants have their own price. Instead, the price is displayed for each variant in the table listing the variants on the page.
If you still want to display the price of the main product, you can remove the code:

|| $this->params->get('characteristic_display') != 'list')
from the code you copy/pasted.

The following user(s) said Thank You: neo191987

Please Log in or Create an account to join the conversation.

Time to create page: 0.057 seconds
Powered by Kunena Forum