bhaskey Posted May 5, 2015 Share Posted May 5, 2015 (edited) I am using PS 1.6.0.14. I have been trying to show "More Sizes Available" on product-list, if a product has combinations. Tries following in product-list.tpl {if (!isset($product.combinations) && $product.combinations > 0)} Tried many other similar conditions but no luck, I could not accomplish the desired. Could someone please hint me what would be the correct condition. Edited May 5, 2015 by bhaskey (see edit history) Link to comment Share on other sites More sharing options...
FullCircles Posted May 5, 2015 Share Posted May 5, 2015 !isset is checking that the variable doesn't exist, so that will be doing the opposite of what you're after. Assuming the variable does indeed exist, this code should do the job: {if !empty($product.combinations)} That is a function which checks if a variable exists and that it isn't empty (bool false, numeric 0, empty array, etc). If you wanted to be a bit more specific to check that it's an array, you could use: {if (isset($product.combinations) && is_array($product.combinations) && count($product.combinations) > 0)} Link to comment Share on other sites More sharing options...
bhaskey Posted May 6, 2015 Author Share Posted May 6, 2015 Thank you for reply. It seems correct, but not working. Even, I have tried every condition seperatly. May be this variable is not passed to product-list, or not assigned. Link to comment Share on other sites More sharing options...
FullCircles Posted May 6, 2015 Share Posted May 6, 2015 Ah, apologies, I didn't spot the product list bit, hmm, I think it isn't available there, no. Would be a bit more involved in that case, you'd need to set up an override file for the front categoryController, then alter the function which returns the product list, called assignProductList, to include an sql query that checks if there are combinations and returns a true/false value. Hmm, actually, checking the query, you might be able to just check if $product.id_product_attribute > 0 .. I think it tries to grab one of the combinations if it can, so that in theory should confirm the existence of them 2 Link to comment Share on other sites More sharing options...
bhaskey Posted May 6, 2015 Author Share Posted May 6, 2015 Hey, You don't need to apologise on anything!!!! And thanks for quick reply. I will try with that, will let you know if I can do it successfully. Link to comment Share on other sites More sharing options...
bhaskey Posted May 7, 2015 Author Share Posted May 7, 2015 Needed to assign a variable to smarty. Solved by creating a small module and hooked it into project-list.tpl. Thanks FullCircles for your help. I will share the module shortly, so maybe someone else could be benifited. 1 Link to comment Share on other sites More sharing options...
alabalcho Posted September 18, 2015 Share Posted September 18, 2015 Hi, I try to do the same! Can your help me? Link to comment Share on other sites More sharing options...
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