This repository was archived by the owner on Apr 29, 2019. It is now read-only.
File tree 1 file changed +25
-16
lines changed
app/code/Magento/Newsletter/Model/ResourceModel
1 file changed +25
-16
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,13 @@ class Subscriber extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
48
48
*/
49
49
protected $ mathRandom ;
50
50
51
+ /**
52
+ * Guest customer id
53
+ *
54
+ * @var int
55
+ */
56
+ private $ guestCustomerId = 0 ;
57
+
51
58
/**
52
59
* Construct
53
60
*
@@ -136,22 +143,24 @@ public function loadByCustomerData(\Magento\Customer\Api\Data\CustomerInterface
136
143
return $ result ;
137
144
}
138
145
139
- $ select = $ this ->connection
140
- ->select ()
141
- ->from ($ this ->getMainTable ())
142
- ->where ('subscriber_email=:subscriber_email and store_id=:store_id ' );
143
-
144
- $ result = $ this ->connection
145
- ->fetchRow (
146
- $ select ,
147
- [
148
- 'subscriber_email ' => $ customer ->getEmail (),
149
- 'store_id ' => $ customer ->getStoreId ()
150
- ]
151
- );
152
-
153
- if ($ result ) {
154
- return $ result ;
146
+ if ($ customer ->getId () === $ this ->guestCustomerId ) {
147
+ $ select = $ this ->connection
148
+ ->select ()
149
+ ->from ($ this ->getMainTable ())
150
+ ->where ('subscriber_email=:subscriber_email and store_id=:store_id ' );
151
+
152
+ $ result = $ this ->connection
153
+ ->fetchRow (
154
+ $ select ,
155
+ [
156
+ 'subscriber_email ' => $ customer ->getEmail (),
157
+ 'store_id ' => $ customer ->getStoreId ()
158
+ ]
159
+ );
160
+
161
+ if ($ result ) {
162
+ return $ result ;
163
+ }
155
164
}
156
165
157
166
return [];
You can’t perform that action at this time.
0 commit comments