VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Themes & Layout Problems and Customization VM 1.1 => Topic started by: dfer_f on September 03, 2009, 21:43:11 pm

Title: Problems with template in Virtuemart
Post by: dfer_f on September 03, 2009, 21:43:11 pm
I have installed Virtuemart and my problem is this: I try to make the purchase Shipping Address (pass without problem) I give you next to Ship Methods and the page is blank, but I realize that is only a problem of the template, as I tried bringing the default installation of Joomla and there if no problem in buying, someone knows how to fix it. Help please, and to work the aesthetic of the Web with this template.

Thanks

Title: Re: Problems with template in Virtuemart
Post by: MikeUK on September 03, 2009, 23:42:24 pm
You probably need to post in a different section, although if it is the template, you will need to ask the template provider.
Title: Re: Problems with template in Virtuemart
Post by: TomD on September 15, 2009, 00:37:39 am
It should be a Virtuemart bug because i experienced the same problem.
We use J1.5.14 and I tried the Virtuemart 1.1.2 and 1.1.3. and i got the same error.

After clicking checkout link on checkout page, a shipping address page comes up, and there is a NEXT button at the bottom.. it goes to the next page,SHIPPING METHODS BUT THE TEMPLATE WILL BE DIFFERENT.

I mean for example we use two templates, ONE for only home page, and ONE for inner pages. And the inner page template belongs to virtuemart HOWEVER the component uses the home page template for some reason.. I could not solve this problem and very annoying
Title: Re: Problems with template in Virtuemart
Post by: MikeUK on September 15, 2009, 01:14:04 am
I think this is a problem with your setup. Maybe your templates are not assigned correctly? There would be many many posts here if there was a problem with the checkout link.
Title: Re: Problems with template in Virtuemart
Post by: TomD on September 15, 2009, 01:34:50 am
No, the problem is not the checkout link, that works.. on the next page (SHIPPING ADDRESS), when i click on NEXT button, a new page comes up but it must be in the same template, however it appears in the front page template.

The Templates are good... the default is the inner template, the front page template belongs to only the home page.

As i said the shop is working, but virtuemart uses a different template for some reason on checkout pages
Title: Re: Problems with template in Virtuemart
Post by: TomD on September 15, 2009, 01:37:41 am
you can test the site
http://web.mydns.net.nz/carteroni.co.nz
PARTS

username: test
password: test2009

this is one of the websites where i got this problem
Title: Re: Problems with template in Virtuemart
Post by: MikeUK on September 15, 2009, 01:41:17 am
Could you take screenshot(s) of your Joomla template config, and highlight which one is what?
Title: Re: Problems with template in Virtuemart
Post by: TomD on September 15, 2009, 01:51:50 am
i have just sent details in email to you... is it good ?
Title: Re: Problems with template in Virtuemart
Post by: TomD on September 15, 2009, 03:13:21 am
here are the screenshots attached in ZIP (joomla config, template page, menu...)

[attachment cleanup by admin]
Title: Re: Problems with template in Virtuemart
Post by: MikeUK on September 15, 2009, 08:53:56 am
I presumed you've got any SEF components turned off?
Title: Re: Problems with template in Virtuemart
Post by: TomD on September 15, 2009, 10:13:52 am
No SEF at the moment, but I tried out with SEF and the same happened..
We dont use any SEF component
Title: Re: Problems with template in Virtuemart
Post by: MikeUK on September 15, 2009, 10:39:44 am
Well, I'm stumped. I've seen this type of thing work fine so I know it does. Setup looks fine. Does it use SSL? Hopefully someone who has had the same issue will know more. I do recommend posting the images actually in the forum (rather than a zip file) as not everyone will download attachments.
Title: Re: Problems with template in Virtuemart
Post by: TomD on September 15, 2009, 10:51:02 am
no SSL. We have several virtuemart shop in older joomla using virtuemart 1.0.15. That was stable and worked without any hassle. But the new virtuemart under new joomla failed to work perfectly. I have been developing joomla sites for 4 years so i am not new. That is why i have no any idea now.
Title: Re: Problems with template in Virtuemart
Post by: TomD on September 15, 2009, 11:13:29 am
I tried out the virtuemart 1.0.15 under Joomla 1.5.14 in legacy mode and i got the same template problem, however the VM1.0.15 is working smoothly under older joomla. So probably it is a joomla problem ?
Title: Re: Problems with template in Virtuemart
Post by: MikeUK on September 15, 2009, 11:37:43 am
I would say it is more a VM than a Joomla issue, assuming this is not just your system. I would have expected a load more posts about it is it was global. Might be worth reporting this to the bug tracker for further testing (there's a thread with info about this). I expect there's a way around it by manually doing something with the URL.
Title: Re: Problems with template in Virtuemart
Post by: PRO on September 15, 2009, 14:45:58 pm
Try this


Create a menu item to a hidden menu

and then use the URL option set to  www.mysite.com/index.php

And then set the assigned template


THIS is assuming your homepage is without the index.php

I dont know if this will work, but you can try


Title: Re: Problems with template in Virtuemart
Post by: TomD on September 15, 2009, 22:37:38 pm
i tried.. unfortunately it doesnt help  :(
Title: Re: Problems with template in Virtuemart
Post by: TomD on September 16, 2009, 22:25:19 pm
IT HELPS

This problem is mostly on VM's side. Joomla 1.5 has new way of resolving Itemid and option values. It uses JURI class to parse query string. VM passes 'index.php' instead of 'index.php?option=com_virtuemart&Itemid=<some id>' to JURI parser. So joomla just can't resolve correct option and Itemid values and uses default ('frontpage' with Itemid=1).

How to fix it? There are two ways. The first one is fixing all 'incorrect' VM's forms by changing tiny 'action="index.php"' to correct URIs with option and Itemid arguments. This solution is already provided by johk.

The second way to alter joomla code a little bit to support Itemid and option values from $_REQUEST. So here is my solution.

1. Find file named 'libraries/joomla/application/application.php'

2. Find these 2 lines (they are located somewhere around line #191):
Code:
// get the full request URI
$uri = clone(JURI::getInstance());

3. Just after these lines add this code:
Code:
// VM uri fix
      if (!$uri->getVar('Itemid') && isset($_REQUEST['Itemid']) || !$uri->getVar('option') && isset($_REQUEST['option'])) {
         if (!$uri->getVar('Itemid') && isset($_REQUEST['Itemid'])) {
            $uri->_query = ($uri->_query ? '&' : '').'Itemid='.(int)$_REQUEST['Itemid'];
         }
         if (!$uri->getVar('option') && isset($_REQUEST['option'])) {
            $uri->_query = ($uri->_query ? '&' : '').'option='.$_REQUEST['option'];
         }
         parse_str($uri->_query, $uri->_vars);
      }
      // end VM uri fix

The final result must be:
Code:
      // get the full request URI
      $uri = clone(JURI::getInstance());
      
      // VM uri fix
      if (!$uri->getVar('Itemid') && isset($_REQUEST['Itemid']) || !$uri->getVar('option') && isset($_REQUEST['option'])) {
         if (!$uri->getVar('Itemid') && isset($_REQUEST['Itemid'])) {
            $uri->_query = ($uri->_query ? '&' : '').'Itemid='.(int)$_REQUEST['Itemid'];
         }
         if (!$uri->getVar('option') && isset($_REQUEST['option'])) {
            $uri->_query = ($uri->_query ? '&' : '').'option='.$_REQUEST['option'];
         }
         parse_str($uri->_query, $uri->_vars);
      }
      // end VM uri fix

That's all. I haven't tested it alot but seems it is working for me.
Title: Re: Problems with template in Virtuemart
Post by: sfuery on October 11, 2009, 13:06:54 pm
Thanks for the code TomD!

I was watching this thread with interest as I have the same problem with a site I'm working onhttp://www.treehousesecrets.com (http://www.treehousesecrets.com). I have two templates, one for the home page only, and one for the inner pages. VM ran OK until the 'Checkout', and then it reverted to the home page template.

I inserted your code on my MAMP-based test server, and it appears to resolve the problem. I'll do some more testing, and then I'll copy it up to the IIS-based production server. I'll post back if I strike any related issues.

Steve.
Title: Re: Problems with template in Virtuemart
Post by: ppp666 on October 12, 2009, 11:45:02 am
HUGE THANK YOU!

TomD you are my hero!
This works as a charm - been looking everywhere to solve my blank page when checking out in VM. (Using JA - Dravity theme)
 :D
Title: Re: Problems with template in Virtuemart
Post by: metamodguy on February 09, 2010, 19:38:57 pm
Just for the record, I've built-in a fix with a very similar approach, to the free MetaTemplate extension (http://extensions.joomla.org/extensions/style-a-design/templating/11172).

The fix is activated by default when you install MetaTemplate, and if for any reason you want to deactivate the fix it can be turned off the the MetaTemplate global preferences.

The advantage of having the fix in an extension like this is that it does not require any changes to core Joomla or VM files (so it won't break when you upgrade), and it can be turned on/off or removed easily.

Hope it helps,
Stephen