Add text to specific product

  • Posts: 40
  • Thank you received: 0
11 years 1 month ago #165793


-- Joomla version -- : 2.5

Hi

I would like to add a small line of text to appear above the add to cart button. It would only appear on certain products, not all of them. It would also need to be visible on both the product listing page and the product page itself.

I have included a little mock-up as an example.
It doesn't have to appear in all the areas I have shown.

Is there a way to do this?

Attachments:

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

  • Posts: 2334
  • Thank you received: 403
11 years 1 month ago #165794

Hi there,

Do you want to include a static text?
What I would suggest is to edit the different views you want to customize (check our documentation here: www.hikashop.com/support/support/documen...-display.html#layout ) to add your text with a simple check.

For example, if all the products you want to be affected belong to the same category, you can operate a check on the category before displaying your text. Example in listing_img_title:

if($this->row->category_id==2) //2 to be treplaced with the id of your category
echo "your text";

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

  • Posts: 40
  • Thank you received: 0
11 years 1 month ago #165920

The products I wish to add static text to do belong to a specific category but I do not wish to affect all the products in that category. I only want to add the text to a few products.

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

  • Posts: 2334
  • Thank you received: 403
11 years 1 month ago #165925

Then you can use the same kind of code with a different condition:

$products_affected = array(1,2,15,16) //to be replaced with the ids of your products
if(in_array($this->row->product_id, $products_affected) {

}

Or simply put all your products in a new category not visible on the front end (easier to handle on a long term, you don't have to edit the code and add the new products ids).

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

Time to create page: 0.073 seconds
Powered by Kunena Forum