Override layouts in template

Phoca Cart - complex e-commerce extension
shtier
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 07 Nov 2016, 04:43

Override layouts in template

Post by shtier »

Hi,

Phoca Cart is a great!

But there is a problem..
I'm trying override layouts in my template:

Code: Select all

components/com_phocacart/layouts/
here

Code: Select all

templates/my_template/html/layouts/com_phocacart/
I also tried here

Code: Select all

templates/my_template/html/com_phocacart/layouts/
this does not work

for example
administrator/components/com_phocacart/libraries/phocacart/filter/filter.php

Code: Select all

~33 line
$layout2 	= new JLayoutFile('form_filter_text', $basePath = JPATH_ROOT .'/components/com_phocacart/layouts');
Specified path is strictly
if you do

Code: Select all

$layout2 	= new JLayoutFile('form_filter_text');
it works

Code: Select all

templates/my_template/html/layouts/com_phocacart/form_filter_text.php
p.s. https://docs.joomla.org/J3.x:JLayout_Im ... for_Joomla! - New requirements, New features

You plan to fix it?

My info:
Joomla 3.6.4
com_phocacart_v3.0.0_rc3 + com_phocacart_demo_data6 + pkg_phocacart_modules_v3.0.0

Thank You. Best regards!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48714
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Override layouts in template

Post by Jan »

Hi, thank you very much for the info, I am now working on RC4 version, tested now, yes, the path prevents from overriding in template, so I will change all the layout instructions (remove the path)

Thank you very much.

Jan
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48714
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Override layouts in template

Post by Jan »

Hi, not easy as it seems:

if only this is called:
$layout2 = new JLayoutFile('form_filter_text');

it is not possible to run layouts from modules, plugins, etc.

The layout seems to have more limits (like forcing client and loading one part from frontend and second part from backend, etc.)

I will do tests with:
$layout = new JLayoutFile('some_layout', null, array('component' => 'com_phocacart'));

Hope, this will work in all the views (include modules and plugins)
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48714
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Override layouts in template

Post by Jan »

It seems:

Code: Select all

$layout = new JLayoutFile('some_layout', null, array('component' => 'com_phocacart'));
This can work as it searches the override layout in this folder

Code: Select all

templates/your_template/html/layouts/com_phocacart
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48714
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Override layouts in template

Post by Jan »

It should be OK now, see version 3.0.0 RC4:
https://www.phoca.cz/news/921-phoca-cart ... 4-released

Jan
If you find Phoca extensions useful, please support the project
Post Reply