Author Topic: Chosen cart layout ignored  (Read 778 times)

gba

  • Jr. Member
  • **
  • Posts: 190
Chosen cart layout ignored
« on: June 06, 2017, 20:40:49 pm »
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

  • VirtueMart Developer Team
  • Global Moderator
  • Full Member
  • *
  • Posts: 825
  • VirtueMart Version: VM3 on J3
Re: Chosen cart layout ignored
« Reply #1 on: June 06, 2017, 23:48:39 pm »
Maybe a menu item with other settings?

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26198
  • Always on vacation
    • Jenkin Hill Internet
Re: Chosen cart layout ignored
« Reply #2 on: June 07, 2017, 00:09:21 am »
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

Jenkin Hill Internet,
Keswick, Lake District

Unsolicited PMs/emails will be ignored.

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

Currently using VM3.2.4 on Joomla 3.8 PHP 7.0.23

Testing VM3.2.4 on J!3.8

gba

  • Jr. Member
  • **
  • Posts: 190
Re: Chosen cart layout ignored
« Reply #3 on: June 07, 2017, 07:30:14 am »
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

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26198
  • Always on vacation
    • Jenkin Hill Internet
Re: Chosen cart layout ignored
« Reply #4 on: June 07, 2017, 12:50:33 pm »
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

Jenkin Hill Internet,
Keswick, Lake District

Unsolicited PMs/emails will be ignored.

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

Currently using VM3.2.4 on Joomla 3.8 PHP 7.0.23

Testing VM3.2.4 on J!3.8

gba

  • Jr. Member
  • **
  • Posts: 190
Re: Chosen cart layout ignored
« Reply #5 on: June 07, 2017, 15:59:37 pm »
This is no option for me, as already mentioned:
Quote
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.

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

Kind regards,
Gerald

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9312
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Chosen cart layout ignored
« Reply #6 on: June 07, 2017, 18:00:21 pm »
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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26198
  • Always on vacation
    • Jenkin Hill Internet
Re: Chosen cart layout ignored
« Reply #7 on: June 07, 2017, 18:17:58 pm »
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

Jenkin Hill Internet,
Keswick, Lake District

Unsolicited PMs/emails will be ignored.

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

Currently using VM3.2.4 on Joomla 3.8 PHP 7.0.23

Testing VM3.2.4 on J!3.8

gba

  • Jr. Member
  • **
  • Posts: 190
Re: Chosen cart layout ignored
« Reply #8 on: June 08, 2017, 20:08:07 pm »
Max - you are my hero!
Thank you!
I love VM!

gba

  • Jr. Member
  • **
  • Posts: 190
Re: Chosen cart layout ignored
« Reply #9 on: June 08, 2017, 23:34:42 pm »
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
Code: [Select]
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
Code: [Select]
if (!empty($this->layoutName) && $this->layoutName == 'defaultmine') {and :274 to
Code: [Select]
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
Code: [Select]
if (!empty($this->layoutName) && $this->layoutName == 'default') {, the TOS field works well, but the if condition gets false!

gba

  • Jr. Member
  • **
  • Posts: 190
Re: Chosen cart layout ignored
« Reply #10 on: June 09, 2017, 00:37:01 am »
Hi!

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

Kind regards,
Gerald

gba

  • Jr. Member
  • **
  • Posts: 190
Re: Chosen cart layout ignored
« Reply #11 on: June 09, 2017, 00:55:37 am »
Hi!

I think, all these
Code: [Select]
if ($this->layoutName == 'default') or
Code: [Select]
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
Code: [Select]
if ($this->layoutName == VmConfig::get('cartlayout', 'default')) or
Code: [Select]
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9312
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Chosen cart layout ignored
« Reply #12 on: June 26, 2017, 20:28:18 pm »
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?
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

gba

  • Jr. Member
  • **
  • Posts: 190
Re: Chosen cart layout ignored
« Reply #13 on: June 27, 2017, 12:34:30 pm »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9312
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Chosen cart layout ignored
« Reply #14 on: June 27, 2017, 15:11:24 pm »
the new version uses now a $defaultLayout = VmConfig::get('cartlayout', 'default');
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/