This commit is contained in:
rahul shukla 2019-04-30 17:53:59 +05:30
parent ca08b9a133
commit db56e4b2df
3 changed files with 26 additions and 4 deletions

View File

@ -5,7 +5,8 @@ return [
'title' => 'Cash On Delivery',
'description' => 'Cash On Delivery',
'class' => 'Webkul\Payment\Payment\CashOnDelivery',
'active' => true
'active' => true,
'sort' => 1
],
'moneytransfer' => [
@ -13,7 +14,8 @@ return [
'title' => 'Money Transfer',
'description' => 'Money Transfer',
'class' => 'Webkul\Payment\Payment\MoneyTransfer',
'active' => true
'active' => true,
'sort' => 2
],
'paypal_standard' => [
@ -23,6 +25,7 @@ return [
'class' => 'Webkul\Paypal\Payment\Standard',
'sandbox' => true,
'active' => true,
'business_account' => 'test@webkul.com'
'business_account' => 'test@webkul.com',
'sort' => 3
]
];

View File

@ -24,10 +24,19 @@ class Payment
'method' => $object->getCode(),
'method_title' => $object->getTitle(),
'description' => $object->getDescription(),
'sort' => $object->getSortOrder(),
];
}
}
usort ($paymentMethods, function($a, $b) {
if ($a['sort'] == $b['sort']) {
return 0;
}
return ($a['sort'] < $b['sort']) ? -1 : 1;
});
return [
'jump_to_section' => 'payment',
'html' => view('shop::checkout.onepage.payment', compact('paymentMethods'))->render()

View File

@ -13,7 +13,7 @@ abstract class Payment
* @var Cart
*/
protected $cart;
/**
* Checks if payment method is available
*
@ -109,4 +109,14 @@ abstract class Payment
return $this->cart->items;
}
/**
* Returns payment method sort order
*
* @return array
*/
public function getSortOrder()
{
return $this->getConfigData('sort');
}
}