News:

Looking for documentation? Take a look on our wiki

Main Menu

Template overrides ONLY from default template?

Started by bryanearl, April 25, 2019, 16:57:35 PM

Previous topic - Next topic

bryanearl

Virtuemart 3.4.2
Joomla 3.9.5


I have two different templates installed in Joomla. My default template is used for most pages, and has many virtuemart override files (such as padded.php in the /cart folder).

I also have a secondary template that is used for multiple specific pages. For only those pages using the secondary template, I am trying to change the "show cart" URL link in the top-right of the popup after adding a product to the cart. Therefore, I added the override for the padded.php file (same as I did for the default template) but it refuses to use it, even when the user is on the page with the secondary template.

It seems that no matter what, it keeps pulling the override file from the default template.

How can I make it use overrides from the ACTIVE template, rather than always from the default template, even when it's not being used?

OR, if I cannot make it use all overrides from a secondary template, how can I make this specific change to the padding.php file while ONLY on the page with the active secondary template? Any way I can force that code change?

Jörgen

Have You assigned the cart to a menu item ? Have You assigned the template to this menu item ?

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

bryanearl

#2
Quote from: Jörgen on April 25, 2019, 20:00:58 PM
Have You assigned the cart to a menu item ? Have You assigned the template to this menu item ?

Jörgen @ Kreativ Fotografi

Yes, assigned and verified. Still pulls virtuemart related overrides from the "default template" only, even if the active template is my secondary one. All other overrides are working from the secondary template, except virtuemart related.

Jörgen

No Virtuemart override works at all ?

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

bryanearl

Quote from: Jörgen on April 25, 2019, 23:24:12 PM
No Virtuemart override works at all ?

Jörgen @ Kreativ Fotografi

Correct. I have been reading up on it and this appears to be standard for virtuemart and I have read many threads here in the forum about it. I just need that one file (/cart/padded.php)to override for my secondary template... I can do without the rest. Any idea how I can force an override via code injection or a head script or something in the active template?

Jörgen

Hello, this is simply non sense. Assigning a different template to a menu item works as expected. How do you assign the other template? What item id do you get in the url.  Are you using some kind of sef extensions ?

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

bryanearl

#6
Quote from: Jörgen on April 26, 2019, 06:41:47 AM
Hello, this is simply non sense. Assigning a different template to a menu item works as expected. How do you assign the other template? What item id do you get in the url.  Are you using some kind of sef extensions ?

Jörgen @ Kreativ Fotografi

Apparently you don't understand what I am saying. Assigning a different template to a menu item works perfectly, just as every other Joomla site. The issue is that the override for com_virtuemart/cart/padded.php DOES NOT WORK FROM A SECONDARY TEMPLATE. It pulls that override from the DEFAULT TEMPLATE, even if the ACTIVE TEMPLATE is the secondary.

The secondary template is assigned via the menu item. No SEF extensions are used. I verified this exact behavior with a fresh site, installing two templates, having that file mentioned above overriden in both templates, but no matter what, it ALWAYS pulls the override from whatever template is marked as the default.

Jörgen

I see but I tried to get some hints
QuoteNo Virtuemart override works at all ?

Jörgen @ Kreativ Fotografi

Will take a closer look.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

bryanearl

I resolved my issue by making extra code changes in the padded.php file (on my default template) to perform an IF statement:

- IF the current page is /XXXXX then make the "show cart" button URL /XXXXX
- ELSE make the "show cart" button URL /XXXXX

... so for the moment, I have a functioning workaround because the page in question can only be accessed by a user that is part of a particular group.