Jump to content

Custom template page for a category and one for all its subcategory


Recommended Posts

Hi guys,

 

One of my clients want to it shop a specific presentation from one of its categories.

And for this category, he would like a specific presentation for all its subcategories.

 

I would like to know if it is possible to create a specific template for a category ?

And if it is possible to create a template for all subcategory of a specific category ?

 

Example :

 

This link => http://espace-vin.com/domaine.html represent the category page. It list all subcategories.

And this link => http://espace-vin.co...rie-bellet.html represent one of its subcategories. We have the subcategory title, description and a list of all product in this subcategory.

 

Can you help me please ?

 

I have find this => http://www.prestasho...cific-category/ but I don't know how to operate it.

 

Thanks.

 

P.S. Sorry for my English.

Edited by RomsWebDesign (see edit history)
Link to comment
Share on other sites

Hi,

Can you explain 'I don't know how to operate it'? I think that's a good way to go. You have to be fond of php and controllers if you want to do such thing as multiple templating. If you're not, I suggest you first look at how to override controllers and classes in the official docs, here:

 

http://doc.prestashop.com/display/PS15/Overriding+default+behaviors

cheers! :)

Link to comment
Share on other sites

  • 3 months later...

Hello,

 

I was using this controller extends in PS 1.4.7 and it works perfectly, but after upgrade to PS 1.5.6 it doesn't works and I don't know why...

 

I am searching for any solution or module to create custom product templates in PS 1.5, but I don't find nothing usefull. Can anyone help me, please?

Link to comment
Share on other sites

Sorry vekia. Simply the override doesn't works :-P Prestashop works fine but don't load the custom tpl.

 

But finally, I have found another way to do this(almost for me). Instead using the category url, it uses the default category id:

class ProductController extends ProductControllerCore
{
public function initContent()
{
parent::initContent();

/* Teste si le fichier existe ou non, sinon c'est le fichier par défaut qui est affiché */
if (is_file(_PS_THEME_DIR_.'product_'. $this->product->id_category_default .'.tpl')) {
$this->setTemplate(_PS_THEME_DIR_.'product_'. $this->product->id_category_default .'.tpl');
} else {
$this->setTemplate(_PS_THEME_DIR_.'product.tpl');
}
}
}

Viewed here (in french): http://www.prestashop.com/forums/topic/254182-fiche-produit-en-fonction-de-la-categorie/?do=findComment&comment=1431086

Edited by Skydone (see edit history)
  • Like 1
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...