Can you add a custom class to a product detail page?

  • Patrick Toulze
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 3 months ago - 3 years 3 months ago #148781 by Patrick Toulze
I search how to add a custom css class to some product details page to be able to make some distinction between some products.

I was thinking at something that add a custom css class to the <div class="class="product-info"">

SUGGESTION:
That will be a great addition to add customizing power to Product details.

In fact, what I want to do is to add an info to product price when the price shown is a “Starting price” depending of options

I already did an HTML override:
 
I use this code in the layout to be able to translate
Code:
<div class="from-price"><?php echo JText::_('ESHOP_STARTING_PRICE'); ?></div>

 

Now I need to be able to hide or show this depending on the product.
Having the ability to add a custom class on a specific product will make that easy (e.g class: price-from-show or price-from-hide)

 
Last edit: 3 years 3 months ago by Patrick Toulze.

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

  • Patrick Toulze
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 3 months ago - 3 years 3 months ago #148784 by Patrick Toulze
Replied by Patrick Toulze on topic Can you add a custom class to a product detail page?
I even try to use the Custom fields but they doesn’t seem to show in frontend
 

 

Nothing show in front....
Last edit: 3 years 3 months ago by Patrick Toulze.

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

  • Patrick Toulze
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 3 months ago - 3 years 3 months ago #148785 by Patrick Toulze
Replied by Patrick Toulze on topic Can you add a custom class to a product detail page?
I was able to get the product SKU as an added product specific class to the <div class="product-info">

adding this code in the Product detail override like this...
Code:
<div class="product-info <?php echo $this->item->product_sku; ?>">

Sadly the result have an illegal class character “:” in “SKU:“
Code:
<div class="class="product-info SKU: TAK-BOARD_TK-CK-35">

Can I output only the SKU number ?

Having the ability to add a custom class to products will be so much better...

The string seem to validate on W3C:
The uploaded document was successfully checked as HTML 4.01 Strict. This means that the resource in question identified itself as "HTML 4.01 Strict" and that we successfully performed a formal validation of it. The parser implementations we used for this check are based on OpenSP (SGML/XML).
Last edit: 3 years 3 months ago by Patrick Toulze.

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

  • Patrick Toulze
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 3 months ago - 3 years 3 months ago #149028 by Patrick Toulze
Replied by Patrick Toulze on topic Can you add a custom class to a product detail page?
Forget this one, I transform it in a suggestion
SOLVED
Last edit: 3 years 3 months ago by Patrick Toulze.

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

  • Giang Dinh Truong
  • Offline
  • Administrator
  • Administrator
More
3 years 2 months ago #149089 by Giang Dinh Truong
Replied by Giang Dinh Truong on topic Can you add a custom class to a product detail page?
OK no problem Patrick!

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

Moderators: Giang Dinh Truong