parentGroup; } /** * @param int $parentGroup */ public function setParentGroup($parentGroup) { $this->parentGroup = $parentGroup; } /** * @return int */ public function getChildGroup() { return $this->childGroup; } /** * @param int $childGroup */ public function setChildGroup($childGroup) { $this->childGroup = $childGroup; } /** * @param array $settings */ public function setSettings($settings) { $this->settings = $settings; } /** * @return array */ public function getSettings() { return $this->settings; } public function getByParentGroup($productAttributes, $onlyInStock = true, $activeFeatures = [], $attributeMapValues = [], $outOfStockStatus = 1) { $parentGroupAttributes = array(); if (empty($activeFeatures)) { return $parentGroupAttributes; } $settings = $this->getSettings(); foreach ($productAttributes as $aParent) { if ($aParent['id_attribute_group'] == $this->getParentGroup()) { foreach ($productAttributes as $aChild) { if ($onlyInStock && $aChild['quantity'] < 1) { continue; } if (!empty($settings['only_available_for_order'])) { if ($aChild['quantity'] < 1 && $outOfStockStatus == 0) { continue; } if ($aChild['quantity'] < 1 && $outOfStockStatus == 2 && $settings['configuration']['PS_ORDER_OUT_OF_STOCK'] == 0) { continue; } } if ($aParent['id_attribute_group'] == $aChild['id_attribute_group'] || empty($activeFeatures[$aChild['id_attribute_group']])) { continue; } if ($aParent['id_product_attribute'] == $aChild['id_product_attribute']) { $parentGroupAttributes[$aParent['attribute_name']][$aChild['id_attribute_group']][] = !empty($attributeMapValues[$aChild['id_attribute_group'].'-'.$aChild['id_attribute']]) ? $attributeMapValues[$aChild['id_attribute_group'].'-'.$aChild['id_attribute']] : $aChild['attribute_name']; } } } } return $parentGroupAttributes; } public function getCombinationParentGroupName($productAttributes, $combinationId) { foreach ($productAttributes as $a) { if ($a['id_attribute_group'] == $this->getParentGroup() && $a['id_product_attribute'] == $combinationId) { return $a['attribute_name']; } } return ''; } public function getCombinationNameByMainGroup($name) { return ', '.$name; } }