Jump to content

Always showing cart in right sidebar in v1.7.X


creation-handicap

Recommended Posts

Hello! I want the shopping cart block always to be there in Prestashop 1.7.X. Right now the shopping cart block is only there on the shopping cart page.

 

There is already a ticket for this topic here:

https://www.prestashop.com/forums/topic/236486-solved-showing-cart-in-right-sidebar/

But it is marked as solved and it is a solution for an older prestashop version...

Link to comment
Share on other sites

Ok. I did it without any help from this forum  :D

 

Here is how I made it work, if somebody out there wants to achieve the same thing:

 

1. Goto admin / design / template and logo and click there on the "Choose layout" button to go to the template page (I'm not 100% sure about the right labeling as my Shop is in German)

2. Change the pages, where you want to have the cart in the right sidebar to "Two Columns, small right column - Two columns with a small right column" (in my case that was the index, product and category page)

3. Open the file themes/classic/templates/layouts/layout-right-column.tpl and add this code there after the comment in the header of the file:

{extends file='layouts/layout-both-columns.tpl'}

{block name='left_column'}{/block}

{block name='content_wrapper'}
  
  {* if page is index / product / category show cart summary *}
  {if $page.page_name == 'index' || $page.page_name == 'product' || $page.page_name == 'category'}
	
    <div id="content-wrapper" class="cart-grid-body col-xs-12 col-lg-8">
        {hook h="displayContentWrapperTop"}
        {block name='content'}
          <p>Hello world! This is HTML5 Boilerplate.</p>
        {/block}
        {hook h="displayContentWrapperBottom"}
 	</div>
    
    <!-- Right Block: cart subtotal & cart total -->
    <div class="cart-grid-right col-xs-12 col-lg-4">
    
      {block name='cart_summary'}
        <div class="card cart-summary">
    
          {block name='hook_shopping_cart'}
            {hook h='displayShoppingCart'}
          {/block}
    
          {block name='cart_totals'}
            {include file='checkout/_partials/cart-detailed-totals.tpl' cart=$cart}
          {/block}
    
          {block name='cart_actions'}
            {include file='checkout/_partials/cart-detailed-actions.tpl' cart=$cart}
          {/block}
    
        </div>
      {/block}
    
      {block name='hook_reassurance'}
        {hook h='displayReassurance'}
      {/block}
    
    </div>
    
  {else}
	
    <div id="content-wrapper" class="right-column col-xs-12 col-sm-8 col-md-9">
        {hook h="displayContentWrapperTop"}
        {block name='content'}
          <p>Hello world! This is HTML5 Boilerplate.</p>
        {/block}
        {hook h="displayContentWrapperBottom"}
 	</div>
    
  {/if}
  
{/block}

There you have the cart summary in your index, product and category page.

 

I don't know if that's the slickest solution. But it works...

Edited by creation-handicap (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...