get category id by product id in opencart

get category id by product id in opencart

$this->load->model('catalog/category');
$product_cat = $this->model_catalog_product->getCategories($product_id);		
		$category_id=$product_cat[0]['category_id'];
$product_cat_parent = $this->model_catalog_category->getCategory($product_cat[0]['category_id']);
print_r($product_cat[0]['category_id']);

get category id by product id in opencart

$data = array(
            'catid'  => '63',
            'sort'  => 'p.date_added',
            'order' => 'DESC',
            'start' => 0,
            'limit' => $setting['limit']
        );
$results = $this->model_catalog_product->getProducts($data);


Leave a Reply