Separate price and currency

  • Posts: 2
  • Thank you received: 0
10 years 1 month ago #200665

-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3
-- PHP version -- : 5.3
-- Browser(s) name and version -- : Chrome
-- Error-message(debug-mod must be tuned on) -- : Hello!
I'm need to display separately "price" and "currency" because i want to insert microdata for "offers/price" and "offers/priceCurrency/" How i can display price and currency in individual 's?

like this:

Hello!
I'm need to display separately "price" and "currency" because i want to insert microdata for "offers/price" and "offers/priceCurrency/" How i can display price and currency in individual <span>'s?

like this:

<span id="hikashop_product_price_with_options_main" class="hikashop_product_price_with_options_main">
<span class="hikashop_option_price_title">Цена:</span>
<span class="hikashop_option_price_value"><span itemprop="price">4 000,00</span> <span itemprop="currency">USD</span>
</span>


View - option price.php

Last edit: 10 years 1 month ago by kun333.

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

  • Posts: 83935
  • Thank you received: 13596
  • MODERATOR
10 years 1 month ago #200670

Hi,

HikaShop already has microdata which supports prices with their currency. You can simply enable the microdata plugin via the Joomla plugins manager for that.
So you shouldn't have to do that.

If nevertheless you want to do it with custom code, you should do differently and instead of separating the price and the currency, you should add such tag in the views where the prices are added:

<?php $currency_id = hikashop_getCurrency();
				$null = null;
				$currencyClass = hikashop_get('class.currency');
				$currencies = $currencyClass->getCurrencies($currency_id,$null);
				$data=$currencies[$currency_id]; ?>
<meta itemprop="priceCurrency" content="'.$data->currency_code.'" />

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

Time to create page: 0.053 seconds
Powered by Kunena Forum