Add button next to a characteristic

  • Posts: 1182
  • Thank you received: 13
  • Hikashop Business
5 days 16 hours ago #372671

-- HikaShop version -- : 6.5.1
-- Joomla version -- : 6.1.2

Hi!

Is it possible to add a button next to one characteristic?
For example there are 4 characteristics in this product, one of them is color.
What i want, is to add a button that opens a PDF file next to it with details of the colors.

Thank you

Attachments:

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

  • Posts: 85945
  • Thank you received: 14133
  • MODERATOR
5 days 12 hours ago #372674

Hi,

Yes, this is possible with a view override, which is the clean way since it survives HikaShop updates.

In the backend go to Display > Views, filter the frontend views, and create an override of the "product / show_block_characteristic" view. In that file, find this line:

$main_html .= '<td>'.$html.'</td></tr>';

and add, just before it:
if($characteristic_id == 4) {
	$html .= ' <a class="hikashop_color_pdf" href="YOUR_PDF_URL" target="_blank" rel="noopener">'.hikashop_translate('Δείτε τα χρώματα').'</a>';
}

Replace YOUR_PDF_URL with the address of your uploaded PDF, and the label with the text you want on the button.

The 4 is the id of your "Χρώμα" characteristic (I checked it on your metal bed product). Characteristics are global in HikaShop, so keying on that id makes the button appear next to the color dropdown on every product that uses that characteristic. If you later want it on another characteristic as well, just add its id, for example if($characteristic_id == 4 || $characteristic_id == 59).

To make it look like a real button instead of a plain link, add a little CSS for the hikashop_color_pdf class in your template.

The following user(s) said Thank You: verzevoul

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

Time to create page: 0.053 seconds
Powered by Kunena Forum