document->setSomeData("data"); I need to read the data in "system/l" /> document->setSomeData("data"); I need to read the data in "system/l" /> document->setSomeData("data"); I need to read the data in "system/l"/>

Opencart - Access document class in every where

34 Views Asked by At

I stored some data in "catalog/controller/product.php" OC v2.0.3.1 by using

$this->document->setSomeData("data");

I need to read the data in "system/library/response.php" by using

$this->document->getSomeData

But the document class is not reachable there. what can i do?

1

There are 1 best solutions below

0
Amin Gholibeigian On BEST ANSWER

You can pass $registry into response class in your system/framework.php like this:

$response = new Response($registry);

In your response class add:

private $registry;
public function __construct($registry){
    $this->registry = $registry;
}

use:

$document = $this->registry->get('document');
$document->setSomeData("data");