/** * Implementation of product specify logic of which product needs to be assigned to option. * For example if product which was added to option already removed from catalog. * * @param \Magento\Catalog\Model\Product $optionProduct * @param \Magento\Sales\Model\Quote\Item\Option $option * @param \Magento\Catalog\Model\Product $product * @return $this */ public function assignProductToOption($optionProduct, $option, $product) { if ($optionProduct) { $option->setProduct($optionProduct); } else { $option->setProduct($product); } return $this; }
/** * Implementation of product specify logic of which product needs to be assigned to option. * For example if product which was added to option already removed from catalog. * * @param \Magento\Catalog\Model\Product|null $optionProduct * @param \Magento\Sales\Model\Quote\Item\Option $option * @param \Magento\Catalog\Model\Product|null $product * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function assignProductToOption($optionProduct, $option, $product) { if ($optionProduct) { $option->setProduct($optionProduct); } else { $option->getItem()->setHasConfigurationUnavailableError(true); } return $this; }