- Posts: 640
- Thank you received: 16
Do not show image module if no images assigned
- PeterChain
-
Topic Author
- Offline
Less
More
11 years 8 months ago #185639
by PeterChain
Do not show image module if no images assigned was created by PeterChain
-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6
For some products I have no images assigned to them, not even a single one, so in this case I would like my custom view to show images under a certain criteria from a certain folder.
This is no problem to do but I want HikaShop not to try to load the default image module or a third party images module in the case there is no one image assigned to a product.
How in the code can I make the default image module not to render if no images are detected?
And, how can I tell my custom view that custom code should be executed if no image is assigned.
To make it simpler: How can i get a True or False value for images available in a product view?
Thank you.
-- Joomla version -- : 3.3.6
For some products I have no images assigned to them, not even a single one, so in this case I would like my custom view to show images under a certain criteria from a certain folder.
This is no problem to do but I want HikaShop not to try to load the default image module or a third party images module in the case there is no one image assigned to a product.
How in the code can I make the default image module not to render if no images are detected?
And, how can I tell my custom view that custom code should be executed if no image is assigned.
To make it simpler: How can i get a True or False value for images available in a product view?
Thank you.
Please Log in or Create an account to join the conversation.
11 years 8 months ago #185644
by nicolas
Replied by nicolas on topic Do not show image module if no images assigned
So if I understand, you're talking about the product page image display, not product listing modules ?
In that case, you'll want to edit the file "show_block_img" via the menu Display>Views and add such code at the beginning:
In that case, you'll want to edit the file "show_block_img" via the menu Display>Views and add such code at the beginning:
Code:
<?php
if(empty($this->element->images)){
// your custom code here
return; //to not display the HTML of the default image
} ?>
The following user(s) said Thank You: PeterChain
Please Log in or Create an account to join the conversation.
Time to create page: 0.182 seconds