public function isSalable($product = null) { $salable = parent::isSalable($product); /*if (!is_null($salable)) { return $salable; }*/ $optionCollection = $this->getOptionsCollection($product); if (!count($optionCollection->getItems())) { return false; } $requiredOptionIds = array(); foreach ($optionCollection->getItems() as $option) { if ($option->getRequired()) { $requiredOptionIds[$option->getId()] = 0; } } $selectionCollection = $this->getSelectionsCollection($optionCollection->getAllIds(), $product); if (!count($selectionCollection->getItems())) { return false; } $salableSelectionCount = 0; foreach ($selectionCollection as $selection) { if ($selection->isSalable()) { $requiredOptionIds[$selection->getOptionId()] = 1; $salableSelectionCount++; } } return array_sum($requiredOptionIds) == count($requiredOptionIds) && $salableSelectionCount; }