jul_ste Posted November 30, 2013 Share Posted November 30, 2013 I've been struggling with a modification on the top menu of a PS 1.5.6 store. We'd like to use the CMS home directory but rather than having "home" link to the CMS home page (/index.php?id_cms_category=1) have it link to the base or index page as the catalog "home" link. Is this possible? I appreciate any assistance you can send my way! Thanks, JS Link to comment Share on other sites More sharing options...
ibndawood Posted November 30, 2013 Share Posted November 30, 2013 Hi, The problem you are facing is you are adding Home from the CMS page. In order to link to your home page you can either use : Home from Category like the one below: Or you can create a new Menu Top link like this and then add to the menu: Hope this helps. 1 Link to comment Share on other sites More sharing options...
jul_ste Posted November 30, 2013 Author Share Posted November 30, 2013 Thanks, but the category home page drops down to the product categories. We want to have one menu item that links to the index and drops down to the CMS pages. I could put a static home button to link to the index and another that drops to CMS but would rather eliminate the need for two separate menu items. So instead of Home (index) - category 1 - category 2 - category 3 or Home (cms) - cms 1 - cms 2 - cms 3 We'd like it to list as this: Home (index) - cms 1 - cms 2 - cms 3 Any suggestion on how this might be possible? thanks again, js Link to comment Share on other sites More sharing options...
ibndawood Posted November 30, 2013 Share Posted November 30, 2013 Unfortunately it is not possible with default Module. However you can write custom code to achieve this. You want me to suggest the code changes ? You'd be able to do it ? Link to comment Share on other sites More sharing options...
ibndawood Posted November 30, 2013 Share Posted November 30, 2013 This is how you custom code. In modules/blocktopmenu/blocktopmenu.php look for method private function makeMenu() makeMenu is the method that builds your menu. There is a switch case in that method. Look for case 'CMS_CAT': $category = new CMSCategory((int)$id, (int)$id_lang); if (count($category)) { $this->_menu .= '<li><a href="'.$category->getLink().'">'.$category->name.'</a>'; $this->getCMSMenuItems($category->id); $this->_menu .= '</li>'.PHP_EOL; } break; The Home CMS category is always 1 so I am going to write a code that will replace the URL of cms_category_1 to shop base url like this : case 'CMS_CAT': $category = new CMSCategory((int)$id, (int)$id_lang); if (count($category)) { if($category->id === 1){ $this->_menu .= '<li><a href="'.__PS_BASE_URI__.'">'.$category->name.'</a>'; }else{ $this->_menu .= '<li><a href="'.$category->getLink().'">'.$category->name.'</a>'; } $this->getCMSMenuItems($category->id); $this->_menu .= '</li>'.PHP_EOL; } break; Hope this should work. This is quick fix. If you want to keep the code on upgrades then you have to use Module Overrides. Read this to get an idea : https://gist.github.com/JulienBreux/2287709 2 Link to comment Share on other sites More sharing options...
manzotin Posted January 7, 2014 Share Posted January 7, 2014 (edited) Hi ibndawood I used your code and it worked great! Problem is now i need multiple cms sections on my menu, and i'm forced to this kind of situation: Home (root category, not shown in menu) Category1 (must be shown in the menu) - page 1 - page 2 Category2 (no need to be shown in the menu) - page 3 (must be shown as a menu main item) I want my Category1, which has ID=2, to link at homepage. I modified your code in the following way but it didn't worked: if($category->id === 2) It should do the trick but it doesn't! Am i missing something? I am working on local so i am afraid i can't link to my site =( Thanks!! Edited January 7, 2014 by manzotin (see edit history) Link to comment Share on other sites More sharing options...
codelicus Posted April 6, 2014 Share Posted April 6, 2014 Hi! Is this possible? cms - category 1 - category 2 - category 3 thanks for your help! Link to comment Share on other sites More sharing options...
sathishinla Posted May 16, 2014 Share Posted May 16, 2014 can anyone help me how can i change the home(category=2) url into my shop url.. how i sort defaultly by discount percentage?? Link to comment Share on other sites More sharing options...
anne81 Posted October 14, 2014 Share Posted October 14, 2014 Hi ibndawood, I've used your code for 1.6 - thanks for that - and it seems to work succesfully for desktop/laptop but not for mobile devices (ipad). Any suggestions how to adjust that? Thanks! Link to comment Share on other sites More sharing options...
Redous Posted September 10, 2015 Share Posted September 10, 2015 Hi ibndawood, I've used your code for 1.6 - thanks for that - and it seems to work succesfully for desktop/laptop but not for mobile devices (ipad). Any suggestions how to adjust that? Thanks! Hi, Would you be able to paste your code here so that we can take a look? Link to comment Share on other sites More sharing options...
Recommended Posts