Skip to content

Commit bafb07d

Browse files
committed
Fixed exposing special price if the current date does not intersects with the period
1 parent a1e5689 commit bafb07d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/SpecialPrice.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\CatalogGraphQl\Model\Resolver\Product;
99

10+
use Magento\Framework\Exception\LocalizedException;
1011
use Magento\Framework\GraphQl\Config\Element\Field;
1112
use Magento\Framework\GraphQl\Query\ResolverInterface;
1213
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
@@ -25,6 +26,11 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
2526
{
2627
/** @var ProductInterface $product */
2728
$product = $value['model'];
29+
30+
if (!isset($value['model'])) {
31+
throw new LocalizedException(__('"model" value should be specified'));
32+
}
33+
2834
/** @var PricingSpecialPrice $specialPrice */
2935
$specialPrice = $product->getPriceInfo()->getPrice(PricingSpecialPrice::PRICE_CODE);
3036

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Product/CollectionProcessor/RequiredColumnsProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public function process(
3636
ContextInterface $context = null
3737
): Collection {
3838
$collection->addAttributeToSelect('special_price');
39-
$collection->addAttributeToSelect('special_price_from');
40-
$collection->addAttributeToSelect('special_price_to');
39+
$collection->addAttributeToSelect('special_from_date');
40+
$collection->addAttributeToSelect('special_to_date');
4141
$collection->addAttributeToSelect('tax_class_id');
4242

4343
return $collection;

0 commit comments

Comments
 (0)