Page 1 of 1

Override layouts in template

Posted: 07 Nov 2016, 05:42
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!

Re: Override layouts in template

Posted: 08 Nov 2016, 14:51
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

Re: Override layouts in template

Posted: 12 Dec 2016, 13:29
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)

Re: Override layouts in template

Posted: 12 Dec 2016, 13:54
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

Re: Override layouts in template

Posted: 15 Dec 2016, 22:28
by Jan
It should be OK now, see version 3.0.0 RC4:
https://www.phoca.cz/news/921-phoca-cart ... 4-released

Jan