How can I test in a theme template file whether or not a display hook has data?
Inside the /themes/themename/product.tpl file there is a hook to check for out of stock conditions and displays an input field, button, or nothing depending on whether not there should be a notification for mailalerts module.
I used the following test just prior to $HOOK_PRODUCT_OOS in the product.tpl file to prevent the div from being displayed if the element wasn't supposed to be displayed as this disrupted my theme by having it display regardless:
I have run in to a similar situation with the /themes/themename/product-list-item.tpl file where the test gets populated regardless of any hook data using the following code:
The reason this happens is because the variable/array $show_functional_buttons gets populated in the /themes/themename/product-list.tpl with this code:
As you can see, it only matters whether we are viewing 'index' or not - which really is not a valid test in my opinion. What I want to do is either unset this variable or change it to false if the hook named "displayProductListFunctionalButtons" actually has data - which it should not if the wishlist module or similar isn't active and I have set the "product compare" setting in [ preferences / products ] configuration page to "0".
Question
Obi
How can I test in a theme template file whether or not a display hook has data?
Inside the /themes/themename/product.tpl file there is a hook to check for out of stock conditions and displays an input field, button, or nothing depending on whether not there should be a notification for mailalerts module.
I used the following test just prior to $HOOK_PRODUCT_OOS in the product.tpl file to prevent the div from being displayed if the element wasn't supposed to be displayed as this disrupted my theme by having it display regardless:
I have run in to a similar situation with the /themes/themename/product-list-item.tpl file where the test gets populated regardless of any hook data using the following code:
The reason this happens is because the variable/array $show_functional_buttons gets populated in the /themes/themename/product-list.tpl with this code:
{$show_functional_buttons = $page_name != 'index'}
As you can see, it only matters whether we are viewing 'index' or not - which really is not a valid test in my opinion. What I want to do is either unset this variable or change it to false if the hook named "displayProductListFunctionalButtons" actually has data - which it should not if the wishlist module or similar isn't active and I have set the "product compare" setting in [ preferences / products ] configuration page to "0".
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now