Custom text before price

  • Posts: 1170
  • Thank you received: 13
  • Hikashop Business
1 week 3 days ago #372306

-- HikaShop version -- : 6.5.0
-- Joomla version -- : 6.1.1

Hi!

Before the price i added a custom text "Our price" in the view file.
The thing is that i have characteristics in the products and when you select a characteristic from the dropdown, that texts disappears.
How can i have it there for all characteristic prices as well?

Thank you

Attachments:

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

  • Posts: 85796
  • Thank you received: 14089
  • MODERATOR
1 week 3 days ago #372310

Hello,

When you select a characteristic, HikaShop does not just refresh the price value: it replaces the whole content of the price container (the element with the id hikashop_product_price_main) with a hidden block that was pre-rendered for the chosen variant. Your "Our price" text sits inside that container, so it gets overwritten by the variant block.

The base price and every variant price are all rendered by the same price layout, listing_price.php. So that is where your text belongs: add "Our price" at the top of listing_price.php (through a template override). It then becomes part of the main price block and of each variant block, so it stays in place when the content is swapped in.

One thing to keep in mind: listing_price.php is also used for the product listings (category pages), so the text would show there too. If you want it only on the product page, then instead add it just before the price container, outside it, in your product page layout (show_default.php, or the layout matching your product page setting):

Our price
<span id="hikashop_product_price_main" class="hikashop_product_price_main">
...
</span>

Only the content inside that span is replaced, so anything placed before it is kept when you change the characteristic.

The following user(s) said Thank You: verzevoul

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

Time to create page: 0.045 seconds
Powered by Kunena Forum