Merge with master

This commit is contained in:
jitendra 2019-09-04 15:05:03 +05:30
commit 45f1ea4b83
97 changed files with 1827 additions and 968 deletions

View File

@ -1,18 +1,18 @@
APP_NAME=Laravel
APP_NAME=Bagisto
APP_ENV=local
APP_VERSION=0.1.6
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_URL=http://yourdomain.com
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
@ -27,12 +27,12 @@ REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
SHOP_MAIL_FROM=shop@bagsaas.com
ADMIN_MAIL_TO=admin@bagsaas.com
SHOP_MAIL_FROM=
ADMIN_MAIL_TO=
fixer_api_key=
@ -42,4 +42,4 @@ PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

View File

@ -0,0 +1,66 @@
<html>
<head>
<title>Feature</title>
<style>
.bagisto
{
color: blue;
}
</style>
</head>
<body>
<div>
<h3>Title</h3>
<hr>
<p class="bagisto">
A well written title should contain a clear, brief explanation of the Feature, making emphasis on the most important points.
</p>
</div>
<div>
<h3>Preconditions</h3>
<hr>
<p class="bagisto">Please provide as detailed information about your environment as possible.</p>
<ul>
<li> framework Version:</li>
<li>Commit id:</li>
</ul>
</div>
<div>
<h3>Description</h3>
<hr>
<p class="bagisto">Description helps the developer to understand the Feature.
</p>
</div>
<div>
<h3>Steps to reproduce</h3>
<hr>
<p class="bagisto">It is important to provide a set of clear steps to that location where feature need to be added. If relevant please include code samples.</p>
<ol>
<li> step1</li>
<li> step2</li>
</ol>
</div>

29
ISSUE_TEMPLATE.md Normal file
View File

@ -0,0 +1,29 @@
# Bug report
### Title
**Title is a vital part of bug report for developer and triager to quickly identify a unique issue.**
A well written title should contain a clear, brief explanation of the issue, making emphasis on the most important points.
### Issue Description
**Bug description helps the developer to understand the bug.It describes the problem encountered.**
### Preconditions
**Please provide as detailed information about your environment as possible.**
1. framework Version.
2. Commit id.
### Steps to reproduce
**It is important to provide a set of clear steps to reproduce this bug.If relevant please include code samples.**
1. step1
2. step2
### Expected result
**Tell us what should happen.**
* [Screenshots, logs or description]
### Actual result
**Tell us what happens instead.**
* [Tell us what happens instead]

View File

@ -48,6 +48,7 @@ It packs in lots of demanding features that allows your business to scale in no
* Customer Cart, Wishlist, Product Reviews.
* Simple and Configurable Products.
* Price rules (Discount) inbuilt.
* CMS Pages.
* Check out [click here](https://bagisto.com/features/).
**For Developers**:
@ -63,7 +64,7 @@ Bagisto is using power of both of these frameworks and making best out of it out
* **OS**: Ubuntu 16.04 LTS or higher / Windows 7 or Higher (WAMP / XAMP).
* **SERVER**: Apache 2 or NGINX.
* **RAM**: 3 GB or higher.
* **PHP**: 7.1.17 or higher.
* **PHP**: 7.2 or higher.
* **Processor**: Clock Cycle 1 Ghz or higher.
* **For MySQL users**: 5.7.23 or higher.
* **For MariaDB users**: 10.2.7 or Higher.

48
SUPPORT_TEMPLATE.md Normal file
View File

@ -0,0 +1,48 @@
<html>
<head>
<title>Support</title>
<style>
.bagisto
{
color: blue;
}
</style>
</head>
<body>
<div>
<h3>Title</h3>
<hr>
<p class="bagisto">
Title is a vital part of bug report for developer and triager to quickly identify a unique issue.
<br>
A well written title should contain a clear, brief explanation of the issue, making emphasis on the most important points.
</p>
</div>
<div>
<h3>Preconditions</h3>
<hr>
<p class="bagisto">Please provide as detailed information about your environment as possible.</p>
<ul>
<li> framework Version:</li>
<li>Commit id:</li>
</ul>
</div>
<div>
<h3>Description</h3>
<hr>
<p class="bagisto">Description helps the developer to understand the exact scenario.It describes the problem encountered.</p>
</div>
<div>
<h3>Steps to reproduce</h3>
<hr>
<p class="bagisto">It is important to provide a set of clear steps to reproduce that scenario. If relevant please include code samples.</p>
<ol>
<li> step1</li>
<li> step2</li>
</ol>
</div>

View File

@ -30,7 +30,7 @@ class Kernel extends HttpKernel
\Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class
],
'api' => [

View File

@ -2,125 +2,124 @@
"name": "bagisto/bagisto",
"description": "Bagisto Laravel ECommerce",
"keywords": [
"framework",
"laravel"
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.1.3",
"ext-curl": "*",
"ext-intl": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-pdo": "*",
"ext-pdo_mysql": "*",
"ext-tokenizer": "*",
"barryvdh/laravel-dompdf": "^0.8.0@dev",
"dimsav/laravel-translatable": "^9.0",
"doctrine/dbal": "^2.9@dev",
"fideloper/proxy": "^4.0",
"flynsarmy/db-blade-compiler": "*",
"guzzlehttp/guzzle": "~6.0",
"intervention/image": "^2.4",
"intervention/imagecache": "^2.3",
"kalnoy/nestedset": "^4.3",
"konekt/concord": "^1.2",
"laravel/framework": "5.6.*",
"laravel/tinker": "^1.0",
"maatwebsite/excel": "3.1.x-dev",
"nwidart/laravel-modules": "^3.2",
"prettus/l5-repository": "^2.6",
"tymon/jwt-auth": "dev-develop"
"php": "^7.1.3",
"ext-curl": "*",
"ext-intl": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-pdo": "*",
"ext-pdo_mysql": "*",
"ext-tokenizer": "*",
"barryvdh/laravel-dompdf": "^0.8.0@dev",
"dimsav/laravel-translatable": "^9.0",
"doctrine/dbal": "^2.9@dev",
"fideloper/proxy": "^4.0",
"flynsarmy/db-blade-compiler": "*",
"guzzlehttp/guzzle": "~6.0",
"intervention/image": "^2.4",
"intervention/imagecache": "^2.3",
"kalnoy/nestedset": "^4.3",
"konekt/concord": "^1.2",
"laravel/framework": "5.6.*",
"laravel/tinker": "^1.0",
"maatwebsite/excel": "3.1.11",
"nwidart/laravel-modules": "^3.2",
"prettus/l5-repository": "2.6.32",
"tymon/jwt-auth": "dev-develop"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.1",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"laravel/dusk": "^4.0",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0"
"barryvdh/laravel-debugbar": "^3.1",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"laravel/dusk": "^4.0",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0"
},
"replace": {
"bagisto/laravel-user": "v0.1.0",
"bagisto/laravel-admin": "v0.1.0",
"bagisto/laravel-ui": "v0.1.0",
"bagisto/laravel-core": "v0.1.0",
"bagisto/laravel-attribute": "v0.1.0",
"bagisto/laravel-checkout": "v0.1.0",
"bagisto/laravel-customer": "v0.1.0",
"bagisto/laravel-inventory": "v0.1.0",
"bagisto/laravel-category": "v0.1.0",
"bagisto/laravel-product": "v0.1.0",
"bagisto/laravel-shop": "v0.1.0",
"bagisto/laravel-theme": "v0.1.0",
"bagisto/laravel-shipping": "v0.1.0",
"bagisto/laravel-payment": "v0.1.0",
"bagisto/laravel-sales": "v0.1.0",
"bagisto/laravel-tax": "v0.1.0",
"bagisto/laravel-api": "v0.1.0",
"bagisto/laravel-paypal": "v0.1.0",
"bagisto/laravel-discount": "v0.1.0"
"bagisto/laravel-user": "v0.1.0",
"bagisto/laravel-admin": "v0.1.0",
"bagisto/laravel-ui": "v0.1.0",
"bagisto/laravel-core": "v0.1.0",
"bagisto/laravel-attribute": "v0.1.0",
"bagisto/laravel-checkout": "v0.1.0",
"bagisto/laravel-customer": "v0.1.0",
"bagisto/laravel-inventory": "v0.1.0",
"bagisto/laravel-category": "v0.1.0",
"bagisto/laravel-product": "v0.1.0",
"bagisto/laravel-shop": "v0.1.0",
"bagisto/laravel-theme": "v0.1.0",
"bagisto/laravel-shipping": "v0.1.0",
"bagisto/laravel-payment": "v0.1.0",
"bagisto/laravel-sales": "v0.1.0",
"bagisto/laravel-tax": "v0.1.0",
"bagisto/laravel-api": "v0.1.0",
"bagisto/laravel-paypal": "v0.1.0",
"bagisto/laravel-discount": "v0.1.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/",
"Webkul\\User\\": "packages/Webkul/User/src",
"Webkul\\Admin\\": "packages/Webkul/Admin/src",
"Webkul\\Ui\\": "packages/Webkul/Ui/src",
"Webkul\\Category\\": "packages/Webkul/Category/src",
"Webkul\\Checkout\\": "packages/Webkul/Checkout/src",
"Webkul\\Attribute\\": "packages/Webkul/Attribute/src",
"Webkul\\Shop\\": "packages/Webkul/Shop/src",
"Webkul\\Core\\": "packages/Webkul/Core/src",
"Webkul\\Customer\\": "packages/Webkul/Customer/src",
"Webkul\\Inventory\\": "packages/Webkul/Inventory/src",
"Webkul\\Product\\": "packages/Webkul/Product/src",
"Webkul\\Theme\\": "packages/Webkul/Theme/src",
"Webkul\\Shipping\\": "packages/Webkul/Shipping/src",
"Webkul\\Payment\\": "packages/Webkul/Payment/src",
"Webkul\\Paypal\\": "packages/Webkul/Paypal/src",
"Webkul\\Sales\\": "packages/Webkul/Sales/src",
"Webkul\\Tax\\": "packages/Webkul/Tax/src",
"Webkul\\API\\": "packages/Webkul/API",
"Webkul\\Discount\\": "packages/Webkul/Discount/src",
"Webkul\\CMS\\": "packages/Webkul/CMS/src"
}
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/",
"Webkul\\User\\": "packages/Webkul/User/src",
"Webkul\\Admin\\": "packages/Webkul/Admin/src",
"Webkul\\Ui\\": "packages/Webkul/Ui/src",
"Webkul\\Category\\": "packages/Webkul/Category/src",
"Webkul\\Checkout\\": "packages/Webkul/Checkout/src",
"Webkul\\Attribute\\": "packages/Webkul/Attribute/src",
"Webkul\\Shop\\": "packages/Webkul/Shop/src",
"Webkul\\Core\\": "packages/Webkul/Core/src",
"Webkul\\Customer\\": "packages/Webkul/Customer/src",
"Webkul\\Inventory\\": "packages/Webkul/Inventory/src",
"Webkul\\Product\\": "packages/Webkul/Product/src",
"Webkul\\Theme\\": "packages/Webkul/Theme/src",
"Webkul\\Shipping\\": "packages/Webkul/Shipping/src",
"Webkul\\Payment\\": "packages/Webkul/Payment/src",
"Webkul\\Paypal\\": "packages/Webkul/Paypal/src",
"Webkul\\Sales\\": "packages/Webkul/Sales/src",
"Webkul\\Tax\\": "packages/Webkul/Tax/src",
"Webkul\\API\\": "packages/Webkul/API",
"Webkul\\Discount\\": "packages/Webkul/Discount/src",
"Webkul\\CMS\\": "packages/Webkul/CMS/src"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
"barryvdh/laravel-debugbar"
]
}
"laravel": {
"dont-discover": [
"barryvdh/laravel-debugbar"
]
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
]
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
]
},
"config": {
"preferred-install": "stable",
"sort-packages": true,
"optimize-autoloader": true
"preferred-install": "stable",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev"
}
}

View File

@ -304,6 +304,6 @@ return [
'PDF' => Barryvdh\DomPDF\Facade::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
'Concord' => Konekt\Concord\Facades\Concord::class,
'Helper' => Konekt\Concord\Facades\Helper::class,
'Helper' => Konekt\Concord\Facades\Helper::class
],
];

View File

@ -57,4 +57,4 @@ return [
'expire' => 60,
],
],
];
];

View File

@ -28,4 +28,4 @@
"type": "opencollective",
"url": "https://opencollective.com/bagisto"
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,207 +6,205 @@ return [
'name' => 'admin::app.layouts.dashboard',
'route' => 'admin.dashboard.index',
'sort' => 1,
'icon-class' => 'dashboard-icon',
'icon-class' => 'dashboard-icon'
], [
'key' => 'sales',
'name' => 'admin::app.layouts.sales',
'route' => 'admin.sales.orders.index',
'sort' => 2,
'icon-class' => 'sales-icon',
'icon-class' => 'sales-icon'
], [
'key' => 'sales.orders',
'name' => 'admin::app.layouts.orders',
'route' => 'admin.sales.orders.index',
'sort' => 1,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'sales.shipments',
'name' => 'admin::app.layouts.shipments',
'route' => 'admin.sales.shipments.index',
'sort' => 2,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'sales.invoices',
'name' => 'admin::app.layouts.invoices',
'route' => 'admin.sales.invoices.index',
'sort' => 3,
'icon-class' => '',
'icon-class' => ''
],
[
'key' => 'catalog',
'name' => 'admin::app.layouts.catalog',
'route' => 'admin.catalog.products.index',
'sort' => 3,
'icon-class' => 'catalog-icon',
'icon-class' => 'catalog-icon'
], [
'key' => 'catalog.products',
'name' => 'admin::app.layouts.products',
'route' => 'admin.catalog.products.index',
'sort' => 4,
'icon-class' => '',
'sort' => 1,
'icon-class' => ''
], [
'key' => 'catalog.categories',
'name' => 'admin::app.layouts.categories',
'route' => 'admin.catalog.categories.index',
'sort' => 3,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'catalog.attributes',
'name' => 'admin::app.layouts.attributes',
'route' => 'admin.catalog.attributes.index',
'sort' => 1,
'icon-class' => '',
'sort' => 2,
'icon-class' => ''
], [
'key' => 'catalog.families',
'name' => 'admin::app.layouts.attribute-families',
'route' => 'admin.catalog.families.index',
'sort' => 2,
'icon-class' => '',
'sort' => 4,
'icon-class' => ''
], [
'key' => 'customers',
'name' => 'admin::app.layouts.customers',
'route' => 'admin.customer.index',
'sort' => 4,
'icon-class' => 'customer-icon',
'icon-class' => 'customer-icon'
], [
'key' => 'customers.customers',
'name' => 'admin::app.layouts.customers',
'route' => 'admin.customer.index',
'sort' => 1,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'customers.groups',
'name' => 'admin::app.layouts.groups',
'route' => 'admin.groups.index',
'sort' => 2,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'customers.reviews',
'name' => 'admin::app.layouts.reviews',
'route' => 'admin.customer.review.index',
'sort' => 3,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'customers.subscribers',
'name' => 'admin::app.layouts.newsletter-subscriptions',
'route' => 'admin.customers.subscribers.index',
'sort' => 4,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'configuration',
'name' => 'admin::app.layouts.configure',
'route' => 'admin.configuration.index',
'sort' => 7,
'icon-class' => 'configuration-icon',
'icon-class' => 'configuration-icon'
], [
'key' => 'settings',
'name' => 'admin::app.layouts.settings',
'route' => 'admin.locales.index',
'sort' => 6,
'icon-class' => 'settings-icon',
'icon-class' => 'settings-icon'
], [
'key' => 'settings.locales',
'name' => 'admin::app.layouts.locales',
'route' => 'admin.locales.index',
'sort' => 1,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'settings.currencies',
'name' => 'admin::app.layouts.currencies',
'route' => 'admin.currencies.index',
'sort' => 2,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'settings.exchange_rates',
'name' => 'admin::app.layouts.exchange-rates',
'route' => 'admin.exchange_rates.index',
'sort' => 3,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'settings.inventory_sources',
'name' => 'admin::app.layouts.inventory-sources',
'route' => 'admin.inventory_sources.index',
'sort' => 4,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'settings.channels',
'name' => 'admin::app.layouts.channels',
'route' => 'admin.channels.index',
'sort' => 5,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'settings.users',
'name' => 'admin::app.layouts.users',
'route' => 'admin.users.index',
'sort' => 6,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'settings.users.users',
'name' => 'admin::app.layouts.users',
'route' => 'admin.users.index',
'sort' => 1,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'settings.users.roles',
'name' => 'admin::app.layouts.roles',
'route' => 'admin.roles.index',
'sort' => 2,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'settings.sliders',
'name' => 'admin::app.layouts.sliders',
'route' => 'admin.sliders.index',
'sort' => 7,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'settings.taxes',
'name' => 'admin::app.layouts.taxes',
'route' => 'admin.tax-categories.index',
'sort' => 8,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'settings.taxes.tax-categories',
'name' => 'admin::app.layouts.tax-categories',
'route' => 'admin.tax-categories.index',
'sort' => 1,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'settings.taxes.tax-rates',
'name' => 'admin::app.layouts.tax-rates',
'route' => 'admin.tax-rates.index',
'sort' => 2,
'icon-class' => '',
'icon-class' => ''
], [
'key' => 'promotions',
'name' => 'admin::app.layouts.promotion',
'route' => 'admin.cart-rule.index',
'sort' => 5,
'icon-class' => 'promotion-icon',
'icon-class' => 'promotion-icon'
], [
'key' => 'promotions.cart-rule',
'name' => 'admin::app.promotion.cart-rule',
'route' => 'admin.cart-rule.index',
'sort' => 1,
'icon-class' => ''
], [
'key' => 'promotions.catalog-rule',
'name' => 'admin::app.promotion.catalog-rule',
'route' => 'admin.catalog-rule.index',
'sort' => 1,
'icon-class' => '',
],
// [
// 'key' => 'promotions.catalog-rule',
// 'name' => 'admin::app.promotion.catalog-rule',
// 'route' => 'admin.catalog-rule.index',
// 'sort' => 1,
// 'icon-class' => '',
// ],
[
], [
'key' => 'cms',
'name' => 'admin::app.layouts.cms',
'route' => 'admin.cms.index',
'sort' => 6,
'icon-class' => 'cms-icon',
'icon-class' => 'cms-icon'
], [
'key' => 'cms.pages',
'name' => 'admin::app.cms.pages.pages',
'route' => 'admin.cms.index',
'sort' => 1,
'icon-class' => '',
'icon-class' => ''
]
];

View File

@ -60,7 +60,7 @@ class CMSPageDataGrid extends DataGrid
$this->addColumn([
'index' => 'locale_id',
'label' => trans('admin::app.cms.pages.locale'),
'type' => 'string',
'type' => 'number',
'searchable' => false,
'sortable' => true,
'filterable' => true,

View File

@ -41,7 +41,7 @@ class CatalogRuleDataGrid extends DataGrid
'index' => 'name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => false,
'searchable' => true,
'sortable' => true,
'filterable' => true
]);
@ -49,7 +49,7 @@ class CatalogRuleDataGrid extends DataGrid
$this->addColumn([
'index' => 'starts_from',
'label' => trans('admin::app.datagrid.starts-from'),
'type' => 'date',
'type' => 'datetime',
'searchable' => false,
'sortable' => true,
'filterable' => true
@ -58,7 +58,7 @@ class CatalogRuleDataGrid extends DataGrid
$this->addColumn([
'index' => 'ends_till',
'label' => trans('admin::app.datagrid.ends-till'),
'type' => 'date',
'type' => 'datetime',
'searchable' => false,
'sortable' => true,
'filterable' => true
@ -98,7 +98,7 @@ class CatalogRuleDataGrid extends DataGrid
'index' => 'action_code',
'label' => 'Action Type',
'type' => 'string',
'searchable' => false,
'searchable' => true,
'sortable' => true,
'filterable' => true
]);

View File

@ -19,7 +19,7 @@ class OrderInvoicesDataGrid extends DataGrid
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('invoices')->select('id', 'order_id', 'state', 'grand_total', 'created_at');
$queryBuilder = DB::table('invoices')->select('id', 'order_id', 'state', 'base_grand_total', 'created_at');
$this->setQueryBuilder($queryBuilder);
}
@ -45,7 +45,7 @@ class OrderInvoicesDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'grand_total',
'index' => 'base_grand_total',
'label' => trans('admin::app.datagrid.grand-total'),
'type' => 'price',
'searchable' => true,

View File

@ -92,7 +92,7 @@ class TaxRateDataGrid extends DataGrid
$this->addColumn([
'index' => 'tax_rate',
'label' => trans('admin::app.datagrid.tax-rate'),
'type' => 'string',
'type' => 'number',
'searchable' => true,
'sortable' => true,
'filterable' => true

View File

@ -9,6 +9,7 @@ use Webkul\Core\Database\Seeders\DatabaseSeeder as CoreSeeder;
use Webkul\User\Database\Seeders\DatabaseSeeder as UserSeeder;
use Webkul\Customer\Database\Seeders\DatabaseSeeder as CustomerSeeder;
use Webkul\Inventory\Database\Seeders\DatabaseSeeder as InventorySeeder;
use Webkul\CMS\Database\Seeders\DatabaseSeeder as CMSSeeder;
class DatabaseSeeder extends Seeder
{
@ -25,5 +26,6 @@ class DatabaseSeeder extends Seeder
$this->call(AttributeSeeder::class);
$this->call(UserSeeder::class);
$this->call(CustomerSeeder::class);
$this->call(CMSSeeder::class);
}
}
}

View File

@ -120,7 +120,11 @@ class CustomerController extends Controller
$customer = $this->customerRepository->create($data);
Mail::queue(new NewCustomerNotification($customer, $password));
try {
Mail::queue(new NewCustomerNotification($customer, $password));
} catch (\Exception $e) {
}
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Customer']));

View File

@ -27,7 +27,7 @@ body {
::-webkit-scrollbar-thumb {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
}
.navbar-top {
@ -211,8 +211,12 @@ body {
.page-header {
display: inline-block;
margin-bottom: 20px;
width: 100%;
padding: 15px 0px 15px 0px;
position: sticky;
top: 60px;
background-color: #ffffff;
z-index: 3;
.page-title {
float: left;
@ -274,7 +278,7 @@ body {
.control {
background: #fff;
border: 2px solid #C7C7C7;
border: 2px solid #c7c7c7;
@include border-radius(3px);
width: 150px;
height: 36px;
@ -285,7 +289,7 @@ body {
font-size: 15px;
&:focus {
border-color: #0041FF;
border-color: #0041ff;
}
}
@ -315,7 +319,7 @@ body {
.locale {
float: right;
color: #8E8E8E;
color: #8e8e8e;
}
}
@ -325,10 +329,8 @@ body {
}
}
// admin dashboard css
.dashboard {
.page-header {
margin-bottom: 0 !important;
padding-bottom: 15px;
@ -341,16 +343,16 @@ body {
.card {
height: 445px;
background: #FFFFFF;
border: 1px solid #E7E7E7;
box-shadow: 0 5px 10px 2px rgba(0,0,0,0.08);
background: #ffffff;
border: 1px solid #e7e7e7;
box-shadow: 0 5px 10px 2px rgba(0, 0, 0, 0.08);
border-radius: 2px;
padding: 20px 0px 0px 20px;
overflow: auto;
.card-title {
font-size: 14px;
color: #A2A2A2;
color: #a2a2a2;
letter-spacing: -0.26px;
text-transform: uppercase;
}
@ -378,7 +380,7 @@ body {
margin-right: 15px;
&.product {
background: #F2F2F2;
background: #f2f2f2;
}
img {
@ -390,11 +392,11 @@ body {
margin-top: 10px;
.name {
color: #0041FF;
color: #0041ff;
}
.info {
color: #3A3A3A;
color: #3a3a3a;
margin-top: 5px;
}
}
@ -417,7 +419,7 @@ body {
p {
margin: 0;
color: #A2A2A2;
color: #a2a2a2;
}
}
}
@ -432,28 +434,27 @@ body {
.dashboard-card {
height: 100px;
background: #FFFFFF;
border: 1px solid #E7E7E7;
box-shadow: 0 5px 10px 2px rgba(0,0,0,0.08);
background: #ffffff;
border: 1px solid #e7e7e7;
box-shadow: 0 5px 10px 2px rgba(0, 0, 0, 0.08);
border-radius: 5px;
position: relative;
padding: 15px;
.title {
font-size: 14px;
color: #A2A2A2;
color: #a2a2a2;
text-transform: uppercase;
}
.data {
padding-top: 13px;
font-size: 32px;
color: #0041FF;
color: #0041ff;
.progress {
font-size: 14px;
color: #8E8E8E;
color: #8e8e8e;
float: right;
margin-top: -2px;
@ -503,7 +504,7 @@ body {
.secton-title {
font-size: 18px;
color: #8E8E8E;
color: #8e8e8e;
padding: 15px 0;
border-bottom: 1px solid $border-color;
}
@ -553,7 +554,6 @@ body {
float: right;
tr {
td {
padding: 5px 8px;
}
@ -584,7 +584,8 @@ body {
.export-import {
cursor: pointer;
.export-icon, .import-icon {
.export-icon,
.import-icon {
position: relative;
top: 10px;
}
@ -619,7 +620,8 @@ body {
padding-top: 15px;
border-top: 1px solid rgba(162, 162, 162, 0.2);
.close-icon, .open-icon {
.close-icon,
.open-icon {
position: absolute;
cursor: pointer;
left: 45%;
@ -762,7 +764,7 @@ body {
// ui
.grid-container {
.filter-row-one .search-filter {
border: 2px solid #C7C7C7;
border: 2px solid #c7c7c7;
border-radius: 2px;
.control {
@ -774,13 +776,14 @@ body {
border: none;
padding-top: 2px;
padding-right: 5px;
border-right: 2px solid #C7C7C7;
border-right: 2px solid #c7c7c7;
border-radius: 0px;
}
}
.filter-row-two .filter-tag {
.wrapper, .icon.cross-icon {
.wrapper,
.icon.cross-icon {
margin-right: 10px;
margin-left: 0px;
}
@ -792,8 +795,15 @@ body {
}
}
.grid-container .filter-wrapper .filter-row-one .dropdown-filters .more-filters .dropdown-toggle .dropdown-header span {
padding-right: 5px;
.grid-container
.filter-wrapper
.filter-row-one
.dropdown-filters
.more-filters
.dropdown-toggle
.dropdown-header
span {
padding-right: 5px;
}
.grid-container .table tbody td.action a:first-child {
@ -830,13 +840,14 @@ body {
.tree-container .tree-item {
padding-right: 30px;
.expand-icon ,.folder-icon {
.expand-icon,
.folder-icon {
margin-left: 10px;
margin-right: 0px;
}
}
.tree-container >.tree-item {
.tree-container > .tree-item {
padding-right: 0px;
}
@ -855,7 +866,7 @@ body {
.control-group label.required::before {
content: "*";
color: #FC6868;
color: #fc6868;
font-weight: 700;
}
@ -886,12 +897,14 @@ body {
position: fixed;
top: 108px;
right: 32px;
z-index: 20;
}
.fixed-action-slight {
position: fixed;
top: 94px;
right: 32px;
z-index: 20;
}
.pagination {
@ -904,4 +917,4 @@ body {
b {
font-weight: 500;
}
}
}

View File

@ -696,10 +696,14 @@ return [
'update-success' => 'Channel updated successfully.',
'delete-success' => 'Channel deleted successfully.',
'last-delete-error' => 'At least one Channel is required.',
'seo' => 'Home page SEO',
'seo-title' => 'Meta title',
'seo-description' => 'Meta description',
'seo-keywords' => 'Meta keywords'
],
'sliders' => [
'title' => 'Title',
'title' => 'Sliders',
'add-title' => 'Create Slider',
'edit-title' => 'Edit Slider',
'save-btn-title' => 'Save Slider',
@ -855,7 +859,7 @@ return [
'create-catalog-rule' => 'Create Catalog Rule',
'create-cart-rule' => 'Create Cart Rule',
'save-btn-title' => 'Create',
'edit-btn-title' => 'Edit',
'edit-btn-title' => 'Save',
'save' => 'Save',
'select-cart-attr' => 'Select Cart Attribute',
'select-products' => 'How to choose products ?',
@ -875,6 +879,7 @@ return [
'rule-desc' => 'Enter Rule Description',
'convert-x-note' => 'If this section is left empty, then rule will get applied to all the products in the cart.',
'declut' => 'Declutter Rules',
'processing-done' => 'Rules processing done',
'declut-success' => 'Catalog rules decluttering successful',
'declut-failure' => 'Catalog rules decluttering failed',
'add-attr-condition' => 'Add Attribute Condition',
@ -1011,6 +1016,8 @@ return [
'cms' => [
'pages' => [
'general' => 'General',
'seo' => 'SEO',
'pages' => 'Page',
'title' => 'pages',
'add-title' => 'Add Page',
@ -1018,11 +1025,12 @@ return [
'url-key' => 'URL Key',
'channel' => 'Channel',
'locale' => 'Locale',
'create-btn-title' => 'Add Page',
'create-btn-title' => 'Save Page',
'edit-title' => 'Edit Page',
'edit-btn-title' => 'Save Page',
'create-success' => 'Page created successfully',
'create-failure' => 'Page cannot be created',
'create-partial' => 'Some of the pages requested already exists',
'create-failure' => 'All pages requested already exists',
'update-success' => 'Page updated successfully',
'update-failure' => 'Page cannot be updated',
'page-title' => 'Page Title',

View File

@ -14,7 +14,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submi t" class="btn btn-lg btn-primary">
{{ __('admin::app.account.save-btn-title') }}
</button>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.catalog.attributes.save-btn-title') }}
</button>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.catalog.attributes.save-btn-title') }}
</button>

View File

@ -18,7 +18,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.catalog.categories.save-btn-title') }}
</button>

View File

@ -18,7 +18,7 @@
{{ __('admin::app.catalog.categories.edit-title') }}
</h1>
<div class="control-group fixed-action">
<div class="control-group">
<select class="control" id="locale-switcher" onChange="window.location.href = this.value">
@foreach (core()->getAllLocales() as $localeModel)

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.catalog.families.save-btn-title') }}
</button>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.catalog.families.save-btn-title') }}
</button>

View File

@ -32,7 +32,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.catalog.products.save-btn-title') }}
</button>

View File

@ -47,7 +47,7 @@
</div>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.catalog.products.save-btn-title') }}
</button>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.cms.pages.create-btn-title') }}
</button>
@ -28,91 +28,98 @@
<div class="form-container">
@csrf()
<accordian :title="'{{ __('admin::app.cms.pages.general') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('page_title') ? 'has-error' : '']">
<label for="page_title" class="required">{{ __('admin::app.cms.pages.page-title') }}</label>
<div class="control-group" :class="[errors.has('page_title') ? 'has-error' : '']">
<label for="page_title" class="required">{{ __('admin::app.cms.pages.page-title') }}</label>
<input type="text" class="control" name="page_title" v-validate="'required'" value="{{ old('page_title') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.page-title') }}&quot;">
<input type="text" class="control" name="page_title" v-validate="'required'" value="{{ old('page_title') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.page-title') }}&quot;">
<span class="control-error" v-if="errors.has('page_title')">@{{ errors.first('page_title') }}</span>
</div>
<span class="control-error" v-if="errors.has('page_title')">@{{ errors.first('page_title') }}</span>
</div>
<div class="control-group" :class="[errors.has('url_key') ? 'has-error' : '']">
<label for="url-key" class="required">{{ __('admin::app.cms.pages.url-key') }}</label>
<div class="control-group" :class="[errors.has('url_key') ? 'has-error' : '']">
<label for="url-key" class="required">{{ __('admin::app.cms.pages.url-key') }}</label>
<input type="text" class="control" name="url_key" v-validate="'required'" value="{{ old('url-key') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.url-key') }}&quot;" v-slugify>
<input type="text" class="control" name="url_key" v-validate="'required'" value="{{ old('url-key') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.url-key') }}&quot;" v-slugify>
<span class="control-error" v-if="errors.has('url_key')">@{{ errors.first('url_key') }}</span>
</div>
<span class="control-error" v-if="errors.has('url_key')">@{{ errors.first('url_key') }}</span>
</div>
@inject('channels', 'Webkul\Core\Repositories\ChannelRepository')
@inject('locales', 'Webkul\Core\Repositories\LocaleRepository')
@inject('channels', 'Webkul\Core\Repositories\ChannelRepository')
@inject('locales', 'Webkul\Core\Repositories\LocaleRepository')
<div class="control-group" :class="[errors.has('channels[]') ? 'has-error' : '']">
<label for="url-key" class="required">{{ __('admin::app.cms.pages.channel') }}</label>
<div class="control-group" :class="[errors.has('channels[]') ? 'has-error' : '']">
<label for="url-key" class="required">{{ __('admin::app.cms.pages.channel') }}</label>
<select type="text" class="control" name="channels[]" v-validate="'required'" value="{{ old('channel[]') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.channel') }}&quot;" multiple="multiple">
@foreach($channels->all() as $channel)
<option value="{{ $channel->id }}">{{ $channel->name }}</option>
@endforeach
</select>
<select type="text" class="control" name="channels[]" v-validate="'required'" value="{{ old('channel[]') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.channel') }}&quot;" multiple="multiple">
@foreach($channels->all() as $channel)
<option value="{{ $channel->id }}">{{ $channel->name }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('channels[]')">@{{ errors.first('channels[]') }}</span>
</div>
<span class="control-error" v-if="errors.has('channels[]')">@{{ errors.first('channels[]') }}</span>
</div>
<div class="control-group" :class="[errors.has('locales[]') ? 'has-error' : '']">
<label for="url-key" class="required">{{ __('admin::app.cms.pages.locale') }}</label>
<div class="control-group" :class="[errors.has('locales[]') ? 'has-error' : '']">
<label for="url-key" class="required">{{ __('admin::app.cms.pages.locale') }}</label>
<select type="text" class="control" name="locales[]" v-validate="'required'" value="{{ old('locale[]') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.locale') }}&quot;" multiple="multiple">
@foreach($locales->all() as $locale)
<option value="{{ $locale->id }}">{{ $locale->name }}</option>
@endforeach
</select>
<select type="text" class="control" name="locales[]" v-validate="'required'" value="{{ old('locale[]') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.locale') }}&quot;" multiple="multiple">
@foreach($locales->all() as $locale)
<option value="{{ $locale->id }}">{{ $locale->name }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('locales[]')">@{{ errors.first('locales[]') }}</span>
</div>
<span class="control-error" v-if="errors.has('locales[]')">@{{ errors.first('locales[]') }}</span>
</div>
<div class="control-group" :class="[errors.has('html_content') ? 'has-error' : '']">
<label for="html_content" class="required">{{ __('admin::app.cms.pages.content') }}</label>
<div class="control-group" :class="[errors.has('html_content') ? 'has-error' : '']">
<label for="html_content" class="required">{{ __('admin::app.cms.pages.content') }}</label>
<textarea type="text" class="control" id="content" name="html_content" v-validate="'required'" value="{{ old('html_content') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.content') }}&quot;"></textarea>
<textarea type="text" class="control" id="content" name="html_content" v-validate="'required'" value="{{ old('html_content') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.content') }}&quot;"></textarea>
{!! __('admin::app.cms.pages.one-col') !!}
{!! __('admin::app.cms.pages.two-col') !!}
{!! __('admin::app.cms.pages.three-col') !!}
{!! __('admin::app.cms.pages.one-col') !!}
{!! __('admin::app.cms.pages.two-col') !!}
{!! __('admin::app.cms.pages.three-col') !!}
<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') }}
</a>
</div>
<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') }}
</a>
<span class="control-error" v-if="errors.has('html_content')">@{{ errors.first('html_content') }}</span>
</div>
</div>
</accordian>
<span class="control-error" v-if="errors.has('html_content')">@{{ errors.first('html_content') }}</span>
</div>
<accordian :title="'{{ __('admin::app.cms.pages.seo') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('meta_title') ? 'has-error' : '']">
<label for="meta_title" class="required">{{ __('admin::app.cms.pages.meta_title') }}</label>
<div class="control-group" :class="[errors.has('meta_title') ? 'has-error' : '']">
<label for="meta_title" class="required">{{ __('admin::app.cms.pages.meta_title') }}</label>
<input type="text" class="control" name="meta_title" v-validate="'required'" value="{{ old('meta_title') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.meta_title') }}&quot;">
<input type="text" class="control" name="meta_title" v-validate="'required'" value="{{ old('meta_title') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.meta_title') }}&quot;">
<span class="control-error" v-if="errors.has('meta_title')">@{{ errors.first('meta_title') }}</span>
</div>
<span class="control-error" v-if="errors.has('meta_title')">@{{ errors.first('meta_title') }}</span>
</div>
<div class="control-group" :class="[errors.has('meta_keywords') ? 'has-error' : '']">
<label for="meta_keywords" class="required">{{ __('admin::app.cms.pages.meta_keywords') }}</label>
<div class="control-group" :class="[errors.has('meta_keywords') ? 'has-error' : '']">
<label for="meta_keywords" class="required">{{ __('admin::app.cms.pages.meta_keywords') }}</label>
<textarea type="text" class="control" name="meta_keywords" v-validate="'required'" value="{{ old('meta_keywords') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.meta_keywords') }}&quot;"></textarea>
<textarea type="text" class="control" name="meta_keywords" v-validate="'required'" value="{{ old('meta_keywords') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.meta_keywords') }}&quot;"></textarea>
<span class="control-error" v-if="errors.has('meta_keywords')">@{{ errors.first('meta_keywords') }}</span>
</div>
<span class="control-error" v-if="errors.has('meta_keywords')">@{{ errors.first('meta_keywords') }}</span>
</div>
<div class="control-group" :class="[errors.has('meta_description') ? 'has-error' : '']">
<label for="meta_description">{{ __('admin::app.cms.pages.meta_description') }}</label>
<div class="control-group" :class="[errors.has('meta_description') ? 'has-error' : '']">
<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>
<textarea type="text" class="control" name="meta_description" value="{{ old('meta_description') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.meta_description') }}&quot;"></textarea>
<span class="control-error" v-if="errors.has('meta_description')">@{{ errors.first('meta_description') }}</span>
</div>
<span class="control-error" v-if="errors.has('meta_description')">@{{ errors.first('meta_description') }}</span>
</div>
</div>
</accordian>
</div>
</div>
</form>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button id="preview" class="btn btn-lg btn-primary">
{{ __('admin::app.cms.pages.preview') }}
</button>
@ -32,64 +32,71 @@
<div class="form-container">
@csrf()
<accordian :title="'{{ __('admin::app.cms.pages.general') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('page_title') ? 'has-error' : '']">
<label for="page_title" class="required">{{ __('admin::app.cms.pages.page-title') }}</label>
<div class="control-group" :class="[errors.has('page_title') ? 'has-error' : '']">
<label for="page_title" class="required">{{ __('admin::app.cms.pages.page-title') }}</label>
<input type="text" class="control" name="page_title" v-validate="'required'" value="{{ $page->page_title ?? old('page_title') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.page-title') }}&quot;">
<input type="text" class="control" name="page_title" v-validate="'required'" value="{{ $page->page_title ?? old('page_title') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.page-title') }}&quot;">
<span class="control-error" v-if="errors.has('page_title')">@{{ errors.first('page_title') }}</span>
</div>
<span class="control-error" v-if="errors.has('page_title')">@{{ errors.first('page_title') }}</span>
</div>
<div class="control-group" :class="[errors.has('url_key') ? 'has-error' : '']">
<label for="url-key" class="required">{{ __('admin::app.cms.pages.url-key') }}</label>
<div class="control-group" :class="[errors.has('url_key') ? 'has-error' : '']">
<label for="url-key" class="required">{{ __('admin::app.cms.pages.url-key') }}</label>
<input type="text" class="control" name="url_key" v-validate="'required'" value="{{ $page->url_key ?? old('url_key') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.url-key') }}&quot;" disabled>
<input type="text" class="control" name="url_key" v-validate="'required'" value="{{ $page->url_key ?? old('url_key') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.url-key') }}&quot;" disabled>
<span class="control-error" v-if="errors.has('url_key')">@{{ errors.first('url_key') }}</span>
</div>
<span class="control-error" v-if="errors.has('url_key')">@{{ errors.first('url_key') }}</span>
</div>
<div class="control-group" :class="[errors.has('html_content') ? 'has-error' : '']">
<label for="html_content" class="required">{{ __('admin::app.cms.pages.content') }}</label>
<div class="control-group" :class="[errors.has('html_content') ? 'has-error' : '']">
<label for="html_content" class="required">{{ __('admin::app.cms.pages.content') }}</label>
<textarea type="text" class="control" id="content" name="html_content" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.cms.pages.content') }}&quot;">{{ $page->html_content ?? old('html_content') }}</textarea>
<textarea type="text" class="control" id="content" name="html_content" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.cms.pages.content') }}&quot;">{{ $page->html_content ?? old('html_content') }}</textarea>
{!! __('admin::app.cms.pages.one-col') !!}
{!! __('admin::app.cms.pages.two-col') !!}
{!! __('admin::app.cms.pages.three-col') !!}
{!! __('admin::app.cms.pages.one-col') !!}
{!! __('admin::app.cms.pages.two-col') !!}
{!! __('admin::app.cms.pages.three-col') !!}
<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') }}
</a>
</div>
<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') }}
</a>
<span class="control-error" v-if="errors.has('html_content')">@{{ errors.first('html_content') }}</span>
</div>
</div>
</accordian>
<span class="control-error" v-if="errors.has('html_content')">@{{ errors.first('html_content') }}</span>
</div>
<accordian :title="'{{ __('admin::app.cms.pages.seo') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('meta_title') ? 'has-error' : '']">
<label for="meta_title" class="required">{{ __('admin::app.cms.pages.meta_title') }}</label>
<div class="control-group" :class="[errors.has('meta_title') ? 'has-error' : '']">
<label for="meta_title" class="required">{{ __('admin::app.cms.pages.meta_title') }}</label>
<input type="text" class="control" name="meta_title" v-validate="'required'" value="{{ $page->meta_title ?? old('meta_title') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.meta_title') }}&quot;">
<input type="text" class="control" name="meta_title" v-validate="'required'" value="{{ $page->meta_title ?? old('meta_title') }}" data-vv-as="&quot;{{ __('admin::app.cms.pages.meta_title') }}&quot;">
<span class="control-error" v-if="errors.has('meta_title')">@{{ errors.first('meta_title') }}</span>
</div>
<span class="control-error" v-if="errors.has('meta_title')">@{{ errors.first('meta_title') }}</span>
</div>
<div class="control-group" :class="[errors.has('meta_keywords') ? 'has-error' : '']">
<label for="meta_keywords" class="required">{{ __('admin::app.cms.pages.meta_keywords') }}</label>
<div class="control-group" :class="[errors.has('meta_keywords') ? 'has-error' : '']">
<label for="meta_keywords" class="required">{{ __('admin::app.cms.pages.meta_keywords') }}</label>
<textarea type="text" class="control" name="meta_keywords" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.cms.pages.meta_keywords') }}&quot;">{{ $page->meta_keywords ?? old('meta_keywords') }}</textarea>
<textarea type="text" class="control" name="meta_keywords" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.cms.pages.meta_keywords') }}&quot;">{{ $page->meta_keywords ?? old('meta_keywords') }}</textarea>
<span class="control-error" v-if="errors.has('meta_keywords')">@{{ errors.first('meta_keywords') }}</span>
</div>
<span class="control-error" v-if="errors.has('meta_keywords')">@{{ errors.first('meta_keywords') }}</span>
</div>
<div class="control-group" :class="[errors.has('meta_description') ? 'has-error' : '']">
<label for="meta_description">{{ __('admin::app.cms.pages.meta_description') }}</label>
<div class="control-group" :class="[errors.has('meta_description') ? 'has-error' : '']">
<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>
<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>
<span class="control-error" v-if="errors.has('meta_description')">@{{ errors.first('meta_description') }}</span>
</div>
<span class="control-error" v-if="errors.has('meta_description')">@{{ errors.first('meta_description') }}</span>
</div>
</div>
</accordian>
</div>
</div>
</form>

View File

@ -100,6 +100,10 @@
<input type="password" v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" value="{{ old($name) ?: core()->getConfigData($name) }}" data-vv-as="&quot;{{ trans($field['title']) }}&quot;">
@elseif ($field['type'] == 'color')
<input type="color" v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $thirdField }}][{{ $field['name'] }}]" value="{{ old($name) ?: core()->getConfigData($name) }}" data-vv-as="&quot;{{ trans($field['title']) }}&quot;">
@elseif ($field['type'] == 'textarea')
@ -128,6 +132,10 @@
$value = null;
} else {
$value = $option['value'];
if (! $value) {
$value = 0;
}
}
?>
@ -162,6 +170,10 @@
$value = null;
} else {
$value = $option['value'];
if (! $value) {
$value = 0;
}
}
?>

View File

@ -19,7 +19,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.customers.customers.save-btn-title') }}
</button>

View File

@ -19,7 +19,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.customers.customers.save-btn-title') }}
</button>

View File

@ -24,7 +24,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.promotion.save-btn-title') }}
</button>
@ -90,7 +90,7 @@
<div class="control-group" :class="[errors.has('channels[]') ? 'has-error' : '']">
<label for="channels" class="required">{{ __('admin::app.promotion.general-info.channels') }}</label>
<select type="text" class="control" name="channels[]" v-model="channels" v-validate="'required'" value="{{ old('channels') }}" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.channels-req') }}&quot;" multiple="multiple">
<select type="text" class="control" name="channels[]" v-model="channels" v-validate="'required'" value="{{ old('channels[]') }}" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.channels-req') }}&quot;" multiple="multiple">
<option disabled="disabled">{{ __('admin::app.promotion.select-attribute', ['attribute' => 'Channels']) }}</option>
@foreach(app('Webkul\Core\Repositories\ChannelRepository')->all() as $channel)
<option value="{{ $channel->id }}">{{ $channel->name }}</option>
@ -104,7 +104,6 @@
<label for="status" class="required">{{ __('admin::app.promotion.general-info.status') }}</label>
<select type="text" class="control" name="status" v-model="status" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.status') }}&quot;">
<option disabled="disabled">{{ __('admin::app.promotion.select-attribtue', ['attribute' => 'Status']) }}</option>
<option value="1">Yes</option>
<option value="0">No</option>
</select>
@ -248,7 +247,7 @@
<div class="control-group" :class="[errors.has('disc_amount') ? 'has-error' : '']">
<label for="disc_amount" class="required">{{ __('admin::app.promotion.general-info.disc_amt') }}</label>
<input type="number" step="0.5000" class="control" name="disc_amount" v-model="disc_amount" v-validate="'required|min_value:0.0001'" value="{{ old('disc_amount') }}" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.disc_amt') }}&quot;">
<input type="number" step="0.0001" class="control" name="disc_amount" v-model="disc_amount" v-validate="'required|min_value:0.0001'" value="{{ old('disc_amount') }}" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.disc_amt') }}&quot;">
<span class="control-error" v-if="errors.has('disc_amount')">@{{ errors.first('disc_amount') }}</span>
</div>
@ -598,12 +597,12 @@
},
onSubmit: function (e) {
if (this.attribute_values.length > 0 || this.category_values.length > 0) {
if (this.attribute_values != null || this.category_values != null) {
for (i in this.attribute_values) {
delete this.attribute_values[i].options;
}
if (this.category_values.length > 0) {
if (this.category_values != null) {
this.all_attributes.categories = this.category_values;
}

View File

@ -24,7 +24,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.promotion.save') }}
</button>
@ -106,7 +106,7 @@
<label for="status" class="required">{{ __('admin::app.promotion.general-info.status') }}</label>
<select type="text" class="control" name="status" v-model="status" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.status') }}&quot;">
<option disabled="disabled">{{ __('admin::app.promotion.select-attribute', ['attribute' => 'Status']) }}</option>
{{-- <option disabled="disabled">{{ __('admin::app.promotion.select-attribute', ['attribute' => 'Status']) }}</option> --}}
<option value="1">{{ __('admin::app.promotion.yes') }}</option>
<option value="0">{{ __('admin::app.promotion.no') }}</option>
</select>
@ -254,7 +254,7 @@
<div class="control-group" :class="[errors.has('disc_amount') ? 'has-error' : '']">
<label for="disc_amount" class="required">{{ __('admin::app.promotion.general-info.disc_amt') }}</label>
<input type="number" step="0.5000" class="control" name="disc_amount" v-model="disc_amount" v-validate="'required|decimal|min_value:0.0001'" value="{{ old('disc_amount') }}" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.disc_amt') }}&quot;">
<input type="number" step="0.0001" class="control" name="disc_amount" v-model="disc_amount" v-validate="'required|decimal|min_value:0.0001'" value="{{ old('disc_amount') }}" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.disc_amt') }}&quot;">
<span class="control-error" v-if="errors.has('disc_amount')">@{{ errors.first('disc_amount') }}</span>
</div>
@ -505,23 +505,33 @@
mounted () {
data = @json($cart_rule[3]);
this.name = data.name;
this.description = data.description;
this.conditions_list = [];
this.channels = [];
for (i in data.channels) {
this.channels.push(data.channels[i].channel_id);
}
this.customer_groups = data.customer_groups;
for (i in data.customer_groups) {
this.customer_groups.push(data.customer_groups[i].customer_group_id);
}
this.ends_till = data.ends_till;
this.starts_from = data.starts_from;
this.priority = data.priority;
this.per_customer = data.per_customer;
this.status = data.status;
if (data.use_coupon == 0) {
// this.auto_generation = null;
this.use_coupon = 0;
@ -539,24 +549,36 @@
}
this.usage_limit = data.usage_limit;
this.is_guest = data.is_guest;
this.action_type = data.action_type;
this.apply = null;
this.apply_amt = false;
this.apply_prct = false;
this.apply_to_shipping = data.apply_to_shipping;
this.disc_amount = data.disc_amount;
// this.disc_threshold = data.disc_threshold;
this.disc_quantity = data.disc_quantity;
this.end_other_rules = data.end_other_rules;
this.coupon_type = data.coupon_type;
this.free_shipping = data.free_shipping;
this.all_conditions = null;
if (data.conditions != null) {
this.conditions_list = JSON.parse(JSON.parse(data.conditions));
this.match_criteria = this.conditions_list.pop().criteria;
}
@ -565,6 +587,16 @@
this.attribute_values = JSON.parse(JSON.parse(data.actions).attribute_conditions).attributes;
if (this.category_values == null) {
this.category_values = [];
}
if (this.attribute_values == null) {
this.attribute_values = [];
}
console.log(this.category_values);
// creating options and has option param on the frontend
for (i in this.attribute_values) {
for (j in this.attribute_input) {
@ -684,14 +716,12 @@
},
onSubmit: function (e) {
if (this.attribute_values.length != 0 || this.category_values.length != 0) {
if (this.attribute_values != null || this.category_values != null) {
for (i in this.attribute_values) {
delete this.attribute_values[i].options;
}
if (this.category_values != null && this.category_values.length > 0) {
this.all_attributes.categories = this.category_values;
}
this.all_attributes.categories = this.category_values;
this.all_attributes.attributes = this.attribute_values;
@ -700,10 +730,12 @@
this.all_attributes = null;
}
if (this.conditions_list.length != 0) {
if (this.conditions_list != null) {
this.conditions_list.push({'criteria': this.match_criteria});
this.all_conditions = JSON.stringify(this.conditions_list);
this.conditions_list.pop();
}
this.$validator.validateAll().then(result => {

View File

@ -24,7 +24,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.promotion.save-btn-title') }}
</button>
@ -46,7 +46,7 @@
</div>
<div class="control-group" :class="[errors.has('description') ? 'has-error' : '']">
<label for="description">{{ __('admin::app.promotion.general-info.description') }}</label>
<label for="description" class="required">{{ __('admin::app.promotion.general-info.description') }}</label>
<textarea class="control" name="description" v-model="description" v-validate="'required'" value="{{ old('description') }}" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.description') }}&quot;"></textarea>
@ -93,7 +93,7 @@
<datetime :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>
<label for="starts_from">{{ __('admin::app.promotion.general-info.starts-from') }}</label>
<input type="text" class="control" v-model="starts_from" name="starts_from" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.starts-from') }}&quot;">
@ -103,7 +103,7 @@
<datetime :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>
<label for="ends_till">{{ __('admin::app.promotion.general-info.ends-till') }}</label>
<input type="text" class="control" v-model="ends_till" name="ends_till" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.ends-till') }}&quot;">
@ -260,7 +260,6 @@
},
mounted () {
console.log(this.attribute_input);
},
methods: {

View File

@ -24,7 +24,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.promotion.edit-btn-title') }}
</button>
@ -46,7 +46,7 @@
</div>
<div class="control-group" :class="[errors.has('description') ? 'has-error' : '']">
<label for="description">{{ __('admin::app.promotion.general-info.description') }}</label>
<label for="description" class="required">{{ __('admin::app.promotion.general-info.description') }}</label>
<textarea class="control" name="description" v-model="description" v-validate="'required'" value="{{ old('description') }}" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.description') }}&quot;"></textarea>
@ -97,7 +97,7 @@
<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>
<label for="starts_from">{{ __('admin::app.promotion.general-info.starts-from') }}</label>
<input type="text" class="control" v-model="starts_from" name="starts_from" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.starts-from') }}&quot;">
@ -107,7 +107,7 @@
<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>
<label for="ends_till">{{ __('admin::app.promotion.general-info.ends-till') }}</label>
<input type="text" class="control" v-model="ends_till" name="ends_till" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.ends-till') }}&quot;">
@ -229,7 +229,7 @@
actions: @json($catalog_rule[3]).actions,
action_type: '{{ $catalog_rule[5]->action_code }}',
disc_amount: '{{ $catalog_rule[5]->disc_amount }}',
disc_amount: null,
end_other_rules: '{{ $catalog_rule[5]->end_other_rules }}',
all_conditions: [],
@ -256,7 +256,7 @@
},
mounted () {
console.log(this.conditions)
catalog_rule = @json($catalog_rule[5]);
channels = @json($catalog_rule[5]->channels);
this.channels = [];
@ -295,9 +295,9 @@
}
}
this.action_type = '{{ $catalog_rule[5]->action_code }}',
this.disc_amount = '{{ $catalog_rule[5]->discount_amount }}',
this.end_other_rules = '{{ $catalog_rule[5]->end_other_rules }}'
this.action_type = '{{ $catalog_rule[5]->action_code }}';
this.disc_amount = catalog_rule.discount_amount;
this.end_other_rules = '{{ $catalog_rule[5]->end_other_rules }}';
},
methods: {
@ -342,8 +342,6 @@
}
this.attribute_values[index].type = this.attribute_input[i].type;
debugger
}
}
},
@ -367,12 +365,12 @@
},
onSubmit: function (e) {
if (this.attribute_values.length > 0 || this.category_values.length > 0) {
if (this.attribute_values != null || this.category_values != null) {
for (i in this.attribute_values) {
delete this.attribute_values[i].options;
}
if (this.category_values.length > 0) {
if (this.category_values != null) {
this.all_attributes.categories = this.category_values;
}

View File

@ -18,7 +18,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.invoices.save-btn-title') }}
</button>

View File

@ -18,7 +18,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.shipments.save-btn-title') }}
</button>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.channels.save-btn-title') }}
</button>
@ -28,6 +28,8 @@
<div class="form-container">
@csrf()
{!! view_render_event('bagisto.admin.settings.channel.create.before') !!}
<accordian :title="'{{ __('admin::app.settings.channels.general') }}'" :active="true">
<div slot="body">
@ -172,6 +174,33 @@
</div>
</accordian>
<accordian :title="'{{ __('admin::app.settings.channels.seo') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('seo_title') ? 'has-error' : '']">
<label for="seo_title" class="required">{{ __('admin::app.settings.channels.seo-title') }}</label>
<input v-validate="'required'" class="control" id="seo_title" name="seo_title" data-vv-as="&quot;{{ __('admin::app.settings.channels.seo-title') }}&quot;" value="{{ old('seo_title') }}"/>
<span class="control-error" v-if="errors.has('seo_title')">@{{ errors.first('seo_title') }}</span>
</div>
<div class="control-group" :class="[errors.has('seo_description') ? 'has-error' : '']">
<label for="seo_description" class="required">{{ __('admin::app.settings.channels.seo-description') }}</label>
<textarea v-validate="'required'" class="control" id="seo_description" name="seo_description" data-vv-as="&quot;{{ __('admin::app.settings.channels.seo-description') }}&quot;" value="{{ old('seo_description') }}"></textarea>
<span class="control-error" v-if="errors.has('seo_description')">@{{ errors.first('seo_description') }}</span>
</div>
<div class="control-group" :class="[errors.has('seo_keywords') ? 'has-error' : '']">
<label for="seo_keywords" class="required">{{ __('admin::app.settings.channels.seo-keywords') }}</label>
<textarea v-validate="'required'" class="control" id="seo_keywords" name="seo_keywords" data-vv-as="&quot;{{ __('admin::app.settings.channels.seo-keywords') }}&quot;" value="{{ old('seo_keywords') }}"></textarea>
<span class="control-error" v-if="errors.has('seo_keywords')">@{{ errors.first('seo_keywords') }}</span>
</div>
</div>
</accordian>
{!! view_render_event('bagisto.admin.settings.channel.create.after') !!}
</div>
</div>
</form>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.channels.save-btn-title') }}
</button>
@ -29,6 +29,8 @@
@csrf()
<input name="_method" type="hidden" value="PUT">
{!! view_render_event('bagisto.admin.settings.channel.edit.before') !!}
<accordian :title="'{{ __('admin::app.settings.channels.general') }}'" :active="true">
<div slot="body">
@ -183,6 +185,37 @@
</div>
</accordian>
@php
$seo = json_decode($channel->home_seo);
@endphp
<accordian :title="'{{ __('admin::app.settings.channels.seo') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('seo_title') ? 'has-error' : '']">
<label for="seo_title" class="required">{{ __('admin::app.settings.channels.seo-title') }}</label>
<input v-validate="'required'" class="control" id="seo_title" name="seo_title" data-vv-as="&quot;{{ __('admin::app.settings.channels.seo-title') }}&quot;" value="{{ $seo->meta_title ?? old('seo_title') }}"/>
<span class="control-error" v-if="errors.has('seo_title')">@{{ errors.first('seo_title') }}</span>
</div>
<div class="control-group" :class="[errors.has('seo_description') ? 'has-error' : '']">
<label for="seo_description" class="required">{{ __('admin::app.settings.channels.seo-description') }}</label>
<textarea v-validate="'required'" class="control" id="seo_description" name="seo_description" data-vv-as="&quot;{{ __('admin::app.settings.channels.seo-description') }}&quot;">{{ $seo->meta_description ?? old('seo_description') }}</textarea>
<span class="control-error" v-if="errors.has('seo_description')">@{{ errors.first('seo_description') }}</span>
</div>
<div class="control-group" :class="[errors.has('seo_keywords') ? 'has-error' : '']">
<label for="seo_keywords" class="required">{{ __('admin::app.settings.channels.seo-keywords') }}</label>
<textarea v-validate="'required'" class="control" id="seo_keywords" name="seo_keywords" data-vv-as="&quot;{{ __('admin::app.settings.channels.seo-keywords') }}&quot;">{{ $seo->meta_keywords ?? old('seo_keywords') }}</textarea>
<span class="control-error" v-if="errors.has('seo_keywords')">@{{ errors.first('seo_keywords') }}</span>
</div>
</div>
</accordian>
{!! view_render_event('bagisto.admin.settings.channel.edit.after') !!}
</div>
</div>
</form>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.currencies.save-btn-title') }}
</button>
@ -28,8 +28,11 @@
<div class="form-container">
@csrf()
{!! view_render_event('bagisto.admin.settings.currencies.create.before') !!}
<accordian :title="'{{ __('admin::app.settings.currencies.general') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
<label for="code" class="required">{{ __('admin::app.settings.currencies.code') }}</label>
<input v-validate="'required|min:3|max:3'" class="control" id="code" name="code" value="{{ old('code') }}" data-vv-as="&quot;{{ __('admin::app.settings.currencies.code') }}&quot;" style="text-transform:uppercase" v-code/>
@ -49,6 +52,7 @@
</div>
</accordian>
{!! view_render_event('bagisto.admin.settings.currencies.create.after') !!}
</div>
</div>
</form>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.currencies.save-btn-title') }}
</button>
@ -29,6 +29,8 @@
@csrf()
<input name="_method" type="hidden" value="PUT">
{!! view_render_event('bagisto.admin.settings.currencies.edit.before') !!}
<accordian :title="'{{ __('admin::app.settings.currencies.general') }}'" :active="true">
<div slot="body">
@ -52,6 +54,7 @@
</div>
</accordian>
{!! view_render_event('bagisto.admin.settings.currencies.edit.after') !!}
</div>
</div>
</form>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.exchange_rates.save-btn-title') }}
</button>
@ -46,6 +46,8 @@
<tbody>
<tr>
{!! view_render_event('bagisto.admin.settings.exchangerate.create.before') !!}
<td>
{{ core()->getBaseCurrencyCode() }}
</td>
@ -69,6 +71,8 @@
<span class="control-error" v-if="errors.has('rate')">@{{ errors.first('rate') }}</span>
</div>
</td>
{!! view_render_event('bagisto.admin.settings.exchangerate.create.after') !!}
</tr>
</tbody>
</table>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.exchange_rates.save-btn-title') }}
</button>
@ -47,6 +47,8 @@
<tbody>
<tr>
{!! view_render_event('bagisto.admin.settings.exchangerate.edit.before') !!}
<td>
{{ core()->getBaseCurrencyCode() }}
</td>
@ -70,6 +72,8 @@
<span class="control-error" v-if="errors.has('rate')">@{{ errors.first('rate') }}</span>
</div>
</td>
{!! view_render_event('bagisto.admin.settings.exchangerate.edit.after') !!}
<tr>
</tbody>
</table>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.inventory_sources.save-btn-title') }}
</button>
@ -28,6 +28,8 @@
<div class="form-container">
@csrf()
{!! view_render_event('bagisto.admin.settings.inventory.create.before') !!}
<accordian :title="'{{ __('admin::app.settings.inventory_sources.general') }}'" :active="true">
<div slot="body">
@ -130,6 +132,7 @@
</div>
</accordian>
{!! view_render_event('bagisto.admin.settings.inventory.create.after') !!}
</div>
</div>
</form>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.inventory_sources.save-btn-title') }}
</button>
@ -27,6 +27,9 @@
<div class="page-content">
<div class="form-container">
@csrf()
{!! view_render_event('bagisto.admin.settings.inventory.edit.before') !!}
<input name="_method" type="hidden" value="PUT">
<accordian :title="'{{ __('admin::app.settings.inventory_sources.general') }}'" :active="true">
@ -131,6 +134,7 @@
</div>
</accordian>
{!! view_render_event('bagisto.admin.settings.inventory.edit.after') !!}
</div>
</div>
</form>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.locales.save-btn-title') }}
</button>
@ -28,6 +28,8 @@
<div class="form-container">
@csrf()
{!! view_render_event('bagisto.admin.settings.locale.create.before') !!}
<accordian :title="'{{ __('admin::app.settings.locales.general') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
@ -50,6 +52,8 @@
</select>
<span class="control-error" v-if="errors.has('direction')">@{{ errors.first('direction') }}</span>
</div>
{!! view_render_event('bagisto.admin.settings.locale.create.after') !!}
</div>
</accordian>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.locales.save-btn-title') }}
</button>
@ -27,6 +27,9 @@
<div class="page-content">
<div class="form-container">
@csrf()
{!! view_render_event('bagisto.admin.settings.locale.edit.before') !!}
<input name="_method" type="hidden" value="PUT">
<accordian :title="'{{ __('admin::app.settings.locales.general') }}'" :active="true">
@ -53,9 +56,11 @@
</select>
<span class="control-error" v-if="errors.has('direction')">@{{ errors.first('direction') }}</span>
</div>
</div>
</accordian>
{!! view_render_event('bagisto.admin.settings.locale.edit.after') !!}
</div>
</div>
</form>

View File

@ -16,7 +16,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.sliders.save-btn-title') }}
</button>
@ -26,6 +26,9 @@
<div class="page-content">
<div class="form-container">
@csrf()
{!! view_render_event('bagisto.admin.settings.slider.create.before') !!}
<div class="control-group" :class="[errors.has('title') ? 'has-error' : '']">
<label for="title" class="required">{{ __('admin::app.settings.sliders.title') }}</label>
<input type="text" class="control" name="title" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.settings.sliders.title') }}&quot;">
@ -46,7 +49,7 @@
</div>
<div class="control-group {!! $errors->has('image.*') ? 'has-error' : '' !!}">
<label>{{ __('admin::app.catalog.categories.image') }}
<label class="required">{{ __('admin::app.catalog.categories.image') }}</label>
<image-wrapper :button-label="'{{ __('admin::app.settings.sliders.image') }}'" input-name="image" :multiple="false"></image-wrapper>
@ -64,6 +67,8 @@
<span class="control-error" v-if="errors.has('content')">@{{ errors.first('content') }}</span>
</div>
{!! view_render_event('bagisto.admin.settings.slider.create.after') !!}
</div>
</div>
</form>

View File

@ -16,7 +16,7 @@
</h1>
</div>
<div class="page-action fixed-action">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.sliders.save-btn-title') }}
</button>
@ -28,6 +28,8 @@
@csrf()
{!! view_render_event('bagisto.admin.settings.slider.edit.before') !!}
<div class="control-group" :class="[errors.has('title') ? 'has-error' : '']">
<label for="title" class="required">{{ __('admin::app.settings.sliders.title') }}</label>
<input type="text" class="control" name="title" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.settings.sliders.title') }}&quot;" value="{{ $slider->title ?: old('title') }}">
@ -48,7 +50,7 @@
</div>
<div class="control-group {!! $errors->has('image.*') ? 'has-error' : '' !!}">
<label>{{ __('admin::app.catalog.categories.image') }}
<label class="required">{{ __('admin::app.catalog.categories.image') }}</label>
<image-wrapper :button-label="'{{ __('admin::app.settings.sliders.image') }}'" input-name="image" :multiple="false" :images='"{{ url('storage/'.$slider->path) }}"' ></image-wrapper>
@ -69,6 +71,7 @@
<span class="control-error" v-if="errors.has('content')">@{{ errors.first('content') }}</span>
</div>
{!! view_render_event('bagisto.admin.settings.slider.edit.after', ['slider' => $slider]) !!}
</div>
</div>
</form>

View File

@ -16,7 +16,7 @@
</h1>
</div>
<div class="page-action fixed-action-slight">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.tax-categories.save-btn-title') }}
</button>

View File

@ -16,7 +16,7 @@
</h1>
</div>
<div class="page-action fixed-action-slight">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.tax-categories.save-btn-title') }}
</button>

View File

@ -16,7 +16,7 @@
</h1>
</div>
<div class="page-action fixed-action-slight">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.tax-rates.save-btn-title') }}
</button>

View File

@ -16,7 +16,7 @@
</h1>
</div>
<div class="page-action fixed-action-slight">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.tax-rates.edit-title') }}
</button>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action-slight">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.users.roles.save-btn-title') }}
</button>

View File

@ -17,7 +17,7 @@
</h1>
</div>
<div class="page-action fixed-action-slight">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.users.roles.save-btn-title') }}
</button>

View File

@ -16,7 +16,7 @@
</h1>
</div>
<div class="page-action fixed-action-slight">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.users.users.save-btn-title') }}
</button>

View File

@ -16,7 +16,7 @@
</h1>
</div>
<div class="page-action fixed-action-slight">
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.users.users.save-btn-title') }}
</button>

View File

@ -60,7 +60,7 @@ class AttributeTableSeeder extends Seeder
'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',
['id' => '25','code' => 'brand','admin_name' => 'Brand','type' => 'select','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]
]);

View File

@ -0,0 +1,114 @@
<?php
namespace Webkul\CMS\Database\Seeders;
use Illuminate\Database\Seeder;
use DB;
class CMSPagesTableSeeder extends Seeder
{
public function run()
{
DB::table('cms_pages')->delete();
DB::table('cms_pages')->insert([
[
'id' => '1',
'url_key' => 'about-us',
'html_content' => '<div class="static-container one-column">
<div class="mb-5">About us page content</div>
</div>',
'page_title' => 'About Us',
'meta_title' => 'about us',
'meta_description' => '',
'meta_keywords' => 'aboutus',
'content' => '{"html": "<div class=\"static-container one-column\">\r\n<div class=\"mb-5\">About us page content</div>\r\n</div>",
"meta_title": "about us",
"page_title": "About Us",
"meta_keywords": "aboutus ", "meta_description": ""}',
'channel_id' => 1,
'locale_id' => 1
], [
'id' => '2',
'url_key' => 'return-policy',
'html_content' => '<div class="static-container one-column">
<div class="mb-5">Return policy page content</div>
</div>',
'page_title' => 'Return Policy',
'meta_title' => 'return policy',
'meta_description' => '',
'meta_keywords' => 'return, policy',
'content' => '{"html": "<div class=\"static-container one-column\">\r\n<div class=\"mb-5\">Return policy page content</div>\r\n</div>",
"meta_title": "return policy",
"page_title": "Return Policy",
"meta_keywords": "return, policy ", "meta_description": ""}',
'channel_id' => 1,
'locale_id' => 1
], [
'id' => '3',
'url_key' => 'refund-policy',
'html_content' => '<div class="static-container one-column">
<div class="mb-5">Refund policy page content</div>
</div>',
'page_title' => 'Refund Policy',
'meta_title' => 'Refund policy',
'meta_description' => '',
'meta_keywords' => 'refund, policy',
'content' => '{"html": "<div class=\"static-container one-column\">\r\n<div class=\"mb-5\">Refund policy page content</div>\r\n</div>",
"meta_title": "Refund policy",
"page_title": "Refund Policy",
"meta_keywords": "refund,policy ", "meta_description": ""}',
'channel_id' => 1,
'locale_id' => 1
], [
'id' => '4',
'url_key' => 'terms-conditions',
'html_content' => '<div class="static-container one-column">
<div class="mb-5">Terms & conditions page content</div>
</div>',
'page_title' => 'Terms & Conditions',
'meta_title' => 'Terms & Conditions',
'meta_description' => '',
'meta_keywords' => 'term, conditions',
'content' => '{"html": "<div class=\"static-container one-column\">\r\n<div class=\"mb-5\">Terms & conditions page content</div>\r\n</div>",
"meta_title": "Terms & Conditions",
"page_title": "Terms & Conditions",
"meta_keywords": "terms, conditions ", "meta_description": ""}',
'channel_id' => 1,
'locale_id' => 1
], [
'id' => '5',
'url_key' => 'terms-of-use',
'html_content' => '<div class="static-container one-column">
<div class="mb-5">Terms of use page content</div>
</div>',
'page_title' => 'Terms of use',
'meta_title' => 'Terms of use',
'meta_description' => '',
'meta_keywords' => 'term, use',
'content' => '{"html": "<div class=\"static-container one-column\">\r\n<div class=\"mb-5\">Terms of use page content</div>\r\n</div>",
"meta_title": "Terms of use",
"page_title": "Terms of use",
"meta_keywords": "terms, use ", "meta_description": ""}',
'channel_id' => 1,
'locale_id' => 1
], [
'id' => '6',
'url_key' => 'contact-us',
'html_content' => '<div class="static-container one-column">
<div class="mb-5">Contact us page content</div>
</div>',
'page_title' => 'Contact Us',
'meta_title' => 'Contact Us',
'meta_description' => '',
'meta_keywords' => 'contact, us',
'content' => '{"html": "<div class=\"static-container one-column\">\r\n<div class=\"mb-5\">Contact us page content</div>\r\n</div>",
"meta_title": "Contact Us",
"page_title": "Contact Us",
"meta_keywords": "contact, us ", "meta_description": ""}',
'channel_id' => 1,
'locale_id' => 1
]
]);
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace Webkul\CMS\Database\Seeders;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call(CMSPagesTableSeeder::class);
}
}

View File

@ -85,10 +85,19 @@ use Webkul\Core\Repositories\LocaleRepository as Locale;
*/
public function store()
{
$data = request()->all();
// part one of the validation in case partials pages were generated or generating partial pages
$this->validate(request(), [
'channels' => 'required',
'locales' => 'required',
'url_key' => 'required|unique:cms_pages,url_key',
'url_key' => 'required'
]);
$channels = $data['channels'];
$locales = $data['locales'];
$this->validate(request(), [
'html_content' => 'required|string',
'page_title' => 'required|string',
'meta_title' => 'required|string',
@ -96,32 +105,49 @@ use Webkul\Core\Repositories\LocaleRepository as Locale;
'meta_keywords' => 'required|string'
]);
$data = request()->all();
$data['content']['html'] = $data['html_content'];
$data['content']['page_title'] = $data['page_title'];
$data['content']['meta_keywords'] = $data['meta_keywords'];
$data['content']['meta_title'] = $data['meta_title'];
$data['content']['meta_description'] = $data['meta_description'];
$data['content'] = json_encode($data['content']);
$totalCount = 0;
$actualCount = 0;
foreach ($channels as $channel) {
foreach ($locales as $locale) {
$pageFound = $this->cms->findOneWhere([
'channel_id' => $channel,
'locale_id' => $locale,
'url_key' => $data['url_key']
]);
$totalCount++;
foreach ($data['channels'] as $channel) {
foreach ($data['locales'] as $locale) {
$data['channel_id'] = $channel;
$data['locale_id'] = $locale;
$data['content']['html'] = $data['html_content'];
$data['content']['page_title'] = $data['page_title'];
$data['content']['meta_keywords'] = $data['meta_keywords'];
$data['content']['meta_title'] = $data['meta_title'];
$data['content']['meta_description'] = $data['meta_description'];
if (! $pageFound) {
$result = $this->cms->create($data);
$data['content'] = json_encode($data['content']);
if ($result) {
$actualCount++;
}
}
$result = $this->cms->create($data);
unset($data['content']);
unset($pageFound);
}
}
if ($result) {
if (($actualCount != 0 && $totalCount != 0) && ($actualCount == $totalCount)) {
session()->flash('success', trans('admin::app.cms.pages.create-success'));
} else if (($actualCount != 0 && $totalCount != 0) && ($actualCount != $totalCount)) {
session()->flash('warning', trans('admin::app.cms.pages.create-partial'));
} else {
session()->flash('success', trans('admin::app.cms.pages.create-failure'));
session()->flash('error', trans('admin::app.cms.pages.create-failure'));
}
return redirect()->route($this->_config['redirect']);

View File

@ -20,5 +20,6 @@ return [
\Webkul\Tax\Providers\ModuleServiceProvider::class,
\Webkul\User\Providers\ModuleServiceProvider::class,
\Webkul\Discount\Providers\ModuleServiceProvider::class,
\Webkul\CMS\Providers\ModuleServiceProvider::class
]
];

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddSeoColumnInChannelsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('channels', function (Blueprint $table) {
$table->json('home_seo')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('channels', function (Blueprint $table) {
$table->dropColumn('home_seo');
});
}
}

View File

@ -17,7 +17,7 @@ class ChannelTableSeeder extends Seeder
'name' => 'Default',
'root_category_id' => 1,
'home_page_content' => '<p>@include("shop::home.slider") @include("shop::home.featured-products") @include("shop::home.new-products")</p><div class="banner-container"><div class="left-banner"><img src="https://s3-ap-southeast-1.amazonaws.com/cdn.uvdesk.com/website/1/201902045c581f9494b8a1.png" /></div><div class="right-banner"><img src="https://s3-ap-southeast-1.amazonaws.com/cdn.uvdesk.com/website/1/201902045c581fb045cf02.png" /> <img src="https://s3-ap-southeast-1.amazonaws.com/cdn.uvdesk.com/website/1/201902045c581fc352d803.png" /></div></div>',
'footer_content' => '<div class="list-container"><span class="list-heading">Quick Links</span><ul class="list-group"><li><a href="#">About Us</a></li><li><a href="#">Return Policy</a></li><li><a href="#">Refund Policy</a></li><li><a href="#">Terms and conditions</a></li><li><a href="#">Terms of Use</a></li><li><a href="#">Contact Us</a></li></ul></div><div class="list-container"><span class="list-heading">Connect With Us</span><ul class="list-group"><li><a href="#"><span class="icon icon-facebook"></span>Facebook </a></li><li><a href="#"><span class="icon icon-twitter"></span> Twitter </a></li><li><a href="#"><span class="icon icon-instagram"></span> Instagram </a></li><li><a href="#"> <span class="icon icon-google-plus"></span>Google+ </a></li><li><a href="#"> <span class="icon icon-linkedin"></span>LinkedIn </a></li></ul></div>',
'footer_content' => '<div class="list-container"><span class="list-heading">Quick Links</span><ul class="list-group"><li><a href="@php echo route("shop.cms.page", "about-us") @endphp">About Us</a></li><li><a href="@php echo route("shop.cms.page", "return-policy") @endphp">Return Policy</a></li><li><a href="@php echo route("shop.cms.page", "refund-policy") @endphp">Refund Policy</a></li><li><a href="@php echo route("shop.cms.page", "terms-conditions") @endphp">Terms and conditions</a></li><li><a href="@php echo route("shop.cms.page", "terms-of-use") @endphp">Terms of Use</a></li><li><a href="@php echo route("shop.cms.page", "contact-us") @endphp">Contact Us</a></li></ul></div><div class="list-container"><span class="list-heading">Connect With Us</span><ul class="list-group"><li><a href="#"><span class="icon icon-facebook"></span>Facebook </a></li><li><a href="#"><span class="icon icon-twitter"></span> Twitter </a></li><li><a href="#"><span class="icon icon-instagram"></span> Instagram </a></li><li><a href="#"> <span class="icon icon-google-plus"></span>Google+ </a></li><li><a href="#"> <span class="icon icon-linkedin"></span>LinkedIn </a></li></ul></div>',
'name' => 'Default',
'default_locale_id' => 1,
'base_currency_id' => 1
@ -27,7 +27,7 @@ class ChannelTableSeeder extends Seeder
'channel_id' => 1,
'currency_id' => 1,
]);
DB::table('channel_locales')->insert([
'channel_id' => 1,
'locale_id' => 1,

View File

@ -26,7 +26,7 @@ abstract class Repository extends BaseRepository {
public function findOneByField($field, $value = null, $columns = ['*'])
{
$model = parent::findByField($field, $value, $columns = ['*']);
return $model->first();
}
@ -42,7 +42,7 @@ abstract class Repository extends BaseRepository {
public function findOneWhere(array $where, $columns = ['*'])
{
$model = parent::findWhere($where, $columns);
return $model->first();
}

View File

@ -76,12 +76,29 @@ class ChannelController extends Controller
'base_currency_id' => 'required',
'root_category_id' => 'required',
'logo.*' => 'mimes:jpeg,jpg,bmp,png',
'favicon.*' => 'mimes:jpeg,jpg,bmp,png'
'favicon.*' => 'mimes:jpeg,jpg,bmp,png',
'seo_title' => 'required|string',
'seo_description' => 'required|string',
'seo_keywords' => 'required|string'
]);
$data = request()->all();
$data['seo']['meta_title'] = $data['seo_title'];
$data['seo']['meta_description'] = $data['seo_description'];
$data['seo']['meta_keywords'] = $data['seo_keywords'];
unset($data['seo_title']);
unset($data['seo_description']);
unset($data['seo_keywords']);
$data['home_seo'] = json_encode($data['seo']);
unset($data['seo']);
Event::fire('core.channel.create.before');
$channel = $this->channelRepository->create(request()->all());
$channel = $this->channelRepository->create($data);
Event::fire('core.channel.create.after', $channel);
@ -124,9 +141,25 @@ class ChannelController extends Controller
'favicon.*' => 'mimes:jpeg,jpg,bmp,png'
]);
$data = request()->all();
$data['seo']['meta_title'] = $data['seo_title'];
$data['seo']['meta_description'] = $data['seo_description'];
$data['seo']['meta_keywords'] = $data['seo_keywords'];
unset($data['seo_title']);
unset($data['seo_description']);
unset($data['seo_keywords']);
$data['home_seo'] = json_encode($data['seo']);
Event::fire('core.channel.update.before', $id);
<<<<<<< HEAD
$channel = $this->channelRepository->update(request()->all(), $id);
=======
$channel = $this->channel->update($data, $id);
>>>>>>> f9580b077a856af56b51d8ffbbff524557b317ee
Event::fire('core.channel.update.after', $channel);

View File

@ -7,8 +7,8 @@ use Webkul\Core\Repositories\SliderRepository;
/**
* Slider controller for managing the slider controls.
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class SliderController extends Controller
{

View File

@ -10,7 +10,7 @@ use Webkul\Core\Contracts\Channel as ChannelContract;
class Channel extends Model implements ChannelContract
{
protected $fillable = ['code', 'name', 'description', 'theme', 'home_page_content', 'footer_content', 'hostname', 'default_locale_id', 'base_currency_id', 'root_category_id'];
protected $fillable = ['code', 'name', 'description', 'theme', 'home_page_content', 'footer_content', 'hostname', 'default_locale_id', 'base_currency_id', 'root_category_id', 'home_seo'];
/**
* Get the channel locales.

View File

@ -8,9 +8,9 @@ use Webkul\Core\Repositories\ChannelRepository;
use Storage;
/**
* Slider Reposotory
* Slider Repository
*
* @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 SliderRepository extends Repository
@ -112,7 +112,7 @@ class SliderRepository extends Repository
if ($uploaded) {
$sliderItem = $this->find($id);
$deleted = Storage::delete($sliderItem->path);
Storage::delete($sliderItem->path);
$data['path'] = $uploaded;
} else {

View File

@ -12,6 +12,6 @@ return [
'remove-all-success' => 'All The Items From Your Wishlist Have Been Removed',
],
'reviews' => [
'empty' => 'You Have Not Reviewed Any Of Product Yet'
'empty' => 'You have not reviewed any of product yet'
]
];

View File

@ -13,37 +13,58 @@ class FixedAmount extends Action
$impact = collect();
$impact->discount = $rule->disc_amount;
$impact->formatted_discount = core()->currency($impact->discount);
$totalDiscount = 0;
if ($rule->uses_attribute_conditions) {
$productIDs = $rule->product_ids;
$productIDs = explode(',', $productIDs);
$matchCount = 0;
foreach ($productIDs as $productID) {
foreach ($items as $item) {
if ($item->product_id == $productID) {
$matchCount++;
$itemPrice = $item->base_price;
if ($item->product->type == 'configurable') {
$itemProductId = $item->child->product_id;
} else {
$itemProductId = $item->product_id;
}
}
}
if ($matchCount > 0) {
$discountPerItem = $impact->discount / $matchCount;
}
$itemQuantity = $item->quantity;
$discQuantity = $rule->disc_quantity;
if ($discQuantity > 1) {
if ($itemQuantity >= $discQuantity) {
if ($rule->disc_amount >= $itemPrice) {
$discount = round($itemPrice * $discQuantity, 4);
} else {
$discount = $rule->disc_amount;
}
} else if ($itemQuantity < $discQuantity) {
if ($rule->disc_amount >= $itemPrice) {
$discount = round($itemPrice * $discQuantity, 4);
} else {
$discount = $rule->disc_amount;
}
}
} else {
if ($rule->disc_amount >= $itemPrice) {
$discount = round($itemPrice * $discQuantity, 4);
} else {
$discount = $rule->disc_amount;
}
}
if ($itemProductId == $productID) {
$totalDiscount = $totalDiscount + $discount;
foreach ($productIDs as $productID) {
foreach ($items as $item) {
if ($item->product_id == $productID) {
$report = array();
$report['item_id'] = $item->id;
$report['product_id'] = $item->product_id;
$report['discount'] = round($discountPerItem, 4);
$report['formatted_discount'] = core()->currency(round($discountPerItem, 4));
$report['product_id'] = $item->child ? $item->child->product_id : $item->product_id;
$report['discount'] = $discount;
$report['formatted_discount'] = core()->currency($discount);
$impact->push($report);
@ -52,15 +73,49 @@ class FixedAmount extends Action
}
}
} else {
$discountPerItem = $impact->discount / $cart->items_qty;
foreach ($items as $item) {
$itemPrice = $item->base_price;
$itemQuantity = $item->quantity;
$discQuantity = $rule->disc_quantity;
if ($discQuantity > 1) {
if ($itemQuantity >= $discQuantity) {
if ($rule->disc_amount >= $itemPrice) {
$discount = round($itemPrice * $discQuantity, 4);
} else {
$discount = $rule->disc_amount;
}
} else if ($itemQuantity < $discQuantity) {
if ($rule->disc_amount >= $itemPrice) {
$discount = round($itemPrice * $discQuantity, 4);
} else {
$discount = $rule->disc_amount;
}
}
} else {
if ($rule->disc_amount >= $itemPrice) {
$discount = round($itemPrice * $discQuantity, 4);
} else {
$discount = $rule->disc_amount;
}
}
$totalDiscount = $totalDiscount + $discount;
$report = array();
$report['item_id'] = $item->id;
$report['product_id'] = $item->product_id;
$report['discount'] = round($discountPerItem, 4);
$report['formatted_discount'] = core()->currency(round($discountPerItem, 4));
$report['product_id'] = $item->child ? $item->child->product_id : $item->product_id;
if ($discount <= $itemPrice) {
$report['discount'] = $discount;
} else {
$report['discount'] = $itemPrice;
}
$report['formatted_discount'] = core()->currency($discount);
$impact->push($report);
@ -68,6 +123,10 @@ class FixedAmount extends Action
}
}
$impact->discount = $totalDiscount;
$impact->formatted_discount = core()->currency($impact->discount);
return $impact;
}
}

View File

@ -19,51 +19,24 @@ class PercentOfProduct extends Action
$impact->discount = $cart->base_sub_total;
$impact->formatted_discount = core()->currency($impact->discount);
} else {
if ($rule->uses_attribute_conditions) {
$productIDs = $rule->product_ids;
}
$productIDs = explode(',', $productIDs);
if ($rule->uses_attribute_conditions) {
$productIDs = $rule->product_ids;
$matchCount = 0;
$productIDs = explode(',', $productIDs);
foreach ($productIDs as $productID) {
foreach ($items as $item) {
if ($item->product_id == $productID) {
$matchCount++;
}
}
}
// $matchCount = 0;
foreach ($productIDs as $productID) {
foreach ($items as $item) {
$itemPrice = $item->base_price;
// foreach ($productIDs as $productID) {
// foreach ($items as $item) {
// if ($item->product_id == $productID) {
// $matchCount++;
// }
// }
// }
if ($item->product->type == 'configurable') {
$itemProductId = $item->child->product_id;
} else {
$itemProductId = $item->product_id;
}
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4);
if ($itemProductId == $productID) {
$totalDiscount = $totalDiscount + $discount;
$report = array();
$report['item_id'] = $item->id;
$report['product_id'] = $item->child ? $item->child->product_id : $item->product_id;
$report['discount'] = $discount;
$report['formatted_discount'] = core()->currency($discount);
$impact->push($report);
unset($report);
}
}
}
} else {
foreach ($productIDs as $productID) {
foreach ($items as $item) {
$itemPrice = $item->base_price;
@ -73,24 +46,100 @@ class PercentOfProduct extends Action
$itemProductId = $item->product_id;
}
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4);
$itemQuantity = $item->quantity;
$totalDiscount = $totalDiscount + $discount;
$discQuantity = $rule->disc_quantity;
$report = array();
if ($discQuantity > 1) {
if ($itemQuantity >= $discQuantity) {
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4) * $discQuantity;
$report['item_id'] = $item->id;
$report['product_id'] = $item->child ? $item->child->product_id : $item->product_id;
$report['discount'] = $discount;
$report['formatted_discount'] = core()->currency($discount);
if ($discount >= $itemPrice) {
$discount = $itemPrice;
}
} else if ($itemQuantity < $discQuantity) {
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4) * $itemQuantity;
$impact->push($report);
if ($discount >= $itemPrice) {
$discount = $itemPrice;
}
}
} else {
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4);
unset($report);
if ($discount >= $itemPrice) {
$discount = $itemPrice;
}
}
if ($itemProductId == $productID) {
$totalDiscount = $totalDiscount + $discount;
$report = array();
$report['item_id'] = $item->id;
$report['product_id'] = $item->child ? $item->child->product_id : $item->product_id;
$report['discount'] = $discount;
$report['formatted_discount'] = core()->currency($discount);
$impact->push($report);
unset($report);
}
}
}
} else {
foreach ($items as $item) {
$itemPrice = $item->base_price;
$itemQuantity = $item->quantity;
$discQuantity = $rule->disc_quantity;
if ($discQuantity > 1) {
if ($itemQuantity >= $discQuantity) {
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4) * $discQuantity;
if ($discount >= $itemPrice) {
$discount = $itemPrice;
}
} else if ($itemQuantity < $discQuantity) {
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4) * $itemQuantity;
if ($discount >= $itemPrice) {
$discount = $itemPrice;
}
}
} else {
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4);
if ($discount >= $itemPrice) {
$discount = $itemPrice;
}
}
$totalDiscount = $totalDiscount + $discount;
$report = array();
$report['item_id'] = $item->id;
$report['product_id'] = $item->child ? $item->child->product_id : $item->product_id;
if ($discount <= $itemPrice) {
$report['discount'] = $discount;
} else {
$report['discount'] = $itemPrice;
}
$report['formatted_discount'] = core()->currency($discount);
$impact->push($report);
unset($report);
}
}
$impact->discount = $totalDiscount;
$impact->formatted_discount = core()->currency($impact->discount);

View File

@ -23,13 +23,7 @@ class WholeCartToPercent extends Action
$impact = collect();
if ($rule->discount_amount >= 100) {
$impact->discount = $cart->base_sub_total;
} else {
$impact->discount = ($rule->disc_amount / 100) * $cart->base_sub_total;
}
$impact->formatted_discount = core()->currency($impact->discount);
$totalDiscount = 0;
if ($rule->uses_attribute_conditions) {
$productIDs = $rule->product_ids;
@ -47,35 +41,63 @@ class WholeCartToPercent extends Action
}
if ($matchCount > 0) {
$discountPerItem = $impact->discount / $matchCount;
}
foreach ($productIDs as $productID) {
foreach ($items as $item) {
$itemPrice = $item->base_price;
foreach ($productIDs as $productID) {
foreach ($items as $item) {
if ($item->product_id == $productID) {
$report = array();
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4);
$report['item_id'] = $item->id;
$report['product_id'] = $item->product_id;
$report['discount'] = round($discountPerItem, 4);
$report['formatted_discount'] = core()->currency(round($discountPerItem, 4));
if ($discount >= $itemPrice) {
$discount = $itemPrice;
}
$impact->push($report);
$totalDiscount = $totalDiscount + $discount;
unset($report);
if ($item->product_id == $productID) {
$report = array();
$report['item_id'] = $item->id;
$report['product_id'] = $item->child ? $item->child->product_id : $item->product_id;
if ($discount <= $itemPrice) {
$report['discount'] = $discount;
} else {
$report['discount'] = $itemPrice;
}
$report['formatted_discount'] = core()->currency(round($discount, 4));
$impact->push($report);
unset($report);
}
}
}
}
} else {
$discountPerItem = $impact->discount / $cart->items_qty;
foreach ($items as $item) {
$itemPrice = $item->base_price;
$discount = round(($itemPrice * $rule->disc_amount) / 100, 4);
if ($discount > $itemPrice) {
$discount = $itemPrice;
}
$totalDiscount = $totalDiscount + $discount;
$report = array();
$report['item_id'] = $item->id;
$report['product_id'] = $item->product_id;
$report['discount'] = round($discountPerItem, 4);
$report['formatted_discount'] = core()->currency(round($discountPerItem, 4));
$report['product_id'] = $item->child ? $item->child->product_id : $item->product_id;
if ($discount <= $itemPrice) {
$report['discount'] = $discount;
} else {
$report['discount'] = $itemPrice;
}
$report['formatted_discount'] = core()->currency(round($discount, 4));
$impact->push($report);
@ -83,6 +105,10 @@ class WholeCartToPercent extends Action
}
}
$impact->discount = $totalDiscount;
$impact->fomatted_discount = core()->currency($impact->discount);
return $impact;
}
}

View File

@ -1,72 +0,0 @@
<?php
namespace Webkul\Discount\Commands\Console;
use Illuminate\Console\Command;
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
class ActivateCatalogRule extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'bagisto:activate {param}';
/**
* The console command description.
*
* @var string
*/
protected $description;
/**
* To hold attribute repository instance
*/
protected $attribute;
/**
* Create a new command instance.
*
* @return void
*/
public function __construct(Attribute $attribute)
{
parent::__construct();
$this->attribute = $attribute;
$this->description = trans('admin::app.promotion.activate-catalog');
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$param = $this->argument('param');
if (isset($param) && $param == 'catalog-rule') {
$attribute = $this->attribute->findWhere([
'code' => 'special_price'
]);
if ($attribute->count()) {
$attribute = $attribute->first();
if ($attribute->value_per_channel == 1) {
$this->info(trans('admin::app.promotion.catalog-rule-already-activated'));
} else {
$attribute->update(['value_per_channel' => 1]);
$this->info(trans('admin::app.promotion.catalog-rule-activated'));
}
} else {
$this->info(trans('admin::app.promotion.cannot-activate-catalog-rule'));
}
}
}
}

View File

@ -70,13 +70,20 @@ class ConvertXToProductId
$this->conditionSymbols = config('pricerules.cart.conditions.symbols');
}
/**
* Collects the attribute and category conditions
*
* @param Integer $ruleId
*
* @param Object $attrribute_conditions
*/
public function convertX($ruleId, $attribute_conditions)
{
$attributeConditions = json_decode($attribute_conditions);
$attributeConditions = $attribute_conditions;
$categoryValues = $attributeConditions->categories;
$categoryValues = $attributeConditions->categories ?? null;
$attributeValues = $attributeConditions->attributes;
$attributeValues = $attributeConditions->attributes ?? null;
if (!isset($categoryValues) && ! isset($attributeValues)) {
return false;
@ -89,6 +96,7 @@ class ConvertXToProductId
}
$attributeResult = collect();
if (isset($attributeValues) && count($attributeValues)) {
$attributeResult = $this->convertFromAttributes($attributeValues);
}

View File

@ -63,6 +63,16 @@ abstract class Discount
'use_coupon' => 1,
'status' => 1
]);
foreach($rules as $rule) {
if ($rule->coupons->code == $code) {
$rules = collect();
$rules->push($rule);
break;
}
}
} else {
$rules = $this->cartRule->findWhere([
'use_coupon' => 0,
@ -143,6 +153,27 @@ abstract class Discount
return collect();
}
/**
* To find the oldes rule
*
* @param Collection $rules
*
* @return CartRule $oldestRule
*/
public function findOldestRule($rules)
{
$leastID = 999999999999;
foreach ($rules as $index => $rule) {
if ($rule->id < $leastID) {
$leastID = $rule->id;
$oldestRule = $rule;
}
}
return $oldestRule;
}
/**
* To sort the rules by the least priority
*
@ -198,6 +229,8 @@ abstract class Discount
if ($alreadyApplied->count() && $alreadyApplied->first()->cart_rule->id == $rule->id) {
if ($this->validateRule($alreadyApplied->first()->cart_rule)) {
$this->reassess($alreadyApplied->first()->cart_rule, $cart);
return false;
} else {
$this->clearDiscount();
@ -255,6 +288,20 @@ abstract class Discount
}
}
/**
* To reassess the discount in case no. of items gets changed
*
* @return Void
*/
public function reassess($rule)
{
$rule->impact = $this->calculateImpact($rule);
$this->updateCartItemAndCart($rule);
return;
}
/**
* To return cart rule which has the max impact
*
@ -306,6 +353,8 @@ abstract class Discount
*/
public function getActionInstance($rule)
{
$this->rules = config('discount-rules');
$actionType = new $this->rules['cart'][$rule->action_type];
return $actionType;
@ -643,12 +692,17 @@ abstract class Discount
]);
if ($alreadyAppliedRule->count()) {
$alreadyAppliedRule = $alreadyAppliedRule->first()->cart_rule;
$alreadyAppliedCartRule = $alreadyAppliedRule->first()->cart_rule;
$result = $this->validateRule($alreadyAppliedRule);
$result = $this->validateRule($alreadyAppliedCartRule);
if (! $result)
if (! $result) {
$this->clearDiscount();
$alreadyAppliedRule->first()->delete();
} else {
$this->reassess($alreadyAppliedCartRule);
}
}
}
@ -725,6 +779,10 @@ abstract class Discount
$result = true;
foreach ($conditions as $condition) {
if (! isset($condition->attribute) || ! isset($condition->condition) || !isset($condition->value)) {
continue;
}
if (isset($condition->attribute)) {
$actual_value = ${$condition->attribute};
@ -784,13 +842,13 @@ abstract class Discount
break;
}
} else if ($test_condition == '{}') {
if (! str_contains($test_value, $actual_value)) {
if (! str_contains($actual_value, $test_value)) {
$result = false;
break;
}
} else if ($test_condition == '!{}') {
if (str_contains($test_value, $actual_value)) {
if (str_contains($actual_value, $test_value)) {
$result = false;
break;
@ -851,9 +909,12 @@ abstract class Discount
}
foreach ($conditions as $condition) {
if (!isset($condition->attribute) || ! isset($condition->condition) || !isset($condition->value)) {
continue;
}
if (isset($condition->attribute)) {
$actual_value = ${$condition->attribute};
} else {
$result = false;
}
@ -910,13 +971,13 @@ abstract class Discount
break;
}
} else if ($test_condition == '{}') {
if (str_contains($test_value, $actual_value)) {
if (str_contains($actual_value, $test_value)) {
$result = true;
break;
}
} else if ($test_condition == '!{}') {
if (! str_contains($test_value, $actual_value)) {
if (! str_contains($actual_value, $test_value)) {
$result = true;
break;

View File

@ -7,21 +7,6 @@ use Webkul\Discount\Repositories\CartRuleCartRepository as CartRuleCart;
class ValidatesDiscount extends Discount
{
/**
* CartRuleCartRepository instance
*/
protected $cartRuleCart;
/**
* Initializes type hinted dependencies
*
* @param CartRuleCart $cartRuleCart
*/
public function __construct(CartRuleCart $cartRuleCart)
{
$this->cartRuleCart = $cartRuleCart;
}
public function apply($code)
{
return null;
@ -38,45 +23,4 @@ class ValidatesDiscount extends Discount
{
$this->validateIfAlreadyApplied();
}
/**
* Removes the already applied coupon on the current cart instance
*
* @return boolean
*/
public function remove()
{
$cart = Cart::getCart();
$existingRule = $this->cartRuleCart->findWhere([
'cart_id' => $cart->id
]);
if ($existingRule->count()) {
$existingRule->first()->delete();
foreach ($cart->items as $item) {
if ($item->discount_amount > 0) {
$item->update([
'discount_amount' => 0,
'base_discount_amount' => 0,
'discount_percent' => 0,
'coupon_code' => NULL
]);
}
}
$cart->update([
'coupon_code' => NULL,
'discount_amount' => 0,
'base_discount_amount' => 0
]);
Cart::collectTotals();
return true;
} else {
return false;
}
}
}

View File

@ -6,13 +6,14 @@ 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\Product\Repositories\ProductRepository as Product;
use Webkul\Discount\Helpers\Catalog\Sale;
/**
* Apply - Applies catalog rule to products intended in the rules
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2019 Webkul Software Pvt Ltd (http://www.webkul.com)
* @copyright 2019 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class Apply extends Sale
{
@ -46,6 +47,11 @@ class Apply extends Sale
*/
protected $catalogRuleProductPrice;
/**
* Hold ProductRepository instance
*/
protected $product;
/**
* To hold the rule classes
*/
@ -58,7 +64,8 @@ class Apply extends Sale
CatalogRule $catalogRule,
ConvertX $convertX,
CatalogRuleProducts $catalogRuleProduct,
CatalogRuleProductsPrice $catalogRuleProductPrice
CatalogRuleProductsPrice $catalogRuleProductPrice,
Product $product
) {
$this->catalogRule = $catalogRule;
@ -68,6 +75,8 @@ class Apply extends Sale
$this->catalogRuleProductPrice = $catalogRuleProductPrice;
$this->product = $product;
$this->active = collect();
$this->activeRules = collect();
@ -100,20 +109,19 @@ class Apply extends Sale
if ($this->active->count()) {
$productIDs = array();
$temp = collect();
foreach ($this->activeRules as $rule) {
$productIDs = $this->getProductIds($rule);
$productIDs = $this->expandProducts($productIDs);
if ($productIDs) {
$productIDs = $this->expandProducts($productIDs);
$result = $this->setSale($rule, $productIDs);
$this->setSale($rule, $productIDs);
}
}
dd($result, 'processing done');
} else {
// handle the deceased rules here
dd($this->deceased);
// handle the deceased rules here or call the declutter handler over here
// dd($this->deceased);
}
}
@ -130,18 +138,305 @@ class Apply extends Sale
// apply on selected products
foreach ($productIDs as $productID) {
// catalog rule product resource is updated here
$this->catalogRuleProduct->createOrUpdate($rule, $productID);
$this->createOrUpdateCatalogRuleProduct($rule, $productID);
// catalog rule product price resource is updated here
$this->catalogRuleProductPrice->createOrUpdate($rule, $productID);
$this->createOrUpdateCatalogRuleProductPrice($rule, $productID);
}
} else if ($productIDs == '*') {
$this->catalogRuleProduct->createOrUpdate($rule, $productIDs);
$this->catalogRuleProduct->createOrUpdateCatalogRuleProduct($rule, $productIDs);
$this->catalogRuleProductPrice->createOrUpdate($rule, $productIDs);
$this->catalogRuleProductPrice->createOrUpdateCatalogRuleProductPrice($rule, $productIDs);
}
}
/**
* Create or update catalog rule product resource
*
* @param CatalogRule $rule
* @param Integer $productID
*
* @return Void
*/
public function createOrUpdateCatalogRuleProduct($rule, $productID)
{
$channels = $rule->channels;
$customerGroups = $rule->customer_groups;
$channelsGroupsCross = $channels->crossJoin($customerGroups);
if ($productID == '*') {
$products = $this->product->all('id');
foreach ($channelsGroupsCross as $channelGroup) {
$channelId = $channelGroup[0]->channel_id;
$groupId = $channelGroup[1]->customer_group_id;
foreach ($products as $product) {
$productID = $product->id;
$catalogRuleProduct = $this->catalogRuleProduct->findWhere([
'channel_id' => $channelId,
'customer_group_id' => $groupId,
'product_id' => $productID
]);
if ($catalogRuleProduct->count()) {
// check for tie breaker rules and then update
$product = $this->product->find($productID);
$productPrice = $product->price;
// check for tie breaker rules and then update
$previousRuleID = $catalogRuleProduct->first()->catalog_rule_id;
$newRuleID = $rule->id;
$winnerRuleId = $this->breakTie($previousRuleID, $newRuleID, $product);
$discountAmount = $this->getDiscountAmount($product, $rule);
$data = [
'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' => $discountAmount
];
if ($rule->id == $winnerRuleId) {
$this->catalogRuleProduct->create($data);
} else {
$this->catalogRuleProduct->update($data, $catalogRuleProduct->first()->id);
}
} else {
$data = [
'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
];
$this->catalogRuleProduct->create($data);
}
}
}
} else {
foreach ($channelsGroupsCross as $channelGroup) {
$channelId = $channelGroup[0]->channel_id;
$groupId = $channelGroup[1]->customer_group_id;
$catalogRuleProduct = $this->catalogRuleProduct->findWhere([
'channel_id' => $channelId,
'customer_group_id' => $groupId,
'product_id' => $productID
]);
if ($catalogRuleProduct->count()) {
$product = $this->product->find($productID);
$productPrice = $product->price;
// check for tie breaker rules and then update
$previousRuleID = $catalogRuleProduct->first()->catalog_rule_id;
$newRuleID = $rule->id;
$winnerRuleId = $this->breakTie($previousRuleID, $newRuleID, $product);
// update
if ($winnerRuleId != $rule->id) {
$discountAmount = $this->getDiscountAmount($product, $rule);
$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' => $discountAmount
]);
} else {
//do reassessment
}
} else if ($catalogRuleProduct->count() == 0) {
$product = $this->product->find($productID);
$discountAmount = $this->getDiscountAmount($product, $rule);
$data = [
'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' => $discountAmount
];
$this->catalogRuleProduct->create($data);
} else {
// do the reassessment updation if the cart rule action changes the new action and its amount needs to be updated
}
}
}
}
/**
* Create or update catalog rule product resource
*
* @param CatalogRule $rule
* @param Integer $productID
*
* @return Void
*/
public function createOrUpdateCatalogRuleProductPrice($rule, $productID)
{
$channels = $rule->channels;
$customerGroups = $rule->customer_groups;
$channelsGroupsCross = $channels->crossJoin($customerGroups);
if ($productID == '*') {
$products = $this->product->all('id');
foreach ($channelsGroupsCross as $channelGroup) {
$channelId = $channelGroup[0]->channel_id;
$groupId = $channelGroup[1]->customer_group_id;
foreach ($products as $product) {
$productID = $product->id;
$catalogRuleProductPrice = $this->catalogRuleProductPrice->findWhere([
'channel_id' => $channelId,
'customer_group_id' => $groupId,
'product_id' => $productID
]);
if ($catalogRuleProductPrice->count()) {
// check for tie breaker rules and then update
$data = [
'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
];
$this->catalogRuleProductPrice->update($data, $catalogRuleProductPrice->first()->id);
} else {
$data = [
'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
];
$this->catalogRuleProductPrice->create($data);
}
}
}
} else {
foreach ($channelsGroupsCross as $channelGroup) {
$channelId = $channelGroup[0]->channel_id;
$groupId = $channelGroup[1]->customer_group_id;
$catalogRuleProduct = $this->catalogRuleProduct->findWhere([
'channel_id' => $channelId,
'customer_group_id' => $groupId,
'product_id' => $productID
]);
$catalogRuleProductPrice = $this->catalogRuleProductPrice->findWhere([
'channel_id' => $channelId,
'customer_group_id' => $groupId,
'product_id' => $productID
]);
if ($catalogRuleProductPrice->count()) {
$catalogRuleProduct = $catalogRuleProduct->first();
$product = $this->product->find($productID);
$productPrice = $product->price - $catalogRuleProduct->action_amount;
$winnerRuleId = $this->breakTie($catalogRuleProduct->catalog_rule_id, $rule->id, $product);
if ($winnerRuleId != $rule->id) {
$data = [
'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,
'rule_price' => $productPrice
];
$catalogRuleProductPrice->first()->update($data);
} else {
// do reassement
}
} else if ($catalogRuleProductPrice->count() == 0) {
$catalogRuleProduct = $catalogRuleProduct->first();
$discountAmount = $catalogRuleProduct->action_amount;
$product = $this->product->find($productID);
$productPrice = $product->price - $discountAmount;
$data = [
'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,
'rule_price' => $productPrice
];
$this->catalogRuleProductPrice->create($data);
} else {
// do the reassessment updation if the cart rule action changes the new action and its amount needs to be updated
}
}
}
}
/**
* Get discount amount for the rule and product
*
* @return Decimal $discountAmount
*/
public function getDiscountAmount($product, $rule)
{
$actionClass = config('discount-rules.catalog')[$rule->action_code];
$actionInstance = new $actionClass();
$discountAmount = $actionInstance->calculate($rule, $product);
return $discountAmount;
}
/**
* To expand the productIDs of configurable products
*
@ -184,13 +479,25 @@ class Apply extends Sale
*
* @return String $id
*/
public function breakTie($previousRuleID, $newRuleID)
public function breakTie($previousRuleID, $newRuleID, $product)
{
$oldRule = $this->catalogRule->find($previousRuleID);
$newRule = $this->catalogRule->find($newRuleID);
dd($oldRule->name, $newRule->name);
if ($oldRule->ends_other_rules) {
return $oldRule->id;
} else {
$oldRuleDiscount = $this->getDiscountAmount($product, $oldRule);
$newRuleDiscount = $this->getDiscountAmount($product, $newRule);
if ($newRuleDiscount > $oldRuleDiscount) {
return $newRule->id;
} else {
return $oldRule->id;
}
}
}
/**

View File

@ -79,9 +79,9 @@ class ConvertXToProductId
{
$attributeConditions = json_decode(json_decode($attribute_conditions));
$categoryValues = $attributeConditions->categories;
$categoryValues = $attributeConditions->categories ?? null;
$attributeValues = $attributeConditions->attributes;
$attributeValues = $attributeConditions->attributes ?? null;
if (!isset($categoryValues) && !isset($attributeValues)) {
return false;
@ -94,6 +94,7 @@ class ConvertXToProductId
}
$attributeResult = collect();
if (isset($attributeValues) && count($attributeValues)) {
$attributeResult = $this->convertFromAttributes($attributeValues);
}

View File

@ -3,7 +3,7 @@
namespace Webkul\Discount\Helpers\Catalog;
use Webkul\Discount\Repositories\CatalogRepository as CatalogRule;
use Webkul\Discount\Helpers\Catalog\ConvertXToProductId;
use Carbon\Carbon;
/**
* Sale - Abstract class designed to initiate the application of Catalog Rules
@ -70,7 +70,7 @@ abstract class Sale
if ($rule->conditions) {
$conditions = $rule->conditions;
$productIDs = $this->convertX->convertX($rule->conditions);
$productIDs = $this->convertX->convertX($conditions);
} else {
$productIDs = '*';
}

View File

@ -112,7 +112,7 @@ class CartRuleController extends Controller
*/
public function store()
{
$validated = $this->validate(request(), [
$this->validate(request(), [
'name' => 'required|string|unique:cart_rules,name',
'description' => 'string',
'customer_groups' => 'required|array',
@ -265,10 +265,11 @@ class CartRuleController extends Controller
// $coupons['limit'] = $data['usage_limit'];
// }
// create a cart rule
$ruleCreated = $this->cartRule->create($data);
// can execute convert x here after when the rule is updated
// can execute convertX here after when the rule is updated
if (isset($attribute_conditions) && $attribute_conditions != "[]" && $attribute_conditions != "") {
$this->convertX->convertX($ruleCreated->id, $attribute_conditions);
}
@ -414,7 +415,9 @@ class CartRuleController extends Controller
$data['disc_quantity'] = $data['disc_amount'];
} else {
if (! isset($attribute_conditions) || $attribute_conditions == "[]" || $attribute_conditions == "") {
$attribute_conditions = json_decode($attribute_conditions);
if (! (isset($attribute_conditions->categories) && count($attribute_conditions->categories)) && ! (isset($attribute_conditions->attributes) && count($attribute_conditions->attributes))) {
$data['uses_attribute_conditions'] = 0;
$data['actions'] = [
@ -429,7 +432,7 @@ class CartRuleController extends Controller
'action_type' => $data['action_type'],
'disc_amount' => $data['disc_amount'],
'disc_quantity' => $data['disc_quantity'],
'attribute_conditions' => $attribute_conditions
'attribute_conditions' => json_encode($attribute_conditions)
];
}
}
@ -492,7 +495,7 @@ class CartRuleController extends Controller
// update cart rule
$ruleUpdated = $this->cartRule->update($data, $id);
if (isset($attribute_conditions) && $attribute_conditions != "[]" && $attribute_conditions != "") {
if (isset($attribute_conditions) && $data['uses_attribute_conditions']) {
// can execute convert X here after when the rule is updated
$this->convertX->convertX($ruleUpdated->id, $attribute_conditions);
} else {

View File

@ -14,8 +14,8 @@ use Webkul\Discount\Helpers\Catalog\Apply;
/**
* CatalogRule controller
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CatalogRuleController extends Controller
{
@ -358,6 +358,10 @@ class CatalogRuleController extends Controller
public function applyRules()
{
$this->sale->apply();
session()->flash('success', trans('admin::app.promotion.processing-done'));
return redirect()->route('admin.catalog-rule.index');
}
/**

View File

@ -6,10 +6,6 @@ use Illuminate\Support\ServiceProvider;
class DiscountServiceProvider extends ServiceProvider
{
protected $commands = [
'Webkul\Discount\Commands\Console\ActivateCatalogRule'
];
/**
* Bootstrap services.
*
@ -28,8 +24,6 @@ class DiscountServiceProvider extends ServiceProvider
public function register()
{
$this->registerConfig();
$this->commands($this->commands);
}
/**

View File

@ -48,136 +48,4 @@ class CatalogRuleProductsPriceRepository extends Repository
{
return 'Webkul\Discount\Contracts\CatalogRuleProductsPrice';
}
/**
* Create or update catalog rule product resource
*
* @param CatalogRule $rule
* @param Integer $productID
*
* @return Void
*/
public function createOrUpdate($rule, $productID)
{
$channels = $rule->channels;
$customerGroups = $rule->customer_groups;
$channelsGroupsCross = $channels->crossJoin($customerGroups);
if ($productID == '*') {
$products = $this->product->all('id');
foreach ($channelsGroupsCross as $channelGroup) {
$channelId = $channelGroup[0]->channel_id;
$groupId = $channelGroup[1]->customer_group_id;
foreach ($products as $product) {
$productID = $product->id;
$catalogRuleProductPrice = $this->findWhere([
'channel_id' => $channelId,
'customer_group_id' => $groupId,
'product_id' => $productID
]);
if ($catalogRuleProductPrice->count()) {
// check for tie breaker rules and then update
$data = [
'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
];
$this->update($data, $catalogRuleProductPrice->first()->id);
} else {
$data = [
'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
];
$this->create($data);
}
}
}
} else {
foreach ($channelsGroupsCross as $channelGroup) {
$channelId = $channelGroup[0]->channel_id;
$groupId = $channelGroup[1]->customer_group_id;
$catalogRuleProduct = $this->catalogRuleProduct->findWhere([
'channel_id' => $channelId,
'customer_group_id' => $groupId,
'product_id' => $productID
]);
$catalogRuleProductPrice = $this->findWhere([
'channel_id' => $channelId,
'customer_group_id' => $groupId,
'product_id' => $productID
]);
if ($catalogRuleProductPrice->count() && $catalogRuleProductPrice->first()->catalog_rule_id != $rule->id) {
$catalogRuleProduct = $catalogRuleProduct->first();
$discountAmount = $rule->discount_amount;
$product = $this->product->find($productID);
$productPrice = $product->price - $catalogRuleProduct->action_amount;
$data = [
'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,
'rule_price' => $productPrice
];
// update
$catalogRuleProductPrice->first()->update($data);
} else if ($catalogRuleProductPrice->count() == 0) {
$catalogRuleProduct = $catalogRuleProduct->first();
$discountAmount = $rule->discount_amount;
$product = $this->product->find($productID);
$productPrice = $product->price - $catalogRuleProduct->action_amount;
if ($productPrice <= $discountAmount) {
$product->price = $productPrice - $discountAmount;
} else {
$product->price = 0;
}
$data = [
'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,
'rule_price' => $productPrice
];
$this->create($data);
} else {
// do the reassessment updation if the cart rule action changes the new action and its amount needs to be updated
}
}
}
}
}

View File

@ -14,40 +14,19 @@ use Illuminate\Container\Container as App;
*/
class CatalogRuleProductsRepository extends Repository
{
/**
* ProductRepository instance
*/
protected $product;
/**
* CatalogRule Apply instance
*/
protected $apply;
/**
* @param Product $product
* @param App $app
* @param Apply $apply
*/
public function __construct(Product $product, App $app)
public function __construct(App $app)
{
$this->product = $product;
parent::__construct($app);
}
public function getDiscountAmount($product, $rule)
{
$actionClass = config('discount-rules.catalog')[$rule->action_code];
$actionInstance = new $actionClass();
$discountAmount = $actionInstance->calculate($rule, $product);
return $discountAmount;
}
/**
* Specify Model class name
*
@ -57,137 +36,4 @@ class CatalogRuleProductsRepository extends Repository
{
return 'Webkul\Discount\Contracts\CatalogRuleProducts';
}
/**
* Create or update catalog rule product resource
*
* @param CatalogRule $rule
* @param Integer $productID
*
* @return Void
*/
public function createOrUpdate($rule, $productID)
{
$channels = $rule->channels;
$customerGroups = $rule->customer_groups;
$channelsGroupsCross = $channels->crossJoin($customerGroups);
if ($productID == '*') {
$products = $this->product->all('id');
foreach ($channelsGroupsCross as $channelGroup) {
$channelId = $channelGroup[0]->channel_id;
$groupId = $channelGroup[1]->customer_group_id;
$model = new $this->model();
foreach ($products as $product) {
$productID = $product->id;
$catalogRuleProduct = $this->findWhere([
'channel_id' => $channelId,
'customer_group_id' => $groupId,
'product_id' => $productID
]);
if ($catalogRuleProduct->count()) {
// check for tie breaker rules and then update
$previousRuleID = $catalogRuleProduct->first()->catalog_rule_id;
$newRuleID = $rule->id;
$winnerRuleId = $this->breakTie($previousRuleID, $newRuleID);
$data = [
'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
];
if ($rule->id == $winnerRuleId) {
$this->catalogRuleProduct->create($data);
} else {
$this->catalogRuleProduct->update($data, $catalogRuleProduct->first()->id);
}
} else {
$data = [
'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
];
$this->catalogRuleProduct->create($data);
}
}
}
} else {
foreach ($channelsGroupsCross as $channelGroup) {
$channelId = $channelGroup[0]->channel_id;
$groupId = $channelGroup[1]->customer_group_id;
$catalogRuleProduct = $this->findWhere([
'channel_id' => $channelId,
'customer_group_id' => $groupId,
'product_id' => $productID
]);
if ($catalogRuleProduct->count() && $catalogRuleProduct->first()->catalog_rule_id != $rule->id) {
$product = $this->product->find($productID);
$productPrice = $product->price;
$discountAmount = $this->getDiscountAmount($product, $rule);
// check for tie breaker rules and then update
$previousRuleID = $catalogRuleProduct->first()->catalog_rule_id;
$newRuleID = $rule->id;
$winnerRuleId = $this->breakTie($previousRuleID, $newRuleID);
// 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' => $discountAmount
]);
} else if ($catalogRuleProduct->count() == 0) {
$product = $this->product->find($productID);
$productPrice = $product->price;
$discountAmount = $this->getDiscountAmount($product, $rule);
$data = [
'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' => $discountAmount
];
$this->create($data);
} else {
// do the reassessment updation if the cart rule action changes the new action and its amount needs to be updated
}
}
}
}
}

View File

@ -0,0 +1,167 @@
<?php
namespace Webkul\Product\Helpers;
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
use Webkul\Product\Models\Product;
use Webkul\Product\Models\ProductFlat;
use Webkul\Discount\Repositories\CatalogRuleProductsRepository as CatalogRuleProduct;
use Webkul\Customer\Repositories\CustomerGroupRepository as CustomerGroup;
class Price extends AbstractProduct
{
/**
* AttributeRepository object
*
* @var array
*/
protected $attribute;
/**
* CatalogRuleProductsRepository object
*
*/
protected $catalogRuleProduct;
/**
* CustomerGroupRepository object
*/
protected $customerGroup;
/**
* Create a new controller instance.
*
* @param Webkul\Attribute\Repositories\AttributeRepository $attribute
* @return void
*/
public function __construct(
Attribute $attribute,
CatalogRuleProduct $catalogRuleProduct,
CustomerGroup $customerGroup
) {
$this->attribute = $attribute;
$this->catalogRuleProduct = $catalogRuleProduct;
$this->customerGroup = $customerGroup;
}
/**
* Returns the product's minimal price
*
* @param Product $product
* @return float
*/
public function getMinimalPrice($product)
{
static $price = [];
if(array_key_exists($product->id, $price))
return $price[$product->id];
if ($product->type == 'configurable') {
return $price[$product->id] = $this->getVariantMinPrice($product);
} else {
if ($this->haveSpecialPrice($product)) {
return $price[$product->id] = $product->special_price;
}
return $price[$product->id] = $product->price;
}
}
/**
* Returns the product's minimal price
*
* @param Product $product
* @return float
*/
public function getVariantMinPrice($product)
{
static $price = [];
$finalPrice = [];
if (array_key_exists($product->id, $price))
return $price[$product->id];
if ($product instanceof ProductFlat) {
$productId = $product->product_id;
} else {
$productId = $product->id;
}
$qb = ProductFlat::join('products', 'product_flat.product_id', '=', 'products.id')
->where('products.parent_id', $productId);
$result = $qb
->distinct()
->selectRaw('IF( product_flat.special_price_from IS NOT NULL
AND product_flat.special_price_to IS NOT NULL , IF( NOW( ) >= product_flat.special_price_from
AND NOW( ) <= product_flat.special_price_to, IF( product_flat.special_price IS NULL OR product_flat.special_price = 0 , product_flat.price, LEAST( product_flat.special_price, product_flat.price ) ) , product_flat.price ) , IF( product_flat.special_price_from IS NULL , IF( product_flat.special_price_to IS NULL , IF( product_flat.special_price IS NULL OR product_flat.special_price = 0 , product_flat.price, LEAST( product_flat.special_price, product_flat.price ) ) , IF( NOW( ) <= product_flat.special_price_to, IF( product_flat.special_price IS NULL OR product_flat.special_price = 0 , product_flat.price, LEAST( product_flat.special_price, product_flat.price ) ) , product_flat.price ) ) , IF( product_flat.special_price_to IS NULL , IF( NOW( ) >= product_flat.special_price_from, IF( product_flat.special_price IS NULL OR product_flat.special_price = 0 , product_flat.price, LEAST( product_flat.special_price, product_flat.price ) ) , product_flat.price ) , product_flat.price ) ) ) AS final_price')
->where('product_flat.channel', core()->getCurrentChannelCode())
->where('product_flat.locale', app()->getLocale())
->get();
if (! auth()->guard('customer')->check()) {
$groupID = $this->customerGroup->findOneWhere([
'code' => 'guest'
])->id;
} else {
$groupID = auth()->guard('customer')->user()->customer_group_id;
}
if ($groupID) {
$something = $this->catalogRuleProduct->findWhere([
'product_id' => $productId,
'channel_id' => core()->getCurrentChannel()->id,
'customer_group_id' => $groupID
]);
}
foreach ($result as $price) {
$finalPrice[] = $price->final_price;
}
if (empty($finalPrice))
return $price[$product->id] = 0;
return $price[$product->id] = min($finalPrice);
}
/**
* Returns the product's minimal price
*
* @param Product $product
* @return float
*/
public function getSpecialPrice($product)
{
static $price = [];
if(array_key_exists($product->id, $price))
return $price[$product->id];
if ($this->haveSpecialPrice($product)) {
return $price[$product->id] = $product->special_price;
} else {
return $price[$product->id] = $product->price;
}
}
/**
* @param Product $product
* @return boolean
*/
public function haveSpecialPrice($product)
{
if (is_null($product->special_price) || ! (float) $product->special_price)
return false;
if (core()->isChannelDateInInterval($product->special_price_from, $product->special_price_to)) {
return true;
}
return false;
}
}

View File

@ -4,7 +4,7 @@ return [
'flatrate' => [
'code' => 'flatrate',
'title' => 'Flat Rate',
'description' => 'shop::app.checkout.onepage.flat-desc',
'description' => 'Flat Rate Shipping',
'active' => true,
'default_rate' => '10',
'type' => 'per_unit',
@ -14,7 +14,7 @@ return [
'free' => [
'code' => 'free',
'title' => 'Free Shipping',
'description' => 'shop::app.checkout.onepage.free-desc',
'description' => 'Free Shipping',
'active' => true,
'default_rate' => '0',
'class' => 'Webkul\Shipping\Carriers\Free',

View File

@ -22,7 +22,7 @@ body {
font-family: $font-montserrat;
}
*::-webkit-input-placeholder {
*::-moz-input-placeholder {
font-family: $font-montserrat;
}
@ -442,10 +442,19 @@ input {
}
.product-card:hover {
<<<<<<< HEAD
outline: 1px solid #eaeaec;
box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
-webkit-box-shadow: 0 2px 16px 4px rgba(40, 44, 63, .07);
box-shadow: 0 2px 16px 4px rgba(40, 44, 63, .07)
=======
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
-webkit-box-shadow: 0px 2px 16px 4px rgba(40, 44, 63, 0.07);
-moz-box-shadow: 0px 2px 16px 4px rgba(40, 44, 63, 0.07);
box-shadow: 0px 2px 16px 4px rgba(40, 44, 63, 0.07);
transition: .3s;
// outline: 1px solid $outline-hvr;
>>>>>>> f9580b077a856af56b51d8ffbbff524557b317ee
}
@media only screen and (max-width: 580px) {

View File

@ -13,10 +13,15 @@
<p>{{ __('shop::app.checkout.success.info') }}</p>
{{ view_render_event('bagisto.shop.checkout.continue-shopping.before', ['order' => $order]) }}
<div class="misc-controls">
<a style="display: inline-block" href="{{ route('shop.home.index') }}" class="btn btn-lg btn-primary">
{{ __('shop::app.checkout.cart.continue-shopping') }}
</a>
</div>
{{ view_render_event('bagisto.shop.checkout.continue-shopping.after', ['order' => $order]) }}
</div>
@endsection
@endsection

View File

@ -4,11 +4,43 @@
{{ __('shop::app.home.page-title') }}
@endsection
@section('content-wrapper')
@php
$channel = core()->getCurrentChannel();
$homeSEO = $channel->home_seo;
if (isset($homeSEO)) {
$homeSEO = json_decode($channel->home_seo);
$metaTitle = $homeSEO->meta_title;
$metaDescription = $homeSEO->meta_description;
$metaKeywords = $homeSEO->meta_keywords;
}
@endphp
@section('head')
@if (isset($homeSEO))
@isset($metaTitle)
<meta name="title" content="{{ $metaTitle }}" />
@endisset
@isset($metaDescription)
<meta name="description" content="{{ $metaDescription }}" />
@endisset
@isset($metaKeywords)
<meta name="keywords" content="{{ $metaKeywords }}" />
@endisset
@endif
@endsection
@section('content-wrapper')
{!! view_render_event('bagisto.shop.home.content.before') !!}
{!! DbView::make(core()->getCurrentChannel())->field('home_page_content')->with(['sliderData' => $sliderData])->render() !!}
{!! DbView::make($channel)->field('home_page_content')->with(['sliderData' => $sliderData])->render() !!}
{{ view_render_event('bagisto.shop.home.content.after') }}

View File

@ -23,7 +23,9 @@
@yield('head')
@section('seo')
<meta name="description" content="{{ core()->getCurrentChannel()->description }}"/>
@if (! request()->is('/'))
<meta name="description" content="{{ core()->getCurrentChannel()->description }}"/>
@endif
@show
@stack('css')

View File

@ -1,4 +1,4 @@
{
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css"
}
}