Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.13 KB | None | 0 0
  1. public function getProductBreadcrumbs($product_id) {
  2.     $path = $this->cache->get('product.breadcrumbs.' . $product_id . '.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'));
  3.    
  4.     if (!$path) {              
  5.         $query = $this->db->query("SELECT p2c.category_id, c.parent_id, c.manufacturer_id, cd.name FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "category c ON (p2c.category_id = c.category_id) LEFT JOIN " . DB_PREFIX . "category_description cd ON (p2c.category_id = cd.category_id) WHERE p2c.product_id = '" . (int)$product_id . "' AND c.category_id NOT IN (SELECT c.parent_id FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "category c ON (p2c.category_id = c.category_id) WHERE product_id = '" . (int)$product_id . "') LIMIT 1");
  6.         $category_data = $query->rows;
  7.        
  8.         $path = $this->getCategoryPath($category_data[0]['category_id']);
  9.        
  10.         $this->cache->set('product.breadcrumbs.' . $product_id . '.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'), $path);
  11.     }
  12.    
  13.     return implode("_",array_reverse($path));
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement