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)
131131 ScopeInterface::SCOPE_STORE
132132 );
133133 $ 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+
134141 foreach ($ linkIds as $ linkId ) {
135142 if (isset ($ links [$ linkId ])) {
136143 $ linkPurchasedItem = $ this ->_createPurchasedItemModel ()->setPurchasedId (
@@ -158,9 +165,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
158165 )->setNumberOfDownloadsBought (
159166 $ numberOfDownloads
160167 )->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
164169 )->setCreatedAt (
165170 $ orderItem ->getCreatedAt ()
166171 )->setUpdatedAt (
You can’t perform that action at this time.
0 commit comments