You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running a clothing store, we exclusively use configurable products.
Price, special price and special from/to dates are all null on configurable products.
I've managed to get validation working correctly on configurable products which have a valid special price on at least one of its associated products (children).
Have I missed something?? If not, would you consider including the following code?
// SmartCategory/Model/Rule/Condition/Product/Sale.php
/**
* Validate product attribute value for condition
*
* @param AbstractModel $model
* @return bool
*/
public function validate(AbstractModel $model)
{
$isOnSale = false;
if ($model->getTypeId() == 'configurable') {
$models = $model->getTypeInstance()->getUsedProducts($model);
foreach ($models as $model) {
if ($this->validateSingleProduct($model)) {
return true;
}
}
return false;
} else {
return $this->validateSingleProduct($model);
}
}
public function validateSingleProduct(AbstractModel $model)
{
$specialPrice = $model->getSpecialPrice();
$isDateInterval = $this->_localeDate->isScopeDateInInterval(
$model->getStore(),
$model->getSpecialFromDate(),
$model->getSpecialToDate()
);
if ($this->getOperator() == '==' && $specialPrice && $isDateInterval) {
return true;
} elseif ($this->getOperator() == '!=' && (!$specialPrice || !$isDateInterval)) {
return true;
}
return false;
}
Thanks,
Luca
The text was updated successfully, but these errors were encountered:
Running a clothing store, we exclusively use configurable products.
Price, special price and special from/to dates are all null on configurable products.
I've managed to get validation working correctly on configurable products which have a valid special price on at least one of its associated products (children).
Have I missed something?? If not, would you consider including the following code?
Thanks,
Luca
The text was updated successfully, but these errors were encountered: