diff --git a/packages/Webkul/Admin/src/Config/system.php b/packages/Webkul/Admin/src/Config/system.php index 04bdc902a..e96dae553 100644 --- a/packages/Webkul/Admin/src/Config/system.php +++ b/packages/Webkul/Admin/src/Config/system.php @@ -20,6 +20,22 @@ return [ 'type' => 'boolean' ] ] + ], [ + 'key' => 'catalog.inventory', + 'name' => 'admin::app.admin.system.inventory', + 'sort' => 1, + ], [ + 'key' => 'catalog.inventory.stock_options', + 'name' => 'admin::app.admin.system.stock-options', + 'sort' => 1, + 'fields' => [ + [ + 'name' => 'backorders', + 'title' => 'admin::app.admin.system.allow-backorders', + 'type' => 'boolean', + 'channel_based' => true + ] + ] ], [ 'key' => 'customer', 'name' => 'admin::app.admin.system.customer', diff --git a/packages/Webkul/Admin/src/Resources/lang/en/app.php b/packages/Webkul/Admin/src/Resources/lang/en/app.php index 2cf7a25dd..0be7dad7d 100755 --- a/packages/Webkul/Admin/src/Resources/lang/en/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/en/app.php @@ -835,6 +835,9 @@ return [ 'products' => 'Products', 'review' => 'Review', 'allow-guest-review' => 'Allow Guest Review', + 'inventory' => 'Inventory', + 'stock-options' => 'Stock Options', + 'allow-backorders' => 'Allow Backorders', 'customer' => 'Customer', 'settings' => 'Settings', 'address' => 'Address', diff --git a/packages/Webkul/Product/src/Models/Product.php b/packages/Webkul/Product/src/Models/Product.php index f75b3165c..4205d25ff 100755 --- a/packages/Webkul/Product/src/Models/Product.php +++ b/packages/Webkul/Product/src/Models/Product.php @@ -195,7 +195,7 @@ class Product extends Model implements ProductContract $total -= $orderedInventory->qty; } - return $qty <= $total ? true : false; + return $qty <= $total ? true : (core()->getConfigData('catalog.inventory.stock_options.backorders') ? true : false); } /** diff --git a/public/installer/Admin.php b/public/installer/Admin.php deleted file mode 100755 index f48b48de3..000000000 --- a/public/installer/Admin.php +++ /dev/null @@ -1,130 +0,0 @@ - - - - -
-
-

Admin Details

- -
-
-
-
- - -
- -
- - -
- -
- - -
- -
- - -
-
-
-
- -
-
- -
-
- - - - - - - - \ No newline at end of file diff --git a/public/installer/AdminConfig.php b/public/installer/AdminConfig.php deleted file mode 100755 index cfb17829b..000000000 --- a/public/installer/AdminConfig.php +++ /dev/null @@ -1,112 +0,0 @@ -connect_error) { - $data['connection'] = $conn->connect_error; - } - - $email = $_POST['admin_email']; - $name = $_POST['admin_name']; - $password = password_hash($_POST['admin_password'], PASSWORD_BCRYPT, ['cost' => 10]); - - // Deleting migrated admin - $deleteAdmin = "DELETE FROM admins WHERE id=1"; - $conn->query($deleteAdmin); - - // query for insertion - $sql = "INSERT INTO admins (name, email, password, role_id, status) - VALUES ('".$name."', '".$email."', '".$password."', '1', '1')"; - - if ($conn->query($sql) === TRUE) { - $data['insert_success'] = 'Data Successfully inserted into database'; - } else { - $data['insert_fail'] = "Error: " . $sql . "
" . $conn->error; - } - - $conn->close(); - } else { - $data['support_error'] = 'Bagisto currently support MySQL only. Press OK to still continue or change you DB connection to MySQL'; - } - - $storage_output = exec('cd ../.. && php artisan storage:link 2>&1'); - - // if there are no errors process our form, then return a message - // show a message of success and provide a true success variable - $data['success'] = true; - $data['message'] = 'Success!'; - } - - // return all our data to an AJAX call - echo json_encode($data); \ No newline at end of file diff --git a/public/installer/CSS/style.css b/public/installer/CSS/style.css deleted file mode 100755 index db093a41a..000000000 --- a/public/installer/CSS/style.css +++ /dev/null @@ -1,191 +0,0 @@ -body { - margin: 0; - font-size: 16px; - font-family: "Montserrat", sans-serif; - color: #000311; - text-align: center; - background: white; - position: relative; - height: 100%; -} - -.initial-display .logo { - width: 150px; -} - -.initial-display p { - font-size: 24px; - color: #333333; - text-align: center; - font-weight: 600; - margin-top: 50px; -} - -.prepare-btn { - box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.2), 0 0 8px 0 rgba(0, 0, 0, 0.1); - border-radius: 3px; - border: none; - cursor: pointer; - font: inherit; - display: inline-block; - background: #0041FF; - color: #ffffff; - padding: 10px 20px; - margin-top: 20px; -} - -.footer { - bottom: 0; - position: absolute; - width: 100%; - padding-bottom: 20px; -} - -.left-patern { - position: absolute; - left: 0; - bottom: 0; -} - -.right-patern { - position: absolute; - right: 0; - bottom: 0; -} - -.content { - border: 1px solid #979797; - border-radius: 3px; - width: 600px; - height: 392px; - margin-left: calc(50% - 300px); - text-align: left; - overflow-x: scroll; -} - -.title { - font-size: 16px; - color: #151515; - line-height: 30px; - text-align: left; - margin-top: 30px; - margin-bottom: 10px; -} - -span { - font-size: 16px; - color: #333333; - line-height: 30px; -} - -.welcome, .environment, .migration, .permission, .admin, .finish { - display : none; -} - -.control-group { - display: block; - margin-bottom: 25px; - font-size: 15px; - color: #333333; - width: 750px; - max-width: 100%; - position: relative; -} - -.control-group label { - display: block; - color: #3a3a3a; -} - -.control-group .control { - background: #fff; - border: 2px solid #C7C7C7; - border-radius: 3px; - width: 100%; - height: 36px; - display: inline-block; - vertical-align: middle; - -webkit-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); - transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); - padding: 0px 10px; - font-size: 15px; - margin-top: 10px; - margin-bottom: 5px; -} - -.control-group label.required::after { - content: "*"; - color: #FC6868; - font-weight: 700; - display: inline-block; -} - -.form-error { - color: #ff5656 !important; -} - -.control-group.has-error .control { - border-color: #FC6868 !important; -} - -pre.bash { - background-color: black; - color: white; - font-size: medium ; - font-family: Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace; - width: 100%; - display: inline-block; - height: 100%; -} - -.cp-round:before { - border-radius: 50%; - content: " "; - width: 48px; - height: 48px; - display: inline-block; - box-sizing: border-box; - border-top: solid 6px #bababa; - border-right: solid 6px #bababa; - border-bottom: solid 6px #bababa; - border-left: solid 6px #bababa; - position: absolute; - top: calc(50% - 24px); - left: calc(50% - 24px); -} - -.check { - line-height: 40px; -} - -.cp-round:after { - border-radius: 50%; - content: " "; - width: 48px; - height: 48px; - display: inline-block; - box-sizing: border-box; - border-top: solid 6px #0041FF; - border-right: solid 6px #bababa; - border-bottom: solid 6px #bababa; - border-left: solid 6px #bababa; - position: absolute; - top: calc(50% - 24px); - left: calc(50% - 24px); - animation: spin 1s ease-in-out infinite; -} - -@keyframes spin { - 0% { transform: rotate(0deg); } - 100% { transform: rotate(360deg); } -} - -.composer { - position: absolute; - top: calc(50% + 24px); - display: none; -} - -.message { - padding-left: 140px; -} diff --git a/public/installer/Classes/Requirement.php b/public/installer/Classes/Requirement.php deleted file mode 100755 index e6ecf5160..000000000 --- a/public/installer/Classes/Requirement.php +++ /dev/null @@ -1,161 +0,0 @@ - [ - 'openssl', - 'pdo', - 'mbstring', - 'tokenizer', - 'JSON', - 'cURL', - ], - // 'apache' => [ - // 'mod_rewrite', - // ] - ]; - - $results = []; - - foreach($requirements as $type => $requirement) - { - switch ($type) { - // check php requirements - case 'php': - foreach($requirements[$type] as $requirement) - { - $results['requirements'][$type][$requirement] = true; - - if(!extension_loaded($requirement)) - { - $results['requirements'][$type][$requirement] = false; - - $results['errors'] = true; - } - } - break; - - // check apache requirements - // case 'apache': - // foreach ($requirements[$type] as $requirement) { - // // if function doesn't exist we can't check apache modules - // if(function_exists('apache_get_modules')) - // { - // $results['requirements'][$type][$requirement] = true; - - // if(!in_array($requirement,apache_get_modules())) - // { - // $results['requirements'][$type][$requirement] = false; - - // $results['errors'] = true; - // } - // } - // } - //break; - } - } - - return $results; - } - - /** - * Check PHP version requirement. - * - * @return array - */ - public function checkPHPversion() - { - /** - * Minimum PHP Version Supported (Override is in installer.php config file). - * - * @var _minPhpVersion - */ - $_minPhpVersion = '7.1.17'; - - $currentPhpVersion = $this->getPhpVersionInfo(); - $supported = false; - - if (version_compare($currentPhpVersion['version'], $_minPhpVersion) >= 0) { - $supported = true; - } - - $phpStatus = [ - 'full' => $currentPhpVersion['full'], - 'current' => $currentPhpVersion['version'], - 'minimum' => $_minPhpVersion, - 'supported' => $supported - ]; - - return $phpStatus; - } - - /** - * Get current Php version information - * - * @return array - */ - private static function getPhpVersionInfo() - { - $currentVersionFull = PHP_VERSION; - preg_match("#^\d+(\.\d+)*#", $currentVersionFull, $filtered); - $currentVersion = $filtered[0]; - - return [ - 'full' => $currentVersionFull, - 'version' => $currentVersion - ]; - } - - /** - * Check composer installation. - * - * @return array - */ - public function composerInstall() - { - $location = str_replace('\\', '/', getcwd()); - $currentLocation = explode("/", $location); - array_pop($currentLocation); - array_pop($currentLocation); - $desiredLocation = implode("/", $currentLocation); - $autoLoadFile = $desiredLocation . '/' . 'vendor' . '/' . 'autoload.php'; - - if (file_exists($autoLoadFile)) { - $data['composer_install'] = 0; - } else { - $data['composer_install'] = 1; - $data['composer'] = 'Composer dependencies is not Installed.Go to root of project, run "composer install" command to install composer dependencies & refresh page again.'; - } - - return $data; - } - - /** - * Render view for class. - * - */ - public function render() - { - $requirements = $this->checkRequirements(); - - $phpVersion = $this->checkPHPversion(); - - $composerInstall = $this->composerInstall(); - - ob_start(); - - include __DIR__ . '/../Views/requirements.blade.php'; - - return ob_get_clean(); - } -} diff --git a/public/installer/Classes/Welcome.php b/public/installer/Classes/Welcome.php deleted file mode 100755 index a18c507fa..000000000 --- a/public/installer/Classes/Welcome.php +++ /dev/null @@ -1,17 +0,0 @@ - $value) { - $changedData[] = $key . '=' . $value; - } - - // inserting new form-data to env - $changedData = implode(PHP_EOL, $changedData); - file_put_contents($envFile, $changedData); - - // checking database connection(mysql only) - if ($_POST["database_connection"] == 'mysql') { - // Create connection - @$conn = new mysqli($_POST["host_name"], $_POST["user_name"], $_POST["user_password"], $_POST["database_name"]); - - // check connection - if ($conn->connect_error) { - $errors['database_error'] = $conn->connect_error; - $data['errors'] = $errors; - $data['success'] = false; - } else { - $data['success'] = true; - $data['message'] = 'Success!'; - } - } else { - $data['success'] = true; - $data['message'] = 'Success!'; - } - - // show a message of success and provide a true success variable - } - - // return all our data to an AJAX call - echo json_encode($data); \ No newline at end of file diff --git a/public/installer/Environment.php b/public/installer/Environment.php deleted file mode 100755 index 74b9cbf60..000000000 --- a/public/installer/Environment.php +++ /dev/null @@ -1,202 +0,0 @@ - - - - -
-
-

Environment Configuration

- -
-
-
-
-
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
-
-
-
- -
- back -
-
-
- -
-
- - - - - - - - - diff --git a/public/installer/Finish.php b/public/installer/Finish.php deleted file mode 100755 index 7ccf136ed..000000000 --- a/public/installer/Finish.php +++ /dev/null @@ -1,34 +0,0 @@ - - - - -
-
-

Finish Installment

-
-
- - Bagisto is successfully installed on your system. Click the below button to launch Admin Panel. - -
-
- - - -
-
- - - - - - \ No newline at end of file diff --git a/public/installer/Images/favicon.ico b/public/installer/Images/favicon.ico deleted file mode 100755 index e9c217bb3..000000000 Binary files a/public/installer/Images/favicon.ico and /dev/null differ diff --git a/public/installer/Images/green-check.svg b/public/installer/Images/green-check.svg deleted file mode 100755 index 25fbb6ab7..000000000 --- a/public/installer/Images/green-check.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - Check-Accent - Created with Sketch. - - - - - - - - - - - - - - \ No newline at end of file diff --git a/public/installer/Images/left-side.svg b/public/installer/Images/left-side.svg deleted file mode 100755 index 891572fc3..000000000 --- a/public/installer/Images/left-side.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - feature-bg-2 copy - Created with Sketch. - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/public/installer/Images/logo.svg b/public/installer/Images/logo.svg deleted file mode 100755 index 412899b60..000000000 --- a/public/installer/Images/logo.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - Logo+Text - Created with Sketch. - - - - - - - - - - \ No newline at end of file diff --git a/public/installer/Images/red-check.svg b/public/installer/Images/red-check.svg deleted file mode 100755 index 6911d37d2..000000000 --- a/public/installer/Images/red-check.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - Check-Accent Copy - Created with Sketch. - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/public/installer/Images/right-side.svg b/public/installer/Images/right-side.svg deleted file mode 100755 index a45fd2f75..000000000 --- a/public/installer/Images/right-side.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - feature-bg-2 - Created with Sketch. - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/public/installer/JS/script b/public/installer/JS/script deleted file mode 100755 index b2662e77d..000000000 --- a/public/installer/JS/script +++ /dev/null @@ -1,83 +0,0 @@ - \ No newline at end of file diff --git a/public/installer/Migration.php b/public/installer/Migration.php deleted file mode 100755 index b2620d893..000000000 --- a/public/installer/Migration.php +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - -
-
-

Migration & Seed

- -
-
- -
-
-
-
-
-
-
-
-
-
-
- -
-
- Click the below button to run following : -
-
- Database Migartion -
-
- Database Seeder -
-
- Publishing Vendor -
-
- Generating Application Key -
-
- - Checking Composer Dependency - Migrating Database - Seeding Data -
- -
-
- - -
-
- back -
-
- -
-
- - - - - - \ No newline at end of file diff --git a/public/installer/MigrationRun.php b/public/installer/MigrationRun.php deleted file mode 100755 index fcb9bb1c1..000000000 --- a/public/installer/MigrationRun.php +++ /dev/null @@ -1,14 +0,0 @@ -&1'; -$seeder = 'cd ../.. && php artisan db:seed 2>&1'; -$publish = 'cd ../.. && php artisan vendor:publish --all --force 2>&1'; - -$key_output = exec($key, $data['key'], $data['key_results']); -$seeder_output = exec($seeder, $data['seeder'], $data['seeder_results']); -$publish = exec($publish, $data['publish'], $data['publish_results']); - -// return a response -//return all our data to an AJAX call - -echo json_encode($data); \ No newline at end of file diff --git a/public/installer/Views/requirements.blade.php b/public/installer/Views/requirements.blade.php deleted file mode 100755 index a746ac2a4..000000000 --- a/public/installer/Views/requirements.blade.php +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - -
-
-

Requirement

- -
-
- Please wait while we are checking the requirements -
- -
- - - - PHP - ( or Higher) -
- - $require): ?> - - $enabled) : ?> -
- - - - - ( Required) -
- - - - - - - - Composer - - - -
- - - -
- -
- - -
- -
- - - -
-
- - - - diff --git a/public/installer/Views/welcome.blade.php b/public/installer/Views/welcome.blade.php deleted file mode 100755 index 4230adedd..000000000 --- a/public/installer/Views/welcome.blade.php +++ /dev/null @@ -1,44 +0,0 @@ - - - - -
-
-

Welcome to Bagisto

- -
-
- - Have you ever heard of an old saying, “No man is an island”? We probably heard that a million times. That saying is actually true because when we became successful, we usually achieve that because someone has helped us. And our thank-you speech skills could be the best thing we can do in return. You may also see - - -
- INTRODUCTION -
- - - Have you ever heard of an old saying, “No man is an island”? We probably heard that a million times. That saying is actually true because when we became successful, we usually achieve that because someone has helped us. And our thank-you speech skills could be the best thing we can do in return. You may also see - -
-
- -
- -
-
-
- - - - - - - - - - - - - - - diff --git a/public/installer/index.php b/public/installer/index.php deleted file mode 100755 index 46853c3f3..000000000 --- a/public/installer/index.php +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Bagisto Installer - - - - - - - - -
-
- -
- - -
- - connect_error) { - // retrieving admin entry - $sql = "SELECT id, name FROM admins"; - $result = $conn->query($sql); - - if ($result) { - $installed = true; - } - } - - $conn->close(); - } else { - $installed = true; - } - } - - if (!$installed) { - - // including classes - include __DIR__ . '/Classes/Requirement.php'; - - // including php files - include __DIR__ . '/Environment.php'; - include __DIR__ . '/Migration.php'; - include __DIR__ . '/Admin.php'; - include __DIR__ . '/Finish.php'; - - // including js - include __DIR__ . '/JS/script'; - - // object creation - $requirement = new Requirement(); - echo $requirement->render(); - } else { - // getting url - $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; - - $url = explode("/", $actual_link); - array_pop($url); - array_pop($url); - $url = implode("/", $url); - $url = $url . '/404'; - - // redirecting to 404 error page - header("Location: $url"); - } - ?> - - - diff --git a/public/installer/install.php b/public/installer/install.php deleted file mode 100755 index 4378aacef..000000000 --- a/public/installer/install.php +++ /dev/null @@ -1,88 +0,0 @@ -connect_error) { - // retrieving admin entry - $sql = "SELECT id, name FROM admins"; - $result = $conn->query($sql); - - if ($result) { - $installed = true; - } - } - - $conn->close(); - } else { - $installed = true; - } - } - - if (!$installed) { - // getting url - $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; - - $url = explode("/", $actual_link); - array_pop($url); - $url = implode("/", $url); - $url = $url . '/installer'; - - return $url; - } else { - return null; - } -?> - - -