Merge remote-tracking branch 'upstream/master' into s-3

This commit is contained in:
devansh bawari 2021-03-02 13:02:27 +05:30
commit 82a56761c8
17 changed files with 197 additions and 98 deletions

View File

@ -320,7 +320,8 @@ class Cart
return false; return false;
} }
$this->cartItemRepository->delete($itemId); if ($cartItem = $cart->items()->find($itemId)) {
$cartItem->delete();
if ($cart->items()->get()->count() == 0) { if ($cart->items()->get()->count() == 0) {
$this->cartRepository->delete($cart->id); $this->cartRepository->delete($cart->id);
@ -339,6 +340,9 @@ class Cart
return true; return true;
} }
return false;
}
/** /**
* This function handles when guest has some of cart products and then logs in. * This function handles when guest has some of cart products and then logs in.
* *

View File

@ -35,7 +35,7 @@ class CheckForMaintenanceMode extends Original
protected $except = []; protected $except = [];
/** /**
* Exclude ips. * Exclude IPs.
*/ */
protected $excludedIPs = []; protected $excludedIPs = [];
@ -49,14 +49,11 @@ class CheckForMaintenanceMode extends Original
/* application */ /* application */
$this->app = $app; $this->app = $app;
/* current channel */
$this->channel = core()->getCurrentChannel();
/* adding exception for admin routes */ /* adding exception for admin routes */
$this->except[] = env('APP_ADMIN_URL', 'admin') . '*'; $this->except[] = env('APP_ADMIN_URL', 'admin') . '*';
/* adding exception for ips */ /* exclude ips */
$this->excludedIPs = array_map('trim', explode(',', $this->channel->allowed_ips)); $this->setAllowedIps();
} }
/** /**
@ -116,4 +113,18 @@ class CheckForMaintenanceMode extends Original
return $next($request); return $next($request);
} }
/**
* Set allowed IPs.
*
* @return void
*/
protected function setAllowedIps()
{
$this->channel = core()->getCurrentChannel();
if ($this->channel) {
$this->excludedIPs = array_map('trim', explode(',', $this->channel->allowed_ips));
}
}
} }

View File

@ -11,12 +11,12 @@ use Webkul\Core\Eloquent\Repository;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Webkul\Attribute\Models\Attribute; use Webkul\Attribute\Models\Attribute;
use Webkul\Product\Models\ProductFlat; use Webkul\Product\Models\ProductFlat;
use Illuminate\Support\Facades\Storage;
use Illuminate\Container\Container as App; use Illuminate\Container\Container as App;
use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Pagination\LengthAwarePaginator;
use Webkul\Product\Models\ProductAttributeValueProxy; use Webkul\Product\Models\ProductAttributeValueProxy;
use Webkul\Attribute\Repositories\AttributeRepository; use Webkul\Attribute\Repositories\AttributeRepository;
use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Facades\Storage;
class ProductRepository extends Repository class ProductRepository extends Repository
{ {
@ -212,8 +212,12 @@ class ProductRepository extends Repository
if ($priceFilter = request('price')) { if ($priceFilter = request('price')) {
$priceRange = explode(',', $priceFilter); $priceRange = explode(',', $priceFilter);
if (count($priceRange) > 0) { if (count($priceRange) > 0) {
$qb->where('variants.min_price', '>=', core()->convertToBasePrice($priceRange[0]));
$qb->where('variants.min_price', '<=', core()->convertToBasePrice(end($priceRange))); $priceQuery = DB::raw('(CASE WHEN ' . DB::getTablePrefix() . 'catalog_rule_product_prices.price > 0 THEN ' . DB::getTablePrefix() . 'catalog_rule_product_prices.price ELSE ' . DB::getTablePrefix() . 'variants.min_price END)');
$qb->leftJoin('catalog_rule_product_prices', 'catalog_rule_product_prices.product_id', '=', 'variants.product_id')
->where($priceQuery, '>=', core()->convertToBasePrice($priceRange[0]))
->where($priceQuery, '<=', core()->convertToBasePrice(end($priceRange)));
} }
} }
@ -812,11 +816,23 @@ class ProductRepository extends Repository
* @return Model * @return Model
*/ */
public function checkOutOfStockItem($query) { public function checkOutOfStockItem($query) {
return $query->leftJoin('products as ps', 'product_flat.product_id', '=', 'ps.id') return $query
->leftJoin('products as ps', 'product_flat.product_id', '=', 'ps.id')
->leftJoin('product_inventories as pv', 'product_flat.product_id', '=', 'pv.product_id') ->leftJoin('product_inventories as pv', 'product_flat.product_id', '=', 'pv.product_id')
->where(function ($qb) { ->where(function ($qb) {
$qb $qb
->WhereIn('ps.type', ['configurable', 'grouped', 'downloadable', 'bundle', 'booking']) ->where('ps.type', 'configurable')
->where(function ($qb) {
$qb
->selectRaw('SUM(' . DB::getTablePrefix() . 'product_inventories.qty)')
->from('product_flat')
->leftJoin('product_inventories', 'product_inventories.product_id', '=', 'product_flat.product_id')
->whereRaw(DB::getTablePrefix() . 'product_flat.parent_id = ps.id');
}, '>', 0);
})
->orWhere(function ($qb) {
$qb
->WhereIn('ps.type', ['grouped', 'downloadable', 'bundle', 'booking'])
->orwhereIn('ps.type', ['simple', 'virtual'])->where('pv.qty' , '>' , 0); ->orwhereIn('ps.type', ['simple', 'virtual'])->where('pv.qty' , '>' , 0);
}); });
} }

View File

@ -2,9 +2,9 @@
namespace Webkul\Shop\Http\Controllers; namespace Webkul\Shop\Http\Controllers;
use PDF;
use Webkul\Sales\Repositories\OrderRepository; use Webkul\Sales\Repositories\OrderRepository;
use Webkul\Sales\Repositories\InvoiceRepository; use Webkul\Sales\Repositories\InvoiceRepository;
use PDF;
class OrderController extends Controller class OrderController extends Controller
{ {
@ -83,6 +83,10 @@ class OrderController extends Controller
{ {
$invoice = $this->invoiceRepository->findOrFail($id); $invoice = $this->invoiceRepository->findOrFail($id);
if ($invoice->order->customer_id !== auth()->guard('customer')->user()->id) {
abort(404);
}
$pdf = PDF::loadView('shop::customers.account.orders.pdf', compact('invoice'))->setPaper('a4'); $pdf = PDF::loadView('shop::customers.account.orders.pdf', compact('invoice'))->setPaper('a4');
return $pdf->download('invoice-' . $invoice->created_at->format('d-m-Y') . '.pdf'); return $pdf->download('invoice-' . $invoice->created_at->format('d-m-Y') . '.pdf');

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
{ {
"/js/velocity.js": "/js/velocity.js?id=88772f0049a360a2c02e", "/js/velocity.js": "/js/velocity.js?id=88772f0049a360a2c02e",
"/css/velocity-admin.css": "/css/velocity-admin.css?id=4322502d80a0e4a0affd", "/css/velocity-admin.css": "/css/velocity-admin.css?id=4322502d80a0e4a0affd",
"/css/velocity.css": "/css/velocity.css?id=b900a5750cddffe0d3f5" "/css/velocity.css": "/css/velocity.css?id=ab692d526032812a7666"
} }

View File

@ -1,4 +1,4 @@
@import "icons"; @import "main/icons";
@font-face { @font-face {
font-family: 'Webkul Rango'; font-family: 'Webkul Rango';

View File

@ -1,18 +1,25 @@
@import "rango"; /* main imports */
@import "icons"; @import "main/rango";
@import "mixins"; @import "main/icons";
@import "variables"; @import "main/mixins";
@import "main/variables";
/* shared components */
@import "components/shared";
/* components */
@import "components/UI"; @import "components/UI";
@import "components/app"; @import "components/app";
@import "components/home"; @import "components/home";
@import "components/footer"; @import "components/footer";
@import "components/shared";
@import "components/product-view"; @import "components/product-view";
@import "components/media"; @import "components/media";
@import "components/rtl"; @import "components/rtl";
/* static */
@import "static/material-icons"; @import "static/material-icons";
/* starting */
* { * {
margin: 0; margin: 0;
padding: 0; padding: 0;
@ -27,6 +34,7 @@
width: 3px; width: 3px;
height: 5px; height: 5px;
} }
/* Track */ /* Track */
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
background: #D8D8D8; background: #D8D8D8;
@ -474,7 +482,7 @@ header {
background-color: $theme-color; background-color: $theme-color;
i { i {
color: $btn-text-color; color: $button-text-color;
} }
} }
} }

View File

@ -406,7 +406,7 @@
padding: 0 10px !important; padding: 0 10px !important;
font-size: 24px !important; font-size: 24px !important;
font-weight: 600 !important; font-weight: 600 !important;
color: $dark-color !important; color: $black-color !important;
background-color: $white-color; background-color: $white-color;
border: 1px solid $border-common !important; border: 1px solid $border-common !important;
} }
@ -501,7 +501,7 @@
label { label {
font-size: 18px; font-size: 18px;
color: $light-grey-clr; color: $grey-color;
text-transform: uppercase; text-transform: uppercase;
} }
} }
@ -525,12 +525,12 @@
button[type=button].btn-secondary { button[type=button].btn-secondary {
border: none; border: none;
font-size: 16px; font-size: 16px;
color: $dark-color; color: $black-color;
background-color: $light-color; background-color: $white-color;
:hover { :hover {
color: $dark-color !important; color: $black-color !important;
background-color: $light-color !important; background-color: $white-color !important;
} }
:focus, :focus,
@ -641,8 +641,8 @@
text-align: center; text-align: center;
position: absolute; position: absolute;
border-radius: 50%; border-radius: 50%;
color: $light-color; color: $white-color;
background: $dark-color; background: $black-color;
} }
} }
@ -774,7 +774,7 @@
} }
.customer-email { .customer-email {
color: $light-grey-clr; color: $grey-color;
} }
} }
@ -876,7 +876,7 @@
font-size: 16px; font-size: 16px;
padding: 5px 16px; padding: 5px 16px;
border-radius: 1px; border-radius: 1px;
background: $btn-text-color; background: $button-text-color;
border: 1px solid $border-common; border: 1px solid $border-common;
} }
@ -1192,7 +1192,7 @@
&.next, &.next,
&.previous { &.previous {
cursor: not-allowed; cursor: not-allowed;
color: $light-grey-clr !important; color: $grey-color !important;
} }
} }
@ -1271,13 +1271,13 @@
font-size: 18px; font-size: 18px;
font-weight: 600; font-weight: 600;
padding-bottom: 10px; padding-bottom: 10px;
color: $light-grey-clr; color: $grey-color;
} }
.section-content { .section-content {
label + span { label + span {
font-weight: 600; font-weight: 600;
color: $light-grey-clr; color: $grey-color;
} }
.totals { .totals {
@ -1318,7 +1318,7 @@
font-size: 18px; font-size: 18px;
padding: 10px 0; padding: 10px 0;
font-weight: 600; font-weight: 600;
color: $light-grey-clr; color: $grey-color;
} }
} }
} }
@ -1497,7 +1497,7 @@
font-size: 16px; font-size: 16px;
padding: 5px 16px; padding: 5px 16px;
border-radius: 1px; border-radius: 1px;
background: $btn-text-color; background: $button-text-color;
border: 1px solid $border-common; border: 1px solid $border-common;
} }
@ -1708,7 +1708,7 @@
&.sale { &.sale {
padding: 2px 14px; padding: 2px 14px;
background-color: $color-danger; background-color: $danger-color;
} }
&.new { &.new {
@ -1867,7 +1867,7 @@
z-index: 100; z-index: 100;
padding-top: 10px; padding-top: 10px;
position: absolute; position: absolute;
background: $light-color; background: $white-color;
border-left: 1px solid $border-common; border-left: 1px solid $border-common;
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
overflow-y: auto; overflow-y: auto;
@ -2131,7 +2131,7 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 50%; border-radius: 50%;
background-color: $light-color; background-color: $white-color;
box-shadow: 0.5px 0.5px 2px 1px rgba(0,0,0,.32); box-shadow: 0.5px 0.5px 2px 1px rgba(0,0,0,.32);
} }
@ -2148,7 +2148,7 @@
text-align: center; text-align: center;
border-radius: 5px; border-radius: 5px;
white-space: nowrap; white-space: nowrap;
color: $light-color; color: $white-color;
border-color: $theme-color !important; border-color: $theme-color !important;
background-color: $theme-color !important; background-color: $theme-color !important;
} }

View File

@ -32,7 +32,7 @@
.social-icons { .social-icons {
height: 100%; height: 100%;
padding: 20px 0; padding: 20px 0;
color: $light-color; color: $white-color;
i { i {
margin: 0; margin: 0;

View File

@ -40,7 +40,6 @@ body {
} }
} }
.hide-text { .hide-text {
white-space: nowrap; white-space: nowrap;
width: 100%; width: 100%;

View File

@ -5,11 +5,10 @@
direction: rtl; direction: rtl;
} }
.padding-15 { .padding-10 {
padding: 15px; padding: 15px;
} }
.padding-15 {
.padding-10 {
padding: 15px; padding: 15px;
} }
@ -72,6 +71,7 @@
.pt20 { .pt20 {
padding-top: 20px !important; padding-top: 20px !important;
} }
.pl0 { .pl0 {
padding-left: 0px !important; padding-left: 0px !important;
} }
@ -93,6 +93,7 @@
.pl40 { .pl40 {
padding-left: 40px !important; padding-left: 40px !important;
} }
.pr0 { .pr0 {
padding-right: 0px !important; padding-right: 0px !important;
} }
@ -105,6 +106,7 @@
.pr40 { .pr40 {
padding-right: 40px !important; padding-right: 40px !important;
} }
.pb0 { .pb0 {
padding-bottom: 0px !important; padding-bottom: 0px !important;
} }
@ -117,6 +119,7 @@
.pb30 { .pb30 {
padding-bottom: 30px !important; padding-bottom: 30px !important;
} }
.mt5 { .mt5 {
margin-top: 5px !important; margin-top: 5px !important;
} }
@ -126,6 +129,7 @@
.mt15 { .mt15 {
margin-top: 15px !important; margin-top: 15px !important;
} }
.mr5 { .mr5 {
margin-right: 5px; margin-right: 5px;
} }
@ -141,6 +145,7 @@
.mr20 { .mr20 {
margin-right: 20px; margin-right: 20px;
} }
.mb5 { .mb5 {
margin-bottom: 5px !important; margin-bottom: 5px !important;
} }
@ -159,15 +164,13 @@
.mb30 { .mb30 {
margin-bottom: 30px; margin-bottom: 30px;
} }
.ml0 { .ml0 {
margin-left: 0px !important; margin-left: 0px !important;
} }
.ml5 { .ml5 {
margin-left: 5px; margin-left: 5px;
} }
.ml0 {
margin-left: 0px;
}
.ml10 { .ml10 {
margin-left: 10px !important; margin-left: 10px !important;
} }
@ -177,6 +180,7 @@
.ml30 { .ml30 {
margin-left: 30px !important; margin-left: 30px !important;
} }
.body-blur { .body-blur {
filter: blur(4px); filter: blur(4px);
-webkit-filter: blur(4px); -webkit-filter: blur(4px);
@ -264,7 +268,7 @@
padding: 10px 20px; padding: 10px 20px;
vertical-align: top; vertical-align: top;
border: 1px solid transparent; border: 1px solid transparent;
color: $light-color !important; color: $white-color !important;
background-color: $theme-color !important; background-color: $theme-color !important;
&:hover, &:hover,
@ -277,7 +281,7 @@
&.light { &.light {
color: $theme-color !important; color: $theme-color !important;
background-color: $light-color !important; background-color: $white-color !important;
box-shadow: 0 1px 0 0 #CFCFCF; box-shadow: 0 1px 0 0 #CFCFCF;
border: 1px solid rgba(0,0,0,0.12); border: 1px solid rgba(0,0,0,0.12);
@ -307,8 +311,8 @@
padding: 9px 20px; padding: 9px 20px;
border-radius: 2px; border-radius: 2px;
vertical-align: top; vertical-align: top;
color: $dark-color !important; color: $black-color !important;
background-color: $light-color !important; background-color: $white-color !important;
} }
.sale-btn { .sale-btn {
@ -625,6 +629,7 @@
top: 6px; top: 6px;
position: relative; position: relative;
} }
.text-up-1 { .text-up-1 {
top: -1px; top: -1px;
position: relative; position: relative;
@ -721,7 +726,7 @@ select:focus,
} }
.control-error { .control-error {
color: $color-danger; color: $danger-color;
} }
.mandatory, .mandatory,
@ -732,7 +737,7 @@ select:focus,
content: "*"; content: "*";
font-size: 16px; font-size: 16px;
margin-left: -1px; margin-left: -1px;
color: $color-danger; color: $danger-color;
} }
} }

View File

@ -1,4 +1,3 @@
// Mixins
@mixin box-shadow($shadows...) { @mixin box-shadow($shadows...) {
-webkit-box-shadow: $shadows; -webkit-box-shadow: $shadows;
-moz-box-shadow: $shadows; -moz-box-shadow: $shadows;

View File

@ -1,35 +1,54 @@
/* /*
Added back again because in chrome this is not using and light house also saying not used. |
But in mozilla all fonts are gone which creating problem. | Added back again because in chrome this is not using and light house also saying not used.
| But in mozilla all fonts are gone which creating problem.
|
*/ */
@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap'); @import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap');
/* velocity variables */ /*
$white-color: #FFFFFF; |--------------------------------------------------------------------------
$black-color: #111111; | Velocity Variables
$font-color: rgba(0,0,0,0.83); |--------------------------------------------------------------------------
$font-color-light: rgba(255, 255, 255, 0.83); |
$button-primary-bg: #21A179; | Below are all the variables used in Velocity's SCSS.
$border-primary: #269c77; |
$button-danger: #F05153; */
$border-danger: #F05153; /* theme colors */
$color-danger: #F05153;
$border-common: #CCCCCC;
$border-dark: #DCDCDC;
$border-light: #ECECEC;
$border-general: #E5E5E5;
$theme-color: #26A37C; $theme-color: #26A37C;
$theme-dark-color: #247959; $theme-dark-color: #247959;
$btn-text-color: #FFFFFF;
$light-color: #FFFFFF; /* background colors */
$dark-color: #000000; $light-background: #F7F7F9;
$light1-black: #141516;
$light2-black: #cfcfd0; /* font colors */
$font-color: rgba(0,0,0,0.83);
$font-color-light: rgba(255, 255, 255, 0.83);
/* button colors */
$button-danger: #F05153;
$button-primary-bg: #21A179;
$button-text-color: #FFFFFF;
/* border colors */
$border-common: #CCCCCC;
$border-danger: #F05153;
$border-dark: #DCDCDC;
$border-general: #E5E5E5;
$border-light: #ECECEC;
$border-primary: #269c77;
/* link colors */
$link-color: #4D7EA8; $link-color: #4D7EA8;
$light-link-color: #28557B; $light-link-color: #28557B;
$grey-clr: rgba(0,0,0,0.53);
$light-grey-clr: rgb(158, 158, 158); /* remaining colors */
$light-background: #F7F7F9; $black-color: #111111;
$danger-color: #F05153;
$grey-color: rgb(158, 158, 158);
$light1-black: #141516;
$light2-black: #cfcfd0;
$white-color: #FFFFFF;
/* other stuffs */ /* other stuffs */
$sidebar-width: 230px; $sidebar-width: 230px;

View File

@ -1,3 +1,4 @@
# Rewrite Module
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
<IfModule mod_negotiation.c> <IfModule mod_negotiation.c>
Options -MultiViews -Indexes Options -MultiViews -Indexes
@ -20,8 +21,41 @@
RewriteRule ^ index.php [L] RewriteRule ^ index.php [L]
</IfModule> </IfModule>
<IfModule mod_expires.c> # Media Files Cache-Control
<filesMatch ".(css|jpg|jpeg|png|gif|js|svg|ico|webp|ttf)$"> <FilesMatch ".(jpg|jpeg|gif|png|svg|swf|webp)$">
Header set Cache-Control "max-age=31536000, public" <IfModule mod_headers.c>
</filesMatch> Header set Cache-Control "max-age=604800, public"
</IfModule>
</FilesMatch>
# Text Files Cache-Control
<FilesMatch ".(xml|txt|css|js)$">
<IfModule mod_headers.c>
Header set Cache-Control "max-age=604800, proxy-revalidate"
</IfModule>
</FilesMatch>
# Text Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
</IfModule> </IfModule>