Author Topic: JRequest::getVar('view') returns 'Frontpage' on VM pages and URL problems  (Read 168839 times)

chetanmadaan

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 291
Re: JRequest::getVar('view') returns 'Frontpage' on VM pages and URL problems
« Reply #60 on: January 07, 2010, 21:37:58 pm »
Love you Pollar. Here is a kiss from my side.

:) ummmmaah

baggiesmad

  • Jr. Member
  • **
  • Posts: 308
Re: JRequest::getVar('view') returns 'Frontpage' on VM pages and URL problems
« Reply #61 on: January 13, 2010, 11:24:51 am »
The second method fixed it for me!!! Thanks Pollar!

I did have to disable SEF URL's and uninstall the "SEF Router for Virtuemart"

metamodguy

  • 3rd party VirtueMart Developer
  • Beginner
  • *
  • Posts: 49
    • MetaMod and MetaTemplate for Joomla
Re: JRequest::getVar('view') returns 'Frontpage' on VM pages and URL problems
« Reply #62 on: January 14, 2010, 01:22:13 am »
Hi all,

there's another discussion about another solution for this, over on http://forum.virtuemart.net/index.php?topic=65450.0

vannquish, I know your problem is already solved, but could you possibly try out the method on that page, and see if it works with SEF URLs and the SEF Router for Virtuemart?
Regards,
Stephen Brandon
MetaMod and MetaTemplate author

abhaykochar

  • Beginner
  • *
  • Posts: 1
Re: JRequest::getVar('view') returns 'Frontpage' on VM pages and URL problems
« Reply #63 on: January 19, 2010, 10:30:02 am »
I did a simple trick
Quote
if(JRequest::getCmd( 'view' ) == 'frontpage' AND JRequest::getCmd( 'option' ) != 'com_virtuemart')
This worked for me

ProjectReady

  • Beginner
  • *
  • Posts: 1
Re: JRequest::getVar('view') returns 'Frontpage' on VM pages and URL problems
« Reply #64 on: January 22, 2010, 19:26:36 pm »
Because I'm on J1.0 something I make the change Change ($_SERVER['PHP_SELF']) with ($_SERVER['REQUEST_URI']) like said before and everything work well (multi-template and language). The only thing where isn't working it's the the Add to cart btn in the product page. Still bring to http://www.mywebsite.com/index.php

So I change in file /product_details/includes/addtocart_from.tpl.php around lign 21 <form action="<?php echo $mm_action_url ?>index.php" for the direct URL of the cart with all the parameter. (You can find this URL by using Cart Module).

work OK for me and the Joomfish switch don't "switch" to the wrong template.

silentBob

  • Beginner
  • *
  • Posts: 20
Re: JRequest::getVar('view') returns 'Frontpage' on VM pages and URL problems
« Reply #65 on: January 28, 2010, 13:33:44 pm »
hi,

i read that pollar used this hack to activate diferent templates for different VM categories. i patched my ps_session.php like pollar and also did that hack for the application.php (VM uri fix)

but now how can i set my templates that i installed for an categorie of VM?


perhaps someone can write an tutorial for that VM multi Template option, this would be great and post it in this forum?

backway2

  • Beginner
  • *
  • Posts: 8
Re: JRequest::getVar('view') returns 'Frontpage' on VM pages and URL problems
« Reply #66 on: February 03, 2010, 04:20:28 am »
thank you pollar, it worked for me too - after spending 2 days trying to work this out.
Appreciated

unleash.it

  • Jr. Member
  • **
  • Posts: 150
Re: JRequest::getVar('view') returns 'Frontpage' on VM pages and URL problems
« Reply #67 on: February 11, 2010, 03:08:25 am »
silentBob, that's not what we've been talking about here (at least as far as I've seen), but you might try metamod: http://extensions.joomla.org/extensions/access-a-security/frontend-access-control/3391

The idea would be to publish a custom HTML module with template markup only on certain virtuemart categories. Make sure to use JCE or something that doesn't strip it out...

Not the most elegant, but should work if you're not so great with PHP like me.

amorino

  • Jr. Member
  • **
  • Posts: 150
    • Création sites web Tunisie
Re: JRequest::getVar('view') returns 'Frontpage' on VM pages and URL problems
« Reply #68 on: February 16, 2010, 12:03:56 pm »
Hello,

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: [Select]
// get the full request URI
$uri = clone(JURI::getInstance());

3. Just after these lines add this code:

Code: [Select]
// 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: [Select]
// 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.


Thanks a lot Pollar
This worked for me like a charm
Création sites web Tunisie
http://www.idealconception.com

jehanon

  • Jr. Member
  • **
  • Posts: 114
in the ps_session.php file located in administrator/components/com_vertuemart/classes i changed the line 503

"$Itemid = "&Itemid=".$this->getShopItemid();"
 to
"$Itemid = "&Itemid=1".$this->getShopItemid();"



there is nothing at line 503 but at 548 :
// If we haven't found an Itemid, use the standard VM-Itemid
$Itemid = "&Itemid=" . ($tmp_Itemid ? $tmp_Itemid : $this->getShopItemid());

I have changed for
$Itemid = "&Itemid=1" . ($tmp_Itemid ? $tmp_Itemid : $this->getShopItemid());

but I still have a blank page  when products are not found in search box

jehanon

  • Jr. Member
  • **
  • Posts: 114
changing application.php doesnt solve it for me

index.php?page=shop.browse&option=com_virtuemart&Itemid=9  gives a blank page  when search box returns nothing

stano

  • Beginner
  • *
  • Posts: 1
A big thank you Pollar!
Saved my weekend and many further hours of searching :)

vincent79

  • Beginner
  • *
  • Posts: 9
Thank you Pollar! Great! I can now go to sleep (ok it's not too late 1:46)

bluebeachdesign

  • Beginner
  • *
  • Posts: 27
Sheesh still no solution

chris w

  • Beginner
  • *
  • Posts: 10
this whole issue is ridiculous, i can tfind a solution that doesnt either work or stop something else working. virtuemart was working fine for me for many years and then this comes along. does this mean this problem will arise on my other virtuemart sites?