Jump to content

How to display "Top Seller" block in home page only?


Recommended Posts

1. Wanna know, how to dispaly a block in a particular page(s) only? To be specific i wanna display Top Sellers block in home page only. How can i do that?

2. Is there any tutorial available that shows how to convert a well written css theme can be converted into presta shop theme? Or at least converting the home page?

3. Is there any built-in css menu available in presta shop? Any tutorial how to integrate a third party menu into prestashop?


Thanks a lot in advance.

Link to comment
Share on other sites

1. The easiest way is to edit modules/blockbestsellers/blockbestsellers.tpl and add the following to the top:

{if $page_name == 'index'}



and the following to the bottom:

{/if}



It is better to avoid modifying code if possible though. To do this without modifying any code, go to Modules > Positions, click the edit button next to the "Top Sellers block", then the following under "Exceptions":

404.php, address.php, addresses.php, attachment.php, authentication.php, best-sales.php, cart.php, category.php, cms.php, contact-form.php, discount.php, footer.php, header.php, history.php, identity.php, loyalty-program.php, manufacturer.php, my-account.php, myalerts.php, mywishlist.php, new-products.php, order-confirmation.php, order-detail.php, order-follow.php, order-return.php, order-slip.php, order.php, pagination.php, password.php, payment.php, prices-drop.php, product.php, referralprogram-program.php, search.php, sitemap.php, statistics.php, supplier.php



This will hide the block on every page except for index.php.

2. There is a tutorial on how to modify the default Prestashop theme here.

3. There is no built-in support for menus. There are third-party modules like WizNav and Horizontal Navigation Bar available.

Link to comment
Share on other sites

Great!! very happy with the support i am getting to start with prestashop.

Just one more question:

{if $page_name == 'index'}

Where can i get the complete list of variables and their possible values. Like the var $page_name and its value 'index'. Are these stored in a database table?

Thank you

Link to comment
Share on other sites

No, they are all declared in init.php in the root directory of Prestashop. Just search for $smarty->assign to find variables that are accessible to all TPL files. Most of the variables are declared at the bottom of the file. When "v1.1 theme compatibility" is turned off, the variables listed on line 117 are used. When "v1.1 theme compatibility" is turned on, the variables listed on line 155 are used.

Link to comment
Share on other sites

  • 1 year later...

Hello all!

 

Rocky, thanks for your posts, they helped me many times.

I have used code like

{if $page_name == 'index'}

on my site.

 

Can you help me one more time?

For example i need to show my module in left column on page category.php?id_category=58 and hide it on the page category.php?id_category=45.

 

Tell me, please, how can i exclude module from the same page, but with different ID?

Code like this

{if $category->id == 59}

not works

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...