merge with master

This commit is contained in:
rahul shukla 2019-02-11 17:18:06 +05:30
commit 15ae803407
18 changed files with 1234 additions and 81 deletions

109
README.md
View File

@ -13,10 +13,9 @@
# Topics # Topics
1. ### [Introduction](#1-introduction-) 1. ### [Introduction](#1-introduction-)
2. ### [Requirements](#2-requirements-) 2. ### [Requirements](#2-requirements-)
3. ### [Configuration](#3-configuration-) 3. ### [Installation & Configuration](#3-installation--configuration-)
4. ### [Installation](#4-installation-) 4. ### [License](#4-license-)
5. ### [License](#5-license-) 5. ### [Miscellaneous](#5-miscellaneous-)
6. ### [Miscellaneous](#6-miscellaneous-)
### 1. Introduction <a name="#1-introduction-"></a>: ### 1. Introduction <a name="#1-introduction-"></a>:
@ -55,24 +54,45 @@ Bagisto is using power of both of these frameworks and making best out of it out
* **SERVER**: Apache 2 or NGINX * **SERVER**: Apache 2 or NGINX
* **RAM**: 2 GB or higher. * **RAM**: 2 GB or higher.
* **PHP**: 7.1.17 or higher. * **PHP**: 7.1.17 or higher.
* **Processor**: Clock Cycle 1Ghz or higher. * **Processor**: Clock Cycle 1 Ghz or higher.
* **Mysql**: 5.7.23 or higher. * **For MySQL users**: 5.7.23 or higher.
* **For MariaDB users**: 10.2.7 or Higher.
* **Node**: 8.11.3 LTS or higher. * **Node**: 8.11.3 LTS or higher.
* **Composer**: 1.6.5 or higher. * **Composer**: 1.6.5 or higher.
### 3. Configuration <a name="#configuration"></a>: ### 3. Installation & Configuration <a name="#configuration"></a>:
**Run this Command** to download the project on to your local machine or server: **1. Try our new GUI installer to install Bagisto:**
> Note: If you have downloaded zip file then ignore this. ##### a. Download zip from the link below:
[Download](https://github.com/bagisto/bagisto/archive/v0.1.4.zip)
##### b. Extract the contents of zip and execute the project in browser:
~~~ ~~~
composer create-project bagisto/bagisto http(s)://localhost/bagisto/public
~~~ ~~~
if the above command's process was successful, you will find directory **bagisto** and all of the code will be inside it. or
After it set your **.env** variable, especially the ones below: ~~~
http(s)://example.com/public
~~~
**2. Try our old fashioned way to install Bagisto:**
##### Execute these commands below as in their order
~~~
1. composer create-project bagisto/bagisto
~~~
**Now configure your database:**
If the above command was completed successfully, then you'll find directory **bagisto** and all of the code will be inside it.
Find file **.env** inside **bagisto** directory and set the environment variables listed below:
* **APP_URL** * **APP_URL**
* **DB_CONNECTION** * **DB_CONNECTION**
@ -82,50 +102,61 @@ After it set your **.env** variable, especially the ones below:
* **DB_USERNAME** * **DB_USERNAME**
* **DB_PASSWORD** * **DB_PASSWORD**
Although you have to set the mailer variables also for full functioning of your store for sending emails at various events by Although, mailer environment variables are also required to be set up as **Bagisto** requires emails to send to customers and admins for various functionalities that are built in.
default.
### 4. Installation <a name="#installation"></a>:
**Run these Commands Below**
> Run this command, in case installing from the zip else skip this command (no need to run this command if you are creating project through composer):
~~~ ~~~
composer install 2. php artisan migrate
~~~ ~~~
> Continue run these command below:
~~~ ~~~
php artisan migrate 3. php artisan db:seed
~~~ ~~~
~~~
php artisan db:seed
~~~
~~~
php artisan vendor:publish
~~~
4. php artisan vendor:publish
-> Press 0 and then press enter to publish all assets and configurations. -> Press 0 and then press enter to publish all assets and configurations.
~~~ ~~~
```
php artisan storage:link
```
```
composer dump-autoload
```
> That's it, now just execute the project on your specified domain entry point pointing to public folder inside installation directory.
> **Note: you can fetch your admin panel by follow below url:**
~~~ ~~~
http(s)://example.com/admin/login 5. php artisan storage:link
~~~ ~~~
~~~
6. composer dump-autoload
~~~
**To execute Bagisto**:
##### On server:
~~~
Open the specified entry point in your hosts file in browser or make entry in hosts file if not done.
~~~
##### On local:
~~~
php artisan serve
~~~
**How to log in as admin:**
> *http(s)://example.com/admin/login*
~~~ ~~~
email:admin@example.com email:admin@example.com
password:admin123 password:admin123
~~~ ~~~
**How to log in as customer:**
*You can directly register as customer and then login.*
> *http(s)://example.com/customer/register*
### 5. License <a name="#license"></a>: ### 5. License <a name="#license"></a>:
Bagisto is a truly opensource E-Commerce framework which will always be free under the [MIT License](https://github.com/bagisto/bagisto/blob/master/LICENSE). Bagisto is a truly opensource E-Commerce framework which will always be free under the [MIT License](https://github.com/bagisto/bagisto/blob/master/LICENSE).

View File

@ -76,6 +76,8 @@ class CustomerReviewDataGrid extends DataGrid
return '<span class="badge badge-md badge-success">Approved</span>'; return '<span class="badge badge-md badge-success">Approved</span>';
else if ($value->product_review_status == "pending") else if ($value->product_review_status == "pending")
return '<span class="badge badge-md badge-warning">Pending</span>'; return '<span class="badge badge-md badge-warning">Pending</span>';
else if ($value->product_review_status == "disapproved")
return '<span class="badge badge-md badge-danger">Disapproved</span>';
}, },
]); ]);
} }
@ -108,8 +110,9 @@ class CustomerReviewDataGrid extends DataGrid
'action' => route('admin.customer.review.massupdate'), 'action' => route('admin.customer.review.massupdate'),
'method' => 'PUT', 'method' => 'PUT',
'options' => [ 'options' => [
'Disapprove' => 0, 'Pending' => 0,
'Approve' => 1 'Approve' => 1,
'Disapprove' => 2
] ]
]); ]);
} }

View File

@ -215,7 +215,7 @@ class DashboardController extends Controller
->addSelect(DB::raw('SUM(qty_ordered) as total_qty_ordered')) ->addSelect(DB::raw('SUM(qty_ordered) as total_qty_ordered'))
->addSelect(DB::raw('COUNT(products.id) as total_products')) ->addSelect(DB::raw('COUNT(products.id) as total_products'))
->addSelect('order_items.id', 'categories.id as category_id', 'category_translations.name') ->addSelect('order_items.id', 'categories.id as category_id', 'category_translations.name')
->groupBy('category_id') ->groupBy('categories.id')
->orderBy('total_qty_ordered', 'DESC') ->orderBy('total_qty_ordered', 'DESC')
->limit(5) ->limit(5)
->get(); ->get();

View File

@ -701,7 +701,8 @@ return [
'status' => 'Status', 'status' => 'Status',
'comment' => 'Comment', 'comment' => 'Comment',
'pending' => 'Pending', 'pending' => 'Pending',
'approved' => 'Approved' 'approved' => 'Approve',
'disapproved' => 'Disapprove'
], ],
'subscribers' => [ 'subscribers' => [
@ -769,6 +770,8 @@ return [
'attribute-product-error' => ':name is used in products.', 'attribute-product-error' => ':name is used in products.',
'customer-associate' => ':name can not be deleted because customer is associated with this group.', 'customer-associate' => ':name can not be deleted because customer is associated with this group.',
'currency-delete-error' => 'This currency is set as channel base currency so it can not be deleted.', 'currency-delete-error' => 'This currency is set as channel base currency so it can not be deleted.',
'upload-success' => ':name uploaded successfully.' 'upload-success' => ':name uploaded successfully.',
'delete-category-root' => 'Cannot delete the root category',
'create-root-failure' => 'Category with name root already exists'
], ],
]; ];

View File

@ -51,12 +51,17 @@
<div class="control-group"> <div class="control-group">
<label for="name" class="required">{{ __('admin::app.customers.reviews.status') }}</label> <label for="name" class="required">{{ __('admin::app.customers.reviews.status') }}</label>
<select class="control" name="status"> <select class="control" name="status">
<option value="pending" {{ $review->status == "pending" ? 'selected' : ''}}>
{{ __('admin::app.customers.reviews.pending') }}
</option>
<option value="approved" {{ $review->status == "approved" ? 'selected' : '' }}> <option value="approved" {{ $review->status == "approved" ? 'selected' : '' }}>
{{ __('admin::app.customers.reviews.approved') }} {{ __('admin::app.customers.reviews.approved') }}
</option> </option>
<option value="disapproved" {{ $review->status == "disapproved" ? 'selected' : ''}}>
{{ __('admin::app.customers.reviews.disapproved') }}
</option>
<option value="pending" {{ $review->status == "pending" ? 'selected' : ''}}>
{{ __('admin::app.customers.reviews.pending') }}
</option>
</select> </select>
</div> </div>

View File

@ -5,6 +5,7 @@ namespace Webkul\Category\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Webkul\Category\Repositories\CategoryRepository as Category; use Webkul\Category\Repositories\CategoryRepository as Category;
use Webkul\Category\Models\CategoryTranslation;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
/** /**
@ -74,9 +75,21 @@ class CategoryController extends Controller
$this->validate(request(), [ $this->validate(request(), [
'slug' => ['required', 'unique:category_translations,slug', new \Webkul\Core\Contracts\Validations\Slug], 'slug' => ['required', 'unique:category_translations,slug', new \Webkul\Core\Contracts\Validations\Slug],
'name' => 'required', 'name' => 'required',
'image.*' => 'mimes:jpeg,jpg,bmp,png' 'image.*' => 'mimes:jpeg, jpg, bmp, png'
]); ]);
if (strtolower(request()->input('name')) == 'root') {
$categoryTransalation = new CategoryTranslation();
$result = $categoryTransalation->where('name', request()->input('name'))->get();
if(count($result) > 0) {
session()->flash('error', trans('admin::app.response.create-root-failure'));
return redirect()->back();
}
}
$category = $this->category->create(request()->all()); $category = $this->category->create(request()->all());
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Category'])); session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Category']));
@ -137,11 +150,15 @@ class CategoryController extends Controller
{ {
Event::fire('catalog.category.delete.before', $id); Event::fire('catalog.category.delete.before', $id);
$this->category->delete($id); if(strtolower($this->category->find($id)->name) == "root") {
session()->flash('warning', trans('admin::app.response.delete-category-root', ['name' => 'Category']));
} else {
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Category']));
Event::fire('catalog.category.delete.after', $id); $this->category->delete($id);
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Category'])); Event::fire('catalog.category.delete.after', $id);
}
return redirect()->back(); return redirect()->back();
} }
@ -154,7 +171,7 @@ class CategoryController extends Controller
public function massDestroy() { public function massDestroy() {
$suppressFlash = false; $suppressFlash = false;
if (request()->isMethod('delete')) { if (request()->isMethod('delete') || request()->isMethod('post')) {
$indexes = explode(',', request()->input('indexes')); $indexes = explode(',', request()->input('indexes'));
foreach ($indexes as $key => $value) { foreach ($indexes as $key => $value) {

View File

@ -591,6 +591,24 @@ class Core
return $collection; return $collection;
} }
/**
* Retrieve all grouped states by country code
*
* @return Collection
*/
public function findStateByCountryCode($countryCode = null, $stateCode = null)
{
$collection = array();
$collection = $this->countryStateRepository->findByField(['country_code' => $countryCode, 'code' => $stateCode]);
if(count($collection)) {
return $collection->first();
} else {
return false;
}
}
/** /**
* Returns time intervals * Returns time intervals
* *

File diff suppressed because it is too large Load Diff

View File

@ -183,6 +183,8 @@ class ReviewController extends Controller
Event::fire('customer.review.update.after', $review); Event::fire('customer.review.update.after', $review);
} else if ($data['update-options'] == 0) { } else if ($data['update-options'] == 0) {
$review->update(['status' => 'pending']); $review->update(['status' => 'pending']);
} else if ($data['update-options'] == 2) {
$review->update(['status' => 'disapproved']);
} else { } else {
continue; continue;
} }

View File

@ -470,7 +470,7 @@ class ProductRepository extends Repository
} }
}); });
return $qb; return $qb->groupBy('product_flat.id');
})->paginate(isset($params['limit']) ? $params['limit'] : 9); })->paginate(isset($params['limit']) ? $params['limit'] : 9);
return $results; return $results;

View File

@ -13,7 +13,7 @@
@if ($cart->selected_shipping_rate) @if ($cart->selected_shipping_rate)
<div class="item-detail"> <div class="item-detail">
<label>{{ __('shop::app.checkout.total.delivery-charges') }}</label> <label>{{ __('shop::app.checkout.total.delivery-charges') }}</label>
<label class="right">{{ core()->currency($cart->selected_shipping_rate->price) }}</label> <label class="right">{{ core()->currency($cart->selected_shipping_rate->base_price) }}</label>
</div> </div>
@endif @endif

View File

@ -2,6 +2,7 @@
return [ return [
'datagrid' => [ 'datagrid' => [
'actions' => 'Actions', 'actions' => 'Actions',
'id' => 'Index columns have value greater than zero only',
'massaction' => [ 'massaction' => [
'mass-delete-confirm' => 'Do you really want to delete these selected :resource?', 'mass-delete-confirm' => 'Do you really want to delete these selected :resource?',

View File

@ -228,6 +228,7 @@
template: '#datagrid-filters', template: '#datagrid-filters',
data: () => ({ data: () => ({
filterIndex: @json($results['index']),
gridCurrentData: @json($results['records']), gridCurrentData: @json($results['records']),
massActions: @json($results['massactions']), massActions: @json($results['massactions']),
massActionsToggle: false, massActionsToggle: false,
@ -338,7 +339,15 @@
if (this.type == 'string') { if (this.type == 'string') {
this.formURL(this.columnOrAlias, this.stringCondition, this.stringValue, label) this.formURL(this.columnOrAlias, this.stringCondition, this.stringValue, label)
} else if (this.type == 'number') { } else if (this.type == 'number') {
this.formURL(this.columnOrAlias, this.numberCondition, this.numberValue, label); indexConditions = true;
if (this.filterIndex == this.columnOrAlias && (this.numberValue == 0 || this.numberValue < 0)) {
indexConditions = false;
alert('index columns can have values greater than zero only');
}
if(indexConditions)
this.formURL(this.columnOrAlias, this.numberCondition, this.numberValue, label);
} else if (this.type == 'boolean') { } else if (this.type == 'boolean') {
this.formURL(this.columnOrAlias, this.booleanCondition, this.booleanValue, label); this.formURL(this.columnOrAlias, this.booleanCondition, this.booleanValue, label);
} else if (this.type == 'datetime') { } else if (this.type == 'datetime') {

View File

@ -46,10 +46,8 @@ class SessionController extends Controller
return redirect()->route('admin.dashboard.index'); return redirect()->route('admin.dashboard.index');
} else { } else {
session()->put('url.intended', url()->previous()); session()->put('url.intended', url()->previous());
return view($this->_config['view']); return view($this->_config['view']);
} }
} }
/** /**

View File

@ -97,7 +97,7 @@ $data = array();
$conn->close(); $conn->close();
} else { } else {
$data['support_error'] = 'It only support mysql Database Connection.If You still want to continue, press OK otherwise change your database connection'; $data['support_error'] = 'Bagisto currently support MySQL only. Press OK to still continue or change you DB connection to MySQL';
} }
// if there are no errors process our form, then return a message // if there are no errors process our form, then return a message

View File

@ -20,9 +20,9 @@ class Requirement {
'JSON', 'JSON',
'cURL', 'cURL',
], ],
'apache' => [ // 'apache' => [
'mod_rewrite', // 'mod_rewrite',
] // ]
]; ];
$results = []; $results = [];
@ -43,24 +43,25 @@ class Requirement {
$results['errors'] = true; $results['errors'] = true;
} }
} }
break; break;
// check apache requirements // check apache requirements
case 'apache': // case 'apache':
foreach ($requirements[$type] as $requirement) { // foreach ($requirements[$type] as $requirement) {
// if function doesn't exist we can't check apache modules // // if function doesn't exist we can't check apache modules
if(function_exists('apache_get_modules')) // if(function_exists('apache_get_modules'))
{ // {
$results['requirements'][$type][$requirement] = true; // $results['requirements'][$type][$requirement] = true;
if(!in_array($requirement,apache_get_modules())) // if(!in_array($requirement,apache_get_modules()))
{ // {
$results['requirements'][$type][$requirement] = false; // $results['requirements'][$type][$requirement] = false;
$results['errors'] = true; // $results['errors'] = true;
} // }
} // }
} // }
break; //break;
} }
} }

View File

@ -22,8 +22,8 @@
<div class="form-container" style="padding: 10%; padding-top: 35px"> <div class="form-container" style="padding: 10%; padding-top: 35px">
<div class="control-group" id="app_name"> <div class="control-group" id="app_name">
<label for="app_name" class="required">App Name</label> <label for="app_name" class="required">App Name</label>
<input type="text" name="app_name" class="control" <input type = "text" name = "app_name" class = "control"
placeholder="Laravel" value = "Bagisto_"
data-validation="required length" data-validation-length="max50" data-validation="required length" data-validation-length="max50"
> >
</div> </div>
@ -71,7 +71,7 @@
<div class="control-group" id="user_name"> <div class="control-group" id="user_name">
<label for="user_name" class="required">User Name</label> <label for="user_name" class="required">User Name</label>
<input type="text" name="user_name" class="control" <input type="text" name="user_name" class="control"
placeholder="database user name" value = "bagisto_"
data-validation="length required" data-validation-length="max50"> data-validation="length required" data-validation-length="max50">
</div> </div>

View File

@ -11,12 +11,13 @@
if (file_exists($envFile)) { if (file_exists($envFile)) {
// reading env content // reading env content
$str= file_get_contents($envFile); $str = file_get_contents($envFile);
// converting env content to key/value pair // converting env content to key/value pair
$data = explode(PHP_EOL,$str); $data = explode(PHP_EOL,$str);
$databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION']; $databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION'];
$key = $value = [];
if ($data) { if ($data) {
foreach ($data as $line) { foreach ($data as $line) {
$rowValues = explode('=', $line); $rowValues = explode('=', $line);