Post by mmalekshahi » Thu Aug 17, 2017 4:23 am

Hello friends
I have a problem with controllers in opencart . I want to call $categories_info['category_id'] in this controller (last line) :

Code: Select all

class ControllerModuleVisitedproduct extends Controller {
	public function index($setting) {

		if (isset($this->session->data['products_id'])) {
			foreach ($this->session->data['products_id'] as $result_id) {
				$result = $this->model_catalog_product->getProduct($result_id);
				$categories = $this->model_catalog_product->getCategories($result_id);
				if ($categories)
                   $categories_info = $this->model_catalog_category->getCategory($categories[0]['category_id']);
from another controller . What should I do ?



Thu Jan 19, 2017 4:06 am

Post by rgbrewer » Thu Aug 17, 2017 6:43 am

if I'm following you correctly, all you need to do is load that model into your new controller with $this->load->model('whatever/whatever') and then just run that model call again to get your variable data.

New member


Sat Apr 22, 2017 9:30 am
Who is online

Users browsing this forum: No registered users and 6 guests