File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed
Eav/Model/Entity/Attribute Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ namespace Magento \Catalog \Observer ;
7
+
8
+ use Magento \Framework \Event \ObserverInterface ;
9
+
10
+ /**
11
+ * Unset value for Special Price if passed as null
12
+ */
13
+ class UnsetSpecialPrice implements ObserverInterface
14
+ {
15
+ /**
16
+ * Unset the Special Price attribute if it is null
17
+ *
18
+ * @param \Magento\Framework\Event\Observer $observer
19
+ * @return $this
20
+ */
21
+ public function execute (\Magento \Framework \Event \Observer $ observer )
22
+ {
23
+ /** @var $product \Magento\Catalog\Model\Product */
24
+ $ product = $ observer ->getEvent ()->getProduct ();
25
+ if ($ product ->getSpecialPrice () === null ) {
26
+ $ product ->setData ('special_price ' , '' );
27
+ }
28
+
29
+ return $ this ;
30
+ }
31
+ }
Original file line number Diff line number Diff line change 56
56
</event >
57
57
<event name =" catalog_product_save_before" >
58
58
<observer name =" set_special_price_start_date" instance =" Magento\Catalog\Observer\SetSpecialPriceStartDate" />
59
+ <observer name =" unset_special_price" instance =" Magento\Catalog\Observer\UnsetSpecialPrice" />
59
60
</event >
60
61
</config >
Original file line number Diff line number Diff line change @@ -661,7 +661,7 @@ public function isValueEmpty($value)
661
661
*/
662
662
public function isAllowedEmptyTextValue ($ value )
663
663
{
664
- return $ this ->isInEmptyStringTypes () && ( $ value === self ::EMPTY_STRING || $ value === null ) ;
664
+ return $ this ->isInEmptyStringTypes () && $ value === self ::EMPTY_STRING ;
665
665
}
666
666
667
667
/**
You can’t perform that action at this time.
0 commit comments