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;
}
$this->cartItemRepository->delete($itemId);
if ($cartItem = $cart->items()->find($itemId)) {
$cartItem->delete();
if ($cart->items()->get()->count() == 0) {
$this->cartRepository->delete($cart->id);
@ -339,6 +340,9 @@ class Cart
return true;
}
return false;
}
/**
* 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 = [];
/**
* Exclude ips.
* Exclude IPs.
*/
protected $excludedIPs = [];
@ -49,14 +49,11 @@ class CheckForMaintenanceMode extends Original
/* application */
$this->app = $app;
/* current channel */
$this->channel = core()->getCurrentChannel();
/* adding exception for admin routes */
$this->except[] = env('APP_ADMIN_URL', 'admin') . '*';
/* adding exception for ips */
$this->excludedIPs = array_map('trim', explode(',', $this->channel->allowed_ips));
/* exclude ips */
$this->setAllowedIps();
}
/**
@ -116,4 +113,18 @@ class CheckForMaintenanceMode extends Original
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 Webkul\Attribute\Models\Attribute;
use Webkul\Product\Models\ProductFlat;
use Illuminate\Support\Facades\Storage;
use Illuminate\Container\Container as App;
use Illuminate\Pagination\LengthAwarePaginator;
use Webkul\Product\Models\ProductAttributeValueProxy;
use Webkul\Attribute\Repositories\AttributeRepository;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Facades\Storage;
class ProductRepository extends Repository
{
@ -212,8 +212,12 @@ class ProductRepository extends Repository
if ($priceFilter = request('price')) {
$priceRange = explode(',', $priceFilter);
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
*/
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')
->where(function ($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);
});
}

View File

@ -2,9 +2,9 @@
namespace Webkul\Shop\Http\Controllers;
use PDF;
use Webkul\Sales\Repositories\OrderRepository;
use Webkul\Sales\Repositories\InvoiceRepository;
use PDF;
class OrderController extends Controller
{
@ -83,6 +83,10 @@ class OrderController extends Controller
{
$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');
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",
"/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-family: 'Webkul Rango';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,3 @@
// Mixins
@mixin box-shadow($shadows...) {
-webkit-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');
/* velocity variables */
$white-color: #FFFFFF;
$black-color: #111111;
$font-color: rgba(0,0,0,0.83);
$font-color-light: rgba(255, 255, 255, 0.83);
$button-primary-bg: #21A179;
$border-primary: #269c77;
$button-danger: #F05153;
$border-danger: #F05153;
$color-danger: #F05153;
$border-common: #CCCCCC;
$border-dark: #DCDCDC;
$border-light: #ECECEC;
$border-general: #E5E5E5;
/*
|--------------------------------------------------------------------------
| Velocity Variables
|--------------------------------------------------------------------------
|
| Below are all the variables used in Velocity's SCSS.
|
*/
/* theme colors */
$theme-color: #26A37C;
$theme-dark-color: #247959;
$btn-text-color: #FFFFFF;
$light-color: #FFFFFF;
$dark-color: #000000;
$light1-black: #141516;
$light2-black: #cfcfd0;
/* background colors */
$light-background: #F7F7F9;
/* 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;
$light-link-color: #28557B;
$grey-clr: rgba(0,0,0,0.53);
$light-grey-clr: rgb(158, 158, 158);
$light-background: #F7F7F9;
/* remaining colors */
$black-color: #111111;
$danger-color: #F05153;
$grey-color: rgb(158, 158, 158);
$light1-black: #141516;
$light2-black: #cfcfd0;
$white-color: #FFFFFF;
/* other stuffs */
$sidebar-width: 230px;

View File

@ -1,3 +1,4 @@
# Rewrite Module
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
@ -20,8 +21,41 @@
RewriteRule ^ index.php [L]
</IfModule>
<IfModule mod_expires.c>
<filesMatch ".(css|jpg|jpeg|png|gif|js|svg|ico|webp|ttf)$">
Header set Cache-Control "max-age=31536000, public"
</filesMatch>
# Media Files Cache-Control
<FilesMatch ".(jpg|jpeg|gif|png|svg|swf|webp)$">
<IfModule mod_headers.c>
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>