Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.19 KB | None | 0 0
  1. Auto (categories)
  2. Peugeot ===> 208 (sub categories)
  3. Color ===> black
  4.  
  5. Material
  6. Plastic ===> Yes
  7. Cuir ===> Yes
  8.  
  9. Auto
  10. Peugeot ===> 208
  11. Renault ===> 208 ==> no good value. it must not appear not included
  12. Color ===> black
  13. Color ===> black ==> no good value. it must not appear not included
  14.  
  15. Materials
  16. Plastic ===> Yes
  17. Cuir ===> Yes
  18.  
  19. $QSpecification = $this->db->prepare('select ag.specification_group_id,
  20. agd.name,
  21. pa.products_id
  22. from :table_products_specification pa,
  23. :table_specification a,
  24. :table_products_specification_group ag,
  25. :table_products_specification_group_description agd
  26. where pa.products_id = :products_id
  27. and agd.language_id = :language_id
  28. and pa.customers_group_id = :customers_group_id
  29. and pa.specification_group_id = a.specification_group_id
  30. and a.specification_group_id = ag.specification_group_id
  31. and ag.specification_group_id = agd.specification_group_id
  32. and pa.status = 1
  33. group by ag.specification_group_id
  34. order by ag.sort_order,
  35. agd.name
  36. ');
  37. $QSpecification->bindInt(':products_id', $products_id);
  38. $QSpecification->bindInt(':language_id', $this->lang->getId());
  39. $QSpecification->bindInt(':customers_group_id', $this->customer->getCustomersGroupID());
  40.  
  41. $QSpecification->execute();
  42.  
  43. $specification = $QSpecification->fetchAll();
  44.  
  45. foreach ($specification as $product_specification_group) {
  46. $product_specification_data = [];
  47.  
  48. $QproductsSpecification = $this->db->prepare('select pa.specification_group_id,
  49. a.specification_id,
  50. pa.id,
  51. ad.name,
  52. pad.text
  53. from :table_products_specification_description pad,
  54. :table_products_specification pa,
  55. :table_specification a,
  56. :table_specification_description ad
  57.  
  58. where pa.products_id = :products_id
  59. and a.specification_group_id = :specification_group_id
  60. and a.specification_id = ad.specification_id
  61. and pa.specification_group_id = a.specification_group_id
  62. and ad.language_id = :language_id
  63. and pad.language_id = :language_id
  64. and pa.id = pad.id
  65. and (pa.customers_group_id = :customers_group_id or pa.customers_group_id = 99)
  66. and pa.status = 1
  67. order by pa.sort_order,
  68. ad.name
  69. ');
  70.  
  71. $QproductsSpecification->bindInt(':specification_group_id', $product_specification_group['specification_group_id']);
  72. $QproductsSpecification->bindInt(':language_id', $this->lang->getId());
  73. $QproductsSpecification->bindInt(':products_id', $products_id);
  74. $QproductsSpecification->bindInt(':customers_group_id', $this->customer->getCustomersGroupID());
  75.  
  76. $QproductsSpecification->execute();
  77.  
  78. $product_specification_data[] = ['specification_id' => $QproductsSpecification->valueInt('specification_id'),
  79. 'name' => $QproductsSpecification->value('name'),
  80. 'text' => $QproductsSpecification->value('text')
  81. ];
  82. }
  83. }
  84.  
  85.  
  86. $product_specification_group_data[] = ['specification_group_id' => $product_specification_group['specification_group_id'],
  87. 'name' => $product_specification_group['name'],
  88. 'specification' => $product_specification_data
  89. ];
  90. }
  91.  
  92. var_dump($product_specification_group_data);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement