News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Override only works with one file

Started by stargazer1682, August 06, 2020, 05:58:58 AM

Previous topic - Next topic

stargazer1682

I'm not sure if this belongs here or in the Themes and Layouts section.  As some of my recent questions have indicated, I'm working on a new store in VM 3.8.4 10335.  I've made some modifications to some PHP files to customize the layout and some of the display settings.  I created the template override location html/com_virtuemart/ in my default template folder, creating the additional sub-folders that any of the modified files would originally need to go in.  I upload the first file, the changes take affect immediately.  Later I try a second files, different location, so I make sure to copy the exact original directory to copy into the template override folder, and save the the file - but nothing happens, the change doesn't take affect.  I check and double check that the override directory is correct for where the file is supposed to be; I test replacing the file in the actual, original location, and the changes take affect there, but when I restored the original file and only had the modified file in the override folder, the default remained.

It didn't make sense, but I moved on.  Now I have a third file, yet another directory; copy folders, add modified file - nothing, zilch, nada.  So I go back to the first file to see if maybe I left a modified copy of that one in the original location, but no, that override and only that override is working.
I even changed the virtuemart template settings from default to the currently set template, but that made no difference.
What am I doing wrong?

Jörgen

Without any details it is not possible to tell.

What files and what locations ?

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

GJC Web Design

tip: always put identifiers in the files so u can be 100% sure what files are being called

e.g. 

<!--  Over ride: /html/com_virtuemart/cart/default.php -->
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

stargazer1682

The file that's work is /components/com_virtuemart/sublayouts/prices.php
I placed the modified copy in  /templates/(MyTemplate)/html/com_virtuemart/sublayouts/prices.php and it works as an override.

The other two are:
/components/com_virtuemart/assets/css/vm-ltr-site.css which I placed the modified copy of in
/templates/(MyTemplate)/html/com_virtuemart/assets/css/vm-ltr-site.css but it does override.

and:
/components/com_virtuemart/views/cart/tmpl/default_pricelist.php
adding modified copy in:
/templates/(MyTemplate)/html/com_virtuemart/views/cart/tmpl/default_pricelist.php and it doesn't take affect either.

I'm not sure I understand the suggestion of putting the identifier in the file.

Jörgen

You have used the wrong path, correct path (this is joomla 1 on 1), not sure if CSS works though:
/templates/(MyTemplate)/css/vm-ltr-site.css

/templates/(MyTemplate)/html/com_virtuemart/cart/default_pricelist.php

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

stargazer1682

Quote from: Jörgen on August 06, 2020, 16:51:49 PM
You have used the wrong path, correct path (this is joomla 1 on 1), not sure if CSS works though:
/templates/(MyTemplate)/css/vm-ltr-site.css

/templates/(MyTemplate)/html/com_virtuemart/cart/default_pricelist.php

Jörgen @ Kreativ Fotografi
Interesting.  Thank you, that did the trick.  I was under the impression that the files needed to be in the full sub-directory location in the html/com_virtuemart folder as they would in the original components/com_virtuemart folder; and just by chance the first one I did was only one sub-folder deep, in contrast to the other two.  The CSS one did work; and I don't think I would have guessed to put it there. And the default_pricelist in the Cart folder kind of makes sense, since there area a lot of other tmpl folders embedded in com_virtuemart.  Are other similar exceptions where an override file wouldn't necessarily go into it's parent folder; or are the only exceptions css files going in the root template css folder, and anything in a tmpl folder goes into whichever parent directory that tmpl is in?  If there are other possible exceptions, are they laid out in some documentation somewhere?

Thanks again

Jörgen

You can learn a lot from examining what happens when you use the Joomla template editing functions in the back end.
It automatically creates the neccesary override files for a module, component etc. The structure of override is joomlas and reading Joomla docs could clear things Up.
Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

pinochico

to stargazer1682:

Pls, before ask you about override template, read carefoully joomla doc :)

https://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core
https://docs.joomla.org/Understanding_Output_Overrides
https://docs.joomla.org/J3.x:Layout_Overrides_in_Joomla
https://docs.joomla.org/How_to_override_the_component_mvc_from_the_Joomla!_core

or find by google another

CSS - I think you can't override, because before this, you must repleace path to this file in override or in model/ view.html.php / helper ...
First yu must find place where is calling and than decide if posible or not.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

stargazer1682

Nope, the virtuemart CSS file override worked without any issue, placing it in the template CSS folder.  Thanks for the links.  Although, is there any difference between how Joomla!'s override works and how Virtuemart's override works?  Or is all just Joomla!'s override method?

Jörgen

There should be no difference between the two. I think even the sublayouts are a Joomla construct. Not so common in simple plugins, but nice to use in something like VM.

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

PRO

you do not have to use  tmpl   in your override structure



html/com_virtuemart/viewname/filename.php

Jörgen

Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

T.A. Garrison, LLC

I've followed (I'm pretty sure) the path for the CSS override and it's not working.

/templates/my-template/html/com_virtuemart/css/my.css

I'm using VM 4 with J 4, which uses Cassiopeia child template and the css file is nowhere near that path.

Is there "another" update to where to place the CSS override for VM?
T.A. Garrison, LLC
3150 Orleans St. # 28261
Bellingham, WA 98228

pinochico

J4 has other condition.

Pls read carefoully documentation for J4, is not problem VM :)
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

GJC Web Design

Because Joomla devs think a change is better than a holiday you can over ride your css with this path

\media\templates\site\YOUR_TEMPLATE\css\my.css

as this should load last it "should" over ride your VM css

I guess by this logic a path \media\com_virtuemart\css\my.css might work though haven't tried

IMHO stuffing EVERYTHING in the media folder is one of their more perverse decisions ..
Used to be so logical when the appropriate language and assets were in the particular folders of the extension
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation