@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $choices = array_slice($vars, 1); |
68 | 68 | $id_product_attribute = $this->getAttribute($product, $choices); |
69 | 69 | Analog::log("Product combination: $id_product_attribute"); |
70 | - $combo_groups = $this->getCombination($product,$id_product_attribute); |
|
70 | + $combo_groups = $this->getCombination($product, $id_product_attribute); |
|
71 | 71 | if (!empty($combo_groups) && is_array($combo_groups) && $combo_groups) { |
72 | 72 | foreach ($combo_groups as $k => $row) { |
73 | 73 | $combinations = $this->buildAttributes($combinations, $id_product_attribute, $row); |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | /** |
207 | 207 | * @param null|string $id_product_attribute |
208 | 208 | */ |
209 | - private function getCombination($product,$id_product_attribute) |
|
209 | + private function getCombination($product, $id_product_attribute) |
|
210 | 210 | { |
211 | 211 | $combo = $this->getAttributeBase($id_product_attribute); |
212 | 212 | |
213 | 213 | if (is_array($combo)) |
214 | 214 | { |
215 | - foreach($combo as $key => $value) |
|
215 | + foreach ($combo as $key => $value) |
|
216 | 216 | { |
217 | 217 | $combo['base_price'] = (float) $this->getOrderPrice($product); |
218 | - $combo['quantity'] = (int) $this->getStockQuantity($product,$id_product_attribute); |
|
218 | + $combo['quantity'] = (int) $this->getStockQuantity($product, $id_product_attribute); |
|
219 | 219 | $combo['id_product'] = (int) $product; |
220 | 220 | $combo['product_name'] = (int) $this->getProductName($product); |
221 | 221 | $pricing = $this->getAttributePricing($id_product_attribute); |
222 | - foreach($pricing as $ki => $val) |
|
222 | + foreach ($pricing as $ki => $val) |
|
223 | 223 | { |
224 | 224 | $combo[$ki] = $val; |
225 | 225 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | |
389 | 389 | if (is_array($result)) |
390 | 390 | { |
391 | - foreach($result as $key => $value) |
|
391 | + foreach ($result as $key => $value) |
|
392 | 392 | { |
393 | 393 | $result['cat_id'] = $value['id_category_default']; |
394 | 394 | $result['orderprice'] = $this->getOrderPrice($product); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | private function getAvailableDate($row) { |
188 | 188 | ($row['available_date'] != '0000-00-00') ? $dater = $row['available_date'] : $dater = ''; |
189 | 189 | return $dater; |
190 | - } |
|
190 | + } |
|
191 | 191 | |
192 | 192 | /** |
193 | 193 | * @param null|string $id_product_attribute |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | if (is_array($combo)) |
214 | 214 | { |
215 | - foreach($combo as $key => $value) |
|
215 | + foreach($combo as $key => $value) |
|
216 | 216 | { |
217 | 217 | $combo['base_price'] = (float) $this->getOrderPrice($product); |
218 | 218 | $combo['quantity'] = (int) $this->getStockQuantity($product,$id_product_attribute); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | private function getAttributeBase($attribute) { |
232 | - $sql = 'SELECT ag.id_attribute_group, ag.is_color_group, agl.name AS group_name, agl.public_name AS public_group_name, |
|
232 | + $sql = 'SELECT ag.id_attribute_group, ag.is_color_group, agl.name AS group_name, agl.public_name AS public_group_name, |
|
233 | 233 | a.id_attribute, al.name AS attribute_name, a.color AS attribute_color, ag.group_type, pac.id_product_attribute |
234 | 234 | FROM '._DB_PREFIX_.'product_attribute_combination pac |
235 | 235 | LEFT JOIN '._DB_PREFIX_.'attribute a ON (a.id_attribute = pac.id_attribute) |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | |
390 | 390 | if (is_array($result)) |
391 | 391 | { |
392 | - foreach($result as $key => $value) |
|
392 | + foreach($result as $key => $value) |
|
393 | 393 | { |
394 | 394 | $result['cat_id'] = $value['id_category_default']; |
395 | 395 | $result['orderprice'] = $this->getOrderPrice($value['id_product']); |
@@ -205,6 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | /** |
207 | 207 | * @param null|string $id_product_attribute |
208 | + * @param string $product |
|
208 | 209 | */ |
209 | 210 | private function getCombination($product,$id_product_attribute) |
210 | 211 | { |
@@ -228,6 +229,9 @@ discard block |
||
228 | 229 | return $combo; |
229 | 230 | } |
230 | 231 | |
232 | + /** |
|
233 | + * @param null|string $attribute |
|
234 | + */ |
|
231 | 235 | private function getAttributeBase($attribute) { |
232 | 236 | $sql = 'SELECT ag.id_attribute_group, ag.is_color_group, agl.name AS group_name, agl.public_name AS public_group_name, |
233 | 237 | a.id_attribute, al.name AS attribute_name, a.color AS attribute_color, ag.group_type, pac.id_product_attribute |
@@ -242,6 +246,9 @@ discard block |
||
242 | 246 | return $result; |
243 | 247 | } |
244 | 248 | |
249 | + /** |
|
250 | + * @param null|string $attribute |
|
251 | + */ |
|
245 | 252 | private function getStockQuantity($product, $attribute) { |
246 | 253 | $sql = 'SELECT stock.quantity from '._DB_PREFIX_.'stock_available as stock WHERE stock.id_product = '.(int) $product.'AND stock.id_product_attribute = '.(int) $attribute; |
247 | 254 | $result = $this->dbConn->fetchColumn($sql); |
@@ -249,6 +256,9 @@ discard block |
||
249 | 256 | } |
250 | 257 | |
251 | 258 | |
259 | + /** |
|
260 | + * @param null|string $attribute |
|
261 | + */ |
|
252 | 262 | private function getAttributePricing($attribute) { |
253 | 263 | $sql = 'SELECT pas.price, pas.ecotax, pas.weight, pas.default_on, pa.reference, pas.unit_price_impact, |
254 | 264 | pas.minimal_quantity, pas.available_date FROM '._DB_PREFIX_.'product_attribute_shop pas |