php - Tree Structure of Categories? -


i want display categories in tree structure in seller page marketplace extension in magento ce1.7 i'm getting in drop down list not looking great.

any ideas

<?php $_helper = mage::helper('catalog/category') ?>                 <?php $_categories = $_helper->getstorecategories() ?>                 <?php $currentcategory = mage::registry('current_category') ?>                 <?php if (count($_categories) > 0): ?>                     <select id="category" class="myinput-text required-entry widthinput" name="category">                     <option value="">--select categories--</option>                     <?php $_helper = mage::helper('catalog/category') ?>                     <?php $_categories = $_helper->getstorecategories() ?>                     <element onclick="<?php $currentcategory = mage::registry('current_category') ?>">                 <?php if (count($_categories) > 0): ?>                         <?php foreach($_categories $_category): ?>                             <option value="<?php echo $_category->getid() ?>">                                 <a href="<?php echo $_helper->getcategoryurl($_category) ?>">                                         <?php echo $_category->getname() ?></a>                         </option>                                 <?php $_category = mage::getmodel('catalog/category')->load($_category->getid()) ?>                                 <?php $_subcategories = $_category->getchildrencategories() ?>                         <?php if (count($_subcategories) > 0): ?>                                 <?php foreach($_subcategories $_subcategory): ?>                                         <option value="<?php echo $_subcategory->getid() ?>">                                         <?php echo '&nbsp;&nbsp;&nbsp;<img/>'; ?>                                             <a href="<?php echo $_helper->getcategoryurl($_subcategory) ?>">                         <?php echo $_subcategory->getname() ?></a>                             </option>                                 <?php $_subcategory = mage::getmodel('catalog/category/subcategory')->load($_subcategory->getid()) ?>                                 <?php $_subsubcategories = $_subcategory->getchildrencategories() ?>                         <?php if (count($_subsubcategories) > 0): ?>                                 <?php foreach($_subsubcategories $_subsubcategory): ?>                                         <option value="<?php echo $_subsubcategory->getid() ?>">                                         <?php echo '&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;       '; ?>                                         <a href="<?php echo $_helper->getcategoryurl($_subsubcategory) ?>">                         <?php echo $_subsubcategory->getname() ?></a>                         </option>                     <?php endforeach; ?>                 <?php endif; ?>                             <?php endforeach; ?>                         <?php endif; ?>                         <?php endforeach; ?>                 <?php endif; ?></select>                 <?php endif; ?> 

sorry every 1 not duplicate code,in place have change because remaining every thing perfect 500 lines code

thank you


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -