Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tep_draw_categories_tree finally no recursion just one mysql_query


Recommended Posts

Got it, and it turns out it was pretty easy! Sometimes, you just have to step back, and take a fresh look at things B)

 

My code in post #48 above wasn't working for me, so I tried something else ... I added a new category, called 'Products'. I then put *all* of my Categories and Products *under* this category. Going back to the original code, everything is now working just like I want it :thumbsup:

 

@@gadlol    Two quick questions (if I may) ...

 

1) I have also adapted this plus/minus function to open and close other boxes (Information, Reports, etc). This is working, but the user can only click on the plus/minus sign to expand the menu. How can I include having the user being able to click on the box header or title to expand the menu?

 

 

(code snippet from my Information box module)

        $data  = '<div id="Information" class="panel panel-default no-border hidden-xs hidden-sm">' .
                 '  <div class="panel-body ContentBody">' .
                 '    <ul class="navMain nav-list">';

        $data .= '      <li> ' .
                 '        <div>Information' .
                 '          <a href="" class="switch">' .
                 '            <span class="glyphicon glyphicon-plus-sign '.($sm==1?'glyphicon-minus-sign':'').'">' .
                 '            </span>' .
                 '          </a>' .
                 '        </div>';

        $data .= '        <ul class="navMain nav-list collapse '.($sm==1?'in':'').' ">';

        $data .= '          <div>' .
                 '            <div class="panel-body ContentBody">' . tep_information_show_category(1) . '</div>' .
                 '          </div>';

        $data .= '        </ul>' .
                 '      </li>' .
                 '    </ul>' .
                 '  </div>' .
                 '</div>';

I tried including the 'Information' heading within the <a href> tag, but it doesn't work.

 

2) How can I replace the glyphicon plus and minus symbols with the plain ASCII plus and minus characters?

 

Thank you, everyone!

 

Malcolm

 

 

Hi Malcolm,

 

1) is not advisable because then you will lose the parent link category. Imaging having a category and a subcategory. If you click on the category then it will expand to show all the subcategories but it will not go to the category link. Thats why I used plus minus icons at the beginning. If you still want that feature post a reply so to start a look at it.

 

2)Perhaps if you used html special chars?

Check out the great Alternative Administration System addon for osCommerce!

Link to comment
Share on other sites

  • Replies 57
  • Created
  • Last Reply

@@gadlol

 

Hi Malcolm,

 

1) is not advisable because then you will lose the parent link category. Imaging having a category and a subcategory. If you click on the category then it will expand to show all the subcategories but it will not go to the category link. Thats why I used plus minus icons at the beginning. If you still want that feature post a reply so to start a look at it.

 

2)Perhaps if you used html special chars?

 

1) Yes, please :)

 

Malcolm

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 years later...

Hi,

I am not programmer so no idea how to write my own code.
Installed 234.1 Edge (BS) with few addons.

I wonder this categories tree for front-end will be possible to show up in the admin side. When trying to modify the user.css in the admin side, it will be helpful if this categories tree folder can show up, and when click on the file selected then confirm if the template/skin has changed or not.... (ideally whole website file categories tree...)

Is it possible to do so?

Thanks!  Lyn

Link to comment
Share on other sites

  • 1 year later...

In Phoenix -> bm_categories.php, I changed the level of $OSCOM_CategoryTree->setMaximumLevel() to 3. Now whenever I click on the parent category which contains subcategories, the subcat titles will show up on the tree. This works for me. Is this something that is not permissible?

Quote

    function execute() {
      global $oscTemplate, $cPath;

      $OSCOM_CategoryTree = new category_tree();
      $OSCOM_CategoryTree->setCategoryPath($cPath, '<strong>', '</strong>');
      $OSCOM_CategoryTree->setMaximumLevel(3);
      
      $OSCOM_CategoryTree->setParentGroupString('<div class="list-group list-group-flush">', '</div>', false);
      $OSCOM_CategoryTree->setChildString('', '');
      
      $category_tree = $OSCOM_CategoryTree->getTree();
      
      ob_start();
      include('includes/modules/boxes/templates/tpl_' . basename(__FILE__));
      $data = ob_get_clean();

      $oscTemplate->addBlock($data, $this->group);
    }

 

Link to comment
Share on other sites

@kgtee

This solution works for me also.

Peter

CE PHOENIX SUPPORTER

Support the Project, go PRO and get access to certified add ons

Full-time I am a C-suite executive of a large retail company in Australia. In my spare time, I enjoying learning about web-design.

Download the latest version of CE Phoenix from gitHub here

Link to comment
Share on other sites

5 hours ago, kgtee said:

This works for me. Is this something that is not permissible?

Sure it's the whole point of open source so you can do as you like, you can even add fetures to the cats.  Add the superfish js script to them and you can have them flyout.

https://superfish.joelbirch.design/examples/vertical/

you can see it working on this site frozen BS4 site

superfish cats

 

image.png.789c3b1028b8474103c720603d9c7de8.png

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...