Contact button conditions

  • Posts: 46
  • Thank you received: 2
3 years 11 months ago #318860

-- HikaShop version -- : 4.3
-- Joomla version -- : 3.18
-- PHP version -- : 7.3

Hello,
in the product page, is it possible, simply, to make the contact button appear only for products that are no longer in stock?
thank you in advance for your advice

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
3 years 11 months ago #318893

Hi,

Yes. Activate the contact button for all the products in the HikaShop configuration.
Then, you can add the code:

if($this->element->product_quantity !=0) $contact = 0;
after the code:
$contact = (int)$this->config->get('product_contact', 0);
in the file product / show_default.php via the menu Display>Views.

The following user(s) said Thank You: philament

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

  • Posts: 46
  • Thank you received: 2
3 years 11 months ago #319041

Hello,

I am confused but I do not arrive at the expected result, surely that I made a mistake somewhere. The contact button always remains displayed even if the product has stock.
I paid contact for all products. I placed the provided code of my template, see the capture because it is here that my knowledge stops.



thank you in advance for your clarification

Attachments:

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

  • Posts: 12953
  • Thank you received: 1778
3 years 11 months ago #319045

Hello,

I just tested it on my end with the same customization, and it worked fine. Can you make sure that you properly edited the file of the good front-end template via "Hikashop->Display->Views" ? Thank you.

Kind regards,
Mohamed.

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

  • Posts: 46
  • Thank you received: 2
3 years 11 months ago #319119

hello Mohamed,
I do not understand. I am in the right template, in the view indicated, but the button remains displayed on all products.
Maybe there is another parameter that forces it? but I have not found.
Can you take a closer look? access to the back?

Thank you

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
3 years 11 months ago #319121

Hi,

Either you're using another view file than show_default.php, like show_tabular.php or show_reversed.php (or another one you or your template provider created), or you're not editing the file for the correct template, or your product has variants (and in that case, the code would have to be modified to support variants), or you have some caching system on your website and you need to clear the cache to see the change.
To check which view file to edit, you should activate temporarily the "Display view files" setting of the HikaShop configuration.
It will tell you which view files are used on which page of your website, so you'll be able to confirm that it is show_default.php which is used on the product page or another one.
Also, to check that you're in the correct view file for the correct template, you can just add <?php exit; ?> at the top of the view.
If you get a blank page on the frontend for that page after that, then you're editing the correct view file. If not, then either you have some caching or you're editing the wrong file.

The following user(s) said Thank You: philament

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

Time to create page: 0.087 seconds
Powered by Kunena Forum