Forum

Thread tagged as: Shop

Shop template location...

Hi, I was wondering if templates are handled a little differently in shop... When I use:

                        <?php   perch_shop_products([
                                'template' => 'custom_list.html',
                                'count' => 10,

                            ]); ?>

debug returns:

Template file not found: /sitedierectory/perch/templates/shop/custom_list.html

Should it not be looking here?

/sitedierectory/perch/addons/apps/perch_shop/templates/shop/products/custom_list.html

also, does that function support category filtering?

Monty Lewis

Monty Lewis 2 points

  • 5 years ago

Hi,

You will need to copy the templates to your templates folder. This is from the docs:

As with all Perch Add-ons, Shop comes with some default templates. These are stored in perch/addons/apps/perch_shop/templates/shop. Inside that folder are subfolders for the different parts of Shop. You should not edit the templates that are inside the app folder.

Before making any changes copy the entire shop folder into perch/templates

Then you would probably want to put the custom template here:

/perch/templates/shop/products/custom_list.html

And call it like this:

perch_shop_products([
  'template' => 'products/custom-list.html',
  'count' => 10,
]);

perch_shop_products does support category filtering, I am using it on a shop at the moment

Hope this helps

Thanks, Michael, I'm not sure that's it as I do have the template files copied over.

And thanks, I must be doing something wrong on the categories. I'll keep at it!

Hmm that's odd then - I would check the template is in products as a first step. And make sure /products is in the path you specify for the template. Good luck!

P.S. My category filter thingummy looks like this:

perch_shop_products([
  'template' => 'products/paginated-list.html',
  'paginate'=>true,
  'count'=>18,
  'sort'=>'priority',
  'sort-order'=>'ASC',
  'sort-type'=>'numeric',
  'category' => array('products/mantel-clocks', 'availability/uk-public'),
  'category-match' => 'all'
]);
Drew McLellan

Drew McLellan 2638 points
Perch Support

I would expect you to need to use

'template' => 'products/custom_list',

Thanks you guys! Back on track!