krzysiekkcn Posted May 1, 2014 Share Posted May 1, 2014 Hi, I got field with all categories. {foreach $categories AS $category} <option value="{$category['id_category']}" {if $product->id_category_default == $category['id_category']}selected="selected"{/if}>{$category['name']}</option> {/foreach} Where I got: cat1 cat2 cat3 cat3>sub1 cat3>sub2 cat3>sub3 cat4 cat4>sub1 cat5 And I would like to not display category if it has subcategories. (I want display subcategories) cat1 cat2 cat3>sub1 cat3>sub2 cat3>sub3 cat4>sub1 cat5 I tried something with {if $category->level_depth == 0} -> displaying all. {if $category->level_depth == 1}-> displaying none. I'm lame with prestashop coding, so please help me. I can not figure out, what I have to use. Best regards! Link to comment Share on other sites More sharing options...
loulou66 Posted May 1, 2014 Share Posted May 1, 2014 hi i dont test but try {foreach $categories AS $category} {foreach $category AS $subcategory} <option value="{$category['id_category']}-{$subcategory['id_category']}" {if $product->id_category_default == $category['id_category']}-{$subcategory['id_category']} selected="selected"{/if}>{$category['name']}-{$subcategory['name']}</option> {/foreach} {/foreach} @++ Loulou66 Link to comment Share on other sites More sharing options...
krzysiekkcn Posted May 1, 2014 Author Share Posted May 1, 2014 Before change: <option value="0"> -- </option> <option value="45" >Dywanowe obiektowe</option> <option value="42" >Dywanowe pętelkowe</option> <option value="43" >Dywanowe welurowe</option> <option value="50" >Inne</option> <option value="41" >Linoleum</option> <option value="47" >Narzędzia</option> <option value="49" >Narzędzia/Elektryczne</option> <option value="48" >Narzędzia/Ręczne</option> <option value="38" >PCV Akustyczne</option> <option value="39" >PCV Antypoślizgowe</option> <option value="37" >PCV Heterogeniczne</option> <option value="36" >PCV Homogeniczne</option> <option value="44" >PCV Prądoprzewodzące</option> <option value="40" >PCV Ścienne</option> <option value="46" >Sportowe</option> After change: <option value="0"> -- </option> <option value="45-" >Dywanowe obiektowe-</option> <option value="45-D" >Dywanowe obiektowe-D</option> <option value="42-" >Dywanowe pętelkowe-</option> <option value="42-D" >Dywanowe pętelkowe-D</option> <option value="43-" >Dywanowe welurowe-</option> <option value="43-D" >Dywanowe welurowe-D</option> <option value="50-" >Inne-</option> <option value="50-I" >Inne-I</option> <option value="41-" >Linoleum-</option> <option value="41-L" >Linoleum-L</option> <option value="47-" >Narzędzia-</option> <option value="47-N" >Narzędzia-N</option> <option value="49-" >Narzędzia/Elektryczne-</option> <option value="49-N" >Narzędzia/Elektryczne-N</option> <option value="48-" >Narzędzia/Ręczne-</option> <option value="48-N" >Narzędzia/Ręczne-N</option> <option value="38-" >PCV Akustyczne-</option> <option value="38-P" >PCV Akustyczne-P</option> <option value="39-" >PCV Antypoślizgowe-</option> <option value="39-P" >PCV Antypoślizgowe-P</option> <option value="37-" >PCV Heterogeniczne-</option> <option value="37-P" >PCV Heterogeniczne-P</option> <option value="36-" >PCV Homogeniczne-</option> <option value="36-P" >PCV Homogeniczne-P</option> <option value="44-" >PCV Prądoprzewodzące-</option> <option value="44-P" >PCV Prądoprzewodzące-P</option> <option value="40-" >PCV Ścienne-</option> <option value="40-P" >PCV Ścienne-P</option> <option value="46-" >Sportowe-</option> <option value="46-S" >Sportowe-S</option> Link to comment Share on other sites More sharing options...
loulou66 Posted May 2, 2014 Share Posted May 2, 2014 Hi i you dont want the "-" in option value when no subcategory try {foreach $categories AS $category} {foreach $category AS $subcategory} <option value="{$category['id_category']}{if $subcategory['id_category']}-{$subcategory['id_category']}{/if}" {if $product->id_category_default == $category['id_category']}{if $subcategory['id_category']}-{$subcategory['id_category']}{/if} selected="selected"{/if}>{$category['name']}{if $subcategory['name']}-{$subcategory['name']}{/if}</option> {/foreach} {/foreach} @++ Loulou66 Link to comment Share on other sites More sharing options...
krzysiekkcn Posted May 4, 2014 Author Share Posted May 4, 2014 Not realy. Maybe I wrote something wrong. I got categories like that: Category1 Category2 --> Sub1 --> Sub2 Category3 Category4 -->Sub3 -->Sub4 -->Sub5 ------->Sub6 ------->Sub7 ------------>Sub8 ------------>Sub9 Category5 I want to display BOLD ones. Display only last in hierarchy. If category do not have anysubcategories, then display it. Link to comment Share on other sites More sharing options...
loulou66 Posted May 4, 2014 Share Posted May 4, 2014 HI the its same but not display the $category['name' ] if $subcategory['name' ] exist {foreach $categories AS $category} {foreach $category AS $subcategory} <option value="{$category['id_category']}{if $subcategory['id_category']}-{$subcategory['id_category']}{/if}" {if $product->id_category_default == $category['id_category']}{if $subcategory['id_category']}-{$subcategory['id_category']}{/if} selected="selected"{/if}>{if $subcategory['name']}-{$subcategory['name']}{else}{$category['name']}{/if}</option> {/foreach} {/foreach} @++ Loulou66 Link to comment Share on other sites More sharing options...
krzysiekkcn Posted May 4, 2014 Author Share Posted May 4, 2014 I did image to help explain this. As you will see, things that should be hidden are still there, But some new appears. I'm so sorry that I do not understand what is going on there. I hope we would find solution. Link to comment Share on other sites More sharing options...
loulou66 Posted May 4, 2014 Share Posted May 4, 2014 Hi weird why that only display 1st letter of subcategory but its for a module ? can you put the zip file of module and version of PS @++ Loulou66 Link to comment Share on other sites More sharing options...
krzysiekkcn Posted May 5, 2014 Author Share Posted May 5, 2014 Oh. That's not that easy. I bought it and I think sharing this module wouldn't be fair for the creators. BTW. I do not think so we will found something there, because it is locked like that:\x47\x4c\x4fBA\x4c\x53"}["\x75\x6ewq\x75\x71\x68"]="c\x61te\x67o\x72y";${"\x47\x4c\x4f\x42\x41L\x5 But do you think If I'll put this into theme header it should work? Because it is not realy :/ Link to comment Share on other sites More sharing options...
loulou66 Posted May 5, 2014 Share Posted May 5, 2014 Hi OH he is encoded ^^ http://ddecode.com/hexdecoder/ yes you can put in html @++ loulou66 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