{"id":29,"date":"2009-07-06T00:32:00","date_gmt":"2009-07-06T00:32:00","guid":{"rendered":"http:\/\/www.codeboss.in\/web-funda\/?p=29"},"modified":"2009-07-06T00:32:00","modified_gmt":"2009-07-06T00:32:00","slug":"zen-cart-multi-level-category-slide-out-menu","status":"publish","type":"post","link":"https:\/\/codeboss.in\/web-funda\/2009\/07\/06\/zen-cart-multi-level-category-slide-out-menu\/","title":{"rendered":"Zen Cart Multi Level Category Slide Out Menu"},"content":{"rendered":"<p><strong>This hack is now available as a downloadable plugin from the Zen Cart site. Please visit <a href=\"http:\/\/www.zen-cart.com\/index.php?main_page=product_contrib_info&#038;products_id=1959\" target=\"_blank\" rel=\"noopener\">this link<\/a> to download it.<\/p>\n<p>The <a href=\"http:\/\/www.zen-cart.com\/index.php?main_page=product_contrib_info&#038;products_id=1959\" target=\"_blank\" rel=\"noopener\">plugin<\/a> uses separate files of its own and doesn&#8217;t need any of the existing files to be updated.<\/strong><\/p>\n<p>The Zen Cart Category Menu shows only the sub categories of the currently selected category. Also the way it is shown is not visually great at all. With big category names and a few levels it gets uglier.<\/p>\n<p>The solution can be a slide out menu. As the sub categories slide out, they will make their own room and not look ugly.<\/p>\n<p>For this two modification needs to be made to the existing Zen Cart system.<\/p>\n<p>1. Call all categories and subcategories in a single page<br \/>\n2. Make them slide out<\/p>\n<p>Lets see the steps for the first requirement<\/p>\n<p>1. Open the file includes\\functions\\functions_categories.php<br \/>\n2. Add the following function<\/p>\n<pre class=\"brush: php;\">\n\/\/\/\/\/\/ Get ul li\nfunction zen_get_categories_ul_li($categories_ul_li = '', $parent_id = '0', $cpath = '') {\nglobal $db;\n\n$categories_query = \"select c.categories_id, cd.categories_name, c.categories_status\n                     from \" . TABLE_CATEGORIES . \" c, \" . TABLE_CATEGORIES_DESCRIPTION . \" cd\n\t\t\t\t\t where \" . $zc_status . \"\n\t\t\t\t\t parent_id = '\" . (int)$parent_id . \"'\n\t\t\t\t\t and c.categories_status = TRUE\n\t\t\t\t\t and c.categories_id = cd.categories_id\n\t\t\t\t\t and cd.language_id = '\" . (int)$_SESSION['languages_id'] . \"'\n\t\t\t\t\t order by sort_order, cd.categories_name\";\n\t\t\t\t\t \n$categories = $db->Execute($categories_query);\n$categories_ul_li .= \"<ul>\";\nwhile (!$categories->EOF) {\n$dpath = $cpath.$categories->fields['categories_id'];\n$categories_ul_li .= \"<li><a href='index.php?main_page=index&amp;cPath=$dpath'>\".$categories->fields['categories_name'].'<\/a>';\nif ($categories->fields['categories_id'] != $parent_id) {\nif(zen_has_category_subcategories($categories->fields['categories_id'])){\n$categories_ul_li = zen_get_categories_ul_li($categories_ul_li, $categories->fields['categories_id'], $dpath.= \"_\");\n}\n$categories_ul_li .= \"<\/li>\";\n$categories->MoveNext();\n}\n$categories_ul_li .= \"<\/ul>\";\nreturn $categories_ul_li;\n}\n<\/pre>\n<p>3. Open the file includes\\templates\\{your_template_name}\\sideboxes\\tpl_categories.php<br \/>\n4. Comment out the entire loop  &#8211;<br \/>\nfor ($i=0;$i&lt;sizeof($box_categories_array);$i++) {  &#8230;..   }<br \/>\n5. After that add the following lines<\/p>\n<pre class=\"brush: php;\">\n$content .= '<div id=\"dhtmlgoodies_menu\" style=\"visibility: hidden;\">';\n$content .=  zen_get_categories_ul_li();\n$content .= '<\/div>';\n<\/pre>\n<p>This would show the entire category \/ sub category using ul , li<\/p>\n<p>Now for getting the slide out effect I have done the following<\/p>\n<p>1. Download the slide out menu from DHTML Goodies &#8211; http:\/\/www.dhtmlgoodies.com\/scripts\/dhtmlgoodies-slide-out-menu\/dhtmlgoodies-slide-out-menu.html<br \/>\n2. Use the slide out menu new version which supports multi level.<\/p>\n<p>That&#8217;s it \ud83d\ude00<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This hack is now available as a downloadable plugin from the Zen Cart site. Please visit this link to download it. The plugin uses separate files of its own and doesn&#8217;t need any of the existing files to be updated. The Zen Cart Category Menu shows only the sub categories of the currently selected category.&hellip; <a class=\"more-link\" href=\"https:\/\/codeboss.in\/web-funda\/2009\/07\/06\/zen-cart-multi-level-category-slide-out-menu\/\">Continue reading <span class=\"screen-reader-text\">Zen Cart Multi Level Category Slide Out Menu<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[57,62,66],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-php","tag-recurssion","tag-zen-cart","entry"],"_links":{"self":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts\/29","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/comments?post=29"}],"version-history":[{"count":0,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"wp:attachment":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/tags?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}