change way for default shipping & payment method selection
This commit is contained in:
parent
45ff0b5602
commit
d27dfd1c1e
|
|
@ -6,8 +6,7 @@ return [
|
|||
'description' => 'shop::app.checkout.onepage.cash-desc',
|
||||
'class' => 'Webkul\Payment\Payment\CashOnDelivery',
|
||||
'active' => true,
|
||||
'sort' => 1,
|
||||
'default' => 'yes'
|
||||
'sort' => 1
|
||||
],
|
||||
|
||||
'moneytransfer' => [
|
||||
|
|
@ -16,8 +15,7 @@ return [
|
|||
'description' => 'shop::app.checkout.onepage.money-desc',
|
||||
'class' => 'Webkul\Payment\Payment\MoneyTransfer',
|
||||
'active' => true,
|
||||
'sort' => 2,
|
||||
'default' => 'no'
|
||||
'sort' => 2
|
||||
],
|
||||
|
||||
'paypal_standard' => [
|
||||
|
|
@ -28,7 +26,6 @@ return [
|
|||
'sandbox' => true,
|
||||
'active' => true,
|
||||
'business_account' => 'test@webkul.com',
|
||||
'sort' => 3,
|
||||
'default' => 'no'
|
||||
'sort' => 3
|
||||
]
|
||||
];
|
||||
|
|
@ -62,14 +62,7 @@ return [
|
|||
'value' => 4
|
||||
]
|
||||
],
|
||||
], [
|
||||
'name' => 'default',
|
||||
'title' => 'admin::app.admin.system.default',
|
||||
'type' => 'boolean',
|
||||
'validation' => 'required',
|
||||
'channel_based' => false,
|
||||
'locale_based' => true
|
||||
],
|
||||
]
|
||||
]
|
||||
], [
|
||||
'key' => 'sales.paymentmethods.moneytransfer',
|
||||
|
|
@ -124,14 +117,7 @@ return [
|
|||
'value' => 4
|
||||
]
|
||||
],
|
||||
], [
|
||||
'name' => 'default',
|
||||
'title' => 'admin::app.admin.system.default',
|
||||
'type' => 'boolean',
|
||||
'validation' => 'required',
|
||||
'channel_based' => false,
|
||||
'locale_based' => true
|
||||
],
|
||||
]
|
||||
]
|
||||
], [
|
||||
'key' => 'sales.paymentmethods.paypal_standard',
|
||||
|
|
@ -192,14 +178,7 @@ return [
|
|||
'value' => 4
|
||||
]
|
||||
],
|
||||
], [
|
||||
'name' => 'default',
|
||||
'title' => 'admin::app.admin.system.default',
|
||||
'type' => 'boolean',
|
||||
'validation' => 'required',
|
||||
'channel_based' => false,
|
||||
'locale_based' => true
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
@ -41,7 +41,6 @@ class Payment
|
|||
'method_title' => $object->getTitle(),
|
||||
'description' => $object->getDescription(),
|
||||
'sort' => $object->getSortOrder(),
|
||||
'default' => $object->getDefaultMethod(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,14 +119,4 @@ abstract class Payment
|
|||
{
|
||||
return $this->getConfigData('sort');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns default payment method.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getDefaultMethod()
|
||||
{
|
||||
return $this->getConfigData('default');
|
||||
}
|
||||
}
|
||||
|
|
@ -8,8 +8,7 @@ return [
|
|||
'active' => true,
|
||||
'default_rate' => '10',
|
||||
'type' => 'per_unit',
|
||||
'class' => 'Webkul\Shipping\Carriers\FlatRate',
|
||||
'default' => 'yes',
|
||||
'class' => 'Webkul\Shipping\Carriers\FlatRate'
|
||||
],
|
||||
|
||||
'free' => [
|
||||
|
|
@ -18,7 +17,6 @@ return [
|
|||
'description' => 'Free Shipping',
|
||||
'active' => true,
|
||||
'default_rate' => '0',
|
||||
'class' => 'Webkul\Shipping\Carriers\Free',
|
||||
'default' => 'yes',
|
||||
'class' => 'Webkul\Shipping\Carriers\Free'
|
||||
]
|
||||
];
|
||||
|
|
@ -43,14 +43,7 @@ return [
|
|||
'validation' => 'required',
|
||||
'channel_based' => false,
|
||||
'locale_based' => true
|
||||
], [
|
||||
'name' => 'default',
|
||||
'title' => 'admin::app.admin.system.default',
|
||||
'type' => 'boolean',
|
||||
'validation' => 'required',
|
||||
'channel_based' => false,
|
||||
'locale_based' => true
|
||||
],
|
||||
]
|
||||
]
|
||||
], [
|
||||
'key' => 'sales.carriers.flatrate',
|
||||
|
|
@ -106,14 +99,7 @@ return [
|
|||
'validation' => 'required',
|
||||
'channel_based' => false,
|
||||
'locale_based' => true
|
||||
], [
|
||||
'name' => 'default',
|
||||
'title' => 'admin::app.admin.system.default',
|
||||
'type' => 'boolean',
|
||||
'validation' => 'required',
|
||||
'channel_based' => false,
|
||||
'locale_based' => true
|
||||
],
|
||||
]
|
||||
]
|
||||
], [
|
||||
'key' => 'sales.shipping',
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ class Shipping
|
|||
if (! isset($rates[$rate->carrier])) {
|
||||
$rates[$rate->carrier] = [
|
||||
'carrier_title' => $rate->carrier_title,
|
||||
'default' => core()->getConfigData('sales.carriers.' . $rate->carrier. '.default'),
|
||||
'rates' => []
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -372,11 +372,13 @@
|
|||
staticRenderFns: shippingTemplateRenderFns,
|
||||
|
||||
mounted: function() {
|
||||
var first_iteration = true;
|
||||
|
||||
for (method in shippingMethods) {
|
||||
if (shippingMethods[method]['default'] == 'yes' || shippingMethods[method]['default'] == 1) {
|
||||
if (first_iteration) {
|
||||
for (rate in shippingMethods[method]['rates']) {
|
||||
this.selected_shipping_method = shippingMethods[method]['rates'][rate]['method'];
|
||||
|
||||
first_iteration = false;
|
||||
this.methodSelected();
|
||||
}
|
||||
}
|
||||
|
|
@ -425,10 +427,12 @@
|
|||
staticRenderFns: paymentTemplateRenderFns,
|
||||
|
||||
mounted: function() {
|
||||
for (method in paymentMethods) {
|
||||
if (paymentMethods[method]['default'] == 'yes' || paymentMethods[method]['default'] == 1) {
|
||||
this.payment.method = paymentMethods[method]['method'];
|
||||
var first_iteration = true;
|
||||
|
||||
for (method in paymentMethods) {
|
||||
if (first_iteration) {
|
||||
this.payment.method = paymentMethods[method]['method'];
|
||||
first_iteration = false;
|
||||
this.methodSelected();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue