1

I keep getting :

Notice: Undefined index: from in /app/design/frontend/default/theme246k/template/catalog/product/view.phtml on line 1

Notice: Undefined index: from in /app/design/frontend/default/theme246k/template/catalog/product/view.phtml on line 196

LINE 1: php if($_GET['from'] == "key") { 

LINE 196: php if($_GET['from'] == "key") {

If I remove one of them, the page is broken. If I remove both of them, the page is broken.

What to do?

  • make sure you have your "Add Secret Key to URLs" set to YES – fmsthird May 3 '19 at 8:46
1

Change

if($_GET['from'] == "key") {

to

if(Mage::app()->getRequest()->getParam('from') == "key") {

  • Worked immediately. Thanks mate. – The Denster May 4 '19 at 21:08
2

First of all, check that you are getting "from" key in GET / POST request or not.

Also, you can use magento way to get parameters fo get or post a request.

$fromVar = $this->getRequest()->getParam("from", false);
if ($fromVar == 'key') {
 //Your logic goes here.
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.