Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to get $HTTP_GET_VARS or $_GET to work? 
 
DetailAddict
Jr. Member
 
Total Posts:  23
Joined:  2008-10-16
 

So I’ve been following instructions and steps from http://www.magentocommerce.com/boards/viewthread/3698/ and able to insert my own PHP code.  However, I am not able to use $HTTP_GET_VARS or $_GET.

I get something like “Undefined index : folder” where folder is the variable name… ie

$temp = $HTTP_GET_VARS[’folder’];
$temp = $_GET[’folder’];

HELP! :(

 
Magento Community Magento Community
Magento Community
Magento Community
 
DetailAddict
Jr. Member
 
Total Posts:  23
Joined:  2008-10-16
 

can anyone help?  thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
vianetz
Guru
 
Avatar
Total Posts:  537
Joined:  2008-04-13
Munich, Germany
 

Take a look at the magento controller model.

 
Magento Community Magento Community
Magento Community
Magento Community
 
DetailAddict
Jr. Member
 
Total Posts:  23
Joined:  2008-10-16
 

sorry, still very new to Magento.... I’ll try to poke around, but could you provide the path to the controller model?

thanks!

massi - 25 October 2008 07:05 AM

Take a look at the magento controller model.

 
Magento Community Magento Community
Magento Community
Magento Community
 
miribota
Jr. Member
 
Total Posts:  23
Joined:  2008-10-13
 

Depending on what type of files you are working on… but for controllers and blocks you can use the preferred method of getting the vars out of the http request object…

$params $this->getRequest()->getParams();

$myParam $this->getRequest()->getParam('my_param');

otherwise the following should work from anywhere:

$params Mage::app()->getRequest()->getParams();

I haven’t tried getting the raw POST vars, maybe Magento is resetting them in the request, but if it isn’t working for you try the above.

Todd

EDIT: Just realized you are using this in a CMS page… the above may or may not be of any use to you.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Fibo
Sr. Member
 
Avatar
Total Posts:  107
Joined:  2008-06-25
Marseille, France
 

You may try to find which values are available in $_GET or $_POST (or $_REQUET which contains them all) by printing at the ad hoc place (peferrably after the <html has already been sent):

$debug=true// easy to change
if ($debug{
   
echo 'Values in GET, POST [<pre>';print_r($_REQUEST); echo '</pre>] ***';
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
DetailAddict
Jr. Member
 
Total Posts:  23
Joined:  2008-10-16
 

@Fibo: Nope, that won’t work… Same as $_GET or $HTTP_GET_VARS…

I get this error message:

NoticeUndefined index:  folder  in /home/hyper7/public_html/app/code/local/DetailAddict/Custom/Block/Portfolio.php on line 13
 
Magento Community Magento Community
Magento Community
Magento Community
 
DetailAddict
Jr. Member
 
Total Posts:  23
Joined:  2008-10-16
 

@miribota:  I LOVE YOU MAN! :D

$myParam $this->getRequest()->getParam('my_param')

worked on the first try!  THANK YOU! smile Almost gave up on Magento…

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top