Hello,
You can use this code.
To check if product has options:
$hasOptions = false;
if (function_exists('Pektsekye_PO')){
include_once(Pektsekye_PO()->getPluginPath() . 'Model/Option.php');
$optionModel = new Pektsekye_ProductOptions_Model_Option();
$productOptions = $optionModel->getProductOptions($productId);
if (count($productOptions) > 0){
$hasOptions = true;
}
}
if ( $hasOptions ){
echo 'contains options';
} else{
echo 'does not contain options';
}
To check if product has required options:
$hasRequired = false;
if (function_exists('Pektsekye_PO')){
include_once(Pektsekye_PO()->getPluginPath() . 'Model/Option.php');
$optionModel = new Pektsekye_ProductOptions_Model_Option();
$productOptions = $optionModel->getProductOptions($productId);
foreach ($productOptions as $option){
if ($option['required'] == 1){
$hasRequired = true;
break;
}
}
}
if ($hasRequired){
echo 'contains required options';
} else{
echo 'does not contain required options';
}
PS: don’t forget that such checking for each product can slow down the website.
Stanislav