get category name in opencart product

$this->load->model('catalog/product');
				$this->load->model('catalog/category');
				$categories = $this->model_catalog_product->getCategories($product['product_id']);
				foreach($categories as $categorie){}
				if ($categorie){
   $categories_info = $this->model_catalog_category->getCategory($categorie['category_id']);

   if($categories_info['name']=='Premium'){
$data['category_title'] = $categories_info['name'];
   }else
   {
	if($product['product_id'] == 60 || $product['product_id'] == 61 || $product['product_id'] == 62 )
	{
		$data['plan_name']=$product['name'];
		$data['plan_price']=$this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
	}else{
	
					$data['products'][] = array(
						'cart_id'    => $product['cart_id'],
						'product_id' => $product['product_id'],
						'name'       => $product['name'],
						'model'      => $product['model'],
						'option'     => $option_data,
						'recurring'  => $recurring,
						'quantity'   => $product['quantity'],
						'subtract'   => $product['subtract'],
						'price'      => $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']),
						'total'      => $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')) * $product['quantity'], $this->session->data['currency']),
						'href'       => $this->url->link('product/plan', 'product_id=' . $product['product_id'])
					);
				}
   }

				}

Leave a Reply