Author Topic: Override only works with one file  (Read 493 times)

stargazer1682

  • Jr. Member
  • **
  • Posts: 144
Override only works with one file
« on: August 06, 2020, 05:58:58 am »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2996
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Override only works with one file
« Reply #1 on: August 06, 2020, 08:15:07 am »
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

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9777
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Override only works with one file
« Reply #2 on: August 06, 2020, 08:39:57 am »
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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

stargazer1682

  • Jr. Member
  • **
  • Posts: 144
Re: Override only works with one file
« Reply #3 on: August 06, 2020, 15:57:10 pm »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2996
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Override only works with one file
« Reply #4 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
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

stargazer1682

  • Jr. Member
  • **
  • Posts: 144
Re: Override only works with one file
« Reply #5 on: August 06, 2020, 17:22:13 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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2996
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Override only works with one file
« Reply #6 on: August 06, 2020, 19:31:39 pm »
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

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 642
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Override only works with one file
« Reply #7 on: August 06, 2020, 19:52:35 pm »
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 from products, orders and database table
Virtuemart Email Manager - customs email templates

stargazer1682

  • Jr. Member
  • **
  • Posts: 144
Re: Override only works with one file
« Reply #8 on: August 06, 2020, 20:09:32 pm »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2996
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Override only works with one file
« Reply #9 on: August 06, 2020, 20:16:33 pm »
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

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10420
  • VirtueMart Version: 3+
Re: Override only works with one file
« Reply #10 on: August 06, 2020, 20:34:49 pm »
you do not have to use  tmpl   in your override structure



html/com_virtuemart/viewname/filename.php
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2996
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Override only works with one file
« Reply #11 on: August 06, 2020, 21:08:15 pm »
@PRO
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

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