- Posts: 1184
- Thank you received: 13
Add button next to a characteristic
2 months 1 week ago #372671
by verzevoul
Add button next to a characteristic was created by verzevoul
-- 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
-- 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
Please Log in or Create an account to join the conversation.
2 months 1 week ago #372674
by nicolas
Replied by nicolas on topic Add button next to a characteristic
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:
and add, just before it:
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.
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:
Code:
$main_html .= '<td>'.$html.'</td></tr>';
and add, just before it:
Code:
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.276 seconds