Cale Posted May 4, 2014 Share Posted May 4, 2014 (edited) Hi, I would like to move the cart into the block topmenu, I tried this way : - Created a hook named displayTopMenu (in the database ps_hook) manually - Edited the blockcart.php , added in function install() : || $this->registerHook('displayTopMenu') == false and created a function hookDisplayTopMenu : public function hookDisplayTopMenu($params) { return $this->hookTop(); } - Placed the hook in the TopMenu.tpl <li>{hook h='displayTopMenu'}</li> - Added the module Cart in displayTopMenu in backoffice module position It works... (i have my module where i want) but the cart now bugs. I suppose it's because of what i wrote in the function ( return $this->hookTop(); ) , i tried many other things, but it still doesn't work. In picture, i have this : and i want this : Thank you in advance for you help ! Edited May 4, 2014 by Cale (see edit history) 1 Link to comment Share on other sites More sharing options...
dioniz Posted May 4, 2014 Share Posted May 4, 2014 Is it possible to see your site? Link to comment Share on other sites More sharing options...
vekia Posted May 4, 2014 Share Posted May 4, 2014 you can do it without new hook. move cart block right after the block top menu module on displayTop modules list (on page: modules > positions) then modify blocktopmenu.tpl (in theme directory) change code: {if $MENU != ''} <!-- Menu --> <div id="block_top_menu" class="sf-contener clearfix col-lg-12"> <div class="cat-title">{l s="Categories" mod="blocktopmenu"}</div> <ul class="sf-menu clearfix menu-content"> {$MENU} {if $MENU_SEARCH} <li class="sf-search noBack" style="float:right"> <form id="searchbox" action="{$link->getPageLink('search')|escape:'html':'UTF-8'}" method="get"> <p> <input type="hidden" name="controller" value="search" /> <input type="hidden" value="position" name="orderby"/> <input type="hidden" value="desc" name="orderway"/> <input type="text" name="search_query" value="{if isset($smarty.get.search_query)}{$smarty.get.search_query|escape:'html':'UTF-8'}{/if}" /> </p> </form> </li> {/if} </ul> </div> <!--/ Menu --> {/if} to: <!-- Menu --> <div id="block_top_menu" class="sf-contener clearfix col-lg-12"> <div class="cat-title">{l s="Categories" mod="blocktopmenu"}</div> <ul class="sf-menu clearfix menu-content"> {$MENU} {if $MENU_SEARCH} <li class="sf-search noBack" style="float:right"> <form id="searchbox" action="{$link->getPageLink('search')|escape:'html':'UTF-8'}" method="get"> <p> <input type="hidden" name="controller" value="search" /> <input type="hidden" value="position" name="orderby"/> <input type="hidden" value="desc" name="orderway"/> <input type="text" name="search_query" value="{if isset($smarty.get.search_query)}{$smarty.get.search_query|escape:'html':'UTF-8'}{/if}" /> </p> </form> </li> {/if} </ul> then in blockcart.tpl at the end of this file add: </div> you can stylize position of the block with position:absolute; right:0px; top:0px; 2 Link to comment Share on other sites More sharing options...
Cale Posted May 4, 2014 Author Share Posted May 4, 2014 (edited) Vekia, thank you so much again for your help ! You saved me Edited May 4, 2014 by Cale (see edit history) Link to comment Share on other sites More sharing options...
emma1 Posted May 7, 2014 Share Posted May 7, 2014 I cant get this to work? Where should i add the </div> tag? Link to comment Share on other sites More sharing options...
b1ker Posted May 7, 2014 Share Posted May 7, 2014 Neither can i, block cart displays under top menu. Even after removing padding from css. Link to comment Share on other sites More sharing options...
vekia Posted May 7, 2014 Share Posted May 7, 2014 it's necessary to: 1) reconfigure top menu module (click save on module configuration page - contents will be generated again with changes you applies) 2) recompile entire theme and turn of cache (TEMPORARILY) Link to comment Share on other sites More sharing options...
emma1 Posted May 7, 2014 Share Posted May 7, 2014 That solved it. Thank you vekia Link to comment Share on other sites More sharing options...
itiago50 Posted May 14, 2014 Share Posted May 14, 2014 Hello Vekia, I tried the settings you described, but it does not work.The code in the 'blocktopmenu.tpl' is well configured?The blockcart still appears just below the 'blocktopmenu'. Please, can you be more specific? Thank you. Link to comment Share on other sites More sharing options...
tharacus Posted August 19, 2014 Share Posted August 19, 2014 I am using this code for fixed top horizontal menu. I would like same thing like Cale - put the cart inside the menu. Does anybody know how? I tried code for Vekia, but it does not work.themes/default-bootstrap/js/modules/blocktopmenu/js/hoverIntent.js var sticky = $('.sf-menu').offset().top; $(window).scroll(function(){ if ($(window).width() > 1182){ if( $(window).scrollTop() > sticky ) { $('.sf-menu').css({position: 'fixed', top: '0px','max-width':'1170px'}); } else { $('.sf-menu').css({position: 'relative','max-width':'1170px'}); } } if ($(window).width() > 974 && $(window).width() < 1183 ){ if( $(window).scrollTop() > sticky ) { $('.sf-menu').css({position: 'fixed', top: '0px','max-width':'940px'}); } else { $('.sf-menu').css({position: 'relative','max-width':'940px'}); } } if ($(window).width() > 750 && $(window).width() < 975){ if( $(window).scrollTop() > sticky ) { $('.sf-menu').css({position: 'fixed', top: '0px','max-width':'720px'}); } else { $('.sf-menu').css({position: 'relative','max-width':'720px'}); } } }); Link to comment Share on other sites More sharing options...
vekia Posted August 19, 2014 Share Posted August 19, 2014 what prestashop version you use? Link to comment Share on other sites More sharing options...
tharacus Posted August 19, 2014 Share Posted August 19, 2014 (edited) 1.6.0.9http://bruslenivbrne.cz/micro/ Edited August 19, 2014 by tharacus (see edit history) Link to comment Share on other sites More sharing options...
herbee Posted August 27, 2014 Share Posted August 27, 2014 Hi Vekia a try everthing but nothing.. my website: http://beta.plysaci.com presta 1.6.0.7 Link to comment Share on other sites More sharing options...
vekia Posted August 28, 2014 Share Posted August 28, 2014 Hi Vekia a try everthing but nothing.. my website: http://beta.plysaci.com presta 1.6.0.7 your cart is out of block top menu do you modified block top menu .tpl file? (remove closing divs, move them to block cart module) 1.6.0.9 http://bruslenivbrne.cz/micro/ the same as above :-) Link to comment Share on other sites More sharing options...
ricky11 Posted September 16, 2014 Share Posted September 16, 2014 (edited) Hi Vekia, When you suggest to edit blockcart.tpl and blocktopmenu.tpl there are two locations which this file can be found one is within /public_html/themes/default-bootstrap/modules/blockcart/blockcart.tpl or another is /public_html/modules/blockcart/blockcart.tpl You stated it is within the theme folder right? Recompiled / Turn of Cache / Refresh Browser / Edited 2 tpl files / moved position in displaytop. Now position sequence is quicksearch,cartblock,top horizontal menu in displaytop. looks all okay. Seem to have tried everything but still can't get it to work.. It still shows the cart block underneath the top menu. Using 1.609 Also i noticed you asked us to paste the code without the {if $MENU != ''} ? Thanks for your help. Edited September 16, 2014 by ricky11 (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted September 16, 2014 Share Posted September 16, 2014 is there any chance to see how it looks like in shop where you modified it? Link to comment Share on other sites More sharing options...
ricky11 Posted September 17, 2014 Share Posted September 17, 2014 (edited) Hi, Link is here : <removed> I will leave it like this for 12 hours as the site is live, hope you can take a look. Thanks! Edited October 7, 2014 by ricky11 (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted September 17, 2014 Share Posted September 17, 2014 to <div> with cart add styles likeposition:absolute;top:0px; right:0px; but im affraid that ther eis not enough space to display cart block Link to comment Share on other sites More sharing options...
ricky11 Posted September 17, 2014 Share Posted September 17, 2014 (edited) Hi, Thanks, yes i can fix the spacing. Where do i put the position:absolute;top:0px; right:0px; inside which div and file? It will still be responsive yes? Thanks. Edited September 17, 2014 by ricky11 (see edit history) Link to comment Share on other sites More sharing options...
ricky11 Posted September 19, 2014 Share Posted September 19, 2014 Do you mean in blockcart.tpl <div position:absolute;top:0px; right:0px; class="col-sm-4 clearfix{if $PS_CATALOG_MODE} header_user_catalog{/if}"> Link to comment Share on other sites More sharing options...
ricky11 Posted September 19, 2014 Share Posted September 19, 2014 Worked, thanks, although i moved it back, didn't end up liking the position. Link to comment Share on other sites More sharing options...
dennissky Posted September 22, 2014 Share Posted September 22, 2014 Hi. I tried this, but dont work. blockcart will stay below topmenu as on attachment. I want it inside topmenu. Changing div in blockcart.tpl (in theme) to below didnt change anything: <div position:absolute; right:0px; top:0px; class="col-sm-4 clearfix{if $PS_CATALOG_MODE} header_user_catalog{/if}"> Tried on a test shop of skyborg.eu version 1.6.0.9 Any ideas? Link to comment Share on other sites More sharing options...
ricky11 Posted September 23, 2014 Share Posted September 23, 2014 Did you put the close div in blockcart? Did you change the position in displaytop? in my opinion, things are better left where they are. Link to comment Share on other sites More sharing options...
dennissky Posted September 23, 2014 Share Posted September 23, 2014 Yes i did but div in blockcart, and change position in displaytop. The hooks of topmenu and cart is connected in liveview, but its not inside the frame of topmenu, and that frame is too big to have cart next to it. Link to comment Share on other sites More sharing options...
dennissky Posted September 23, 2014 Share Posted September 23, 2014 I partly solved it. If i move both </ul> and </div> from topmenu.tpl to blockcart.tpl then cart works inside topmenu. See www.skyborg.eu But on my testshop the blockcart hook delete itself all the time from displaytop, and cart is gone. If i add hook again it works for a little while. Any ideas? Link to comment Share on other sites More sharing options...
Adrix Posted December 17, 2014 Share Posted December 17, 2014 (edited) I tried all the combinations given above but none of them works. The cart block always comes under top menu. PS 1.6.0.9. website:www.shopyouwant.com Edited December 17, 2014 by [email protected] (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 25, 2015 Share Posted August 25, 2015 new better way to achieve it! if someone still looks for the way of how to do it - you can do it in that way: move block cart to top menu! effects: it will work also with non-default templates Link to comment Share on other sites More sharing options...
Recommended Posts