Guest User

Untitled

a guest
Jan 15th, 2016
36
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $category_data = $this->model_catalog_product->getProductCategory($result['product_id']);foreach($category_data as $id){$category_name = $id['name'];$category_category_id = $id['category_id'];$category_sort_order = $id['sort_order'];}
  2. $this->data['products'][] = array(
  3. 'product_id' => $result['product_id'],
  4. 'thumb' => $image,
  5. 'name' => $result['name'],
  6. 'category_name'=> $category_name,
  7. 'category_id'=> $category_category_id,
  8. 'category_sort'=> $category_sort_order,
  9. 'price' => $price,
  10. 'price_byr' => $price_byr,
  11. 'special' => $special,
  12. 'special_byr'=> $special_byr,
  13. 'rating' => $rating,
  14. 'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
  15. 'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']),
  16. );
  17. if (!in_array($category_name, $category_names)){
  18. $category_names[] = $category_name;}
  19. $this->data['products_cat'] = $category_names;
  20. }
  21. foreach ($this->data['products_cat'] as $name) {
  22. $products = array();
  23. foreach ($this->data['products'] as $result) {
  24. if($name == $result['category_name']){
  25. $products[] = array('product_id' => $result['product_id'],
  26. 'thumb'=> $result['thumb'],
  27. 'name'=> $result['name'],
  28. 'price'=> $result['price'],
  29. 'special'=> $result['special'],
  30. 'category_id'=> $result['category_id'],
  31. 'rating'=> $result['rating'],
  32. 'reviews'=> $result['reviews'],
  33. 'href'=> $result['href']);}}
  34. $this->data['categories'][] = array('name'=> $name,'products'=> $products, 'category_id'=>$category_id);}
RAW Paste Data