Using login on custom fields

  • Posts: 66
  • Thank you received: 1
3 years 5 months ago #336017

-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.9.2

I have a Checkbox custom field, with only 'Yes' that can be selected.

Ideally, I'd like to show a button on the product frontend if the Checkbox is set to Yes.

Is this possible please?

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

  • Posts: 4816
  • Thank you received: 654
  • MODERATOR
3 years 5 months ago #336021

Hello,

So far from, I think that it's possible, but can you elaborate a little more in order to better understand the purpose and the context.
But we can already invite you to check in your custom field the "display limited to", with this you can condition the display of a custom field from another custom field value :



Provide elements like relative screenshot settings, url link to the page where you want to use this button and the custom field.

Awaiting your elements in order to go more far on your subject.
Regards

Last edit: 3 years 5 months ago by Philip.

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

  • Posts: 66
  • Thank you received: 1
3 years 5 months ago #336096

Thanks for your reply.

I have setup a Checkbox custom field in the backend and this is showing on the products page as follows:



If this is showing on a product page, I'd like it to perform the same type of function as the Contact Us button:



I just need to know if I can show only this code and style it accordingly?

Attachments:
Last edit: 3 years 5 months ago by Storm.

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

  • Posts: 83402
  • Thank you received: 13496
  • MODERATOR
3 years 5 months ago #336097

Hi,

Well, if you want to show a button only if a custom product field is set to yes, you need to edit a view file (product / show_default.php for example), via the menu Display>Views and add such code:

if(!empty($this->element->xxx) && $this->element->xxx == 'Yes') {
echo '<input type="button" value="1" onclick="alert(\'button clicked\');" name="Need help ?"/>';
}
where xxx is the column name of the custom product field and Yes the value for which you want the button HTML to display.

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

Time to create page: 0.064 seconds
Powered by Kunena Forum