Jump to content

How To Include Blockcategory on CMS page?


Recommended Posts

I have a need to show the blockcategory module on a cms page we have created.  I have used the following include and it shows the word categories but no images.

 

{include file='themes/warehouse/modules/blockcategories/blockcategories.tpl' id_category=84}

 

I am wanting to have something similar to this page http://www.theherbsplace.com/84-Male_Products_page_1_c_74 take the place of the existing image grid that is there now.  As it is now, I have to keep track that the images don't get changed by the manufacturer or a product gets discontinued.  Using the cart derived categories page will eliminate both of those issues.

 

Thanks,

 

Randal

 

Server information

Server information: Linux #1 SMP Wed May 13 20:33:05 UTC 2015 x86_64

Server software version: Apache/2.2.29 (Amazon)

PHP version: 5.3.29

Memory limit: 256M

Max execution time: 30

Database information

MySQL version: 5.5.42

MySQL engine: InnoDB

Tables prefix: ps_

Store information

PrestaShop version: 1.5.6.1

Shop URL: https://www.theherbsplace.com/

Current theme in use: warehouse

 

 

 

 

Link to comment
Share on other sites

The example link is not working.

You could show blockcategory module in the CMS page by enabling the left column for CMS from BO > Preferences > Themes > Advanced Settings > Appearance of columns and check the x from Left column on the cms row.

If the module is not already hooked on displayLeftColumn, go to BO > Modules and Services > Positions and transplant the module. You can use Exceptions to show the module only on CMS by selecting all the other pages except cms.

Link to comment
Share on other sites

The example link is not working.

You could show blockcategory module in the CMS page by enabling the left column for CMS from BO > Preferences > Themes > Advanced Settings > Appearance of columns and check the x from Left column on the cms row.

If the module is not already hooked on displayLeftColumn, go to BO > Modules and Services > Positions and transplant the module. You can use Exceptions to show the module only on CMS by selecting all the other pages except cms.

I tried to follow your directions but I see nothing about Advanced Settings in BO > Preferences > Themes.  I am on PS 1.5.6.1.

 

The module is hooked on left column now on the site.

Link to comment
Share on other sites

including the code to tpl file is also not enough

there is no php code behind this.

 

you want to display this blockcategories only on selected category page? or somewhere else too?

Yes, I want to display the categories on more than one cms page.  Specifically, I want to display all products for males and females each on a separate cms page.

Link to comment
Share on other sites

I tried to follow your directions but I see nothing about Advanced Settings in BO > Preferences > Themes.

 

This is on v1.6. On v1.5.6.1 the left column should be visible in cms pages by default if you're using the default theme. Make sure the module Categories block doesn't have any exceptions set on Left colums block.

Link to comment
Share on other sites

Thanks for the clarification.  The categories block has no exceptions listed.

 

I tried to follow your directions but I see nothing about Advanced Settings in BO > Preferences > Themes.  I am on PS 1.5.6.1.

 

The module is hooked on left column now on the site.

 

I am wanting to put the categories products in a 4 column display of the products on the cms page.  So I am wondering if your suggestion will do that or does that put the categories block on the left column of the cms page?  If so, I already have that showing on every page of the site.

 

Just wanted to make sure I had become more clear in my description.

 

You should be able to access that link now.  If not, you might need to clear your browser cache.

 

Thanks,

Link to comment
Share on other sites

I am wanting to put the categories products in a 4 column display of the products on the cms page.

 

I think I understand now what you want to achieve. This will not be easy, you'll need to find or create a module that can list products based on a category id, then in your cms.tpl create a custom hook and adapt that module to support the custom hook.

Link to comment
Share on other sites

I think I understand now what you want to achieve. This will not be easy, you'll need to find or create a module that can list products based on a category id, then in your cms.tpl create a custom hook and adapt that module to support the custom hook.

In regards to creating a module, I was just going to use the block category module which allows me to specify what category id.  Just like this screenshot of the blood sugar category.

 

http://gyazo.com/29ffba53e4cf64e6b5412d0a45fce879

 

Can I not use that module?  If I can how do you create a custom hook for cms pages?

 

Thanks,

Link to comment
Share on other sites

The blockcategories module displays only categories and subcategories, it doesn't show the products it contains. You could use this module as a starting point.

To create a hook you could write in your cms.tpl something like:

{hook h="displayCategoryOnCMS"}

Then in your module you need to register the hook:

$this->registerHook('displayCategoryOnCMS');

And write the function that handles the hook:

public function hookDisplayCategoryOnCMS() {
   // your code here
}
Link to comment
Share on other sites

  • 2 weeks later...
×
×
  • Create New...