removed some dead code

This commit is contained in:
Prashant Singh 2019-06-14 17:54:36 +05:30
parent 2b9f40d7db
commit da82f2935c
4 changed files with 15 additions and 64 deletions

View File

@ -1092,59 +1092,6 @@ class Cart {
return $finalData;
}
/**
* Save discount data for cart
*/
public function saveDiscount()
{
$rule = $impact['rule'];
$cart = $this->getCart();
//update the cart items
foreach($cart->items as $item) {
if ($rule->use_coupon) {
if ($rule->action_type != config('pricerules.cart.validation.0')) {
$item->update([
'coupon_code' => $rule->coupon->code,
'discount_amount' => core()->convertPrice($impact['amount'], $cart->channel_currency_code),
'base_discount_amount' => $impact['amount']
]);
} else {
$item->update([
'coupon_code' => $rule->coupon->code,
'discount_percent' => $rule->disc_amount
]);
}
} else {
if ($rule->action_type != config('pricerules.cart.validation.0')) {
$item->update([
'discount_amount' => core()->convertPrice($impact['amount'], $cart->channel_currency_code),
'base_discount_amount' => $impact['amount']
]);
} else {
$item->update([
'discount_percent' => $rule->disc_amount
]);
}
}
}
// update the cart
if ($rule->use_coupon) {
$cart->update([
'coupon_code' => $rule->coupons->code,
'discount_amount' => core()->convertPrice($impact['amount'], $cart->channel_currency_code),
'base_discount_amount' => $impact['amount']
]);
} else {
$cart->update([
'discount_amount' => core()->convertPrice($impact['amount'], $cart->channel_currency_code),
'base_discount_amount' => $impact['amount']
]);
}
}
/**
* Prepares data for order item
*

View File

@ -280,14 +280,6 @@ class CartController extends Controller
return $nonCouponAbleRules;
}
/**
* To save the discount values inside the tables of orders and cart
*/
public function saveDiscount()
{
return ['hellow'];
}
/**
* To remove the currently active
* couponable rule

View File

@ -41,8 +41,6 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
Route::post('checkout/check/coupons', 'Webkul\Shop\Http\Controllers\CartController@applyCoupon')->name('shop.checkout.check.coupons');
Route::post('checkout/save/discounts', 'Webkul\Shop\Http\Controllers\CartController@saveDiscount')->name('shop.checkout.save.discount');
Route::post('checkout/fetch/noncoupon', 'Webkul\Shop\Http\Controllers\CartController@getNonCouponAbleRule')->name('shop.checkout.fetch.non-coupon');
Route::post('checkout/remove/coupon', 'Webkul\Shop\Http\Controllers\CartController@removeCoupon')->name('shop.checkout.remove.coupon');

View File

@ -504,6 +504,20 @@
this.templateRender() :
'')
]);
},
methods: {
onSubmit: function() {
var this_this = this;
axios.post('{{ route('shop.checkout.check.coupons') }}', {
code: this_this.code
}).then(function(response) {
console.log(response.data);
}).catch(function(error) {
console.log(error.data);
});
}
}
});
</script>