Added discount amount to cart item
This commit is contained in:
parent
72e56f4709
commit
806f8f71f6
|
|
@ -249,7 +249,7 @@
|
|||
<td>{{ core()->formatBasePrice($item->base_discount_amount) }}</td>
|
||||
@endif
|
||||
|
||||
<td>{{ core()->formatBasePrice($item->base_total + $item->base_tax_amount) }}</td>
|
||||
<td>{{ core()->formatBasePrice($item->base_total + $item->base_tax_amount - $item->base_total + $item->base_tax_amount) }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@
|
|||
<td>{{ core()->formatBasePrice($item->base_discount_amount) }}</td>
|
||||
@endif
|
||||
|
||||
<td>{{ core()->formatBasePrice($item->base_total + $item->base_tax_amount) }}</td>
|
||||
<td>{{ core()->formatBasePrice($item->base_total + $item->base_tax_amount - $item->base_discount_amount) }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1167,6 +1167,9 @@ class Cart {
|
|||
'tax_percent' => $data['tax_percent'],
|
||||
'tax_amount' => $data['tax_amount'],
|
||||
'base_tax_amount' => $data['base_tax_amount'],
|
||||
'discount_percent' => $data['discount_percent'],
|
||||
'discount_amount' => $data['discount_amount'],
|
||||
'base_discount_amount' => $data['base_discount_amount'],
|
||||
'additional' => $data['additional'],
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -71,16 +71,33 @@ class CartRuleController extends Controller
|
|||
*/
|
||||
protected $cart;
|
||||
|
||||
public function __construct(Attribute $attribute, AttributeFamily $attributeFamily, Category $category, Product $product, CatalogRule $catalogRule, CartRule $cartRule, CartRuleCoupons $cartRuleCoupon, CartRuleLabels $cartRuleLabel)
|
||||
public function __construct(
|
||||
Attribute $attribute,
|
||||
AttributeFamily $attributeFamily,
|
||||
Category $category,
|
||||
Product $product,
|
||||
CatalogRule $catalogRule,
|
||||
CartRule $cartRule,
|
||||
CartRuleCoupons $cartRuleCoupon,
|
||||
CartRuleLabels $cartRuleLabel
|
||||
)
|
||||
{
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->attribute = $attribute;
|
||||
|
||||
$this->attributeFamily = $attributeFamily;
|
||||
|
||||
$this->category = $category;
|
||||
|
||||
$this->product = $product;
|
||||
|
||||
$this->cartRule = $cartRule;
|
||||
|
||||
$this->cartRuleCoupon = $cartRuleCoupon;
|
||||
|
||||
$this->cartRuleLabel = $cartRuleLabel;
|
||||
|
||||
$this->appliedConfig = config('pricerules.cart');
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +108,11 @@ class CartRuleController extends Controller
|
|||
|
||||
public function create()
|
||||
{
|
||||
return view($this->_config['view'])->with('cart_rule', [$this->appliedConfig, $this->fetchOptionableAttributes(), $this->getStatesAndCountries()]);
|
||||
return view($this->_config['view'])->with('cart_rule', [
|
||||
$this->appliedConfig,
|
||||
$this->fetchOptionableAttributes(),
|
||||
$this->getStatesAndCountries()
|
||||
]);
|
||||
}
|
||||
|
||||
public function store()
|
||||
|
|
@ -170,6 +191,7 @@ class CartRuleController extends Controller
|
|||
} else {
|
||||
$data['conditions'] = json_encode($data['all_conditions']);
|
||||
}
|
||||
|
||||
unset($data['all_conditions']);
|
||||
|
||||
if ($data['use_coupon']) {
|
||||
|
|
@ -207,7 +229,8 @@ class CartRuleController extends Controller
|
|||
if (isset($labels['global'])) {
|
||||
foreach (core()->getAllChannels() as $channel) {
|
||||
$label1['channel_id'] = $channel->id;
|
||||
foreach($channel->locales as $locale) {
|
||||
|
||||
foreach ($channel->locales as $locale) {
|
||||
$label1['locale_id'] = $locale->id;
|
||||
$label1['label'] = $labels['global'];
|
||||
$label1['cart_rule_id'] = $ruleCreated->id;
|
||||
|
|
@ -221,7 +244,7 @@ class CartRuleController extends Controller
|
|||
$ruleLabelCreated = $this->cartRuleLabel->create($label2);
|
||||
}
|
||||
|
||||
if(isset($coupons)) {
|
||||
if (isset($coupons)) {
|
||||
$coupons['cart_rule_id'] = $ruleCreated->id;
|
||||
$coupons['usage_per_customer'] = $data['per_customer']; //0 is for unlimited usage
|
||||
|
||||
|
|
@ -247,7 +270,12 @@ class CartRuleController extends Controller
|
|||
{
|
||||
$cart_rule = $this->cartRule->find($id);
|
||||
|
||||
return view($this->_config['view'])->with('cart_rule', [$this->appliedConfig, $this->fetchOptionableAttributes(), $this->getStatesAndCountries(), $cart_rule]);
|
||||
return view($this->_config['view'])->with('cart_rule', [
|
||||
$this->appliedConfig,
|
||||
$this->fetchOptionableAttributes(),
|
||||
$this->getStatesAndCountries(),
|
||||
$cart_rule
|
||||
]);
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
|
|
@ -274,8 +302,10 @@ class CartRuleController extends Controller
|
|||
'label' => 'array|nullable'
|
||||
]);
|
||||
|
||||
$data['usage_limit'] = 0;
|
||||
$data['per_customer'] = 0;
|
||||
$data = [
|
||||
'usage_limit' => 0,
|
||||
'per_customer' => 0,
|
||||
];
|
||||
|
||||
if ($validated->fails()) {
|
||||
session()->flash('error', 'Validation failed');
|
||||
|
|
@ -294,6 +324,7 @@ class CartRuleController extends Controller
|
|||
unset($data['_token']);
|
||||
|
||||
$channels = $data['channels'];
|
||||
|
||||
unset($data['channels']);
|
||||
|
||||
// $customer_groups = $data['customer_groups'];
|
||||
|
|
@ -302,6 +333,7 @@ class CartRuleController extends Controller
|
|||
|
||||
if (isset($data['label'])) {
|
||||
$labels = $data['label'];
|
||||
|
||||
unset($data['label']);
|
||||
}
|
||||
|
||||
|
|
@ -325,6 +357,7 @@ class CartRuleController extends Controller
|
|||
}
|
||||
|
||||
$data['actions'] = json_encode($data['actions']);
|
||||
|
||||
if (! isset($data['all_conditions']) || $data['all_conditions'] == "[]") {
|
||||
$data['conditions'] = null;
|
||||
} else {
|
||||
|
|
@ -416,9 +449,9 @@ class CartRuleController extends Controller
|
|||
|
||||
public function fetchOptionableAttributes()
|
||||
{
|
||||
$attributesWithOptions = array();
|
||||
return $attributesWithOptions = [];
|
||||
|
||||
foreach($this->attribute->all() as $attribute) {
|
||||
foreach ($this->attribute->all() as $attribute) {
|
||||
if (($attribute->type == 'select' || $attribute->type == 'multiselect') && $attribute->code != 'tax_category_id') {
|
||||
$attributesWithOptions[$attribute->admin_name] = $attribute->options->toArray();
|
||||
}
|
||||
|
|
@ -426,4 +459,4 @@ class CartRuleController extends Controller
|
|||
|
||||
return $attributesWithOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/shop.js": "/js/shop.js?id=9a7027b387c171cd0fd3",
|
||||
"/css/shop.css": "/css/shop.css?id=5d0ffa213eda626b89f6"
|
||||
"/css/shop.css": "/css/shop.css?id=0e57754dbdaba7c6eb76"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 51.1 (57501) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Icon-Note-Large</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Icon-Note-Large" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
|
||||
<g id="Group" transform="translate(3.000000, 3.000000)" stroke="#979797" stroke-width="2">
|
||||
<path d="M0,3 L18,3 L18,15 L12.5,15 C10.5,17 9.5,18 9.5,18 C9.5,18 8.33333333,17 6,15 L0,15 L0,3 Z" id="Rectangle-16"></path>
|
||||
<path d="M7,2.2522475 C7,0.997673883 8.09454039,4.04787445e-16 9.44472438,0 C10.7949084,-4.04787445e-16 11.8894488,0.997673883 11.8894488,2.22836699 L11.8894488,7.77163301 C11.8894488,9.00232612 10.7949084,10 9.44472438,10 C8.09454039,10 7,9.00232612 7,7.77163301 L7,6.80974897" id="Rectangle-17"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 51.1 (57501) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Icon-Promition-Active</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Icon-Promition-Active" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
|
||||
<g id="Group" transform="translate(8.000000, 10.000000)" stroke="#0041FF" stroke-width="2">
|
||||
<polygon id="Rectangle-15" points="5 8.96186626 22 1.91619318 22 26.0838068 5 19.0381337"></polygon>
|
||||
<path d="M22,0 L22,28" id="Path-17"></path>
|
||||
<path d="M3.5,9 L5,9 L5,19 L3.5,19 C1.56700338,19 2.36723813e-16,17.4329966 0,15.5 L0,12.5 C-2.36723813e-16,10.5670034 1.56700338,9 3.5,9 Z" id="Rectangle-15"></path>
|
||||
<path d="M8,21 L8,22.5494015 C8,24.2446714 9.1212786,25.7355564 10.75,26.2058824 L10.75,26.2058824 C12.3703103,26.6737794 14.1023615,25.9901587 14.9663265,24.5417467 L15.5,23.6470588" id="Path-18"></path>
|
||||
<path d="M26,14.25 L32,14.25" id="Path-19"></path>
|
||||
<path d="M26,9.24264069 L30.2426407,5" id="Path-19"></path>
|
||||
<path d="M26,23.1213203 L30.2426407,18.8786797" id="Path-19" transform="translate(28.121320, 21.000000) scale(-1, 1) translate(-28.121320, -21.000000) "></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 51.1 (57501) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Icon-Promition</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Icon-Promition" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
|
||||
<g id="Group" transform="translate(8.000000, 10.000000)" stroke="#979797" stroke-width="2">
|
||||
<polygon id="Rectangle-15" points="5 8.96186626 22 1.91619318 22 26.0838068 5 19.0381337"></polygon>
|
||||
<path d="M22,0 L22,28" id="Path-17"></path>
|
||||
<path d="M3.5,9 L5,9 L5,19 L3.5,19 C1.56700338,19 2.36723813e-16,17.4329966 0,15.5 L0,12.5 C-2.36723813e-16,10.5670034 1.56700338,9 3.5,9 Z" id="Rectangle-15"></path>
|
||||
<path d="M8,21 L8,22.5494015 C8,24.2446714 9.1212786,25.7355564 10.75,26.2058824 L10.75,26.2058824 C12.3703103,26.6737794 14.1023615,25.9901587 14.9663265,24.5417467 L15.5,23.6470588" id="Path-18"></path>
|
||||
<path d="M26,14.25 L32,14.25" id="Path-19"></path>
|
||||
<path d="M26,9.24264069 L30.2426407,5" id="Path-19"></path>
|
||||
<path d="M26,23.1213203 L30.2426407,18.8786797" id="Path-19" transform="translate(28.121320, 21.000000) scale(-1, 1) translate(-28.121320, -21.000000) "></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/ui.js": "/js/ui.js?id=97343143e38eeba34064",
|
||||
"/css/ui.css": "/css/ui.css?id=f912bd2a6525691bdb61"
|
||||
}
|
||||
"/js/ui.js": "/js/ui.js?id=a882033f451695263976",
|
||||
"/css/ui.css": "/css/ui.css?id=c846938a649c221ac297"
|
||||
}
|
||||
Loading…
Reference in New Issue