issue #814
This commit is contained in:
parent
ca08b9a133
commit
db56e4b2df
|
|
@ -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
|
||||
]
|
||||
];
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue