This commit is contained in:
jitendra 2019-10-15 18:59:54 +05:30
parent 4657430da1
commit 94d7289927
5 changed files with 21 additions and 6 deletions

View File

@ -43,6 +43,22 @@ class Virtual extends AbstractType
*/
protected $showQuantityBox = true;
/**
* Return true if this product type is saleable
*
* @return boolean
*/
public function isSaleable()
{
if (! $this->product->status)
return false;
if ($this->haveSufficientQuantity(1))
return true;
return false;
}
/**
* @param integer $qty
* @return bool

View File

@ -134,7 +134,7 @@ class InvoiceRepository extends Repository
'base_discount_amount' => ( ($orderItem->base_discount_amount / $orderItem->qty_ordered) * $qty ),
'product_id' => $orderItem->product_id,
'product_type' => $orderItem->product_type,
'additional' => $orderItem->additional,
'additional' => $orderItem->additional
]);
if ($orderItem->getTypeInstance()->isComposite()) {
@ -160,7 +160,7 @@ class InvoiceRepository extends Repository
'base_discount_amount' => 0,
'product_id' => $childOrderItem->product_id,
'product_type' => $childOrderItem->product_type,
'additional' => $childOrderItem->additional,
'additional' => $childOrderItem->additional
]);
if (! $childOrderItem->product->getTypeInstance()->isStockable() && $childOrderItem->product->getTypeInstance()->showQuantityBox()) {

View File

@ -40,7 +40,7 @@ class RefundItemRepository extends Repository
if ($orderItem->qty_shipped && $quantity > $orderItem->qty_ordered - $orderItem->qty_shipped) {
$nonShippedQty = $orderItem->qty_ordered - $orderItem->qty_shipped;
if (($totalShippedQtyToRefund = $quantity - $nonShippedQty) > 0) {
if (($totalShippedQtyToRefund = $quantity - $nonShippedQty) > 0) {
foreach ($orderItem->shipment_items as $shipmentItem) {
if (! $totalShippedQtyToRefund)
break;

View File

@ -166,8 +166,7 @@ class RefundRepository extends Repository
'additional' => $childOrderItem->additional
]);
if ($childOrderItem->product->getTypeInstance()->showQuantityBox())
$this->refundItemRepository->returnQtyToProductInventory($childOrderItem, $finalQty);
$this->refundItemRepository->returnQtyToProductInventory($childOrderItem, $finalQty);
$this->orderItemRepository->collectTotals($childOrderItem);
}

View File

@ -91,7 +91,7 @@ class DownloadableProductDataGrid extends DataGrid
'label' => trans('shop::app.customer.account.downloadable_products.remaining-downloads'),
'type' => 'datetime',
'searchable' => false,
'sortable' => false,
'sortable' => true,
'filterable' => false,
'closure' => true,
'wrapper' => function ($value) {