how van I change the layout/styling of the product tag output

  • Posts: 323
  • Thank you received: 24
1 month 3 weeks ago #370964

-- HikaShop version -- : 6.4.0
-- Joomla version -- : 6.0.3
-- PHP version -- : 8.4

Hi,

Just wondering how I can use the producttag plugin to show, for example, a linked price inside a line of text.

Example:
By this product for [price] in april.

Now I see the tags being converted into a div on a new line.
Tried this tutorial : www.hikashop.com/support/documentation/1...-product-insert.html but for some reason this is not working.

Any tips are very welcome.

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

  • Posts: 85609
  • Thank you received: 14016
  • MODERATOR
1 month 3 weeks ago #370976

Hi,

The product insert plugin (`{product 123|price}`) renders each product as a block-level `<div>` element, which is why it displays on a separate line instead of inline within your text.

To display just the price inline within a sentence, you have two options:

Option 1: CSS override

Add this CSS to your template to make the inserted product render inline:

div[id^="hikashop_inserted_product_"] {
    display: inline;
    text-align: inherit;
}
div[id^="hikashop_inserted_product_"] .hikashop_product_price_main {
    display: inline;
}

Option 2: Template override of the product insert view

Create a file called `hikashopproductinsert_view.php` in your Joomla template's `system` folder (e.g. `templates/your_template/system/hikashopproductinsert_view.php`). Copy it from `plugins/system/hikashopproductinsert/hikashopproductinsert_view.php` and change line 23 from:
echo'<div id="hikashop_inserted_product_'.$product->product_id.'" class="hikashop_inserted_product_'.$product->product_id.'" style="text-align:center;">';

to:
echo'<span id="hikashop_inserted_product_'.$product->product_id.'" class="hikashop_inserted_product_'.$product->product_id.'">';

And change line 160 from `echo'</div>';` to `echo'</span>';`.

This will make the product insert render as an inline `<span>` instead of a block `<div>`, allowing it to flow within your sentence text.

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

  • Posts: 323
  • Thank you received: 24
1 month 3 weeks ago #370988

Hi Nicolas,
I found my issue regarding the override, it was a child template... overlooked that in a smaller screen.
Your suggestions works perfect. Small thing for others reading this is that for version 6.4.0 the line numbers are 33 and 164.

The CSS solution is still placing the span outside the paragraph tags.

The following user(s) said Thank You: nicolas

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

Time to create page: 0.044 seconds
Powered by Kunena Forum