File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
app/code/Magento/Downloadable/Observer Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,13 @@ public function execute(\Magento\Framework\Event\Observer $observer)
131
131
ScopeInterface::SCOPE_STORE
132
132
);
133
133
$ linkPurchased ->setLinkSectionTitle ($ linkSectionTitle )->save ();
134
+
135
+ $ linkstatus = \Magento \Downloadable \Model \Link \Purchased \Item::LINK_STATUS_PENDING ;
136
+ if ( $ orderStatusToEnableItem == \Magento \Sales \Model \Order \Item::STATUS_PENDING
137
+ || $ orderItem ->getOrder ()->getStatus () == \Magento \Sales \Model \Order::STATE_COMPLETE ){
138
+ $ linkstatus = \Magento \Downloadable \Model \Link \Purchased \Item::LINK_STATUS_AVAILABLE ;
139
+ }
140
+
134
141
foreach ($ linkIds as $ linkId ) {
135
142
if (isset ($ links [$ linkId ])) {
136
143
$ linkPurchasedItem = $ this ->_createPurchasedItemModel ()->setPurchasedId (
@@ -158,9 +165,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
158
165
)->setNumberOfDownloadsBought (
159
166
$ numberOfDownloads
160
167
)->setStatus (
161
- \Magento \Sales \Model \Order \Item::STATUS_PENDING == $ orderStatusToEnableItem ?
162
- \Magento \Downloadable \Model \Link \Purchased \Item::LINK_STATUS_AVAILABLE :
163
- \Magento \Downloadable \Model \Link \Purchased \Item::LINK_STATUS_PENDING
168
+ $ linkstatus
164
169
)->setCreatedAt (
165
170
$ orderItem ->getCreatedAt ()
166
171
)->setUpdatedAt (
You can’t perform that action at this time.
0 commit comments