Merge pull request #1296 from prashant-webkul/development

Development
This commit is contained in:
Jitendra Singh 2019-08-14 14:55:44 +05:30 committed by GitHub
commit 39a195f923
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 828 additions and 277 deletions

View File

@ -42,23 +42,5 @@ return [
'model' => App\User::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
],
'facebook' => [
'client_id' => env('FACEBOOK_CLIENT_ID'),
'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
'redirect' => env('FACEBOOK_URL'),
],
'twitter' => [
'client_id' => env('TWITTER_CLIENT_ID'),
'client_secret' => env('TWITTER_CLIENT_SECRET'),
'redirect' => env('TWITTER_URL'),
],
'google' => [
'client_id' => env('GOOGLE_CLIENT_ID'),
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
'redirect' => env('GOOGLE_URL'),
],
]
];

View File

@ -21,7 +21,5 @@ class EventServiceProvider extends ServiceProvider
Event::listen('sales.shipment.save.after', 'Webkul\Admin\Listeners\Order@sendNewShipmentMail');
Event::listen('checkout.order.save.after', 'Webkul\Admin\Listeners\Order@updateProductInventory');
Event::listen('products.datagrid.sync', 'Webkul\Admin\Listeners\Product@sync');
}
}

View File

@ -989,7 +989,7 @@ return [
'url-key' => 'URL Key',
'create-btn-title' => 'Add Page',
'edit-title' => 'Edit Page',
'edit-btn-title' => 'Edit Page',
'edit-btn-title' => 'Save Page',
'create-success' => 'Page created successfully',
'create-failure' => 'Page cannot be created',
'update-success' => 'Page updated successfully',

View File

@ -76,10 +76,10 @@
{!! __('admin::app.cms.pages.two-col') !!}
{!! __('admin::app.cms.pages.three-col') !!}
<div class="mt-10 mb-10" @submit.prevent="showModal('showHelpers')">
<button class="btn btn-sm btn-primary">
<div class="mt-10 mb-10">
<a target="_blank" href="{{ route('ui.helper.classes') }}" class="btn btn-sm btn-primary">
{{ __('admin::app.cms.pages.helper-classes') }}
</button>
</a>
</div>
<span class="control-error" v-if="errors.has('html_content')">@{{ errors.first('html_content') }}</span>
@ -110,7 +110,7 @@
</div>
<div class="control-group" :class="[errors.has('meta_description') ? 'has-error' : '']">
<label for="meta_description" class="required">{{ __('admin::app.cms.pages.meta_description') }}</label>
<label for="meta_description">{{ __('admin::app.cms.pages.meta_description') }}</label>
<textarea type="text" class="control" name="meta_description" value="{{ old('meta_description') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.meta_description') }}&quot;"></textarea>
@ -121,13 +121,13 @@
</form>
</div>
<modal id="showHelpers" :is-open="modalIds.showHelpers">
{{-- <modal id="showHelpers" :is-open="modalIds.showHelpers">
<h3 slot="header">{{ __('admin::app.cms.pages.helper-classes') }}</h3>
<div slot="body">
@include('ui::partials.helper-classes')
</div>
</modal>
</modal> --}}
@stop
@push('scripts')

View File

@ -80,10 +80,10 @@
{!! __('admin::app.cms.pages.two-col') !!}
{!! __('admin::app.cms.pages.three-col') !!}
<div class="mt-10 mb-10" @submit.prevent="showModal('showHelpers')">
<button class="btn btn-sm btn-primary">
<div class="mt-10 mb-10">
<a target="_blank" href="{{ route('ui.helper.classes') }}" class="btn btn-sm btn-primary">
{{ __('admin::app.cms.pages.helper-classes') }}
</button>
</a>
</div>
<span class="control-error" v-if="errors.has('html_content')">@{{ errors.first('html_content') }}</span>
@ -114,7 +114,7 @@
</div>
<div class="control-group" :class="[errors.has('meta_description') ? 'has-error' : '']">
<label for="meta_description" class="required">{{ __('admin::app.cms.pages.meta_description') }}</label>
<label for="meta_description">{{ __('admin::app.cms.pages.meta_description') }}</label>
<textarea type="text" class="control" name="meta_description" data-vv-as="&quot;{{ __('admin::app.cms.pages.meta_description') }}&quot;">{{ $page->meta_description ?? old('meta_description') }}</textarea>
@ -124,14 +124,6 @@
</div>
</form>
</div>
<modal id="showHelpers" :is-open="modalIds.showHelpers">
<h3 slot="header">{{ __('admin::app.cms.pages.helper-classes') }}</h3>
<div slot="body">
@include('ui::partials.helper-classes')
</div>
</modal>
@stop
@push('scripts')

View File

@ -689,7 +689,7 @@
delete this.attribute_values[i].options;
}
if (this.category_values.length > 0) {
if (this.category_values != null && this.category_values.length > 0) {
this.all_attributes.categories = this.category_values;
}

View File

@ -136,7 +136,11 @@
<option v-for="(attr_ip, index1) in attribute_input" :value="attr_ip.code" :key="index1">@{{ attr_ip.name }}</option>
</select>
<select class="control" v-model="attribute_values[index].condition" style="margin-right: 15px;">
<select v-show='attribute_values[index].type == "select" || attribute_values[index].type == "multiselect"' class="control" v-model="attribute_values[index].condition" style="margin-right: 15px;">
<option v-for="(condition, index) in conditions.select" :value="index" :key="index">@{{ condition }}</option>
</select>
<select v-show='attribute_values[index].type == "text" || attribute_values[index].type == "textarea" || attribute_values[index].type == "price"' class="control" v-model="attribute_values[index].condition" style="margin-right: 15px;">
<option v-for="(condition, index) in conditions.string" :value="index" :key="index">@{{ condition }}</option>
</select>
@ -159,7 +163,7 @@
<span class="icon trash-icon" v-on:click="removeAttr(index)"></span>
</div>
<span class="btn btn-primary btn-lg mt-20" v-on:click="addAttributeCondition">Add Attribute Condition</span>
<span class="btn btn-primary btn-lg mt-20" v-on:click="addAttributeCondition">{{ __('admin::app.promotion.add-attr-condition') }}</span>
</div>
</accordian>
@ -256,6 +260,7 @@
},
mounted () {
console.log(this.attribute_input);
},
methods: {
@ -336,6 +341,7 @@
for(i in this.attribute_input) {
if (i == selectedIndex) {
if (this.attribute_input[i].has_options == true) {
this.selectedIndex
this.attribute_values[index].options = this.attribute_input[i].options;
}
@ -355,7 +361,7 @@
},
removeAttr(index) {
this.conditions_list.splice(index, 1);
this.attribute_values.splice(index, 1);
},
removeCat(index) {

View File

@ -1,7 +1,7 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('admin::app.promotion.add-catalog-rule') }}
{{ __('admin::app.promotion.edit-catalog-rule') }}
@stop
@section('content')
@ -12,7 +12,7 @@
@push('scripts')
<script type="text/x-template" id="catalog-rule-form-template">
<div>
<form method="POST" action="{{ route('admin.catalog-rule.store') }}" @submit.prevent="onSubmit">
<form method="POST" action="{{ route('admin.catalog-rule.update', $catalog_rule[5]->id) }}" @submit.prevent="onSubmit">
@csrf
<div class="page-header">
@ -20,13 +20,13 @@
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
{{ __('admin::app.promotion.add-catalog-rule') }}
{{ __('admin::app.promotion.edit-catalog-rule') }}
</h1>
</div>
<div class="page-action fixed-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.promotion.save-btn-title') }}
{{ __('admin::app.promotion.edit-btn-title') }}
</button>
</div>
</div>
@ -91,7 +91,11 @@
<span class="control-error" v-if="errors.has('status')">@{{ errors.first('status') }}</span>
</div>
<datetime :name="starts_from">
@php
$now = new \Carbon\Carbon();
@endphp
<date :name="starts_from">
<div class="control-group" :class="[errors.has('starts_from') ? 'has-error' : '']">
<label for="starts_from" class="required">{{ __('admin::app.promotion.general-info.starts-from') }}</label>
@ -99,9 +103,9 @@
<span class="control-error" v-if="errors.has('starts_from')">@{{ errors.first('starts_from') }}</span>
</div>
</datetime>
</date>
<datetime :name="starts_from">
<date :name="starts_from">
<div class="control-group" :class="[errors.has('ends_till') ? 'has-error' : '']">
<label for="ends_till" class="required">{{ __('admin::app.promotion.general-info.ends-till') }}</label>
@ -109,7 +113,7 @@
<span class="control-error" v-if="errors.has('ends_till')">@{{ errors.first('ends_till') }}</span>
</div>
</datetime>
</date>
</div>
</accordian>
@ -136,7 +140,11 @@
<option v-for="(attr_ip, index1) in attribute_input" :value="attr_ip.code" :key="index1">@{{ attr_ip.name }}</option>
</select>
<select class="control" v-model="attribute_values[index].condition" style="margin-right: 15px;">
<select v-show='attribute_values[index].type == "select" || attribute_values[index].type == "multiselect"' class="control" v-model="attribute_values[index].condition" style="margin-right: 15px;">
<option v-for="(condition, index) in conditions.select" :value="index" :key="index">@{{ condition }}</option>
</select>
<select v-show='attribute_values[index].type == "text" || attribute_values[index].type == "textarea" || attribute_values[index].type == "price"' class="control" v-model="attribute_values[index].condition" style="margin-right: 15px;">
<option v-for="(condition, index) in conditions.string" :value="index" :key="index">@{{ condition }}</option>
</select>
@ -159,7 +167,7 @@
<span class="icon trash-icon" v-on:click="removeAttr(index)"></span>
</div>
<span class="btn btn-primary btn-lg mt-20" v-on:click="addAttributeCondition">Add Attribute Condition</span>
<span class="btn btn-primary btn-lg mt-20" v-on:click="addAttributeCondition">{{ __('admin::app.promotion.add-attr-condition') }}</span>
</div>
</accordian>
@ -235,7 +243,7 @@
category_options: @json($catalog_rule[1]),
category_values: [],
conditions: @json($catalog_rule[5]).conditions,
conditions: @json($catalog_rule[3]).conditions,
attribute_values: [],
attr_object: {
attribute: null,
@ -243,11 +251,12 @@
value: [],
options: []
},
attribute_input: @json($catalog_rule[3])
attribute_input: @json($catalog_rule[0])
}
},
mounted () {
console.log(this.conditions)
channels = @json($catalog_rule[5]->channels);
this.channels = [];
@ -292,6 +301,18 @@
},
methods: {
created() {
VeeValidate.Validator.extend('is_time', {
getMessage: field => `The format must be HH:MM:SS`,
validate: (value) => new Promise(resolve => {
let regex = new RegExp("([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])");
resolve({
valid: value && regex.test(value)
});
})
});
},
categoryLabel (option) {
return option.name + ' [ ' + option.slug + ' ]';
},
@ -321,6 +342,8 @@
}
this.attribute_values[index].type = this.attribute_input[i].type;
debugger
}
}
},
@ -336,7 +359,7 @@
},
removeAttr(index) {
this.conditions_list.splice(index, 1);
this.attribute_values.splice(index, 1);
},
removeCat(index) {

View File

@ -43,7 +43,8 @@ class AttributeGroupTableSeeder extends Seeder
['attribute_id' => '21','attribute_group_id' => '5','position' => '3'],
['attribute_id' => '22','attribute_group_id' => '5','position' => '4'],
['attribute_id' => '23','attribute_group_id' => '1','position' => '9'],
['attribute_id' => '24','attribute_group_id' => '1','position' => '10']
['attribute_id' => '24','attribute_group_id' => '1','position' => '10'],
['attribute_id' => '25','attribute_group_id' => '1','position' => '11']
]);
}
}

View File

@ -59,6 +59,8 @@ class AttributeTableSeeder extends Seeder
['id' => '23','code' => 'color','admin_name' => 'Color','type' => 'select','validation' => NULL,'position' => '23','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '1','is_user_defined' => '1','is_visible_on_front' => '0',
'use_in_flat' => '1','created_at' => $now,'updated_at' => $now],
['id' => '24','code' => 'size','admin_name' => 'Size','type' => 'select','validation' => NULL,'position' => '24','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '1','is_user_defined' => '1','is_visible_on_front' => '0',
'use_in_flat' => '1','created_at' => $now,'updated_at' => $now],
['id' => '25','code' => 'brand','admin_name' => 'Brand','type' => 'text','validation' => NULL,'position' => '25','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '1',
'use_in_flat' => '1','created_at' => $now,'updated_at' => $now]
]);
@ -87,7 +89,8 @@ class AttributeTableSeeder extends Seeder
['id' => '21','locale' => 'en','name' => 'Depth','attribute_id' => '21'],
['id' => '22','locale' => 'en','name' => 'Weight','attribute_id' => '22'],
['id' => '23','locale' => 'en','name' => 'Color','attribute_id' => '23'],
['id' => '24','locale' => 'en','name' => 'Size','attribute_id' => '24']
['id' => '24','locale' => 'en','name' => 'Size','attribute_id' => '24'],
['id' => '25','locale' => 'en','name' => 'Brand','attribute_id' => '25']
]);
}
}

View File

@ -224,7 +224,7 @@ class AttributeRepository extends Repository
if ($attribute->options()->exists()) {
array_push($trimmed, [
'id' => $attribute->id,
'name' => $attribute->name,
'name' => $attribute->admin_name,
'type' => $attribute->type,
'code' => $attribute->code,
'has_options' => true,
@ -233,7 +233,7 @@ class AttributeRepository extends Repository
} else {
array_push($trimmed, [
'id' => $attribute->id,
'name' => $attribute->name,
'name' => $attribute->admin_name,
'type' => $attribute->type,
'code' => $attribute->code,
'has_options' => false,

View File

@ -194,11 +194,11 @@ use Webkul\Core\Repositories\LocaleRepository as Locale;
$page = $this->cms->findOrFail($id);
if ($page->delete()) {
session()->flash('success', trans('admin::app.cms.delete-success'));
session()->flash('success', trans('admin::app.cms.pages.delete-success'));
return response()->json(['message' => true], 200);
} else {
session()->flash('success', trans('admin::app.cms.delete-failure'));
session()->flash('success', trans('admin::app.cms.pages.delete-failure'));
return response()->json(['message' => false], 200);
}

View File

@ -75,6 +75,11 @@ use Webkul\Core\Repositories\LocaleRepository as Locale;
'channel_id' => $currentChannel->id
]);
return view('shop::cms.page')->with('page', $page);
if ($page) {
return view('shop::cms.page')->with('page', $page);
} else {
abort(404);
}
}
}

View File

@ -11,9 +11,10 @@ use Auth;
use Hash;
/**
* Customer controlller for the customer basically for the tasks of customers which will be done after customer authentication.
* Customer controlller for the customer basically for the tasks of customers which will be
* done after customer authentication.
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CustomerController extends Controller

View File

@ -133,10 +133,22 @@ return [
'string' => [
'=' => 'Equals',
// '>=' => 'Greater or equals',
// '<=' => 'Lesser or equals',
// '>' => 'Greater than',
// '<' => 'Lesser than',
'>=' => 'Greater or equals',
'<=' => 'Lesser or equals',
'>' => 'Greater than',
'<' => 'Lesser than',
'{}' => 'Contains',
'!{}' => 'Does not contains'
],
'select' => [
'=' => 'Equals',
'{}' => 'Contains',
'!{}' => 'Does not contains'
],
'multiselect' => [
'=' => 'Equals',
'{}' => 'Contains',
'!{}' => 'Does not contains'
],

View File

@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCatalogRuleProductPriceTable extends Migration
class CreateCatalogRuleProductsPriceTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ class CreateCatalogRuleProductPriceTable extends Migration
*/
public function up()
{
Schema::create('catalog_rule_product_price', function (Blueprint $table) {
Schema::create('catalog_rule_products_price', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('channel_id')->unsigned();
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Discount\Helpers;
namespace Webkul\Discount\Helpers\Cart;
use Webkul\Discount\Repositories\CartRuleRepository as CartRule;
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
@ -8,7 +8,6 @@ use Webkul\Attribute\Repositories\AttributeOptionRepository as AttributeOption;
use Webkul\Category\Repositories\CategoryRepository as Category;
use Webkul\Product\Repositories\ProductRepository as Product;
use Webkul\Product\Models\ProductAttributeValue as ProductAttributeValue;
use DB;
class ConvertXToProductId
{
@ -284,13 +283,9 @@ class ConvertXToProductId
$qb->where('product_categories.category_id', $categoryId);
}
if (is_null(request()->input('status'))) {
$qb->where('product_flat.status', 1);
}
$qb->where('product_flat.status', 1);
if (is_null(request()->input('visible_individually'))) {
$qb->where('product_flat.visible_individually', 1);
}
$qb->where('product_flat.visible_individually', 1);
$queryBuilder = $qb->leftJoin('product_flat as flat_variants', function($qb) use($channel, $locale) {
$qb->on('product_flat.id', '=', 'flat_variants.parent_id');

View File

@ -1,10 +1,8 @@
<?php
namespace Webkul\Discount\Helpers;
namespace Webkul\Discount\Helpers\Cart;
use Webkul\Discount\Helpers\Discount;
use Carbon\Carbon;
use Cart;
class CouponAbleRule extends Discount

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Discount\Helpers;
namespace Webkul\Discount\Helpers\Cart;
use Webkul\Discount\Repositories\CartRuleRepository as CartRule;
use Webkul\Checkout\Repositories\CartItemRepository as CartItem;
@ -283,30 +283,6 @@ abstract class Discount
return $maxImpact;
}
/**
* To find oldest rule
*
* @param Collection $rules
*
* @return Collection $rule
*/
public function findOldestRule($rules)
{
$leastId = 0;
if ($rules->count()) {
$leastId = $rules->min('id');
foreach ($rules as $rule) {
if ($rule->id == $leastId) {
return $rule;
}
}
} else {
return collect();
}
}
/**
* To calculate the impact of the rule
*
@ -350,6 +326,23 @@ abstract class Discount
$channelBased = false;
// time based constraints
if ($rule->starts_from != null && $rule->ends_till == null) {
if (Carbon::parse($rule->starts_from) < now()) {
$timeBased = true;
}
} else if ($rule->starts_from == null && $rule->ends_till != null) {
if (Carbon::parse($rule->ends_till) > now()) {
$timeBased = true;
}
} else if ($rule->starts_from != null && $rule->ends_till != null) {
if (Carbon::parse($rule->starts_from) < now() && now() < Carbon::parse($rule->ends_till)) {
$timeBased = true;
}
} else {
$timeBased = true;
}
// channel based constraints
foreach ($rule->channels as $channel) {
if ($channel->channel_id == core()->getCurrentChannel()->id) {
@ -407,7 +400,7 @@ abstract class Discount
}
}
if ($channelBased && $customerGroupBased && $conditionsBased) {
if ($channelBased && $customerGroupBased && $timeBased && $conditionsBased) {
if ($rule->uses_attribute_conditions == 1 && $partialMatch) {
return true;
} else if ($rule->uses_attribute_conditions == 0) {

View File

@ -1,10 +1,8 @@
<?php
namespace Webkul\Discount\Helpers;
namespace Webkul\Discount\Helpers\Cart;
use Webkul\Discount\Helpers\Discount;
use Webkul\Discount\Repositories\CartRuleCartRepository as CartRuleCart;
use Cart;
class NonCouponAbleRule extends Discount
{

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Discount\Helpers;
namespace Webkul\Discount\Helpers\Cart;
use Webkul\Discount\Helpers\Discount;
use Webkul\Discount\Repositories\CartRuleCartRepository as CartRuleCart;

View File

@ -0,0 +1,121 @@
<?php
namespace Webkul\Discount\Helpers\Catalog;
use Webkul\Discount\Repositories\CatalogRuleRepository as CatalogRule;
use Webkul\Discount\Repositories\CatalogRuleProductsRepository as CatalogRuleProducts;
use Webkul\Discount\Repositories\CatalogRuleProductsPriceRepository as CatalogRuleProductsPrice;
use Webkul\Discount\Helpers\Catalog\ConvertXToProductId as ConvertX;
use Webkul\Discount\Helpers\Catalog\Sale;
class Apply extends Sale
{
/**
* To hold the catalog rule repository instance
*/
protected $catalogRule;
/**
* To maintain the list of deceased rules and remove their records if present
*/
protected $activeRules;
/**
* To maintain the list of deceased rules and remove their records if present
*/
protected $deceased;
/**
* Holds convertXToProductId instance
*/
protected $convertX;
/**
* Hold catalog rule products repository instance
*/
protected $catalogRuleProduct;
/**
* Hold catalog rule products price repository instance
*/
protected $catalogRuleProductPrice;
/**
* To hold the rule classes
*/
protected $rules;
/**
* @param CatalogRule $catalogRule
*/
public function __construct(
CatalogRule $catalogRule,
ConvertX $convertX,
CatalogRuleProducts $catalogRuleProduct,
CatalogRuleProductsPrice $catalogRuleProductPrice
) {
$this->catalogRule = $catalogRule;
$this->convertX = $convertX;
$this->catalogRuleProduct = $catalogRuleProduct;
$this->catalogRuleProductPrice = $catalogRuleProductPrice;
$this->active = collect();
$this->deceased = collect();
$this->rules = config('discount-rules.catalog');
}
/**
* To apply the new catalog rules and sync previous rules changes,
*/
public function apply()
{
$rules = $this->catalogRule->all();
foreach ($rules as $rule) {
$validated = $this->checkApplicability($rule);
if ($validated) {
$this->active->push($rule->id);
// Job execution for active rules
$productIDs = $this->getProductIds($rule);
$this->setSale($rule, $productIDs);
} else {
$this->deceased->push($rule->id);
// Job execution for deceased rules
}
}
dd('done');
}
/**
* To set the sale price for products falling catalog rule criteria
*
* @param CatalogRule $catalogRule
*
* @return Void
*/
public function setSale($rule, $productIDs)
{
if (is_array($productIDs)) {
// apply on selected products
foreach ($productIDs as $productID) {
$this->catalogRuleProduct->createOrUpdate($rule, $productID);
$this->catalogRuleProductPrice->createOrUpdate($rule, $productID);
}
} else if ($productIDs == '*') {
$this->catalogRuleProduct->createOrUpdate($rule, $productIDs);
$this->catalogRuleProductPrice->createOrUpdate($rule, $productIDs);
}
}
}

View File

@ -0,0 +1,272 @@
<?php
namespace Webkul\Discount\Helpers\Catalog;
use Webkul\Discount\Repositories\CatalogRuleRepository as CatalogRule;
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
use Webkul\Attribute\Repositories\AttributeOptionRepository as AttributeOption;
use Webkul\Category\Repositories\CategoryRepository as Category;
use Webkul\Product\Repositories\ProductRepository as Product;
use Webkul\Product\Models\ProductAttributeValue as ProductAttributeValue;
class ConvertXToProductId
{
/**
* CategoryRepository instance
*/
protected $category;
/**
* AttributeRepository instance
*/
protected $attribute;
/**
* ProductRepository instance
*/
protected $product;
/**
* AttributeOptionRepository instance
*/
protected $attributeOption;
/**
* CatalogRuleRepository instance
*/
protected $catalogRule;
/**
* ProductAttributeValueRepository instance
*/
protected $pav;
/**
* Condition symbols for matching the criteria with attributes selected
*/
protected $symbols;
public function __construct(
Category $category,
Attribute $attribute,
Product $product,
AttributeOption $attributeOption,
CatalogRule $catalogRule,
ProductAttributeValue $pav
) {
$this->category = $category;
$this->attribute = $attribute;
$this->product = $product;
$this->attributeOption = $attributeOption;
$this->catalogRule = $catalogRule;
$this->pav = $pav;
$this->conditionSymbols = config('pricerules.cart.conditions.symbols');
}
public function convertX($attribute_conditions)
{
$attributeConditions = json_decode(json_decode($attribute_conditions));
$categoryValues = $attributeConditions->categories;
$attributeValues = $attributeConditions->attributes;
if (!isset($categoryValues) && !isset($attributeValues)) {
return false;
}
$categoryResult = collect();
if (isset($categoryValues) && count($categoryValues)) {
$categoryResult = $this->convertFromCategories($categoryValues);
}
$attributeResult = collect();
if (isset($attributeValues) && count($attributeValues)) {
$attributeResult = $this->convertFromAttributes($attributeValues);
}
// now call the function that will find all the unique product ids
$productIDs = $this->findAllUniqueIds($attributeResult, $categoryResult);
return $productIDs;
}
/**
* This method will return product id from the attribute and attribute option params
*
* @return array
*/
public function convertFromAttributes($attributeOptions)
{
$products = collect();
foreach ($attributeOptions as $attributeOption) {
$selectedOptions = $attributeOption->value;
if ($attributeOption->type == 'select' || $attributeOption->type == 'multiselect') {
$attribute = $this->attribute->findWhere([
'code' => $attributeOption->attribute
]);
$attributeOptions = $attribute->first()->options;
$selectedAttributeOptions = collect();
foreach ($attributeOptions as $attributeOption) {
foreach ($selectedOptions as $key => $value) {
if ($attributeOption->id == $value) {
$selectedAttributeOptions->push($attributeOption);
}
}
}
foreach ($selectedAttributeOptions as $selectedAttributeOption) {
$typeColumn = $this->pav::$attributeTypeFields[$attribute->first()->type];
$pavResults = $this->pav->where(
"{$typeColumn}",
$selectedAttributeOption->id
)->get();
foreach ($pavResults as $pavResult) {
if ($pavResult->product->type == 'simple')
$products->push($pavResult->product);
}
}
} else {
$attribute = $this->attribute->findWhere([
'code' => $attributeOption->attribute
]);
$pavValues = $attribute->first();
$selectedAttributeValues = collect();
if ($attributeOption->attribute == 'sku') {
$testValue = $attributeOption->value;
$testCondition = $attributeOption->condition;
if ($testCondition == '{}') {
$foundProducts = $this->product->findWhere([
['sku', 'like', '%' . $testValue . '%'],
['type', '!=', 'configurable']
])->flatten()->all();
} else if ($testCondition == '!{}') {
$foundProducts = $this->product->findWhere([
['sku', 'not like', '%' . $testValue . '%'],
['type', '!=', 'configurable']
])->flatten()->all();
} else if ($testCondition == '=') {
$foundProducts = $this->product->findWhere([
['sku', '=', '%' . $testValue . '%'],
['type', '!=', 'configurable']
])->flatten()->all();
}
}
foreach ($foundProducts as $foundProduct) {
$products->push($foundProduct);
}
}
}
return $products;
}
/**
* This method will return product id from the attribute and attribute option params
*
* @param Collection $categories
*
* @return array
*/
public function convertFromCategories($categories)
{
$products = collect();
foreach ($categories as $category) {
$data = $this->getAll($category->id);
if ($data->count()) {
$products->push($data);
unset($data);
}
}
return $products->flatten()->all();
}
/**
* This method will remove the duplicates from the array and merge all the items into single array
*
* @param array
*
* @return array
*/
public function findAllUniqueIds(...$data)
{
$attributeResult = $data[0] ?? collect();
$categoryResult = $data[1] ?? collect();
// find matched attribute options product ids
$mergedCollection = $attributeResult->merge($categoryResult);
$productIDs = collect();
foreach ($mergedCollection as $merged) {
$productIDs->push($merged->id);
}
// find all the unique product ids
$productIDs = $productIDs->unique();
return $productIDs->flatten()->all();
}
/**
* To get all product ids lying in the criteria
*
* @param integer $categoryId
*
* @return Collection
*/
public function getAll($categoryId = null)
{
$results = app('Webkul\Product\Repositories\ProductFlatRepository')->scopeQuery(function ($query) use ($categoryId) {
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
$locale = request()->get('locale') ?: app()->getLocale();
$qb = $query->distinct()
->select('products.id')
->leftJoin('products', 'product_flat.product_id', '=', 'products.id')
->leftJoin('product_categories', 'products.id', '=', 'product_categories.product_id')
->where('products.type', '!=', 'configurable')
->whereNotNull('product_flat.url_key');
if ($categoryId) {
$qb->where('product_categories.category_id', $categoryId);
}
$qb->where('product_flat.status', 1);
$qb->where('product_flat.visible_individually', 1);
$queryBuilder = $qb->leftJoin('product_flat as flat_variants', function ($qb) use ($channel, $locale) {
$qb->on('product_flat.id', '=', 'flat_variants.parent_id');
});
return $qb->groupBy('product_flat.id');
})->get();
return $results;
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace Webkul\Discount\Helpers\Catalog;
use Webkul\Discount\Repositories\CatalogRepository as CatalogRule;
use Webkul\Discount\Helpers\Catalog\ConvertXToProductId;
abstract class Sale
{
abstract function apply();
/**
* To validate rule
*
* @param CatalogRule $rule
*
* @return Boolean
*/
public function checkApplicability($rule)
{
$cart = \Cart::getCart();
$timeBased = false;
$status = false;
// time based constraints
if ($rule->starts_from != null && $rule->ends_till == null) {
if (Carbon::parse($rule->starts_from) < now()) {
$timeBased = true;
}
} else if ($rule->starts_from == null && $rule->ends_till != null) {
if (Carbon::parse($rule->ends_till) > now()) {
$timeBased = true;
}
} else if ($rule->starts_from != null && $rule->ends_till != null) {
if (Carbon::parse($rule->starts_from) < now() && now() < Carbon::parse($rule->ends_till)) {
$timeBased = true;
}
} else {
$timeBased = true;
}
if ($rule->status) {
$status = true;
}
if ($timeBased && $status) {
return true;
} else {
return false;
}
}
/**
* Function to maintain products and catalog rule
*
* @param CatalogRule $rule
*
* @return String|NULL
*/
public function getProductIds($rule)
{
if ($rule->conditions) {
$conditions = $rule->conditions;
$productIDs = $this->convertX->convertX($rule->conditions);
} else {
$productIDs = '*';
}
return $productIDs;
}
/**
* Function to maintain products, catalog rule, price
*/
}

View File

@ -1,71 +0,0 @@
<?php
namespace Webkul\Discount\Helpers;
use Webkul\Product\Repositories\ProductRepository as Product;
use Webkul\Product\Repositories\ProductFlatRepository as ProductFlat;
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
use Webkul\Core\Repositories\LocaleRepository as Locale;
class FindProducts
{
/**
* To hold the product repository instance
*/
protected $product;
/**
* To hold the attribute repository instance
*/
protected $attribute;
public function __construct(Product $product, Attribute $attribute, ProductFlat $productFlat, Locale $locale)
{
$this->product = $product;
$this->attribute = $attribute;
$this->productFlat = $productFlat;
$this->locale = $locale;
}
public function findByConditions($conditions)
{
/**
* Empty collection instance to hold all the products that satisfy the conditions
*/
$products = array();
foreach ($conditions as $condition) {
$attribute = $this->attribute->findOneByField('code', $condition->attribute);
dump($attribute->type);
if ($condition->type == 'select' || $condition->type == 'multiselect') {
$values = $condition->value;
$attributeValues = array();
foreach ($condition->options as $option) {
foreach ($values as $value) {
if ($value == $option->id) {
array_push($attributeValues, $option);
}
}
}
$defaultChannelCode = core()->getDefaultChannel()->code;
$defaultLocaleCode = $this->locale->find(core()->getDefaultChannel()->default_locale_id)->code;
foreach ($attributeValues as $attributeValue) {
$productFound = $this->productFlat->findByField([$attribute->code => $attributeValue->id, 'locale' => $defaultLocaleCode, 'channel' => $defaultChannelCode]);
if ($productFound->count()) {
array_push($products, $productFound->toArray());
}
}
} else {
}
}
dd(array_flatten($products, 1));
}
}

View File

@ -5,7 +5,7 @@ namespace Webkul\Discount\Http\Controllers;
use Webkul\Discount\Repositories\CartRuleRepository as CartRule;
use Webkul\Category\Repositories\CategoryRepository as Category;
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
use Webkul\Discount\Helpers\ConvertXToProductId as ConvertX;
use Webkul\Discount\Helpers\Cart\ConvertXToProductId as ConvertX;
use Webkul\Discount\Repositories\CartRuleLabelsRepository as CartRuleLabels;
use Webkul\Discount\Repositories\CartRuleCouponsRepository as CartRuleCoupons;
@ -117,7 +117,7 @@ class CartRuleController extends Controller
public function store()
{
$validated = $this->validate(request(), [
'name' => 'required|string',
'name' => 'required|string|unique:cart_rules,name',
'description' => 'string',
'customer_groups' => 'required|array',
'channels' => 'required|array',
@ -349,8 +349,9 @@ class CartRuleController extends Controller
*/
public function update($id)
{
dd(request()->all());
$this->validate(request(), [
'name' => 'required|string',
'name' => 'required|string|unique:cart_rules,name,'.$id,
'description' => 'string',
'customer_groups' => 'required|array',
'channels' => 'required|array',

View File

@ -12,7 +12,7 @@ use Webkul\Product\Repositories\ProductFlatRepository as Product;
use Webkul\Discount\Repositories\CatalogRuleRepository as CatalogRule;
use Webkul\Discount\Repositories\CatalogRuleChannelsRepository as CatalogRuleChannels;
use Webkul\Discount\Repositories\CatalogRuleCustomerGroupsRepository as CatalogRuleCustomerGroups;
use Webkul\Discount\Helpers\FindProducts;
use Webkul\Discount\Helpers\Catalog\Apply;
/**
* Catalog Rule controller
@ -68,28 +68,35 @@ class CatalogRuleController extends Controller
protected $catalogRuleCustomerGroups;
/**
* To hold the catalog repository instance
* To hold catalog repository instance
*/
protected $catalogRule;
/**
* Find products using conditions helper instance
* To hold Sale instance
*/
protected $findProducts;
protected $apply;
public function __construct(Attribute $attribute, AttributeFamily $attributeFamily, Category $category, Product $product, CatalogRule $catalogRule, CatalogRuleChannels $catalogRuleChannels, CatalogRuleCustomerGroups $catalogRuleCustomerGroups, FindProducts $findProducts)
{
public function __construct(
Attribute $attribute,
AttributeFamily $attributeFamily,
Category $category, Product $product,
CatalogRule $catalogRule,
CatalogRuleChannels $catalogRuleChannels,
CatalogRuleCustomerGroups $catalogRuleCustomerGroups,
Apply $sale
) {
$this->_config = request('_config');
$this->attribute = $attribute;
$this->attributeFamily = $attributeFamily;
$this->category = $category;
$this->product = $product;
$this->sale = $sale;
$this->catalogRule = $catalogRule;
$this->catalogRuleChannels = $catalogRuleChannels;
$this->catalogRuleCustomerGroups = $catalogRuleCustomerGroups;
$this->appliedConfig = config('pricerules.catalog');
$this->appliedConditions = config('pricerules.conditions');
$this->findProducts = $findProducts;
}
public function index()
@ -97,12 +104,21 @@ class CatalogRuleController extends Controller
return view($this->_config['view']);
}
/**
* To load create form for catalog rule
*
* @return View
*/
public function create()
{
// dd($this->appliedConfig);
return view($this->_config['view'])->with('catalog_rule', [$this->appliedConfig, $this->category->getPartial(), $this->getStatesAndCountries(), $this->attribute->getPartial()]);
}
/**
* To store newly created catalog rule and store it
*
* @return Redirect
*/
public function store()
{
$this->validate(request(), [
@ -141,8 +157,11 @@ class CatalogRuleController extends Controller
unset($catalog_rule['criteria']);
$catalog_rule['conditions'] = $catalog_rule['all_conditions'];
unset($catalog_rule['all_conditions']);
$catalog_rule['conditions'] = json_encode($catalog_rule['conditions']);
if (isset($catalog_rule['disc_amount'])) {
$catalog_rule['actions'] = [
'action_code' => $catalog_rule['action_type'],
@ -166,7 +185,6 @@ class CatalogRuleController extends Controller
unset($catalog_rule['all_actions']);
$catalog_rule['actions'] = json_encode($catalog_rule['actions']);
$catalog_rule['conditions'] = json_encode($catalog_rule['conditions']);
$catalogRule = $this->catalogRule->create($catalog_rule);
@ -196,6 +214,13 @@ class CatalogRuleController extends Controller
}
}
/**
* To load edit for previously created catalog rule
*
* @param $id
*
* @return View
*/
public function edit($id)
{
$catalog_rule = $this->catalogRule->find($id);
@ -217,12 +242,19 @@ class CatalogRuleController extends Controller
]);
}
/**
* To update previously created catalog rule
*
* @param $id
*
* @return Redirect
*/
public function update($id)
{
$data = request()->input();
// $validated = \Validator::make($data, [
// 'name' => 'required|stringunique:catalog_rule,name,' . $id,
// 'name' => 'required|string|unique:catalog_rules,name,' . $id,
// 'starts_from' => 'present|nullable|date',
// 'ends_till' => 'present|nullable|date',
// 'description' => 'string',
@ -242,7 +274,8 @@ class CatalogRuleController extends Controller
// }
$this->validate(request(), [
'name' => 'required|stringunique:catalog_rule,name,'.$id,
'name' => 'required|string|unique:catalog_rules,name,'.$id,
// 'name' => 'required|string',
'starts_from' => 'present|nullable|date',
'ends_till' => 'present|nullable|date',
'description' => 'string',
@ -280,19 +313,22 @@ class CatalogRuleController extends Controller
unset($catalog_rule['all_conditions']);
if (isset($catalog_rule['disc_amount'])) {
$catalog_rule['action_type'] = $catalog_rule['apply'];
$catalog_rule['action_code'] = $catalog_rule['action_type'];
$catalog_rule['actions'] = [
'action_type' => $catalog_rule['apply'],
'action_code' => $catalog_rule['action_type'],
'disc_amount' => $catalog_rule['disc_amount']
];
} else if (isset($catalog_rule['disc_percent'])) {
$catalog_rule['action_type'] = $catalog_rule['apply'];
$catalog_rule['action_code'] = $catalog_rule['action_type'];
$catalog_rule['actions'] = [
'action_type' => $catalog_rule['apply'],
'action_code' => $catalog_rule['action'],
'disc_percent' => $catalog_rule['disc_percent'],
];
}
$catalog_rule['discount_amount'] = $catalog_rule['disc_amount'];
unset($catalog_rule['disc_amount']);
unset($catalog_rule['apply']);
unset($catalog_rule['attributes']);
unset($catalog_rule['_token']);
@ -317,14 +353,14 @@ class CatalogRuleController extends Controller
}
}
/**
* To apply the catalog rules
*
* @return Redirect
*/
public function applyRules()
{
$catalogRules = $this->catalogRule->all();
$decoded = json_decode($catalogRules->first()->conditions);
$conditions = json_decode($decoded[0]);
$optionableAttributes = $this->fetchOptionableAttributes();
$results = $this->findProducts->findByConditions($conditions);
$this->sale->apply();
}
public function fetchOptionableAttributes()
@ -340,6 +376,13 @@ class CatalogRuleController extends Controller
return $attributesWithOptions;
}
/**
* To delete existing catalog rule
*
* @param Integer $id
*
* @return Redirect
*/
public function destroy($id)
{
$catalogRule = $this->catalogRule->findOrFail($id);
@ -355,7 +398,6 @@ class CatalogRuleController extends Controller
}
}
/**
* Get Countries and states list from core helpers
*

View File

@ -3,8 +3,8 @@
namespace Webkul\Discount\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Customer\Models\CustomerGroupProxy;
use Webkul\Discount\Contracts\CatalogRuleCustomerGroups as CatalogRuleCustomerGroupsContract;
use Webkul\Discount\Models\CatalogRuleProxy as CatalogRule;
class CatalogRuleCustomerGroups extends Model implements CatalogRuleCustomerGroupsContract
{
@ -12,8 +12,8 @@ class CatalogRuleCustomerGroups extends Model implements CatalogRuleCustomerGrou
protected $guarded = ['created_at', 'updated_at'];
public function catalog_rule()
public function customer_group()
{
return $this->belongsTo(CatalogRule::modelClass(), 'catalog_rule_id');
return $this->hasOne(CustomerGroupProxy::modelClass(), 'id', 'customer_group_id');
}
}

View File

@ -3,13 +3,13 @@
namespace Webkul\Discount\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Discount\Contracts\CatalogRuleProducts as CatalogRuleProductContract;
use Webkul\Discount\Contracts\CatalogRuleProducts as CatalogRuleProductsContract;
use Webkul\Discount\Models\CatalogRuleChannelsProxy as CatalogRuleChannels;
use Webkul\Discount\Models\CatalogRuleCustomerGroupsProxy as CatalogRuleCustomerGroups;
class CatalogRuleProducts extends Model implements CatalogRuleProductContract
class CatalogRuleProducts extends Model implements CatalogRuleProductsContract
{
protected $table = 'catalog_rules_products';
protected $table = 'catalog_rule_products';
protected $guarded = ['created_at', 'updated_at'];
protected $fillable = ['catalog_rule_id', 'starts_from', 'ends_till', 'customer_group_id', 'channel_id', 'product_id', 'action_code', 'action_amount'];
}

View File

@ -3,11 +3,11 @@
namespace Webkul\Discount\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Discount\Contracts\CatalogRuleProductsPrice as CatalogRuleProductPriceContract;
use Webkul\Discount\Contracts\CatalogRuleProductsPrice as CatalogRuleProductsPriceContract;
class CatalogRuleProductsPrice extends Model implements CatalogRuleProductContract
class CatalogRuleProductsPrice extends Model implements CatalogRuleProductsPriceContract
{
protected $table = 'catalog_rules_products_price';
protected $guarded = ['created_at', 'updated_at'];
protected $fillable = ['catalog_rule_id', 'starts_from', 'ends_till', 'customer_group_id', 'channel_id', 'product_id', 'rule_price'];
}

View File

@ -11,6 +11,7 @@ class ModuleServiceProvider extends BaseModuleServiceProvider
\Webkul\Discount\Models\CatalogRuleChannels::class,
\Webkul\Discount\Models\CatalogRuleCustomerGroups::class,
\Webkul\Discount\Models\CatalogRuleProducts::class,
\Webkul\Discount\Models\CatalogRuleProductsPrice::class,
\Webkul\Discount\Models\CartRule::class,
\Webkul\Discount\Models\CartRuleChannels::class,
\Webkul\Discount\Models\CartRuleCustomerGroups::class,

View File

@ -1,24 +0,0 @@
<?php
namespace Webkul\Discount\Repositories;
use Webkul\Core\Eloquent\Repository;
/**
* Catalog Rule Products Reposotory
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CatalogRuleProductsRepository extends Repository
{
/**
* Specify Model class name
*
* @return mixed
*/
function model()
{
return 'Webkul\Discount\Contracts\CatalogRuleProducts';
}
}

View File

@ -1,24 +0,0 @@
<?php
namespace Webkul\Discount\Repositories;
use Webkul\Core\Eloquent\Repository;
/**
* Catalog Rule Products Price Reposotory
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CatalogRuleProductsPriceRepository extends Repository
{
/**
* Specify Model class name
*
* @return mixed
*/
function model()
{
return 'Webkul\Discount\Contracts\CatalogRuleProductsPrice';
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace Webkul\Discount\Repositories;
use Webkul\Core\Eloquent\Repository;
use Webkul\Product\Repositories\ProductRepository as Product;
/**
* Catalog Rule Products Price Reposotory
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CatalogRuleProductsPriceRepository extends Repository
{
/**
* ProductRepository instance
*/
protected $product;
public function __construct(Product $product)
{
$this->product = $product;
}
/**
* Specify Model class name
*
* @return mixed
*/
function model()
{
return 'Webkul\Discount\Contracts\CatalogRuleProductsPrice';
}
/**
* Create or update resource
*/
public function createOrUpdate($rule, $productID)
{
if ($productID == '*') {
} else {
$products = $this->product->all('id');
foreach ($products as $product) {
}
}
}
}

View File

@ -0,0 +1,96 @@
<?php
namespace Webkul\Discount\Repositories;
use Webkul\Core\Eloquent\Repository;
use Webkul\Product\Repositories\ProductRepository as Product;
use Illuminate\Container\Container as App;
/**
* Catalog Rule Products Reposotory
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CatalogRuleProductsRepository extends Repository
{
/**
* ProductRepository instance
*/
protected $product;
public function __construct(Product $product, App $app)
{
$this->product = $product;
parent::__construct($app);
}
/**
* Specify Model class name
*
* @return Mixed
*/
function model()
{
return 'Webkul\Discount\Contracts\CatalogRuleProducts';
}
/**
* Create or update catalog rule product resource
*/
public function createOrUpdate($rule, $productID)
{
$channels = $rule->channels;
$customerGroups = $rule->customer_groups;
$channelsGroupsCross = $channels->crossJoin($customerGroups);
if ($productID == '*') {
$products = $this->product->all('id');
// for all products do that thing later
} else {
$product = $this->product->find($productID);
foreach ($channelsGroupsCross as $channelGroup) {
$channelId = $channelGroup[0]->channel_id;
$groupId = $channelGroup[1]->customer_group_id;
$model = new $this->model();
$catalogRuleProduct = $model->where([
'channel_id' => $channelId,
'customer_group_id' => $groupId,
'product_id' => $productID
])->get();
if ($catalogRuleProduct->count()) {
// update
$catalogRuleProduct->first()->update([
'catalog_rule_id' => $rule->id,
'starts_from' => $rule->starts_from,
'ends_till' => $rule->ends_till,
'customer_group_id' => $groupId,
'channel_id' => $channelId,
'product_id' => $productID,
'action_code' => $rule->action_code,
'action_amount' => $rule->discount_amount
]);
} else {
// create
$this->create([
'catalog_rule_id' => $rule->id,
'starts_from' => $rule->starts_from,
'ends_till' => $rule->ends_till,
'customer_group_id' => $groupId,
'channel_id' => $channelId,
'product_id' => $productID,
'action_code' => $rule->action_code,
'action_amount' => $rule->discount_amount
]);
}
}
}
}
}

View File

@ -8,12 +8,9 @@ use Webkul\Shipping\Facades\Shipping;
use Webkul\Payment\Facades\Payment;
use Webkul\Checkout\Http\Requests\CustomerAddressForm;
use Webkul\Sales\Repositories\OrderRepository;
use Webkul\Discount\Helpers\CouponAbleRule as Coupon;
use Webkul\Discount\Helpers\NonCouponAbleRule as NonCoupon;
use Webkul\Discount\Helpers\ValidatesDiscount;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Auth;
use Webkul\Discount\Helpers\Cart\CouponAbleRule as Coupon;
use Webkul\Discount\Helpers\Cart\NonCouponAbleRule as NonCoupon;
use Webkul\Discount\Helpers\Cart\ValidatesDiscount;
/**
* Chekout controller for the customer and guest for placing order

View File

@ -409,8 +409,6 @@
mounted: function() {
this.templateRender = paymentHtml.render;
console.log(paymentHtml.render);
for (var i in paymentHtml.staticRenderFns) {
paymentTemplateRenderFns.push(paymentHtml.staticRenderFns[i]);
}
@ -535,7 +533,6 @@
},
changeCoupon: function() {
console.log('called');
if (this.couponChanged == true && this.changeCount == 0) {
this.changeCount++;

View File

@ -2,6 +2,8 @@
Route::view('/ui-kit', 'ui::partials.ui-kit');
Route::view('/helper-classess', 'ui::partials.helper-classes')->name('ui.helper.classes');
// Route::get('/users', function () {
// $users = \Webkul\User\Models\Admin::paginate(1);
// echo $users->links();

View File

@ -11,7 +11,7 @@ Vue.use(VueFlatpickr);
export default {
data() {
const now = new Date();
console.log(now);
return {
fpOptions: {
utc: false,

View File

@ -21,6 +21,10 @@ export default {
};
},
created() {
},
mounted() {
var this_this = this;