The price is not displayed in show_default.php

  • Posts: 350
  • Thank you received: 14
  • Hikaauction Standard Hikamarket Multivendor Hikaserial Subscription Hikashop Business
2 weeks 2 days 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: 2 weeks 2 days ago by neo191987.

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

  • Posts: 66849
  • Thank you received: 9881
  • MODERATOR
2 weeks 2 days 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.054 seconds
Powered by Kunena Forum