Merge branch 'master' of https://github.com/bagisto/bagisto into development
This commit is contained in:
commit
91c4a4205b
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/admin.js": "/js/admin.js",
|
||||
"/css/admin.css": "/css/admin.css"
|
||||
"/js/admin.js": "/js/admin.js?id=c70dacdf945a32e04b77",
|
||||
"/css/admin.css": "/css/admin.css?id=d40a640933cbcc121f1d"
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
const { mix } = require("laravel-mix");
|
||||
require("laravel-mix-merge-manifest");
|
||||
|
||||
// var publicPath = 'publishable/assets';
|
||||
var publicPath = "../../../public/vendor/webkul/admin/assets";
|
||||
var publicPath = 'publishable/assets';
|
||||
// var publicPath = "../../../public/vendor/webkul/admin/assets";
|
||||
|
||||
mix.setPublicPath(publicPath).mergeManifest();
|
||||
mix.disableNotifications();
|
||||
|
|
|
|||
|
|
@ -152,8 +152,8 @@ class Cart {
|
|||
$this->putCart($result);
|
||||
|
||||
if($result) {
|
||||
if($this->createItem($id, $data))
|
||||
return true;
|
||||
if($item = $this->createItem($id, $data))
|
||||
return $item;
|
||||
else
|
||||
return false;
|
||||
} else {
|
||||
|
|
@ -284,26 +284,17 @@ class Cart {
|
|||
'weight' => $weight,
|
||||
'total_weight' => $weight * $data['quantity'],
|
||||
'base_total_weight' => $weight * $data['quantity'],
|
||||
'additional' => $additional
|
||||
'additional' => $additional,
|
||||
'type' => $product['type'],
|
||||
'product_id' => $product['id'],
|
||||
'additional' => $data,
|
||||
];
|
||||
|
||||
if($configurable){
|
||||
$parentData['type'] = $product['type'];
|
||||
$parentData['product_id'] = $product['id'];
|
||||
$parentData['additional'] = $data;
|
||||
} else {
|
||||
$parentData['type'] = $product['type'];
|
||||
$parentData['product_id'] = $product['id'];
|
||||
$parentData['additional'] = $data;
|
||||
}
|
||||
|
||||
if($configurable) {
|
||||
$additional = $this->getProductAttributeOptionDetails($parentProduct);
|
||||
$attributeDetails = $this->getProductAttributeOptionDetails($parentProduct);
|
||||
unset($attributeDetails['html']);
|
||||
|
||||
unset($additional['html']);
|
||||
|
||||
$additional['request'] = $data;
|
||||
$additional['variant_id'] = $data['selected_configurable_option'];
|
||||
$parentData['additional'] = array_merge($parentData['additional'], $attributeDetails);
|
||||
|
||||
$childData['product_id'] = (int)$data['selected_configurable_option'];
|
||||
$childData['sku'] = $parentProduct->sku;
|
||||
|
|
@ -319,10 +310,7 @@ class Cart {
|
|||
$this->cartItem->create($childData);
|
||||
}
|
||||
|
||||
if($result)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -336,6 +324,12 @@ class Cart {
|
|||
{
|
||||
$item = $this->cartItem->findOneByField('id', $itemId);
|
||||
|
||||
if (isset($data['product'])) {
|
||||
$additional = $data;
|
||||
} else {
|
||||
$additional = $item->additional;
|
||||
}
|
||||
|
||||
if($item->type == 'configurable') {
|
||||
$product = $this->product->findOneByField('id', $item->child->product_id);
|
||||
|
||||
|
|
@ -344,6 +338,11 @@ class Cart {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
$attributeDetails = $this->getProductAttributeOptionDetails($product);
|
||||
unset($attributeDetails['html']);
|
||||
|
||||
$additional = array_merge($additional, $attributeDetails);
|
||||
} else {
|
||||
$product = $this->product->findOneByField('id', $item->product_id);
|
||||
|
||||
|
|
@ -361,7 +360,8 @@ class Cart {
|
|||
'total' => core()->convertPrice($item->price * ($quantity)),
|
||||
'base_total' => $item->price * ($quantity),
|
||||
'total_weight' => $item->weight * ($quantity),
|
||||
'base_total_weight' => $item->weight * ($quantity)
|
||||
'base_total_weight' => $item->weight * ($quantity),
|
||||
'additional' => $additional
|
||||
]);
|
||||
|
||||
$this->collectTotals();
|
||||
|
|
@ -369,7 +369,7 @@ class Cart {
|
|||
if($result) {
|
||||
session()->flash('success', trans('shop::app.checkout.cart.quantity.success'));
|
||||
|
||||
return true;
|
||||
return $item;
|
||||
} else {
|
||||
session()->flash('warning', trans('shop::app.checkout.cart.quantity.error'));
|
||||
|
||||
|
|
@ -793,11 +793,13 @@ class Cart {
|
|||
$item->update(['name' => $item->product->name]);
|
||||
|
||||
} else if($item->child->product->price != $item->price) {
|
||||
$price = (float) $item->custom_price ? $item->custom_price : $item->child->product->price;
|
||||
|
||||
$item->update([
|
||||
'price' => $item->child->product->price,
|
||||
'base_price' => $item->child->product->price,
|
||||
'total' => core()->convertPrice($item->child->product->price * ($item->quantity)),
|
||||
'base_total' => $item->child->product->price * ($item->quantity),
|
||||
'price' => $price,
|
||||
'base_price' => $price,
|
||||
'total' => core()->convertPrice($price * ($item->quantity)),
|
||||
'base_total' => $price * ($item->quantity),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -809,11 +811,13 @@ class Cart {
|
|||
$item->update(['name' => $item->product->name]);
|
||||
|
||||
} else if($item->product->price != $item->price) {
|
||||
$price = (float) $item->custom_price ? $item->custom_price : $item->product->price;
|
||||
|
||||
$item->update([
|
||||
'price' => $item->product->price,
|
||||
'base_price' => $item->product->price,
|
||||
'total' => core()->convertPrice($item->product->price * ($item->quantity)),
|
||||
'base_total' => $item->product->price * ($item->quantity),
|
||||
'price' => $price,
|
||||
'base_price' => $price,
|
||||
'total' => core()->convertPrice($price * ($item->quantity)),
|
||||
'base_total' => $price * ($item->quantity),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,16 @@ class CartItem extends Model
|
|||
|
||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||
|
||||
public function product() {
|
||||
public function product()
|
||||
{
|
||||
return $this->hasOne(Product::class, 'id', 'product_id');
|
||||
}
|
||||
|
||||
public function cart()
|
||||
{
|
||||
return $this->hasOne(Cart::class, 'id', 'cart_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the child item.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -244,32 +244,23 @@ class OrderRepository extends Repository
|
|||
*/
|
||||
public function collectTotals($order)
|
||||
{
|
||||
$subTotalInvoiced = $baseSubTotalInvoiced = 0;
|
||||
$shippingInvoiced = $baseShippingInvoiced = 0;
|
||||
$taxInvoiced = $baseTaxInvoiced = 0;
|
||||
$order->sub_total_invoiced = $order->base_sub_total_invoiced = 0;
|
||||
$order->shipping_invoiced = $order->base_shipping_invoiced = 0;
|
||||
$order->tax_amount_invoiced = $order->base_tax_amount_invoiced = 0;
|
||||
|
||||
foreach($order->invoices as $invoice) {
|
||||
$subTotalInvoiced += $invoice->sub_total;
|
||||
$baseSubTotalInvoiced += $invoice->base_sub_total;
|
||||
$order->sub_total_invoiced += $invoice->sub_total;
|
||||
$order->base_sub_total_invoiced += $invoice->base_sub_total;
|
||||
|
||||
$shippingInvoiced += $invoice->shipping_amount;
|
||||
$baseShippingInvoiced += $invoice->base_shipping_amount;
|
||||
$order->shipping_invoiced += $invoice->shipping_amount;
|
||||
$order->base_shipping_invoiced += $invoice->base_shipping_amount;
|
||||
|
||||
$taxInvoiced += $invoice->tax_amount;
|
||||
$baseTaxInvoiced += $invoice->base_tax_amount;
|
||||
$order->tax_amount_invoiced += $invoice->tax_amount;
|
||||
$order->base_tax_amount_invoiced += $invoice->base_tax_amount;
|
||||
}
|
||||
|
||||
$order->sub_total_invoiced = $subTotalInvoiced;
|
||||
$order->base_sub_total_invoiced = $baseSubTotalInvoiced;
|
||||
|
||||
$order->shipping_invoiced = $shippingInvoiced;
|
||||
$order->base_shipping_invoiced = $baseShippingInvoiced;
|
||||
|
||||
$order->tax_amount_invoiced = $taxInvoiced;
|
||||
$order->base_tax_amount_invoiced = $baseTaxInvoiced;
|
||||
|
||||
$order->grand_total_invoiced = $subTotalInvoiced + $shippingInvoiced + $taxInvoiced;
|
||||
$order->base_grand_total_invoiced = $baseSubTotalInvoiced + $shippingInvoiced + $baseTaxInvoiced;
|
||||
$order->grand_total_invoiced = $order->sub_total_invoiced + $order->shipping_invoiced + $order->tax_amount_invoiced;
|
||||
$order->base_grand_total_invoiced = $order->base_sub_total_invoiced + $order->base_shipping_invoiced + $order->base_tax_amount_invoiced;
|
||||
|
||||
$order->save();
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,10 +1,4 @@
|
|||
{
|
||||
<<<<<<< HEAD
|
||||
"/js/shop.js": "/js/shop.js?id=0e3e1ea03fe1f7358aaa",
|
||||
"/css/shop.css": "/css/shop.css?id=4bdb6dfb99c5788a9dc4"
|
||||
}
|
||||
=======
|
||||
"/js/shop.js": "/js/shop.js?id=dc2ea56a854d779e7089",
|
||||
"/css/shop.css": "/css/shop.css?id=d5e0d64663045e5aa78b"
|
||||
"/css/shop.css": "/css/shop.css?id=7a0ee09c1b127c0490e0"
|
||||
}
|
||||
>>>>>>> c9f2fd218b27272ccdb7183bc26b482410dfea1b
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use Webkul\Product\Repositories\ProductRepository;
|
|||
use Webkul\Customer\Repositories\CustomerRepository;
|
||||
use Webkul\Product\Helpers\ProductImage;
|
||||
use Webkul\Product\Helpers\View as ProductView;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Cart;
|
||||
|
||||
/**
|
||||
|
|
@ -76,7 +77,8 @@ class CartController extends Controller
|
|||
*
|
||||
* @return Mixed
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
return view($this->_config['view'])->with('cart', Cart::getCart());
|
||||
}
|
||||
|
||||
|
|
@ -85,10 +87,15 @@ class CartController extends Controller
|
|||
*
|
||||
* @return Mixed
|
||||
*/
|
||||
public function add($id) {
|
||||
public function add($id)
|
||||
{
|
||||
Event::fire('checkout.cart.add.before', $id);
|
||||
|
||||
$result = Cart::add($id, request()->except('_token'));
|
||||
|
||||
if($result) {
|
||||
Event::fire('checkout.cart.add.after', $result);
|
||||
|
||||
if ($result) {
|
||||
session()->flash('success', trans('shop::app.checkout.cart.item.success'));
|
||||
} else {
|
||||
session()->flash('warning', trans('shop::app.checkout.cart.item.error-add'));
|
||||
|
|
@ -104,9 +111,14 @@ class CartController extends Controller
|
|||
*
|
||||
* @param integer $itemId
|
||||
*/
|
||||
public function remove($itemId) {
|
||||
public function remove($itemId)
|
||||
{
|
||||
Event::fire('checkout.cart.delete.before', $itemId);
|
||||
|
||||
Cart::removeItem($itemId);
|
||||
|
||||
Event::fire('checkout.cart.delete.after', $itemId);
|
||||
|
||||
Cart::collectTotals();
|
||||
|
||||
return redirect()->back();
|
||||
|
|
@ -117,10 +129,11 @@ class CartController extends Controller
|
|||
*
|
||||
* @return response
|
||||
*/
|
||||
public function updateBeforeCheckout() {
|
||||
public function updateBeforeCheckout()
|
||||
{
|
||||
$request = request()->except('_token');
|
||||
|
||||
foreach($request['qty'] as $id => $quantity) {
|
||||
foreach ($request['qty'] as $id => $quantity) {
|
||||
if($quantity <= 0) {
|
||||
session()->flash('warning', trans('shop::app.checkout.cart.quantity.illegal'));
|
||||
|
||||
|
|
@ -128,13 +141,18 @@ class CartController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
foreach($request['qty'] as $key => $value) {
|
||||
|
||||
foreach ($request['qty'] as $key => $value) {
|
||||
$item = $this->cartItem->findOneByField('id', $key);
|
||||
|
||||
$data['quantity'] = $value;
|
||||
|
||||
Event::fire('checkout.cart.update.before', $key);
|
||||
|
||||
Cart::updateItem($item->product_id, $data, $key);
|
||||
|
||||
Event::fire('checkout.cart.update.after', $item);
|
||||
|
||||
unset($item);
|
||||
unset($data);
|
||||
}
|
||||
|
|
@ -150,17 +168,19 @@ class CartController extends Controller
|
|||
*
|
||||
* @return response
|
||||
*/
|
||||
public function addConfigurable($slug) {
|
||||
public function addConfigurable($slug)
|
||||
{
|
||||
session()->flash('warning', trans('shop::app.checkout.cart.add-config-warning'));
|
||||
return redirect()->route('shop.products.index', $slug);
|
||||
}
|
||||
|
||||
public function buyNow($id) {
|
||||
public function buyNow($id)
|
||||
{
|
||||
$result = Cart::proceedToBuyNow($id);
|
||||
|
||||
Cart::collectTotals();
|
||||
|
||||
if(!$result) {
|
||||
if (!$result) {
|
||||
return redirect()->back();
|
||||
} else {
|
||||
return redirect()->route('shop.checkout.onepage.index');
|
||||
|
|
@ -173,10 +193,11 @@ class CartController extends Controller
|
|||
*
|
||||
* @param instance cartItem $id
|
||||
*/
|
||||
public function moveToWishlist($id) {
|
||||
public function moveToWishlist($id)
|
||||
{
|
||||
$result = Cart::moveToWishlist($id);
|
||||
|
||||
if(!$result) {
|
||||
if (!$result) {
|
||||
Cart::collectTotals();
|
||||
|
||||
session()->flash('success', trans('shop::app.wishlist.moved'));
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="22px" height="22px" viewBox="0 0 22 22" 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-star</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Icon-star" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<polygon id="Star" fill="#0031F0" points="11.0839804 15.75 6.08780574 18.3766445 7.04199019 12.8133222 3 8.87335555 8.58589307 8.06167777 11.0839804 3 13.5820677 8.06167777 19.1679608 8.87335555 15.1259706 12.8133222 16.080155 18.3766445"></polygon>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 711 B |
File diff suppressed because one or more lines are too long
|
|
@ -1,10 +1,4 @@
|
|||
{
|
||||
<<<<<<< HEAD
|
||||
"/js/ui.js": "/js/ui.js?id=188cc8772638ec817a35",
|
||||
"/css/ui.css": "/css/ui.css?id=014ff883008a2459b5e1"
|
||||
}
|
||||
=======
|
||||
"/js/ui.js": "/js/ui.js?id=c3ee60fd11e29aca2922",
|
||||
"/css/ui.css": "/css/ui.css?id=0433c5b81c6583e79c04"
|
||||
"/css/ui.css": "/css/ui.css?id=0b2b51d90a970c9a4219"
|
||||
}
|
||||
>>>>>>> 4e89ce082ea6e0282b569e4928016771b99a8f56
|
||||
|
|
|
|||
Loading…
Reference in New Issue