mitzayapa Posted May 3, 2018 Share Posted May 3, 2018 (edited) Hey guys , i know theres a better way of checking a products default category , right now im using : {if $product->id_category_default == 38 || $product->id_category_default == 107 || $product->id_category_default == 89 || $product->id_category_default == 106 || $product->id_category_default == 172 || $product->id_category_default == 174 || $product->id_category_default == 153 || $product->id_category_default == 156 || $product->id_category_default == 29 || $product->id_category_default == 35 || $product->id_category_default == 135 || $product->id_category_default == 165 || $product->id_category_default == 166 || $product->id_category_default == 155 || $product->id_category_default == 167 || $product->id_category_default == 173 || $product->id_category_default == 157 || $product->id_category_default == 158 || $product->id_category_default == 105 || $product->id_category_default == 30 || $product->id_category_default == 159 || $product->id_category_default == 42 || $product->id_category_default == 65 || $product->id_category_default == 39} it works , but i don't think its a good option. i've tried : {assign var=categoriaceptada value=[38,107,89,106,172,174,153,156,29,35,135,165,166,155,167,173,157,158,105,30,159,42,65,39,63]} {if $product->id_category_default == is_array($categoriaceptada)} do something bla bla {/if} but it doesn't work. Edited May 16, 2018 by mitzayapa (see edit history) Link to comment Share on other sites More sharing options...
jgamio Posted May 4, 2018 Share Posted May 4, 2018 You are doing a bad == I haven't try it but try something like these {if in_array($product->id_category_default, $categoriaceptada)} Link to comment Share on other sites More sharing options...
mitzayapa Posted May 16, 2018 Author Share Posted May 16, 2018 Awesome! Thanks alot. 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