Merge pull request #5675 from akhtarkhan1/product-download

–Fixed Download product issue #5663
This commit is contained in:
Devansh 2022-01-25 13:29:57 +05:30 committed by GitHub
commit 0fe5b20bda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -106,6 +106,9 @@ class DownloadableLinkPurchasedRepository extends Repository
$totalInvoiceQty = $totalInvoiceQty + $invoice_item->qty;
}
$orderedQty = $purchasedLink->order_item->qty_ordered;
$totalInvoiceQty = $totalInvoiceQty * ($purchasedLink->download_bought / $orderedQty);
$this->update([
'status' => $purchasedLink->download_used == $totalInvoiceQty ? $status : $purchasedLink->status,
'download_canceled' => $purchasedLink->download_bought - $totalInvoiceQty,

View File

@ -65,6 +65,9 @@ class DownloadableProductController extends Controller
}
}
$orderedQty = $downloadableLinkPurchased->order->total_qty_ordered;
$totalInvoiceQty = $totalInvoiceQty * ($downloadableLinkPurchased->download_bought / $orderedQty);
if ($downloadableLinkPurchased->download_used == $totalInvoiceQty || $downloadableLinkPurchased->download_used > $totalInvoiceQty) {
session()->flash('warning', trans('shop::app.customer.account.downloadable_products.payment-error'));