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?

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

2 Answers 2

1

Change

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

to

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

1
  • Worked immediately. Thanks mate. Commented May 4, 2019 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 and acknowledge you have read our privacy policy.

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