News:

Support the VirtueMart project and become a member

Main Menu

Chosen cart layout ignored

Started by gba, June 06, 2017, 20:40:49 PM

Previous topic - Next topic

gba

Hi all!

I made a copy of my templates category layout file default.php named default2.php. I can choose it in VM configuration and it is applied in FE. Fine.
The same I did with the cart layout file default.php. I can choose default2.php in VM configuration and ... it is not applied in FE.
Why?

Thank you very much in advance for any useful hint!

Kind regards,
Gerald

K&K media production

Maybe a menu item with other settings?

jenkinhill

I generally use the same filename for cart layouts, default.php, and put that file in templates/myjoomlatemplate/html/com_virtuemart/cart/  - after all I only want one version of the cart!

I may use different names for the various other overrides eg where an override needs to be specific for a category or product, if I only need one version of a default.php override then I keep that file name.
Any overrides also go into the appropriate override directories so I know exactly where they are, and makes it easier to duplicate overrides between different VM sites. 

I have tested whet you decsribed and yes, anything other than default.php is ignored for the carteven if selected in config. But I still only need one version of the cart anyway.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

gba

#3
Hi!

Thank you for your replies and thank you for taking time to get into this matter.

All menu items, categories, payment and shipping plugins are configured to use the setting in the VM config.

I am using a paid VM template. To preserve my changes to the template override html/com_virtuemart/cart/default.php on updating the template I need to be able to use a copy of this file for my cart instead of the defaul.php itself.

@VM team:
Is it intentional that anything other than default.php is ignored for the cart even if selected in VM config?
And how can I anyhow use a copy of default.php as layout for my cart?

Kind regards,
Gerald

jenkinhill

Further testing, a cart override file named default.php placed in templates/myjoomlatemplate/html/com_virtuemart/cart/ will be used as the cart template, but any other name will not. If you have local copies of changed files it is easy to switch them over with FTP.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

gba

#5
This is no option for me, as already mentioned:
QuoteI am using a paid VM template. To preserve my changes to the template override html/com_virtuemart/cart/default.php on updating the template I need to be able to use a copy of this file for my cart instead of the defaul.php itself.

I am wondering, what core hack would solve the problem until the next VM update?

Kind regards,
Gerald

Milbo

There is no hack needed, because it works.

It is just stored in the cart session, in case a payment changes the layout, the layout must be kept,...

So if you change configure the cart override layout, you must empty your session, means login/logout or logout/login.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

jenkinhill

Ahh it suffers from browser caching, too, as it persisted even after logging out. If I select the override in Firefox and then view the cart in a new session in Chrome the override is used even if a different name. Thanks, Max, I never thought that through properly.

The override file works in templates/myjoomlatemplate/html/com_virtuemart/cart/  and in the normal VM view directory
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

gba

Max - you are my hero!
Thank you!
I love VM!

gba

#9
Hi again!

I'm afraid there could still be something wrong with own layouts for cart.
The TOS field stops working well: On checking it nothing happens and if it was checked, unchecking it not stored.

Can anyone confirm this?

Kind regards,
Gerald

EDIT:

Maybe it has something to do with /components/com_virtuemart/views/cart/tmpl/default_pricelist.php:271 or :274 ...
I changed my own template override defaultmine.php for /components/com_virtuemart/views/cart/tmpl/default.php:72 to echo $this->loadTemplate ('pricelistmine');
Furthermore I changed my own template override default_pricelistmine.php for /components/com_virtuemart/views/cart/tmpl/default_pricelist.php:271 to if (!empty($this->layoutName) && $this->layoutName == 'defaultmine') {
and :274 to echo $this->loadTemplate('paymentgmr');. This loads my own template override select_paymentmine.php.

When I copy my own template override from defaulmine.php to default.php and let :271 be if (!empty($this->layoutName) && $this->layoutName == 'default') {, the TOS field works well, but the if condition gets false!

gba

Hi!

Even if I let :274 be echo $this->loadTemplate('payment');(that means, the VM core select_payment.php is used), the TOS crashes.

Kind regards,
Gerald

gba

#11
Hi!

I think, all these if ($this->layoutName == 'default') or if (!empty($this->layoutName) and $this->layoutName == 'default') conditions in numerous files lead to unexpected behaviour of VM, when another template than default.php is chosen.
Shouldn't they look like if ($this->layoutName == VmConfig::get('cartlayout', 'default')) or if (!empty($this->layoutName) and $this->layoutName == VmConfig::get('cartlayout', 'default')) or something similar?
At least it works for me this way  :).
What do you guys think about that?

Kind regards,
Gerald

Milbo

I can see this only in the price list. When you use an override of default, it works as expected and when you set your own layout... take a look to the code, executed for default. the $this->loadTemplate('coupon') would not load the "default_coupon.php" it would load instead the "mylayout_coupon.php". So you must copy the layout "default_coupon" anyway and name it "mylayout_coupon.php"

I also wonder why you do not just remove the code, if you do not use the default layout anyway. I mean, it is in your override, or not?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

gba

Hi!

Thank you for your reply.
I did not look at the coupon layout.
I had troubles with select_payment.php and select_shipment.php instead.

Kind regards,
Gerald

Milbo

the new version uses now a $defaultLayout = VmConfig::get('cartlayout', 'default');
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/