Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getProductBreadcrumbs($product_id) {
- $path = $this->cache->get('product.breadcrumbs.' . $product_id . '.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'));
- if (!$path) {
- $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");
- $category_data = $query->rows;
- $path = $this->getCategoryPath($category_data[0]['category_id']);
- $this->cache->set('product.breadcrumbs.' . $product_id . '.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'), $path);
- }
- return implode("_",array_reverse($path));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement