This commit is contained in:
2026-09-15 10:26:34 +08:00
commit ecf36afa56
10493 changed files with 1404888 additions and 0 deletions
+7977
View File
File diff suppressed because it is too large Load Diff
+9
View File
@@ -0,0 +1,9 @@
Copyright © 2013-present Magento, Inc.
Each Magento source file included in this distribution is licensed under OSL 3.0 or the Magento Enterprise Edition (MEE) license
http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
Please see LICENSE.txt for the full text of the OSL 3.0 license or contact license@magentocommerce.com for a copy.
Subject to Licensee's payment of fees and compliance with the terms and conditions of the MEE License, the MEE License supersedes the OSL 3.0 license for each source file.
Please see LICENSE_EE.txt for the full text of the MEE License or visit http://magento.com/legal/terms/enterprise.
+110
View File
@@ -0,0 +1,110 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// For performance use one level down: 'name/{,*/}*.js'
// If you want to recursively match all subfolders, use: 'name/**/*.js'
module.exports = function (grunt) {
'use strict';
var _ = require('underscore'),
path = require('path'),
filesRouter = require('./dev/tools/grunt/tools/files-router'),
configDir = './dev/tools/grunt/configs',
tasks = grunt.file.expand('./dev/tools/grunt/tasks/*'),
themes;
filesRouter.set('themes', 'dev/tools/grunt/configs/themes');
themes = filesRouter.get('themes');
tasks = _.map(tasks, function (task) {
return task.replace('.js', '');
});
tasks.push('time-grunt');
tasks.forEach(function (task) {
require(task)(grunt);
});
require('load-grunt-config')(grunt, {
configPath: path.join(__dirname, configDir),
init: true,
jitGrunt: {
staticMappings: {
usebanner: 'grunt-banner'
}
}
});
_.each({
/**
* Assembling tasks.
* ToDo: define default tasks.
*/
default: function () {
grunt.log.subhead('I\'m default task and at the moment I\'m empty, sorry :/');
},
/**
* Production preparation task.
*/
prod: function (component) {
var tasks = [
'less',
'cssmin',
'usebanner'
].map(function (task) {
return task + ':' + component;
});
if (typeof component === 'undefined') {
grunt.log.subhead('Tip: Please make sure that u specify prod subtask. By default prod task do nothing');
} else {
grunt.task.run(tasks);
}
},
/**
* Refresh themes.
*/
refresh: function () {
var tasks = [
'clean',
'exec:all'
];
_.each(themes, function (theme, name) {
tasks.push('less:' + name);
});
grunt.task.run(tasks);
},
/**
* Documentation
*/
documentation: [
'replace:documentation',
'less:documentation',
'styledocco:documentation',
'usebanner:documentationCss',
'usebanner:documentationLess',
'usebanner:documentationHtml',
'clean:var',
'clean:pub'
],
'legacy-build': [
'mage-minify:legacy'
],
spec: function (theme) {
var runner = require('./dev/tests/js/jasmine/spec_runner');
runner.init(grunt, { theme: theme });
grunt.task.run(runner.getTasks());
}
}, function (task, name) {
grunt.registerTask(name, task);
});
};
+48
View File
@@ -0,0 +1,48 @@
Open Software License ("OSL") v. 3.0
This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
Licensed under the Open Software License version 3.0
1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
1. to reproduce the Original Work in copies, either alone or as part of a collective work;
2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License;
4. to perform the Original Work publicly; and
5. to display the Original Work publicly.
2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
16. Modification of This License. This License is Copyright (C) 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
+48
View File
@@ -0,0 +1,48 @@
Academic Free License ("AFL") v. 3.0
This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
Licensed under the Academic Free License version 3.0
1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
1. to reproduce the Original Work in copies, either alone or as part of a collective work;
2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
4. to perform the Original Work publicly; and
5. to display the Original Work publicly.
2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
+10
View File
@@ -0,0 +1,10 @@
# Reporting Security Issues
Magento values the contributions of the security research community, and we look forward to working with you to minimize risk to Magento merchants.
## Where should I report security issues?
We strongly encourage you to report all security issues privately via our [bug bounty program](https://hackerone.com/adobe). Please provide us with relevant technical details and repro steps to expedite our investigation. If you prefer not to use HackerOne, email us directly at `psirt@adobe.com` with details and repro steps.
## Learning More About Security
To learn more about securing a Magento store, please visit the [Security Center](https://magento.com/security).
+18
View File
@@ -0,0 +1,18 @@
diff --git a/vendor/magento/framework/Webapi/ServiceInputProcessor.php b/vendor/magento/framework/Webapi/ServiceInputProcessor.php
index ba58dc2bc7acf..06919af36d2eb 100644
--- a/vendor/magento/framework/Webapi/ServiceInputProcessor.php
+++ b/vendor/magento/framework/Webapi/ServiceInputProcessor.php
@@ -246,6 +246,13 @@ private function getConstructorData(string $className, array $data): array
if (isset($data[$parameter->getName()])) {
$parameterType = $this->typeProcessor->getParamType($parameter);
+ // Allow only simple types or Api Data Objects
+ if (!($this->typeProcessor->isTypeSimple($parameterType)
+ || preg_match('~\\\\?\w+\\\\\w+\\\\Api\\\\Data\\\\~', $parameterType) === 1
+ )) {
+ continue;
+ }
+
try {
$res[$parameter->getName()] = $this->convertValue($data[$parameter->getName()], $parameterType);
} catch (\ReflectionException $e) {
+8
View File
@@ -0,0 +1,8 @@
<IfVersion < 2.4>
order allow,deny
deny from all
</IfVersion>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
+52
View File
@@ -0,0 +1,52 @@
<?php
/**
* Register basic autoloader that uses include path
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
use Magento\Framework\Autoload\AutoloaderRegistry;
use Magento\Framework\Autoload\ClassLoaderWrapper;
/**
* Shortcut constant for the root directory
*/
\define('BP', \dirname(__DIR__));
\define('VENDOR_PATH', BP . '/app/etc/vendor_path.php');
if (!\is_readable(VENDOR_PATH)) {
throw new \Exception(
'We can\'t read some files that are required to run the Magento application. '
. 'This usually means file permissions are set incorrectly.'
);
}
$vendorAutoload = (
static function (): ?string {
$vendorDir = require VENDOR_PATH;
$vendorAutoload = BP . "/{$vendorDir}/autoload.php";
if (\is_readable($vendorAutoload)) {
return $vendorAutoload;
}
$vendorAutoload = "{$vendorDir}/autoload.php";
if (\is_readable($vendorAutoload)) {
return $vendorAutoload;
}
return null;
}
)();
if ($vendorAutoload === null) {
throw new \Exception(
'Vendor autoload is not found. Please run \'composer install\' under application root directory.'
);
}
$composerAutoloader = include $vendorAutoload;
AutoloaderRegistry::registerAutoloader(new ClassLoaderWrapper($composerAutoloader));
+88
View File
@@ -0,0 +1,88 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Environment initialization
*/
error_reporting(E_ALL);
if (in_array('phar', \stream_get_wrappers())) {
stream_wrapper_unregister('phar');
}
#ini_set('display_errors', 1);
/* PHP version validation */
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 80100) {
if (PHP_SAPI == 'cli') {
echo 'Magento supports PHP 8.1.0 or later. ' .
'Please read https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/system-requirements.html';
} else {
echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
<p>Magento supports PHP 8.1.0 or later. Please read
<a target="_blank" href="https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/system-requirements.html">
Magento System Requirements</a>.
</div>
HTML;
}
http_response_code(503);
exit(1);
}
// PHP 8 compatibility. Define constants that are not present in PHP < 8.0
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 80000) {
if (!defined('T_NAME_QUALIFIED')) {
define('T_NAME_QUALIFIED', 24001);
}
if (!defined('T_NAME_FULLY_QUALIFIED')) {
define('T_NAME_FULLY_QUALIFIED', 24002);
}
}
require_once __DIR__ . '/autoload.php';
// Sets default autoload mappings, may be overridden in Bootstrap::create
\Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);
/* Custom umask value may be provided in optional mage_umask file in root */
$umaskFile = BP . '/magento_umask';
$mask = file_exists($umaskFile) ? octdec(file_get_contents($umaskFile)) : 002;
umask($mask);
if (empty($_SERVER['ENABLE_IIS_REWRITES']) || ($_SERVER['ENABLE_IIS_REWRITES'] != 1)) {
/*
* Unset headers used by IIS URL rewrites.
*/
unset($_SERVER['HTTP_X_REWRITE_URL']);
unset($_SERVER['HTTP_X_ORIGINAL_URL']);
unset($_SERVER['IIS_WasUrlRewritten']);
unset($_SERVER['UNENCODED_URL']);
unset($_SERVER['ORIG_PATH_INFO']);
}
if (
(!empty($_SERVER['MAGE_PROFILER']) || file_exists(BP . '/var/profiler.flag'))
&& isset($_SERVER['HTTP_ACCEPT'])
&& strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false
) {
$profilerConfig = isset($_SERVER['MAGE_PROFILER']) && strlen($_SERVER['MAGE_PROFILER'])
? $_SERVER['MAGE_PROFILER']
: trim(file_get_contents(BP . '/var/profiler.flag'));
if ($profilerConfig) {
$profilerConfig = json_decode($profilerConfig, true) ?: $profilerConfig;
}
Magento\Framework\Profiler::applyConfig(
$profilerConfig,
BP,
!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'
);
}
date_default_timezone_set('UTC');
/* For data consistency between displaying (printing) and serialization a float number */
ini_set('precision', 14);
ini_set('serialize_precision', 14);
+50
View File
@@ -0,0 +1,50 @@
# These are some examples of commonly ignored file patterns.
# You should customize this list as applicable to your project.
# Learn more about .gitignore:
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
# Node artifact files
node_modules/
dist/
# Compiled Java class files
*.class
# Compiled Python bytecode
*.py[cod]
# Log files
*.log
# Package files
*.jar
# Maven
target/
dist/
# JetBrains IDE
.idea/
# Unit test reports
TEST*.xml
# Generated by MacOS
.DS_Store
# Generated by Windows
Thumbs.db
# Applications
*.app
*.exe
*.war
# Large media files
*.mp4
*.tiff
*.avi
*.flv
*.mov
*.wmv
@@ -0,0 +1,58 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Block\Adminhtml\Conditions;
class AssignProduct extends \Magento\Backend\Block\Template
{
/**
* Block template
*
* @var string
*/
protected $_template = 'Magezon_Core::assign_items.phtml';
/**
* @var \Magezon\Core\Block\Adminhtml\Conditions\Product
*/
protected $blockGrid;
/**
* Retrieve instance of grid block
*
* @return \Magento\Framework\View\Element\BlockInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getBlockGrid()
{
if (null === $this->blockGrid) {
$this->blockGrid = $this->getLayout()->createBlock(
\Magezon\Core\Block\Adminhtml\Conditions\Product::class,
'product.grid'
);
}
return $this->blockGrid;
}
/**
* Return HTML of grid block
*
* @return string
*/
public function getGridHtml()
{
$button = $this->getLayout()->createBlock(PreviewButton::class);
return $button->toHtml() . $this->getBlockGrid()->toHtml();
}
}
@@ -0,0 +1,65 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Block\Adminhtml\Conditions;
class PreviewButton extends \Magento\Backend\Block\Template
{
protected $_template = 'Magezon_Core::conditions_preview_button.phtml';
/**
* @var \Magento\Framework\Registry
*/
protected $registry;
/**
* Constructor
*
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Registry $registry,
array $data = []
) {
parent::__construct($context, $data);
$this->registry = $registry;
}
/**
* @return mixed|null
*/
public function getFormName()
{
return $this->registry->registry('mgz_conditions_form_name');
}
/**
* @return string
*/
public function getButtonHtml()
{
$button = $this->getLayout()->createBlock(
\Magento\Backend\Block\Widget\Button::class
)->setData(
[
'id' => 'mgz_conditions_preview_btn',
'label' => __('Preview Products'),
'class' => 'save primary',
]
);
return $button->toHtml();
}
}
@@ -0,0 +1,378 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Block\Adminhtml\Conditions;
use Magento\Backend\Block\Template\Context;
use Magento\Backend\Block\Widget\Grid;
use Magento\Backend\Block\Widget\Grid\Extended;
use Magento\Backend\Helper\Data;
use Magento\Catalog\Model\Product\Attribute\Source\Status;
use Magento\Catalog\Model\Product\Visibility;
use Magento\Catalog\Model\ProductFactory;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Registry;
use Magento\Framework\App\CacheInterface;
use Magento\Framework\App\ObjectManager;
use Magezon\Core\Model\ConditionsProcessor;
class Product extends Extended
{
/**
* Cache group Tag
*/
const CACHE_GROUP = \Magento\Framework\App\Cache\Type\Config::TYPE_IDENTIFIER;
const CACHE_TAG = \Magento\Framework\App\Cache\Type\Config::CACHE_TAG;
/**
* Core registry
*
* @var Registry
*/
protected $_coreRegistry;
/**
* @var ResourceConnection
*/
protected $resource;
/**
* @var \Magento\Store\Model\System\Store
*/
protected $systemStore;
/**
* @var ConditionsProcessor
*/
protected $prosessor;
/**
* @var array
*/
protected $_cacheManager;
/**
* @var \Magezon\Core\Helper\Data
*/
protected $coreHelper;
/**
* @var Status
*/
protected $_status;
/**
* @var Visibility
*/
protected $_visibility;
/**
* @var ProductFactory
*/
protected $_productFactory;
/**
* @var \Magento\Framework\App\Cache\StateInterface
*/
protected $cacheState;
/**
* Product constructor.
* @param Context $context
* @param Data $backendHelper
* @param Status $status
* @param Visibility $visibility
* @param ProductFactory $productFactory
* @param Registry $coreRegistry
* @param ResourceConnection $resource
* @param \Magento\Store\Model\System\Store $systemStore
* @param \Magento\Framework\App\Cache\StateInterface $cacheState
* @param \Magezon\Core\Helper\Data $coreHelper
* @param ConditionsProcessor $processor
* @param array $data
*/
public function __construct(
Context $context,
Data $backendHelper,
Status $status,
Visibility $visibility,
ProductFactory $productFactory,
Registry $coreRegistry,
ResourceConnection $resource,
\Magento\Store\Model\System\Store $systemStore,
\Magento\Framework\App\Cache\StateInterface $cacheState,
\Magezon\Core\Helper\Data $coreHelper,
ConditionsProcessor $processor,
array $data = []
) {
$this->resource = $resource;
$this->_status = $status;
$this->_visibility = $visibility;
$this->_productFactory = $productFactory;
$this->_coreRegistry = $coreRegistry;
$this->systemStore = $systemStore;
$this->cacheState = $cacheState;
$this->coreHelper = $coreHelper;
$this->prosessor = $processor;
parent::__construct($context, $backendHelper, $data);
}
/**
* @return void
*/
protected function _construct()
{
parent::_construct();
$this->setId('mgz_conditions_product');
$this->setDefaultSort('entity_id');
$this->setUseAjax(true);
}
/**
* @return \Magento\Rule\Model\AbstractModel
*/
public function getModel()
{
return $this->_coreRegistry->registry('mgz_conditions_model');
}
/**
* @return int
*/
public function getGridId()
{
return $this->getRequest()->getParam('mgz_conditions_grid_id');
}
/**
* @return Grid
*/
protected function _prepareCollection()
{
$productIds = $this->getProductIds();
$collection = $this->_productFactory->create()->getCollection();
$collection->addAttributeToSelect(
['name', 'url_key', 'visibility', 'status', 'price', 'small_image', 'created_at']
);
$tableName = $collection->getTable('cataloginventory_stock_item');
$collection->getSelect()->joinLeft(
['_inventory_table' => $tableName],
"_inventory_table.product_id = e.entity_id",
['is_in_stock']
);
$collection->getSelect()->group('e.entity_id');
$this->setCollection($collection);
if (empty($productIds)) {
$productIds = 0;
}
$this->getCollection()->addFieldToFilter('entity_id', ['in' => $productIds]);
$sortOrder = $this->getModel()->getSortOrder();
if ($sortOrder != null) {
switch ($sortOrder) {
case '0':
$this->getCollection()->addAttributeToSort('entity_id', 'ASC');
break;
case '1':
$this->getCollection()->getSelect()->order('created_at DESC');
break;
case '2':
$this->getCollection()->getSelect()->order(['is_in_stock DESC']);
break;
case '3':
$this->getCollection()->addAttributeToSort('name', 'ASC');
break;
case '4':
$this->getCollection()->addAttributeToSort('name', 'DESC');
break;
case '5':
$this->getCollection()->addAttributeToSort('price', 'ASC');
break;
case '6':
$this->getCollection()->addAttributeToSort('price', 'DESC');
break;
}
}
return parent::_prepareCollection();
}
/**
* Get product ids by file model
*
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
protected function getProductIds()
{
$model = $this->getModel();
$formRegistry = $this->_coreRegistry->registry('mgz_conditions_form_name');
$formName = $model->getFormName() ? $model->getFormName() : $formRegistry;
if ($formName != 'mgz_landing_page_form') {
$productIds = $this->getFromCache();
if (!empty($productIds)) {
return $productIds;
}
}
$storeIds = $model->getStoreId();
$productIds = [];
if (!empty($storeIds)) {
if (in_array(0, $storeIds)) {
$stores = $this->systemStore->getStoreValuesForForm();
foreach ($stores as $store) {
if (is_array($store['value']) && !empty($store['value'])) {
foreach ($store['value'] as $_store) {
$store = $this->_storeManager->getStore($_store['value']);
$productIds = $this->prosessor->getProductByConditions($model, $store)->getAllIds();
}
}
}
} else {
foreach ($storeIds as $storeId) {
$store = $this->_storeManager->getStore($storeId);
$productIds = $this->prosessor->getProductByConditions($model, $store)->getAllIds();
}
}
}
if ($formName!= 'mgz_landing_page_form') {
$this->saveToCache($productIds);
}
return $productIds;
}
/**
* @return Extended
*/
protected function _prepareColumns()
{
$this->addColumn(
'entity_id',
[
'header' => __('ID'),
'sortable' => true,
'index' => 'entity_id',
'header_css_class' => 'col-id',
'column_css_class' => 'col-id'
]
);
$this->addColumn(
'name',
[
'header' => __('Title'),
'index' => 'name'
]
);
$this->addColumn(
'sku',
[
'header' => __('SKU'),
'index' => 'sku'
]
);
$this->addColumn(
'status',
[
'header' => __('Status'),
'index' => 'status',
'type' => 'options',
'header_css_class' => 'col-status data-grid-actions-cell',
'source' => Status::class,
'options' => $this->_status->getOptionArray()
]
);
$this->addColumn(
'visibility',
[
'header' => __('Visibility'),
'index' => 'visibility',
'type' => 'options',
'options' => $this->_visibility->getOptionArray(),
'header_css_class' => 'col-visibility data-grid-actions-cell',
'column_css_class' => 'col-visibility'
]
);
return parent::_prepareColumns();
}
/**
* @return string
*/
public function getGridUrl()
{
return $this->getUrl(
'mgzcore/conditions/productlist',
['current' => true, 'mgz_conditions_grid_id' => $this->getGridId()]
);
}
/**
* @param string $key
* @return string
*/
public function getGridCacheKey()
{
return $this->getGridId();
}
/**
* @return mixed|void
*/
public function getFromCache()
{
if (!$this->getRequest()->getParam('current') || !$this->getGridId()) return;
if ($this->cacheState->isEnabled(self::CACHE_GROUP)) {
$key = $this->getGridCacheKey();
$config = $this->getCacheManager()->load($key);
if ($config) {
return $this->coreHelper->unserialize($config);
}
}
}
/**
* @param $value
*/
public function saveToCache($value)
{
if ($this->cacheState->isEnabled(self::CACHE_GROUP)) {
$key = $this->getGridCacheKey();
$this->getCacheManager()->save(
$this->coreHelper->serialize($value),
$key,
[
self::CACHE_TAG
]
);
}
}
/**
* Retrieve cache interface
*
* @return CacheInterface
* @deprecated 101.0.3
*/
private function getCacheManager()
{
if (!$this->_cacheManager) {
$this->_cacheManager = ObjectManager::getInstance()
->get(CacheInterface::class);
}
return $this->_cacheManager;
}
}
@@ -0,0 +1,166 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Block\Adminhtml\Form\Element;
class Image extends \Magento\Framework\Data\Form\Element\AbstractElement
{
/**
* @var \Magento\Backend\Model\UrlInterface
*/
protected $_backendUrl;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $_storeManager;
/**
* @param \Magento\Framework\Data\Form\Element\Factory $factoryElement
* @param \Magento\Framework\Data\Form\Element\CollectionFactory $factoryCollection
* @param \Magento\Framework\Escaper $escaper
* @param \Magento\Backend\Model\UrlInterface $backendUrl
* @param \Magento\Store\Model\StoreManagerInterface $_storeManager
* @param array $data
*/
public function __construct(
\Magento\Framework\Data\Form\Element\Factory $factoryElement,
\Magento\Framework\Data\Form\Element\CollectionFactory $factoryCollection,
\Magento\Framework\Escaper $escaper,
\Magento\Backend\Model\UrlInterface $backendUrl,
\Magento\Store\Model\StoreManagerInterface $_storeManager,
$data = []
) {
parent::__construct($factoryElement, $factoryCollection, $escaper, $data);
$this->setType('text');
$this->setExtType('text');
$this->_backendUrl = $backendUrl;
$this->_storeManager = $_storeManager;
}
/**
* Get the Html for the element.
*
* @return string
*/
public function getElementHtml()
{
$html = '';
$htmlId = $this->getHtmlId();
$html .= '<div class="mgz-form_image">';
$beforeElementHtml = $this->getBeforeElementHtml();
if ($beforeElementHtml) {
$html .= '<label class="addbefore" for="' . $htmlId . '">' . $beforeElementHtml . '</label>';
}
$html .= '<input id="' . $htmlId . '" name="' . $this->getName() . '" ' . $this->_getUiId() . ' value="' .
$this->getEscapedValue() . '" ' . $this->serialize($this->getHtmlAttributes()) . '/>';
$visible = true;
if ($this->getDisabled()) {
$visible = false;
}
$html .= $this->_getButtonHtml(
[
'title' => __('Insert Image'),
'onclick' => "MgzMediabrowserUtility.openDialog('" . $this->_backendUrl->getUrl('mgzcore/wysiwyg_images/index', ['target_element_id'=> $this->getName()]) . "', false, false, 'Insert Image', {closed: function() { jQuery('#mceModalBlocker').show()}})",
'class' => 'action-add-image plugin',
'style' => $visible ? '' : 'display:none',
]
);
$afterElementJs = $this->getAfterElementJs();
if ($afterElementJs) {
$html .= $afterElementJs;
}
$afterElementHtml = $this->getAfterElementHtml();
if ($afterElementHtml) {
$html .= '<label class="addafter" for="' . $htmlId . '">' . $afterElementHtml . '</label>';
}
$html .= '</div>';
return $html;
}
/**
* Return custom button HTML
*
* @param array $data Button params
* @return string
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
protected function _getButtonHtml($data)
{
$htmlId = $this->getHtmlId();
$html = '<button type="button"';
$html .= ' class="scalable ' . (isset($data['class']) ? $data['class'] : '') . '"';
$html .= isset($data['onclick']) ? ' onclick="' . $data['onclick'] . '"' : '';
$html .= isset($data['style']) ? ' style="' . $data['style'] . '"' : '';
$html .= isset($data['id']) ? ' id="' . $data['id'] . '"' : '';
$html .= '>';
$html .= isset($data['title']) ? '<span><span><span>' . $data['title'] . '</span></span></span>' : '';
$html .= '</button>';
$imgSrc = $this->getValue();
if ($imgSrc && !preg_match("/^http\:\/\/|https\:\/\//", $imgSrc)) {
$imgSrc = $this->getMediaUrl() . $imgSrc;
}
$html .= '<div id="' . $htmlId . '-preview" class="image-preview" ' . ($imgSrc ? 'style="display: block"' : '') .'><a href="' . $imgSrc . '" id="' . $htmlId . '-preview_image"><img src="' . $imgSrc . '"/></a></div>';
$html .= '<script>
require(["jquery", "Magezon_Core/js/mage/browser"], function($) {
$("#' . $htmlId . '-preview_image").click(function(e) {
var win = window.open(\'\', \'preview\', \'width=500,height=500,resizable=1,scrollbars=1\');
win.document.open();
win.document.write(\'<body style="padding:0;margin:0"><img src="\'+$(this).find("img").eq(0).attr("src")+\'" id="image_preview"/></body>\');
win.document.close();
Event.observe(win, \'load\', function(){
var img = win.document.getElementById(\'image_preview\');
win.resizeTo(img.width+40, img.height+80)
});
return false;
});
$(document).on("keyup, change", "#' . $htmlId . '", function() {
var val = $(this).val();
if (val) {
$("#' . $htmlId . '-preview").show();
if (((val.indexOf("wysiwyg") !== -1) && (val.indexOf("http") === -1)) || ((val.indexOf("wysiwyg") === -1) && (val.indexOf("http") === -1))) {
$("#' . $htmlId . '-preview img").attr("src", "' . $this->getMediaUrl() . '" + val);
$("#' . $htmlId . '").attr("data-link", "' . $this->getMediaUrl() . '" + val);
} else {
$("#' . $htmlId . '-preview img").attr("src", val);
$("#' . $htmlId . '").attr("data-link", val);
}
} else {
$("#' . $htmlId . '-preview").hide();
}
}).change();
});
</script>';
return $html;
}
public function getMediaUrl()
{
$mediaUrl = $this->_storeManager->getStore()->getBaseUrl(
\Magento\Framework\UrlInterface::URL_TYPE_MEDIA
);
return $mediaUrl;
}
}
+50
View File
@@ -0,0 +1,50 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Block\Adminhtml;
class Head extends \Magento\Framework\View\Element\Template
{
/**
* @var \Magento\Backend\Model\UrlInterface
*/
protected $_backendUrl;
/**
* Constructor
*
* @param Template\Context $context
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Backend\Model\UrlInterface $backendUrl,
array $data = []
) {
parent::__construct($context, $data);
$this->_backendUrl = $backendUrl;
}
public function getMediaUrl()
{
return $this->_storeManager->getStore()->getBaseUrl(
\Magento\Framework\UrlInterface::URL_TYPE_MEDIA
);
}
public function getFilesBrowserWindowUrl()
{
return $this->_backendUrl->getUrl('mgzcore/wysiwyg_images/index');
}
}
@@ -0,0 +1,179 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Block\Adminhtml\Product\Widget;
use Magento\Backend\Block\Template;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\Data\Form\Element\Renderer\RendererInterface;
class Conditions extends Template implements RendererInterface
{
/**
* @var \Magento\Rule\Block\Conditions
*/
protected $conditions;
/**
* @var \Magento\CatalogWidget\Model\Rule
*/
protected $rule;
/**
* @var \Magento\Framework\Data\Form\Element\Factory
*/
protected $elementFactory;
/**
* @var \Magento\Framework\Registry
*/
protected $registry;
/**
* @var AbstractElement
*/
protected $element;
/**
* @var \Magento\Framework\Data\Form\Element\Text
*/
protected $input;
/**
* @var string
*/
protected $_template = 'Magento_CatalogWidget::product/widget/conditions.phtml';
/**
* @param \Magento\Framework\Data\Form\Element\Factory $elementFactory
* @param \Magento\Rule\Block\Conditions $conditions
* @param \Magento\CatalogWidget\Model\Rule $rule
* @param \Magento\Framework\Registry $registry
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Data\Form\Element\Factory $elementFactory,
\Magento\Rule\Block\Conditions $conditions,
\Magento\Rule\Block\ConditionsFactory $conditionsFactory,
\Magento\CatalogWidget\Model\Rule $rule,
\Magento\Framework\Registry $registry,
array $data = []
) {
$this->elementFactory = $elementFactory;
$this->conditions = $conditions;
$this->conditionsFactory = $conditionsFactory;
$this->registry = $registry;
parent::__construct($context, $data);
}
/**
* {@inheritdoc}
*/
public function render(AbstractElement $element)
{
$this->element = $element;
return $this->toHtml();
}
/**
* @return string
*/
public function getNewChildUrl()
{
return $this->getUrl(
'catalog_widget/product_widget/conditions',
[
'form' => $this->getHtmlId(),
'mgz_builder' => 1
]
);
}
/**
* @return AbstractElement
*/
public function getElement()
{
return $this->element;
}
/**
* @return string
*/
public function getHtmlId()
{
if ($this->hasData('htmlid')) {
return $this->getData('htmlid');
}
return $this->getElement()->getContainer()->getHtmlId();
}
public function getCurrentRule() {
if (!$this->rule) {
$this->rule = $this->getRule();
}
return $this->rule;
}
/**
* @return string
*/
public function getInputHtml()
{
$rule = $this->getRule();
$parameters = $this->getData('parameters');
if ($parameters) {
if (isset($parameters['conditions'])) {
$parameters['conditions'] = json_decode($parameters['conditions'], TRUE);
$rule->loadPost($parameters);
}
}
$this->input = $this->elementFactory->create('text');
$this->input->setRule($rule)->setRenderer($this->conditions);
$this->setConditionFormName($rule->getConditions(), $this->getHtmlId(), $this->getHtmlId());
return $this->input->toHtml();
}
/**
* @param AbstractCondition $conditions
* @param string $formName
* @param string $jsFormName
* @return void
*/
private function setConditionFormName($conditions, $formName, $jsFormName)
{
$conditions->setFormName($formName);
$conditions->setJsFormObject($jsFormName);
if ($conditions->getConditions() && is_array($conditions->getConditions())) {
foreach ($conditions->getConditions() as $condition) {
$this->setConditionFormName($condition, $formName, $jsFormName);
}
}
}
/**
* Escape string for the JavaScript context
*
* @param string $string
* @return string
* @since 101.0.0
*/
public function escapeJs($string)
{
return $this->_escaper->escapeJs($string);
}
}
@@ -0,0 +1,33 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Block\Adminhtml\System\Config\Form\Field;
use Magento\Config\Block\System\Config\Form\Field;
class Heading extends Field
{
/**
* render separator config row
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$html = '<tr id="row_' . $element->getHtmlId() . '">' . '<td class="label" colspan="3"><div class="mgz-system-heading">' . $element->getLabel() . '</div></td></tr>';
return $html;
}
}
@@ -0,0 +1,44 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Block\Adminhtml\System\Config\Form\Field;
use Magento\Config\Block\System\Config\Form\Field;
class Minicolors extends Field
{
/**
* render separator config row
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$html = parent::render($element);
$htmlId = $element->getHtmlId();
$html .= "<script>
require(['jquery', 'Magezon_Core/js/jquery.minicolors'], function($) {
$('#" . $htmlId . "').minicolors({
theme: 'bootstrap'
});
});
</script>
";
return $html;
}
}
+266
View File
@@ -0,0 +1,266 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Block\Adminhtml\Tab;
use Magento\Backend\Block\Widget\Form\Generic;
use Magento\Backend\Block\Widget\Form\Renderer\Fieldset;
use Magento\Framework\App\ObjectManager;
use Magento\Ui\Component\Layout\Tabs\TabInterface;
class Conditions extends Generic implements TabInterface
{
/**
* Core registry
*
* @var \Magento\Backend\Block\Widget\Form\Renderer\Fieldset
*/
protected $rendererFieldset;
/**
* @var \Magento\Rule\Block\Conditions
*/
protected $conditions;
/**
* @var string
*/
protected $_nameInLayout = 'conditions_serialized';
/**
* @var \Magento\SalesRule\Model\RuleFactory
*/
private $ruleFactory;
/**
* Initialize dependencies.
*
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Data\FormFactory $formFactory
* @param \Magento\Rule\Block\Conditions $conditions
* @param \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset
* @param \Magento\SalesRule\Model\RuleFactory $ruleFactory
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Data\FormFactory $formFactory,
\Magento\Rule\Block\Conditions $conditions,
\Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset,
\Magento\SalesRule\Model\RuleFactory $ruleFactory,
array $data = []
) {
$this->conditions = $conditions;
$this->rendererFieldset = $rendererFieldset;
$this->ruleFactory = $ruleFactory;
parent::__construct($context, $registry, $formFactory, $data);
}
/**
* The getter function to get the new RuleFactory dependency
*
* @return \Magento\SalesRule\Model\RuleFactory
*
* @deprecated
*/
private function getRuleFactory()
{
if ($this->ruleFactory === null) {
$this->ruleFactory = ObjectManager::getInstance()->get(\Magento\SalesRule\Model\RuleFactory::class);
}
return $this->ruleFactory;
}
/**
* {@inheritdoc}
* @codeCoverageIgnore
*/
public function getTabClass()
{
return null;
}
/**
* {@inheritdoc}
* @codeCoverageIgnore
*/
public function getTabUrl()
{
return null;
}
/**
* {@inheritdoc}
* @codeCoverageIgnore
*/
public function isAjaxLoaded()
{
return false;
}
/**
* {@inheritdoc}
* @codeCoverageIgnore
*/
public function getTabLabel()
{
return __('Conditions');
}
/**
* {@inheritdoc}
* @codeCoverageIgnore
*/
public function getTabTitle()
{
return __('Conditions');
}
/**
* {@inheritdoc}
* @codeCoverageIgnore
*/
public function canShowTab()
{
return true;
}
/**
* {@inheritdoc}
* @codeCoverageIgnore
*/
public function isHidden()
{
return false;
}
/**
* @return Conditions
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function _prepareForm()
{
$model = $this->_coreRegistry->registry('mgz_conditions_model');
$fieldsetId = $this->_coreRegistry->registry('mgz_conditions_fieldset');
$formName = $this->_coreRegistry->registry('mgz_conditions_form_name');
if (!$fieldsetId) {
$fieldsetId = 'conditions_fieldset';
}
$form = $this->addTabToForm($model, $formName, $fieldsetId);
$this->setForm($form);
return parent::_prepareForm();
}
/**
* @return string
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getGridHtml()
{
$previewBlock = $this->getLayout()->createBlock(
\Magezon\Core\Block\Adminhtml\Conditions\AssignProduct::class
);
return $previewBlock->toHtml();
}
/**
* @return string
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function toHtml()
{
return parent::toHtml() . $this->getGridHtml();
}
/**
* Handles addition of conditions tab to supplied form.
*
* @param \Magento\SalesRule\Model\Rule $model
* @param string $fieldsetId
* @param string $formName
* @return \Magento\Framework\Data\Form
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function addTabToForm(
$model,
$formName,
$fieldsetId = 'conditions_fieldset'
) {
$conditionsFieldSetId = $model->getConditionsFieldSetId($formName);
$newChildUrl = $this->getUrl(
'sales_rule/promo_quote/newConditionHtml/form/' . $conditionsFieldSetId,
['form_namespace' => $formName]
);
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create();
$form->setHtmlIdPrefix('rule_');
$renderer = $this->getLayout()->createBlock(Fieldset::class);
$renderer->setTemplate(
'Magento_CatalogRule::promo/fieldset.phtml'
)->setNewChildUrl(
$newChildUrl
)->setFieldSetId(
$conditionsFieldSetId
);
$fieldset = $form->addFieldset(
$fieldsetId,
[
'legend' => __(
'Apply the rule only if the following conditions are met (leave blank for all products).'
),
]
)->setRenderer(
$renderer
);
$fieldset->addField(
'conditions',
'text',
[
'name' => 'conditions',
'label' => __('Conditions'),
'title' => __('Conditions'),
'required' => true,
'data-form-part' => $formName,
]
)->setRule(
$model
)->setRenderer(
$this->conditions
);
$form->setValues($model->getData());
$this->setConditionFormName($model->getConditions(), $formName);
return $form;
}
/**
* Handles addition of form name to condition and its conditions.
*
* @param \Magento\Rule\Model\Condition\AbstractCondition $conditions
* @param string $formName
* @return void
*/
private function setConditionFormName(\Magento\Rule\Model\Condition\AbstractCondition $conditions, $formName)
{
$conditions->setFormName($formName);
if ($conditions->getConditions() && is_array($conditions->getConditions())) {
foreach ($conditions->getConditions() as $condition) {
$this->setConditionFormName($condition, $formName);
}
}
}
}
+130
View File
@@ -0,0 +1,130 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Block\Adminhtml;
use Magento\Framework\App\ObjectManager;
class TopMenu extends \Magento\Framework\View\Element\Template
{
/**
* @var \Magento\Framework\AuthorizationInterface
*/
protected $_authorization;
/**
* Own page title to display on the page
*
* @var string
*/
protected $pageTitle;
/**
* @return \Magento\Framework\AuthorizationInterface
*/
protected function getAuthorization()
{
if ($this->_authorization == null) {
$this->_authorization = ObjectManager::getInstance()->get(\Magento\Framework\AuthorizationInterface::class);
}
return $this->_authorization;
}
/**
* Check permission for passed action
*
* @param string $resourceId
* @return bool
*/
protected function _isAllowedAction($resourceId)
{
return $this->getAuthorization()->isAllowed($resourceId);
}
/**
* @return bool|void
*/
public function getLinks()
{
$links = $this->intLinks();
if ($links) {
foreach ($links as $z => &$_columnLinks) {
if (!isset($_columnLinks['title'])) {
foreach ($_columnLinks as $k => $_link) {
if (isset($_link['resource']) && !$this->_isAllowedAction($_link['resource'])) {
unset($_columnLinks[$k]);
}
}
} elseif (isset($_columnLinks['resource']) && !$this->_isAllowedAction($_columnLinks['resource'])) {
unset($links[$z]);
}
}
return $links;
}
return false;
}
/**
* @return string
*/
public function getSupportLink()
{
return 'https://magezon.ticksy.com';
}
/**
* @return void
*/
public function intLinks()
{
return;
}
/**
* Provide own page title or pick it from Head Block
*
* @return string
*/
public function getPageTitle()
{
if (!empty($this->pageTitle)) {
return $this->pageTitle;
}
return __($this->pageConfig->getTitle()->getShort());
}
/**
* Provide own page content heading
*
* @return string
*/
public function getPageHeading()
{
if (!empty($this->pageTitle)) {
return __($this->pageTitle);
}
return __($this->pageConfig->getTitle()->getShortHeading());
}
/**
* Set own page title
*
* @param string $pageTitle
* @return void
*/
public function setPageTitle($pageTitle)
{
$this->pageTitle = $pageTitle;
}
}
@@ -0,0 +1,31 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Block\Adminhtml\Widget\Field;
use Magento\Backend\Block\Template;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\Data\Form\Element\Renderer\RendererInterface;
class Heading extends Template implements RendererInterface
{
/**
* {@inheritdoc}
*/
public function render(AbstractElement $element)
{
$html = '<div class="mgz-heading">' . $element->getLabel() . '</div>';
return $html;
}
}
+242
View File
@@ -0,0 +1,242 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Block\Product;
use Magento\Catalog\Helper\ImageFactory as HelperFactory;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Image\NotLoadInfoImageException;
class ImageBuilder
{
protected $_imageWidth;
protected $_imageHeight;
protected $_resizeImageWidth;
protected $_resizeImageHeight;
/**
* @var ImageFactory
*/
protected $imageFactory;
/**
* @var HelperFactory
*/
protected $helperFactory;
/**
* @var Product
*/
protected $product;
/**
* @var string
*/
protected $imageId;
/**
* @var array
*/
protected $attributes = [];
/**
* @param HelperFactory $helperFactory
* @param ImageFactory $imageFactory
*/
public function __construct(
HelperFactory $helperFactory,
\Magento\Catalog\Block\Product\ImageFactory $imageFactory
) {
$this->helperFactory = $helperFactory;
$this->imageFactory = $imageFactory;
}
/**
* Set product
*
* @param Product $product
* @return $this
*/
public function setProduct(Product $product)
{
$this->product = $product;
return $this;
}
/**
* Set image ID
*
* @param string $imageId
* @return $this
*/
public function setImageId($imageId)
{
$this->imageId = $imageId;
return $this;
}
/**
* Set custom attributes
*
* @param array $attributes
* @return $this
*/
public function setAttributes(array $attributes)
{
$this->attributes = $attributes;
return $this;
}
/**
* Retrieve image custom attributes for HTML element
*
* @return string
*/
protected function getCustomAttributes()
{
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$productMetadata = $objectManager->get('Magento\Framework\App\ProductMetadataInterface');
if ($productMetadata->getVersion() < '2.4.0') {
$result = [];
foreach ($this->attributes as $name => $value) {
$result[] = $name . '="' . $value . '"';
}
return !empty($result) ? implode(' ', $result) : '';
}
return $this->attributes;
}
/**
* Calculate image ratio
*
* @param \Magento\Catalog\Helper\Image $helper
* @return float|int
*/
protected function getRatio(\Magento\Catalog\Helper\Image $helper)
{
$width = $helper->getWidth();
$height = $helper->getHeight();
if ($width && $height) {
return $height / $width;
}
return 1;
}
public function setImageWidth($imageWidth)
{
$this->_imageWidth = $imageWidth;
return $this;
}
public function getImageWidth()
{
return $this->_imageWidth;
}
public function setImageHeight($imageHeight)
{
$this->_imageHeight = $imageHeight;
return $this;
}
public function getImageHeight()
{
return $this->_imageHeight;
}
public function setResizeImageWidth($resizeImageWidth)
{
$this->_resizeImageWidth = $resizeImageWidth;
return $this;
}
public function getResizeImageWidth()
{
return $this->_resizeImageWidth;
}
public function setResizeImageHeight($resizeImageHeight)
{
$this->_resizeImageHeight = $resizeImageHeight;
return $this;
}
public function getResizeImageHeight()
{
return $this->_resizeImageHeight;
}
/**
* Create image block
*
* @return \Magento\Catalog\Block\Product\Image
*/
public function create(Product $product = null, $imageId = null, array $attributes = null)
{
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$attrs = [];
if ($this->getImageWidth()) {
$attrs['width'] = $this->getImageWidth();
}
if ($this->getImageHeight()) {
$attrs['height'] = $this->getImageHeight();
}
/** @var \Magento\Catalog\Helper\Image $helper */
$helper = $this->helperFactory->create()->init($this->product, $this->imageId, $attrs);
$template = $helper->getFrame()
? 'Magento_Catalog::product/image.phtml'
: 'Magento_Catalog::product/image_with_borders.phtml';
$imagesize = $helper->getResizedImageInfo();
$imageWidth = $this->getImageWidth()?$this->getImageWidth():$helper->getWidth();
$imageHeight = $this->getImageHeight()?$this->getImageHeight():$helper->getHeight();
if ($this->getResizeImageWidth()) {
$resizeImageWidth = $this->getResizeImageWidth();
} else {
$resizeImageWidth = !empty($imagesize[0]) ? $imagesize[0] : $helper->getWidth();
}
if ($this->getResizeImageHeight()) {
$resizeImageHeight = $this->getResizeImageHeight();
} else {
$resizeImageHeight = !empty($imagesize[1]) ? $imagesize[1] : $helper->getHeight();
}
$data = [
'template' => $template,
'image_url' => $helper->getUrl(),
'width' => $imageWidth,
'height' => $imageHeight,
'label' => $helper->getLabel(),
'ratio' => $this->getRatio($helper),
'custom_attributes' => $this->getCustomAttributes(),
'resized_image_width' => $resizeImageWidth,
'resized_image_height' => $resizeImageHeight,
'class' => 'product-image-photo'
];
$productMetadata = $objectManager->get('Magento\Framework\App\ProductMetadataInterface');
if ($productMetadata->getVersion() < '2.3.0') {
return $this->imageFactory->create(['data' => $data]);
} else {
$helper = $this->imageFactory->create($this->product, $this->imageId, $attrs);
$helper->setData($data);
return $helper;
}
}
}
@@ -0,0 +1,96 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_ProductAttachments
* @copyright Copyright (C) 2020 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Controller\Adminhtml\Conditions;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Controller\Result\Raw;
use Magento\Framework\Controller\Result\RawFactory;
use Magento\Framework\Registry;
use Magento\Framework\View\LayoutFactory;
use Magezon\Core\Block\Adminhtml\Conditions\Product;
use Magento\CatalogRule\Model\Rule;
class ProductList extends Action
{
/**
* @var RawFactory
*/
protected $resultRawFactory;
/**
* @var LayoutFactory
*/
protected $layoutFactory;
/**
* @var Registry
*/
protected $_coreRegistry;
/**
* @var Product
*/
protected $gridProduct;
/**
* @param Context $context
* @param RawFactory $resultRawFactory
* @param LayoutFactory $layoutFactory
* @param Registry $registry
*/
public function __construct(
Context $context,
RawFactory $resultRawFactory,
LayoutFactory $layoutFactory,
Registry $registry,
Product $gridProduct
) {
parent::__construct($context);
$this->resultRawFactory = $resultRawFactory;
$this->layoutFactory = $layoutFactory;
$this->_coreRegistry = $registry;
$this->gridProduct = $gridProduct;
}
/**
* Grid Action
* Display list of products related to current post
*
* @return Raw
*/
public function execute()
{
$data = $this->getRequest()->getParams();
if (isset($data['rule'])) {
$data['conditions'] = $data['rule']['conditions'];
unset($data['rule']);
}
unset($data['conditions_serialized']);
unset($data['actions_serialized']);
$file = $this->_objectManager->create(Rule::class);
$file->loadPost($data);
$this->_coreRegistry->unregister('mgz_conditions_model');
$this->_coreRegistry->register('mgz_conditions_model', $file);
/** @var Raw $resultRaw */
$resultRaw = $this->resultRawFactory->create();
return $resultRaw->setContents(
$this->layoutFactory->create()->createBlock(
\Magezon\Core\Block\Adminhtml\Conditions\Product::class,
'product.grid'
)->toHtml()
);
}
}
@@ -0,0 +1,62 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Controller\Adminhtml\Wysiwyg\Images;
class Index extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images
{
/**
* @var \Magento\Framework\View\Result\LayoutFactory
*/
protected $resultLayoutFactory;
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $coreRegistry,
\Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
) {
$this->resultLayoutFactory = $resultLayoutFactory;
parent::__construct($context, $coreRegistry);
}
/**
* Index action
*
* @return \Magento\Framework\Controller\ResultInterface
*/
public function execute()
{
$storeId = (int)$this->getRequest()->getParam('store');
try {
$this->_objectManager->get('Magento\Cms\Helper\Wysiwyg\Images')->getCurrentPath();
} catch (\Exception $e) {
$this->messageManager->addError($e->getMessage());
}
$this->_initAction();
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
$resultLayout = $this->resultLayoutFactory->create();
$resultLayout->addHandle('overlay_popup');
$block = $resultLayout->getLayout()->getBlock('wysiwyg_images.js');
if ($block) {
$block->setStoreId($storeId);
}
return $resultLayout;
}
}
@@ -0,0 +1,61 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Controller\Adminhtml\Wysiwyg\Images;
class OnInsert extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images
{
/**
* @var \Magento\Framework\Controller\Result\RawFactory
*/
protected $resultRawFactory;
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $coreRegistry,
\Magento\Framework\Controller\Result\RawFactory $resultRawFactory
) {
$this->resultRawFactory = $resultRawFactory;
parent::__construct($context, $coreRegistry);
}
/**
* Fire when select image
*
* @return \Magento\Framework\Controller\ResultInterface
*/
public function execute()
{
$helper = $this->_objectManager->get('Magezon\Core\Helper\Wysiwyg\Images');
$storeId = $this->getRequest()->getParam('store');
$filename = $this->getRequest()->getParam('filename');
$filename = $helper->idDecode($filename);
$asIs = $this->getRequest()->getParam('as_is');
$this->_objectManager->get('Magento\Catalog\Helper\Data')->setStoreId($storeId);
$helper->setStoreId($storeId);
$image = $helper->getImageHtmlDeclaration($filename, $asIs);
/** @var \Magento\Framework\Controller\Result\Raw $resultRaw */
$resultRaw = $this->resultRawFactory->create();
return $resultRaw->setContents($image);
}
}
@@ -0,0 +1,50 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Framework\SearchCriteria;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Data\Collection\AbstractDb;
class CollectionProcessor implements CollectionProcessorInterface
{
/**
* @var CollectionProcessorInterface[]
*/
private $processors;
/**
* @param CollectionProcessorInterface[] $processors
*/
public function __construct(
array $processors
) {
$this->processors = $processors;
}
/**
* @inheritDoc
*/
public function process(SearchCriteriaInterface $searchCriteria, AbstractDb $collection)
{
foreach ($this->processors as $name => $processor) {
if (!($processor instanceof CollectionProcessorInterface)) {
throw new \InvalidArgumentException(
sprintf('Processor %s must implement %s interface.', $name, CollectionProcessorInterface::class)
);
}
$processor->process($searchCriteria, $collection);
}
}
}
@@ -0,0 +1,32 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Framework\SearchCriteria;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Data\Collection\AbstractDb;
interface CollectionProcessorInterface
{
/**
* Apply Search Criteria to Collection
*
* @param SearchCriteriaInterface $searchCriteria
* @param AbstractDb $collection
* @throws \InvalidArgumentException
* @return void
* @since 100.2.0
*/
public function process(SearchCriteriaInterface $searchCriteria, AbstractDb $collection);
}
@@ -0,0 +1,44 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Framework\Serialize\Serializer;
class Json
{
/**
* {@inheritDoc}
* @since 100.2.0
*/
public function serialize($data)
{
$result = json_encode($data);
if (false === $result) {
throw new \InvalidArgumentException('Unable to serialize value.');
}
return $result;
}
/**
* {@inheritDoc}
* @since 100.2.0
*/
public function unserialize($string)
{
$result = json_decode($string, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \InvalidArgumentException('Unable to unserialize value.');
}
return $result;
}
}
+36
View File
@@ -0,0 +1,36 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Framework\Stdlib;
class ArrayManager extends \Magento\Framework\Stdlib\ArrayManager
{
/**
* Finds node in nested array and saves its index and parent node reference
*
* @param string $path
* @param array $data
* @param string $delimiter
* @param bool $populate
* @return bool
*/
protected function find($path, array &$data, $delimiter, $populate = false)
{
if (is_array($path)) {
$path = implode($delimiter, $path);
}
return parent::find($path, $data, $delimiter, $populate);
}
}
+171
View File
@@ -0,0 +1,171 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Helper;
use Magento\Framework\App\Filesystem\DirectoryList;
class Api extends \Magento\Framework\App\Helper\AbstractHelper
{
/**
* @var \Magento\Framework\Filesystem
*/
protected $fileSystem;
/**
* @param \Magento\Framework\App\Helper\Context $context
* @param \Magento\Framework\Filesystem $fileSystem
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Framework\Filesystem $fileSystem
) {
parent::__construct($context);
$this->fileSystem = $fileSystem;
}
public function imagePreprocessing($fileContent, $saveFolder, $enableFilesDispersion = false)
{
if (strpos($fileContent, 'base64') === false) {
return $fileContent;
}
$mediaDirectory = $this->fileSystem->getDirectoryRead(DirectoryList::MEDIA);
if (is_array($fileContent)) {
$imageData = explode("base64,", $fileContent['base64_encoded_data'])[1];
} else {
$imageData = explode("base64,", $fileContent)[1];
}
$imageData = base64_decode($imageData);
$destinationFolder = $mediaDirectory->getAbsolutePath($saveFolder) . '/';
if (!file_exists($destinationFolder)) {
mkdir($destinationFolder, 0777, true);
}
if (is_array($fileContent)) {
if (!isset($fileContent['name'])) {
$name = uniqid();
} else {
$name = $fileContent['name'];
}
} else {
$name = uniqid();
}
if (strpos($name, '.') === false) {
$name .= '.jpg';
}
$actual_name = pathinfo($destinationFolder . $name,PATHINFO_FILENAME);
$original_name = $actual_name;
$extension = pathinfo($destinationFolder . $name, PATHINFO_EXTENSION);
$i = 1;
if ($enableFilesDispersion) {
if ($this->endsWith($destinationFolder, "/")) {
$destinationFolder = substr($destinationFolder, 0, -1);
}
$dispertionPath = $this->getDispretionPath($name) . '/';
$destinationFolder .= $dispertionPath;
$this->_createDestinationFolder($destinationFolder);
}
while(file_exists($destinationFolder . $actual_name . '.' . $extension))
{
$actual_name = (string) $original_name . $i;
$name = $actual_name . "." . $extension;
$i++;
}
$success = file_put_contents($destinationFolder . $name, $imageData);
if ($success) {
if ($enableFilesDispersion) {
return $dispertionPath . $name;
}
return $name;
}
return null;
}
/**
* Get dispertion path
*
* @param string $fileName
* @return string
*/
public static function getDispretionPath($fileName)
{
$char = 0;
$dispertionPath = '';
while ($char < 2 && $char < strlen($fileName)) {
if (empty($dispertionPath)) {
$dispertionPath = '/' . ('.' == $fileName[$char] ? '_' : $fileName[$char]);
} else {
$dispertionPath = self::_addDirSeparator(
$dispertionPath
) . ('.' == $fileName[$char] ? '_' : $fileName[$char]);
}
$char++;
}
return $dispertionPath;
}
/**
* Add directory separator
*
* @param string $dir
* @return string
*/
protected static function _addDirSeparator($dir)
{
if (substr($dir, -1) != '/') {
$dir .= '/';
}
return $dir;
}
/**
* Create destination folder
*
* @param string $destinationFolder
* @return \Magento\Framework\File\Uploader
* @throws \Exception
*/
private function _createDestinationFolder($destinationFolder)
{
if (!$destinationFolder) {
return $this;
}
if (substr($destinationFolder, -1) == '/') {
$destinationFolder = substr($destinationFolder, 0, -1);
}
if (!(is_dir($destinationFolder)
|| mkdir($destinationFolder, 0777, true)
)) {
throw new \Exception("Unable to create directory '{$destinationFolder}'.");
}
return $this;
}
public function endsWith($haystack, $needle)
{
$length = strlen($needle);
return $length === 0 ||
(substr($haystack, -$length) === $needle);
}
}
+456
View File
@@ -0,0 +1,456 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Helper;
use \Magento\Framework\App\ObjectManager;
class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
/**
* Default charset
*/
const ICONV_CHARSET = 'UTF-8';
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $_storeManager;
/**
* @var \Magento\Cms\Model\Template\FilterProvider
*/
protected $filterProvider;
/**
* @var \Magento\Framework\Registry
*/
protected $registry;
/**
* @var \Magento\Cms\Model\Page
*/
protected $cmsPage;
/**
* @var \Magezon\Core\Framework\Serialize\Serializer\Json
*/
protected $serializer;
/**
* @param \Magento\Framework\App\Helper\Context $context
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Cms\Model\Template\FilterProvider $filterProvider
* @param \Magento\Framework\Registry $registry
* @param \Magento\Cms\Model\Page $cmsPage
* @param \Magezon\Core\Framework\Serialize\Serializer\Json $serializer
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Cms\Model\Template\FilterProvider $filterProvider,
\Magento\Framework\Registry $registry,
\Magento\Cms\Model\Page $cmsPage,
\Magezon\Core\Framework\Serialize\Serializer\Json $serializer
) {
parent::__construct($context);
$this->_storeManager = $storeManager;
$this->filterProvider = $filterProvider;
$this->registry = $registry;
$this->cmsPage = $cmsPage;
$this->serializer = $serializer;
}
public function filter($str)
{
if (!$str || !is_string($str)) {
return $str;
}
$str = $this->decodeDirectiveImages($str);
$storeId = $this->_storeManager->getStore()->getId();
$filter = $this->filterProvider->getBlockFilter()->setStoreId($storeId);
$variables = [];
if ($this->cmsPage->getId()) {
$variables['page'] = $this->cmsPage;
}
if ($category = $this->getCurrentCategory()) {
$variables['category'] = $category;
}
if ($product = $this->getCurrentProduct()) {
$variables['product'] = $product;
}
$filter->setVariables($variables);
$productMetadata = ObjectManager::getInstance()->get(\Magento\Framework\App\ProductMetadataInterface::class);
if ($productMetadata->getVersion() >= '2.4.0') {
$filter->setStrictMode(false);
}
return $filter->filter($str);
}
/**
* @return \Magento\Catalog\Model\Category
*/
public function getCurrentCategory()
{
return $this->registry->registry('current_category');
}
/**
* @return \Magento\Catalog\Model\Product
*/
public function getCurrentProduct()
{
return $this->registry->registry('current_product');
}
/**
* @param string $content
* @return string
*/
public function decodeDirectiveImages($content)
{
$matches = $search = $replace = [];
preg_match_all('/<img[\s\r\n]+.*?>/is', $content, $matches);
foreach ($matches[0] as $imgHTML) {
$key = 'directive/___directive/';
if (strpos($imgHTML, $key) !== false) {
$srcKey = 'src="';
$start = strpos($imgHTML, $srcKey) + strlen($srcKey);
$end = strpos($imgHTML, '"', $start);
if ($end > $start) {
$imgSrc = substr($imgHTML, $start, $end - $start);
$start = strpos($imgSrc, $key) + strlen($key);
$imgBase64 = substr($imgSrc, $start);
$replaceHTML = str_replace($imgSrc, $this->urlDecoder->decode(urldecode($imgBase64)), $imgHTML);
$search[] = $imgHTML;
$replace[] = $replaceHTML;
}
}
}
return str_replace($search, $replace, $content);
}
public function unserialize($string)
{
if ($string && $this->isJSON($string)) {
return $this->serializer->unserialize($string);
}
return $string;
}
public function serialize($array = [])
{
return $this->serializer->serialize($array);
}
/**
* @param string $string
* @return boolean
*/
public function isJSON($string)
{
return is_string($string) && is_array(json_decode($string, true)) ? true : false;
}
/**
* @return string
*/
public function getMediaUrl()
{
$mediaUrl = $this->_storeManager->getStore()->getBaseUrl(
\Magento\Framework\UrlInterface::URL_TYPE_MEDIA
);
return $mediaUrl;
}
/**
* Remove base url
*/
public function convertImageUrl($string)
{
$mediaUrl = $this->getMediaUrl();
return str_replace($mediaUrl, '', $string);
}
/**
* @return boolean
*/
public function startsWith($haystack, $needle)
{
$length = strlen($needle);
return (substr($haystack, 0, $length) === $needle);
}
/**
* @return boolean
*/
public function endsWith($haystack, $needle)
{
$length = strlen($needle);
return $length === 0 ||
(substr($haystack, -$length) === $needle);
}
/**
* @param string $string
* @return string
*/
public function getImageUrl($string)
{
if ($string && is_string($string) && strpos($string, 'http') === false && (strpos($string, '<div') === false)) {
$mediaUrl = $this->getMediaUrl();
$string = $mediaUrl . $string;
}
return $string;
}
/**
* Convert string to numbder
*/
public function dataPreprocessing($data)
{
if (is_array($data)) {
foreach ($data as &$_row) {
$_row = $this->unserialize($_row);
if ($_row === '1' || $_row === '0') {
$_row = (int) $_row;
}
$_row = $this->getImageUrl($_row);
if (is_array($_row)) {
$_row = $this->dataPreprocessing($_row);
}
}
}
return $data;
}
/**
* Pass through to mb_substr()
*
* @param string $string
* @param int $offset
* @param int $length
* @return string
*/
public function substr($string, $length, $keepWords = true)
{
$string = $this->cleanString($string);
if ($keepWords) {
if (preg_match('/^.{1,' . $length . '}\b/s', $string, $match)) {
$string = $match[0];
}
} else {
$string = mb_substr($string, 0, $length, self::ICONV_CHARSET);
}
return $string;
}
/**
* Clean non UTF-8 characters
*
* @param string $string
* @return string
*/
public function cleanString($string)
{
return mb_convert_encoding($string, self::ICONV_CHARSET);
}
/**
* Retrieve string length using default charset
*
* @param string $string
* @return int
*/
public function strlen($string)
{
return mb_strlen($string, self::ICONV_CHARSET);
}
/**
* Filter images with placeholders in the content
*
* @param string $content
* @return string
*/
public function filterCarouselLazyImage($content)
{
$matches = $search = $replace = [];
preg_match_all('/<img[\s\r\n]+.*?>/is', $content, $matches);
$placeHolderUrl = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR4nGNiAAAABgADNjd8qAAAAABJRU5ErkJggg==';
$lazyClasses = 'owl-lazy';
foreach ($matches[0] as $imgHTML) {
if (! preg_match("/src=['\"]data:image/is", $imgHTML) && strpos($imgHTML, 'data-src')===false) {
// replace the src and add the data-src attribute
$replaceHTML = preg_replace('/<img(.*?)src=/is', '<img$1src="' . $placeHolderUrl . '" data-src=', $imgHTML);
// add the lazy class to the img element
if (preg_match('/class=["\']/i', $replaceHTML)) {
$replaceHTML = preg_replace('/class=(["\'])(.*?)["\']/is', 'class=$1' . $lazyClasses . ' $2$1', $replaceHTML);
} else {
$replaceHTML = preg_replace('/<img/is', '<img class="' . $lazyClasses . '"', $replaceHTML);
}
$search[] = $imgHTML;
$replace[] = $replaceHTML;
}
}
$content = str_replace($search, $replace, $content);
return $content;
}
/**
* @param int $number
* @return int
*/
public function getResponsiveClass($number)
{
if (in_array($number, [1, 2, 3, 4, 6, 12])) {
return 12 / $number;
}
if ($number == 5) {
return 15;
}
return $number;
}
/**
* @param string $value
* @return string
*/
public function getStyleColor($value, $isImportant = false)
{
if ($value && (!$this->startsWith($value, '#') && !$this->startsWith($value, 'rgb'))) {
if ($value != 'transparent') {
$value = '#' . $value;
}
}
if ($value && $isImportant) {
$value .= ' !important';
}
return $value;
}
/**
* @param string $value
* @return string
*/
public function getStyleProperty($value, $isImportant = false, $unit = '')
{
if (is_numeric($value)) {
if ($unit) {
$value .= $unit;
} else {
$value .= 'px';
}
}
if ($value == '-') {
$value = '';
}
if ($value && $isImportant) {
$value .= ' !important';
}
return $value;
}
/**
* @param string|array $target
* @param array $styles
* @param string $suffix
* @return string
*/
public function getStyles($target, $styles, $suffix = '')
{
$html = '';
if (is_array($target)) {
foreach ($target as $k => $_selector) {
if (!$_selector) {
unset($target[$k]);
}
}
$i = 0;
$count = count($target);
foreach ($target as $_selector) {
$html .= $_selector . $suffix;
if ($i!=$count-1) {
$html .= ',';
}
$i++;
}
} else {
$html = $target . $suffix;
}
$stylesHtml = $this->parseStyles($styles);
if (!$stylesHtml) {
return;
}
if ($styles) {
$html .= '{';
$html .= $stylesHtml;
$html .= '}';
}
return $html;
}
/**
* @param array $styles
* @return string
*/
public function parseStyles($styles)
{
$result = '';
foreach ($styles as $k => $v) {
if ($v=='') {
continue;
}
$result .= $k . ':' . $v . ';';
}
return $result;
}
/**
* Check value is null
*
* @param $value
* @return bool
*/
public function isNull($value)
{
if (is_numeric($value)) {
return false;
}
if ($value === '' || $value === null) {
return true;
}
return false;
}
/**
* @param string $html
* @return string
*/
public function cleanStyle($html)
{
$regex = '@(?:<style class="mgz-style">)(.*)</style>@msU';
preg_match_all($regex, $html, $matches);
if ($matches[0]) {
$html = str_replace($matches[0], [], $html);
}
return $html;
}
}
+83
View File
@@ -0,0 +1,83 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Helper;
use Magento\Framework\App\Filesystem\DirectoryList;
class File extends \Magento\Framework\App\Helper\AbstractHelper
{
/**
* @var \Magento\Framework\ObjectManagerInterface
*/
protected $_objectManager;
/**
* @var \Magento\Framework\App\RequestInterface
*/
protected $_httpRequest;
/**
* @param \Magento\Framework\App\Helper\Context $context
* @param \Magento\Framework\ObjectManagerInterface $objectManager
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Framework\ObjectManagerInterface $objectManager
) {
parent::__construct($context);
$this->_objectManager = $objectManager;
$this->_httpRequest = $context->getRequest();
}
public function uploadImage($type, $data, $mediaFolder, $allowedExtensions = '', $maximumSize = 0)
{
$mediaDirectory = $this->_objectManager->get('Magento\Framework\Filesystem')->getDirectoryRead(DirectoryList::MEDIA);
$imagePath = $mediaDirectory->getAbsolutePath();
if (isset($data[$type]['delete'])) {
$imagePath .= isset($data[$type]['value']) ? $data[$type]['value'] : $data[$type];
if ($imagePath != $mediaDirectory && file_exists($imagePath)) {
unlink($imagePath);
}
$data[$type] = '';
}
$image = $this->_httpRequest->getFiles($type);
if (isset($image['error']) && $image['error'] == 0) {
if ($imagePath) {
if ($imagePath != $mediaDirectory && file_exists($imagePath) && $imagePath != $mediaDirectory->getAbsolutePath()) {
unlink($imagePath);
}
}
if ($maximumSize && $image['size'] > $maximumSize) {
throw new \Magento\Framework\Exception\ValidatorException(__('The file is too large. Maximum upload file size: %1MB', $maximumSize/1000000));
}
$savePath = $mediaDirectory->getAbsolutePath($mediaFolder);
$uploader = $this->_objectManager->create(
'Magento\Framework\File\Uploader',
array('fileId' => $type)
);
$uploader->setAllowRenameFiles(true);
$uploader->setFilesDispersion(false);
if ($allowedExtensions) {
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
}
$file = $uploader->save($savePath);
$data[$type] = $mediaFolder . '/' . $file['name'];
$data[$type] = str_replace('//', '/', $data[$type]);
} else if (isset($data[$type]) && is_array($data[$type])) {
$data[$type] = $data[$type]['value'];
}
return $data;
}
}
+127
View File
@@ -0,0 +1,127 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Helper;
use Magento\Framework\App\Filesystem\DirectoryList;
class Image extends \Magento\Framework\App\Helper\AbstractHelper
{
/**
* @var \Magezon\Core\Block\Product\ImageBuilder
*/
protected $imageBuilder;
/**
* @var \Magento\Framework\Filesystem
*/
protected $_filesystem;
/**
* @var \Magento\Framework\Image\AdapterFactory
*/
protected $_imageFactory;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $_storeManager;
/**
* @param \Magento\Framework\App\Helper\Context $context
* @param \Magezon\Core\Block\Product\ImageBuilder $imageBuilder
* @param \Magento\Framework\Filesystem $filesystem
* @param \Magento\Framework\Image\AdapterFactory $imageFactory
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magezon\Core\Block\Product\ImageBuilder $imageBuilder,
\Magento\Framework\Filesystem $filesystem,
\Magento\Framework\Image\AdapterFactory $imageFactory,
\Magento\Store\Model\StoreManagerInterface $storeManager
) {
parent::__construct($context);
$this->imageBuilder = $imageBuilder;
$this->_filesystem = $filesystem;
$this->_imageFactory = $imageFactory;
$this->_storeManager = $storeManager;
}
/**
* Retrieve product image
*
* @param \Magento\Catalog\Model\Product $product
* @param string $imageId
* @param array $attributes
* @return \Magento\Catalog\Block\Product\Image
*/
public function resizeImage($product, $imageWidth = '', $imageHeight = '', $attributes = [], $imageId ='category_page_grid')
{
return $this->imageBuilder->setProduct($product)
->setImageWidth($imageWidth)
->setImageHeight($imageHeight)
->setResizeImageWidth($imageWidth)
->setResizeImageHeight($imageHeight)
->setImageId($imageId)
->setAttributes($attributes)
->create();
}
/**
* @param string $src
* @param integer $width
* @param integer $height
* @param integer $quality
* @param string $dir
* @param string $newName
* @param boolean $deleteIfExist
* @return string
*/
public function resize($src, $width = 150, $height = 0, $quality = 80, $dir = 'magezon/resized', $newName = '', $deleteIfExist = false)
{
$dir = $dir . '/' . $width;
$absPath = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath($src);
if ($newName) {
$imageResized = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath($dir . '/' . $newName);
} else {
$imageResized = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath($dir . '/' . $src);
}
$imageResize = $this->_imageFactory->create();
$resizedURL = '';
if (file_exists($absPath)) {
$imageResize->open($absPath);
$imageResize->backgroundColor([255, 255, 255]);
$imageResize->constrainOnly(TRUE);
$imageResize->keepTransparency(TRUE);
$imageResize->keepFrame(true);
$imageResize->keepAspectRatio(true);
$imageResize->quality($quality);
if ($height) {
$imageResize->resize($width, $height);
} else {
$imageResize->resize($width);
}
if (!file_exists($imageResized) || $deleteIfExist) {
$imageResize->save($imageResized);
}
if ($newName) {
$resizedURL = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA). $dir . '/' . $newName;
} else {
$resizedURL = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA). $dir . '/' . $src;
}
}
return $resizedURL;
}
}
+285
View File
@@ -0,0 +1,285 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Helper;
class Style extends \Magento\Framework\App\Helper\AbstractHelper
{
/**
* @var Data
*/
protected $dataHelper;
/**
* @param \Magezon\Core\Helper\Data $dataHelper
*/
public function __construct(
\Magezon\Core\Helper\Data $dataHelper
) {
$this->dataHelper = $dataHelper;
}
/**
* @param string|array $target
* @param array $styles
* @param string $suffix
* @return string
*/
public function getHtml($target, $styles, $suffix = '')
{
$html = '';
if (is_array($target)) {
foreach ($target as $k => $_selector) {
if (!$_selector) {
unset($target[$k]);
}
}
$i = 0;
$count = count($target);
foreach ($target as $_selector) {
$html .= $_selector . $suffix;
if ($i!=$count-1) {
$html .= ',';
}
$i++;
}
} else {
$html = $target . $suffix;
}
$stylesHtml = $this->parseStyles($styles);
if (!$stylesHtml) return;
if ($styles) {
$html .= '{';
$html .= $stylesHtml;
$html .= '}';
}
return $html;
}
/**
* @param array $styles
* @return string
*/
public function parseStyles($styles)
{
$result = '';
foreach ($styles as $k => $v) {
if ($v=='') continue;
$result .= $k . ':' . $v . ';';
}
return $result;
}
/**
* @param string $value
* @return string
*/
public function getColor($value, $important = false)
{
if ($value && (!$this->dataHelper->startsWith($value, '#') && !$this->dataHelper->startsWith($value, 'rgb'))) {
if ($value != 'transparent') {
$value = '#' . $value;
}
}
if ($value && $important) {
$value .= ' !important';
}
return $value;
}
/**
* @param string $value
* @return string
*/
public function getProperty($value, $important = false, $unit = '')
{
if (!$unit) $unit = 'px';
if (is_numeric($value)) {
$value .= $unit;
} else if ($value == '-') {
$value = '';
}
if ($value && $important) {
$value .= ' !important';
}
return $value;
}
/**
* @param string $value
* @return boolean
*/
public function isNull($value) {
if (is_numeric($value)) return false;
if ($value === '' || $value === null) {
return true;
}
return false;
}
/**
* @param array $data
* @return array
*/
public function getStyles($data)
{
$styles = [];
$config = new \Magento\Framework\DataObject($data);
$paddingTop = $this->getProperty($config['padding_top']);
$paddingRight = $this->getProperty($config['padding_right']);
$paddingBottom = $this->getProperty($config['padding_bottom']);
$paddingLeft = $this->getProperty($config['padding_left']);
if (!$this->isNull($paddingTop) && !$this->isNull($paddingRight) && !$this->isNull($paddingBottom) && !$this->isNull($paddingLeft)) {
if ($paddingTop == $paddingRight && $paddingTop == $paddingBottom && $paddingTop == $paddingLeft) {
$styles['padding'] = $paddingTop;
} else {
$styles['padding'] = $paddingTop . ' ' . $paddingRight . ' ' . $paddingBottom . ' ' . $paddingLeft;
}
} else {
$styles['padding-top'] = $paddingTop;
$styles['padding-right'] = $paddingRight;
$styles['padding-bottom'] = $paddingBottom;
$styles['padding-left'] = $paddingLeft;
}
$marginTop = $this->getProperty($config['margin_top']);
$marginRight = $this->getProperty($config['margin_right']);
$marginBottom = $this->getProperty($config['margin_bottom']);
$marginLeft = $this->getProperty($config['margin_left']);
if (!$this->isNull($marginTop) && !$this->isNull($marginRight) && !$this->isNull($marginBottom) && !$this->isNull($marginLeft)) {
if ($marginTop == $marginRight && $marginTop == $marginBottom && $marginTop == $marginLeft) {
$styles['margin'] = $marginTop;
} else {
$styles['margin'] = $marginTop . ' ' . $marginRight . ' ' . $marginBottom . ' ' . $marginLeft;
}
} else {
$styles['margin-top'] = $marginTop;
$styles['margin-right'] = $marginRight;
$styles['margin-bottom'] = $marginBottom;
$styles['margin-left'] = $marginLeft;
}
$borderStyle = $config['border_style'];
if ($borderStyle && $config['border_color']) {
$borderTopWidth = $this->getProperty($config['border_top_width']);
$borderRightWidth = $this->getProperty($config['border_right_width']);
$borderBottomWidth = $this->getProperty($config['border_bottom_width']);
$borderLeftWidth = $this->getProperty($config['border_left_width']);
$borderColor = $this->getColor($config['border_color']);
$styles['border-color'] = $this->getColor($config['border_color']);
if (!$this->isNull($borderTopWidth)) {
$styles['border-top-width'] = $borderTopWidth;
$styles['border-top-style'] = $borderStyle;
}
if (!$this->isNull($borderRightWidth)) {
$styles['border-right-width'] = $borderRightWidth;
$styles['border-right-style'] = $borderStyle;
}
if (!$this->isNull($borderBottomWidth)) {
$styles['border-bottom-width'] = $borderBottomWidth;
$styles['border-bottom-style'] = $borderStyle;
}
if (!$this->isNull($borderLeftWidth)) {
$styles['border-left-width'] = $borderLeftWidth;
$styles['border-left-style'] = $borderStyle;
}
if (!$this->isNull($borderTopWidth) && !$this->isNull($borderRightWidth) && !$this->isNull($borderBottomWidth) && !$this->isNull($borderLeftWidth)) {
unset($styles['border-top-style']);
unset($styles['border-right-style']);
unset($styles['border-bottom-style']);
unset($styles['border-left-style']);
$styles['border-style'] = $borderStyle;
if ($borderTopWidth == $borderRightWidth && $borderTopWidth == $borderBottomWidth && $borderTopWidth == $borderLeftWidth) {
$styles['border'] = $borderTopWidth . ' ' . $borderStyle . ' ' . $borderColor;
unset($styles['border-top-width']);
unset($styles['border-top-style']);
unset($styles['border-right-width']);
unset($styles['border-right-style']);
unset($styles['border-bottom-width']);
unset($styles['border-bottom-style']);
unset($styles['border-left-width']);
unset($styles['border-left-style']);
unset($styles['border-color']);
}
}
if ($this->isNull($borderTopWidth) && $this->isNull($borderRightWidth) && $this->isNull($borderBottomWidth) && $this->isNull($borderLeftWidth)) {
unset($styles['border-style']);
unset($styles['border-color']);
}
}
$borderTopLeftRadius = $this->getProperty($config['border_top_left_radius']);
$borderTopRightRadius = $this->getProperty($config['border_top_right_radius']);
$borderBottomRightRadius = $this->getProperty($config['border_bottom_right_radius']);
$borderBottomLeftRadius = $this->getProperty($config['border_bottom_left_radius']);
if (!$this->isNull($borderTopLeftRadius) || !$this->isNull($borderTopRightRadius) || !$this->isNull($borderBottomRightRadius) || !$this->isNull($borderBottomLeftRadius)) {
if ($borderTopLeftRadius == $borderTopRightRadius && $borderTopLeftRadius == $borderBottomRightRadius && $borderTopLeftRadius == $borderBottomLeftRadius) {
$styles['border-radius'] = $borderTopLeftRadius;
} else {
if (!$borderTopLeftRadius) $borderTopLeftRadius = 0;
if (!$borderTopRightRadius) $borderTopRightRadius = 0;
if (!$borderBottomRightRadius) $borderBottomRightRadius = 0;
if (!$borderBottomLeftRadius) $borderBottomLeftRadius = 0;
$styles['border-radius'] = $borderTopLeftRadius . ' ' . $borderTopRightRadius . ' ' . $borderBottomRightRadius . ' ' . $borderBottomLeftRadius;
}
}
$styles['background-color'] = $this->getColor($config['background_color']);
if ($backgroundImage = $config['background_image']) {
$styles['background-image'] = 'url(\'' . $this->dataHelper->getImageUrl($backgroundImage) . '\')';
$backgroundPosition = $config['background_position'];
if ($backgroundPosition == 'custom') {
if ($config['custom_background_position']) {
$styles['background-position'] = $config['custom_background_position'];
}
} else {
$styles['background-position'] = $backgroundPosition;
}
$backgroundSize = $config['background_size'];
if ($backgroundSize == 'custom') {
if ($config['custom_background_size']) {
$styles['background-size'] = $config['custom_background_size'];
}
} else {
$styles['background-size'] = $backgroundSize;
}
$styles['background-repeat'] = $config['background_repeat'];
}
if ($config['boxshadow']) {
$boxshadowHorizontal = $this->getProperty($config['boxshadow_horizontal']);
$boxshadowVertical = $this->getProperty($config['boxshadow_vertical']);
$boxshadowBlur = $this->getProperty($config['boxshadow_blur']);
$boxshadowSpread = $this->getProperty($config['boxshadow_spread']);
$boxshadowColor = $this->getColor($config['boxshadow_color']);
$styles['box-shadow'] = $boxshadowHorizontal . ' ' . $boxshadowVertical . ' ' . $boxshadowBlur . ' ' . $boxshadowSpread . ' ' . $boxshadowColor;
if ($config['boxshadow_position'] == 'inset') {
$styles['box-shadow'] .= ' inset';
}
}
return $styles;
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Helper\Wysiwyg;
class Images extends \Magento\Cms\Helper\Wysiwyg\Images
{
/**
* Prepare Image insertion declaration for Wysiwyg or textarea(as_is mode)
*
* @param string $filename Filename transferred via Ajax
* @param bool $renderAsTag Leave image HTML as is or transform it to controller directive
* @return string
*/
public function getImageHtmlDeclaration($filename, $renderAsTag = false)
{
$fileurl = $this->getCurrentUrl() . $filename;
$mediaUrl = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
$mediaPath = str_replace($mediaUrl, '', $fileurl);
return $mediaPath;
}
}
+47
View File
@@ -0,0 +1,47 @@
Open Software License ("OSL") v. 3.0
This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
Licensed under the Open Software License version 3.0
1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
1. to reproduce the Original Work in copies, either alone or as part of a collective work;
2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License;
4. to perform the Original Work publicly; and
5. to display the Original Work publicly.
2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
16. Modification of This License. This License is Copyright (C) 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
+47
View File
@@ -0,0 +1,47 @@
Academic Free License ("AFL") v. 3.0
This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
Licensed under the Academic Free License version 3.0
1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
1. to reproduce the Original Work in copies, either alone or as part of a collective work;
2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
4. to perform the Original Work publicly; and
5. to display the Original Work publicly.
2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
+455
View File
@@ -0,0 +1,455 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Model;
use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\CatalogInventory\Model\Configuration;
use Magento\Framework\DB\Select;
use Magento\Store\Model\ScopeInterface;
use Zend_Db_Expr;
class ConditionsProcessor
{
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $_storeManager;
/**
* @var \Magento\Catalog\Model\Config
*/
protected $_catalogConfig;
/**
* @var \Magento\Rule\Model\Condition\Sql\Builder
*/
protected $sqlBuilder;
/**
* @var \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory
*/
protected $productCollectionFactory;
/**
* @var \Magento\Catalog\Model\Product\Visibility
*/
protected $catalogProductVisibility;
/**
* @var \Magento\CatalogWidget\Model\Rule
*/
protected $rule;
/**
* @var \Magento\Framework\App\ResourceConnection
*/
protected $_resource;
/**
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface
*/
protected $_localeDate;
/**
* @var \Magento\Reports\Model\Event\TypeFactory
*/
protected $_eventTypeFactory;
/**
* @var \Magento\Store\Model\System\Store
*/
protected $_systemStore;
/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface
*/
protected $scopeConfig;
/**
* @var \Magento\Store\Model\App\Emulation
*/
protected $_appEmulation;
/**
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory
* @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility
* @param \Magento\Catalog\Model\Config $catalogConfig
* @param \Magento\CatalogWidget\Model\Rule $rule
* @param \Magento\Rule\Model\Condition\Sql\Builder $sqlBuilder
* @param \Magento\Framework\App\ResourceConnection $resource
* @param \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
* @param \Magento\Catalog\Model\ResourceModel\Product $product
* @param \Magento\Store\Model\System\Store $systemStore
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
*/
public function __construct(
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
\Magento\Catalog\Model\Product\Visibility $catalogProductVisibility,
\Magento\Catalog\Model\Config $catalogConfig,
\Magento\CatalogWidget\Model\Rule $rule,
\Magento\Rule\Model\Condition\Sql\Builder $sqlBuilder,
\Magento\Framework\App\ResourceConnection $resource,
\Magento\Reports\Model\Event\TypeFactory $eventTypeFactory,
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
\Magento\Catalog\Model\ResourceModel\Product $product,
\Magento\Store\Model\System\Store $systemStore,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Store\Model\App\Emulation $appEmulation
) {
$this->_storeManager = $storeManager;
$this->_catalogConfig = $catalogConfig;
$this->sqlBuilder = $sqlBuilder;
$this->productCollectionFactory = $productCollectionFactory;
$this->catalogProductVisibility = $catalogProductVisibility;
$this->rule = $rule;
$this->_resource = $resource;
$this->_localeDate = $localeDate;
$this->_eventTypeFactory = $eventTypeFactory;
$this->_systemStore = $systemStore;
$this->scopeConfig = $scopeConfig;
$this->_appEmulation = $appEmulation;
}
public function getProductByConditions($model, $store)
{
$collection = $this->productCollectionFactory->create();
$collection->getSelect()->reset(Select::WHERE);
$collection->setStore($store);
if (!$this->_storeManager->isSingleStoreMode()) {
$collection = $this->_addProductAttributesAndPrices($collection);
}
$collection->addStoreFilter($store);
//$collection->addAttributeToSelect('*');
$conditions = $model->getConditions();
$conditions->collectValidatedAttributes($collection);
$this->sqlBuilder->attachConditionToCollection($collection, $conditions);
//$collection->addAttributeToSelect('*');
switch ($model->getProductType()) {
case 'latest':
$collection->getSelect()->order('created_at DESC');
break;
case 'new':
$this->_getNewProductCollection($collection);
break;
case 'bestseller':
$this->_getBestSellerProductCollection($collection, $store->getId());
break;
case 'onsale':
$this->_getOnsaleProductCollection($collection, $store->getId());
break;
case 'mostviewed':
$this->_getMostViewedProductCollection($collection, $store->getId());
break;
case 'wishlisttop':
$this->_getWishlisttopProductCollection($collection, $store->getId());
break;
case 'free':
$collection->addAttributeToFilter('price', ['eq' => 0]);
break;
case 'featured':
$collection->addAttributeToFilter('featured', ['eq' => 1]);
break;
case 'toprated':
$this->_getTopRatedProductCollection($collection, $store->getId());
break;
}
if ($model->getStockStatus() == "1") {
$this->addOutStockFilterToCollection($collection);
}
if ($model->getStockStatus() == "2") {
$this->addInStockFilterToCollection($collection);
}
$collection->joinField(
'qty',
'cataloginventory_stock_item',
'qty',
'product_id=entity_id',
'{{table}}.stock_id=1',
'left'
);
if ($ruleStockHigher = $model->getRuleStockHigher()) {
$collection->addFieldToFilter('qty', ['gteq' => $ruleStockHigher]);
}
if ($ruleStockLower = $model->getRuleStockLower()) {
$collection->addFieldToFilter('qty', ['lteq' => $ruleStockLower]);
}
$collection->setVisibility(
$this->catalogProductVisibility->getVisibleInSiteIds()
);
return $collection;
}
/**
* Adds filtering for collection to return only in stock products
*
* @param \Magento\Catalog\Model\ResourceModel\Product\Link\Product\Collection $collection
* @return void
*/
public function addInStockFilterToCollection($collection)
{
$manageStock = $this->scopeConfig->getValue(
Configuration::XML_PATH_MANAGE_STOCK,
ScopeInterface::SCOPE_STORE
);
$cond = [
'{{table}}.use_config_manage_stock = 0 AND {{table}}.manage_stock=1 AND {{table}}.is_in_stock=1',
'{{table}}.use_config_manage_stock = 0 AND {{table}}.manage_stock=0'
];
if ($manageStock) {
$cond[] = '{{table}}.use_config_manage_stock = 1 AND {{table}}.is_in_stock=1';
} else {
$cond[] = '{{table}}.use_config_manage_stock = 1';
}
$collection->joinField(
'inventory_in_stock',
'cataloginventory_stock_item',
'is_in_stock',
'product_id=entity_id',
'(' . join(') OR (', $cond) . ')'
);
$collection->addAttributeToFilter('inventory_in_stock', 1);
}
/**
* Adds filtering for collection to return only in stock products
*
* @param \Magento\Catalog\Model\ResourceModel\Product\Link\Product\Collection $collection
* @return void
*/
public function addOutStockFilterToCollection($collection)
{
$manageStock = $this->scopeConfig->getValue(
Configuration::XML_PATH_MANAGE_STOCK,
ScopeInterface::SCOPE_STORE
);
$cond = [
'{{table}}.use_config_manage_stock = 0 AND {{table}}.manage_stock=1 AND {{table}}.is_in_stock=0',
'{{table}}.use_config_manage_stock = 0 AND {{table}}.manage_stock=0'
];
if ($manageStock) {
$cond[] = '{{table}}.use_config_manage_stock = 1 AND {{table}}.is_in_stock=0';
} else {
$cond[] = '{{table}}.use_config_manage_stock = 1';
}
$collection->joinField(
'inventory_in_stock',
'cataloginventory_stock_item',
'is_in_stock',
'product_id=entity_id',
'(' . join(') OR (', $cond) . ')'
);
$collection->addAttributeToFilter('inventory_in_stock', 0);
}
protected function _getTopRatedProductCollection($collection, $storeId)
{
$collection->joinField(
'review',
$this->_resource->getTableName('review_entity_summary'),
'reviews_count',
'entity_pk_value=entity_id',
'at_review.store_id=' . (int)$storeId,
'review > 0',
'left'
);
$collection->getSelect()->order(['review DESC', 'e.created_at']);
}
protected function _getNewProductCollection($collection)
{
$todayStartOfDayDate = $this->_localeDate->date()->setTime(0, 0, 0)->format('Y-m-d H:i:s');
$todayEndOfDayDate = $this->_localeDate->date()->setTime(23, 59, 59)->format('Y-m-d H:i:s');
$collection->addAttributeToFilter(
'news_from_date',
[
'or' => [
0 => ['date' => true, 'to' => $todayEndOfDayDate],
1 => ['is' => new Zend_Db_Expr('null')],
]
],
'left'
)->addAttributeToFilter(
'news_to_date',
[
'or' => [
0 => ['date' => true, 'from' => $todayStartOfDayDate],
1 => ['is' => new Zend_Db_Expr('null')],
]
],
'left'
)->addAttributeToFilter(
[
['attribute' => 'news_from_date', 'is' => new Zend_Db_Expr('not null')],
['attribute' => 'news_to_date', 'is' => new Zend_Db_Expr('not null')],
]
)->addAttributeToSort(
'news_from_date',
'desc'
);
}
protected function _getBestSellerProductCollection($collection, $storeId)
{
$collection->getSelect()
->join(
[
'aggregation' => $this->_resource->getTableName('sales_bestsellers_aggregated_monthly'),
],
"e.entity_id = aggregation.product_id AND aggregation.store_id={$storeId} AND qty_ordered >0",
[
'sold_quantity' => 'SUM(aggregation.qty_ordered)'
]
)
->group('e.entity_id')
->order(['sold_quantity DESC', 'e.created_at']);
}
protected function _getWishlisttopProductCollection($collection, $storeId)
{
$eventTypes = $this->_eventTypeFactory->create()->getCollection();
foreach ($eventTypes as $eventType) {
if ($eventType->getEventName() == 'wishlist_add_product') {
$wishlistEvent = (int)$eventType->getId();
break;
}
}
$collection->getSelect()
->join(
[
'report_table_views' => $this->_resource->getTableName('report_event'),
],
"e.entity_id = report_table_views.object_id AND report_table_views.event_type_id = " . $wishlistEvent,
[
'views' => 'COUNT(report_table_views.event_id)'
]
)
->group('e.entity_id')
->order(['views DESC'])
->having(
'COUNT(report_table_views.event_id) > ?',
0
);
}
protected function _getMostViewedProductCollection($collection, $storeId)
{
$eventTypes = $this->_eventTypeFactory->create()->getCollection();
foreach ($eventTypes as $eventType) {
if ($eventType->getEventName() == 'catalog_product_view') {
$productViewEvent = (int)$eventType->getId();
break;
}
}
$collection->getSelect()
->join(
[
'report_table_views' => $this->_resource->getTableName('report_event'),
],
"e.entity_id = report_table_views.object_id AND report_table_views.event_type_id = " . $productViewEvent,
[
'views' => 'COUNT(report_table_views.event_id)'
]
)
->group('e.entity_id')
->order(['views DESC', 'e.created_at'])
->having(
'COUNT(report_table_views.event_id) > ?',
0
);
}
protected function _getOnsaleProductCollection($collection, $storeId)
{
$todayStartOfDayDate = $this->_localeDate->date()->setTime(0, 0, 0)->format('Y-m-d H:i:s');
$todayEndOfDayDate = $this->_localeDate->date()->setTime(23, 59, 59)->format('Y-m-d H:i:s');
$collection->addAttributeToFilter(
'special_from_date',
[
'or' => [
0 => ['date' => true, 'to' => $todayEndOfDayDate],
1 => ['is' => new Zend_Db_Expr('null')],
]
],
'left'
)->addAttributeToFilter(
'special_to_date',
[
'or' => [
0 => ['date' => true, 'from' => $todayStartOfDayDate],
1 => ['is' => new Zend_Db_Expr('null')],
]
],
'left'
)->addAttributeToFilter(
[
['attribute' => 'special_from_date', 'is' => new Zend_Db_Expr('not null')],
['attribute' => 'special_to_date', 'is' => new Zend_Db_Expr('not null')],
]
)->addAttributeToSort(
'special_from_date',
'desc'
);
$collection->getSelect()->where('final_price < price');
}
/**
* Add all attributes and apply pricing logic to products collection
* to get correct values in different products lists.
* E.g. crosssells, upsells, new products, recently viewed
*
* @param Collection $collection
* @return Collection
*/
protected function _addProductAttributesAndPrices(
Collection $collection
) {
return $collection
->addMinimalPrice()
->addFinalPrice()
->addTaxPercents()
->addAttributeToSelect($this->_catalogConfig->getProductAttributes())
->addUrlRewrite();
}
}
@@ -0,0 +1,90 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Model\Eav\Attribute\Backend;
use Magento\Framework\App\Filesystem\DirectoryList;
class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
{
/**
* @var \Magento\Backend\Model\UrlInterface
*/
protected $_backendUrl;
/**
* @var \Magento\Framework\Filesystem\Directory\ReadInterface
*/
protected $rootDirectory;
/**
* @param \Psr\Log\LoggerInterface $logger
* @param \Magento\Framework\Filesystem $filesystem
* @param \Magento\MediaStorage\Model\File\UploaderFactory $fileUploaderFactory
*/
public function __construct(
\Magento\Backend\Model\UrlInterface $backendUrl,
\Magento\Framework\Filesystem $filesystem
) {
$this->_backendUrl = $backendUrl;
$this->rootDirectory = $filesystem->getDirectoryRead(DirectoryList::MEDIA);
}
/**
* Validate SKU
*
* @param Product $object
* @return bool
* @throws \Magento\Framework\Exception\LocalizedException
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function validate($object)
{
$attrCode = $this->getAttribute()->getAttributeCode();
$value = $object->getData($attrCode);
if ($value && !$this->isImage($value)) {
throw new \Magento\Framework\Exception\InputException(
__('File \'%1\' is not an image.', $value)
);
}
return true;
}
/**
* Simple check if file is image
*
* @param array|string $fileInfo - either file data from \Zend_File_Transfer or file path
* @return boolean
* @see \Magento\Catalog\Model\Product\Option\Type\File::_isImage
*/
protected function isImage($fileInfo)
{
if (file_exists($this->rootDirectory->getAbsolutePath($fileInfo))) {
// Maybe array with file info came in
if (is_array($fileInfo)) {
return strstr($fileInfo['type'], 'image/');
}
// File path came in - check the physical file
if (!$this->rootDirectory->isReadable($this->rootDirectory->getRelativePath($fileInfo))) {
return false;
}
$imageInfo = getimagesize($this->rootDirectory->getAbsolutePath($fileInfo));
if (!$imageInfo) {
return false;
}
}
return true;
}
}
+137
View File
@@ -0,0 +1,137 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Model;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\File\Mime;
use Magento\Framework\Filesystem;
use Magento\Framework\Filesystem\Directory\WriteInterface;
class FileInfo
{
/**
* Path in /pub/media directory
*/
const ENTITY_MEDIA_PATH = '';
/**
* @var Filesystem
*/
private $filesystem;
/**
* @var Mime
*/
private $mime;
/**
* @var WriteInterface
*/
private $mediaDirectory;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $_storeManager;
/**
* @param Filesystem $filesystem
* @param Mime $mime
*/
public function __construct(
\Magento\Store\Model\StoreManagerInterface $storeManager,
Filesystem $filesystem,
Mime $mime
) {
$this->_storeManager = $storeManager;
$this->filesystem = $filesystem;
$this->mime = $mime;
}
/**
* Get WriteInterface instance
*
* @return WriteInterface
*/
private function getMediaDirectory()
{
if ($this->mediaDirectory === null) {
$this->mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA);
}
return $this->mediaDirectory;
}
/**
* Retrieve MIME type of requested file
*
* @param string $fileName
* @return string
*/
public function getMimeType($fileName)
{
$filePath = self::ENTITY_MEDIA_PATH . '/' . ltrim($fileName, '/');
$absoluteFilePath = $this->getMediaDirectory()->getAbsolutePath($filePath);
$result = $this->mime->getMimeType($absoluteFilePath);
return $result;
}
/**
* Get file statistics data
*
* @param string $fileName
* @return array
*/
public function getStat($fileName)
{
$filePath = self::ENTITY_MEDIA_PATH . '/' . ltrim($fileName, '/');
$result = $this->getMediaDirectory()->stat($filePath);
return $result;
}
/**
* Check if the file exists
*
* @param string $fileName
* @return bool
*/
public function isExist($fileName)
{
$filePath = self::ENTITY_MEDIA_PATH . '/' . ltrim($fileName, '/');
$result = $this->getMediaDirectory()->isExist($filePath);
return $result;
}
/**
* Get file url
*
* @param string $fileName
* @return string
*/
public function getFileUrl($fileName)
{
$url = $this->getMediaUrl() . $fileName;
return $url;
}
public function getMediaUrl()
{
return $this->_storeManager->getStore()->getBaseUrl(
\Magento\Framework\UrlInterface::URL_TYPE_MEDIA
);
}
}
+425
View File
@@ -0,0 +1,425 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Model;
class ProductList
{
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $_storeManager;
/**
* @var \Magento\Catalog\Model\Config
*/
protected $_catalogConfig;
/**
* @var \Magento\Rule\Model\Condition\Sql\Builder
*/
protected $sqlBuilder;
/**
* @var \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory
*/
protected $productCollectionFactory;
/**
* @var \Magento\Catalog\Model\Product\Visibility
*/
protected $catalogProductVisibility;
/**
* @var \Magento\CatalogWidget\Model\Rule
*/
protected $rule;
/**
* @var \Magento\Framework\App\ResourceConnection
*/
protected $_resource;
/**
* @var \Magento\Reports\Model\Event\TypeFactory
*/
protected $_eventTypeFactory;
/**
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface
*/
protected $_localeDate;
/**
* @var \Magento\Widget\Helper\Conditions
*/
protected $conditionsHelper;
/**
* @var \Magento\CatalogInventory\Helper\Stock
*/
protected $stockHelper;
/**
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory
* @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility
* @param \Magento\Catalog\Model\Config $catalogConfig
* @param \Magento\CatalogWidget\Model\Rule $rule
* @param \Magento\Rule\Model\Condition\Sql\Builder $sqlBuilder
* @param \Magento\Framework\App\ResourceConnection $resource
* @param \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
* @param \Magento\Widget\Helper\Conditions $conditionsHelper
* @param \Magento\CatalogInventory\Helper\Stock $stockHelper
*/
public function __construct(
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
\Magento\Catalog\Model\Product\Visibility $catalogProductVisibility,
\Magento\Catalog\Model\Config $catalogConfig,
\Magento\CatalogWidget\Model\Rule $rule,
\Magento\Rule\Model\Condition\Sql\Builder $sqlBuilder,
\Magento\Framework\App\ResourceConnection $resource,
\Magento\Reports\Model\Event\TypeFactory $eventTypeFactory,
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
\Magento\Widget\Helper\Conditions $conditionsHelper,
\Magento\CatalogInventory\Helper\Stock $stockHelper
) {
$this->_storeManager = $storeManager;
$this->productCollectionFactory = $productCollectionFactory;
$this->catalogProductVisibility = $catalogProductVisibility;
$this->_catalogConfig = $catalogConfig;
$this->rule = $rule;
$this->sqlBuilder = $sqlBuilder;
$this->_resource = $resource;
$this->_eventTypeFactory = $eventTypeFactory;
$this->_localeDate = $localeDate;
$this->conditionsHelper = $conditionsHelper;
$this->stockHelper = $stockHelper;
}
public function getProductCollection($source = 'latest', $numberItems = 8, $order = 'newestfirst', $conditions = '', $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID, $isShowOutOfStock = true)
{
$store = $this->_storeManager->getStore($storeId);
$collection = $this->productCollectionFactory->create();
if ($isShowOutOfStock != 1) {
$this->stockHelper->addInStockFilterToCollection($collection);
}
$collection->addAttributeToFilter('visibility', $this->catalogProductVisibility->getVisibleInCatalogIds());
$collection = $this->_addProductAttributesAndPrices($collection)->addStoreFilter($store);
if ($conditions) {
$conditions = $this->conditionsHelper->decode($conditions);
foreach ($conditions as $key => $condition) {
if (!empty($condition['attribute'])
&& in_array($condition['attribute'], ['special_from_date', 'special_to_date'])
) {
$conditions[$key]['value'] = date('Y-m-d H:i:s', strtotime($condition['value']));
}
}
$this->rule->loadPost(['conditions' => $conditions]);
$conditions = $this->rule->getConditions();
$conditions->collectValidatedAttributes($collection);
$this->sqlBuilder->attachConditionToCollection($collection, $conditions);
}
$collection->setPageSize($numberItems);
switch ($source) {
case 'latest':
$collection->getSelect()->order('created_at DESC');
break;
case 'new':
$this->_getNewProductCollection($collection);
break;
case 'bestseller':
$this->_getBestSellerProductCollection($collection, $store->getId());
break;
case 'onsale':
$this->_getOnsaleProductCollection($collection, $store->getId());
break;
case 'mostviewed':
$this->_getMostViewedProductCollection($collection, $store->getId());
break;
case 'wishlisttop':
$this->_getWishlisttopProductCollection($collection, $store->getId());
break;
case 'free':
$collection->getSelect()->where('price_index.price = ?', 0);
$collection->addAttributeToFilter('type_id', [
'in' => [
\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE,
\Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL,
\Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE
]
]);
break;
case 'featured':
$collection->addAttributeToFilter('featured', ['eq' => 1]);
break;
case 'toprated':
$this->_getTopRatedProductCollection($collection, $store->getId());
break;
case 'random':
$collection->getSelect()->order('RAND()');
break;
}
if ($order!='default') {
switch ($order) {
case 'alphabetically':
$collection->getSelect()->reset(\Magento\Framework\DB\Select::ORDER);
$collection->setOrder('name', 'ASC');
// usort($items, function($a, $b) {
// return $a['name'] > $b['name'];
// });
break;
case 'price_low_to_high':
$collection->getSelect()->reset(\Magento\Framework\DB\Select::ORDER);
$collection->setOrder('price', 'ASC');
// usort($items, function($a, $b) {
// return $a['price'] > $b['price'];
// });
break;
case 'price_high_to_low':
$collection->getSelect()->reset(\Magento\Framework\DB\Select::ORDER);
$collection->setOrder('price', 'DESC');
// usort($items, function($a, $b) {
// return $a['price'] < $b['price'];
// });
break;
case 'random':
$collection->getSelect()->reset(\Magento\Framework\DB\Select::ORDER);
$collection->getSelect()->order('RAND()');
break;
case 'newestfirst':
$collection->getSelect()->reset(\Magento\Framework\DB\Select::ORDER);
$collection->setOrder('entity_id', 'DESC');
// usort($items, function($a, $b) {
// $aval = strtotime($a['created_at']);
// $bval = strtotime((int) $b['created_at']);
// if ($aval == $bval) {
// return 0;
// }
// return $aval < $bval ? 1 : -1;
// });
break;
case 'oldestfirst':
$collection->getSelect()->reset(\Magento\Framework\DB\Select::ORDER);
$collection->setOrder('entity_id', 'ASC');
// usort($items, function($a, $b) {
// $aval = strtotime($a['created_at']);
// $bval = strtotime((int) $b['created_at']);
// if ($aval == $bval) {
// return 0;
// }
// return $aval > $bval ? 1 : -1;
// });
break;
case 'product_attr':
$collection->setOrder('product_position', 'ASC');
// usort($items, function($a, $b) {
// return (isset($a['product_position']) ? (int) $a['product_position'] : 0) > (isset($b['product_position']) ? (int) $b['product_position'] : 0);
// });
break;
}
}
$items = $collection->getItems();
return $items;
}
protected function _getTopRatedProductCollection($collection, $storeId)
{
$collection->joinField(
'review',
$this->_resource->getTableName('review_entity_summary'),
'reviews_count',
'entity_pk_value=entity_id',
'at_review.store_id=' . (int) $storeId,
'review > 0',
'left'
);
$collection->getSelect()->order(['review DESC', 'e.created_at']);
}
protected function _getNewProductCollection($collection)
{
$todayStartOfDayDate = $this->_localeDate->date()->setTime(0, 0, 0)->format('Y-m-d H:i:s');
$todayEndOfDayDate = $this->_localeDate->date()->setTime(23, 59, 59)->format('Y-m-d H:i:s');
$collection->addAttributeToFilter(
'news_from_date',
[
'or' => [
0 => ['date' => true, 'to' => $todayEndOfDayDate],
1 => ['is' => new \Zend_Db_Expr('null')],
]
],
'left'
)->addAttributeToFilter(
'news_to_date',
[
'or' => [
0 => ['date' => true, 'from' => $todayStartOfDayDate],
1 => ['is' => new \Zend_Db_Expr('null')],
]
],
'left'
)->addAttributeToFilter(
[
['attribute' => 'news_from_date', 'is' => new \Zend_Db_Expr('not null')],
['attribute' => 'news_to_date', 'is' => new \Zend_Db_Expr('not null')],
]
)->addAttributeToSort(
'news_from_date',
'desc'
);
}
protected function _getBestSellerProductCollection($collection, $storeId)
{
$collection->getSelect()
->join(
[
'aggregation' => $this->_resource->getTableName('sales_bestsellers_aggregated_monthly'),
],
"e.entity_id = aggregation.product_id AND aggregation.store_id={$storeId} AND qty_ordered >0",
[
'sold_quantity' => 'SUM(aggregation.qty_ordered)'
]
)->group(
'e.entity_id'
)->order([
'sold_quantity DESC',
'e.created_at'
]);
}
protected function _getWishlisttopProductCollection($collection, $storeId)
{
$collection->getSelect()
->join(
[
'wi' => $this->_resource->getTableName('wishlist_item'),
],
'e.entity_id = wi.product_id',
[
'count' => 'COUNT(wi.wishlist_item_id)'
]
)
->group('e.entity_id')
->order(['count DESC']);
}
protected function _getMostViewedProductCollection($collection, $storeId)
{
$eventTypes = $this->_eventTypeFactory->create()->getCollection();
foreach ($eventTypes as $eventType) {
if ($eventType->getEventName() == 'catalog_product_view') {
$productViewEvent = (int)$eventType->getId();
break;
}
}
$collection->getSelect()
->join(
[
'report_table_views' => $this->_resource->getTableName('report_event'),
],
'e.entity_id = report_table_views.object_id AND report_table_views.event_type_id = ' . $productViewEvent,
[
'views' => 'COUNT(report_table_views.event_id)'
]
)->group(
'e.entity_id'
)->order([
'views DESC',
'e.created_at'
])->having(
'COUNT(report_table_views.event_id) > ?',
0
);
}
protected function _getOnsaleProductCollection($collection, $storeId)
{
$todayStartOfDayDate = $this->_localeDate->date()->setTime(0, 0, 0)->format('Y-m-d H:i:s');
$todayEndOfDayDate = $this->_localeDate->date()->setTime(23, 59, 59)->format('Y-m-d H:i:s');
$collection->addAttributeToFilter(
'special_from_date',
[
'or' => [
0 => ['date' => true, 'to' => $todayEndOfDayDate],
1 => ['is' => new \Zend_Db_Expr('null')],
]
],
'left'
)->addAttributeToFilter(
'special_to_date',
[
'or' => [
0 => ['date' => true, 'from' => $todayStartOfDayDate],
1 => ['is' => new \Zend_Db_Expr('null')],
]
],
'left'
)->addAttributeToFilter(
[
['attribute' => 'special_from_date', 'is' => new \Zend_Db_Expr('not null')],
['attribute' => 'special_to_date', 'is' => new \Zend_Db_Expr('not null')],
]
)->addAttributeToSort(
'special_from_date',
'desc'
);
$collection->getSelect()->where('price_index.final_price < price_index.price');
}
/**
* Add all attributes and apply pricing logic to products collection
* to get correct values in different products lists.
* E.g. crosssells, upsells, new products, recently viewed
*
* @param \Magento\Catalog\Model\ResourceModel\Product\Collection $collection
* @return \Magento\Catalog\Model\ResourceModel\Product\Collection
*/
protected function _addProductAttributesAndPrices(
\Magento\Catalog\Model\ResourceModel\Product\Collection $collection
) {
$collection->addTaxPercents()
->addMinimalPrice()
->addFinalPrice()
->addAttributeToSelect($this->_catalogConfig->getProductAttributes())
->addUrlRewrite();
return $collection;
}
}
@@ -0,0 +1,310 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Model\ResourceModel\Collection;
use Magento\Store\Model\Store;
class AbstractCollection extends \Magento\Eav\Model\Entity\Collection\AbstractCollection
{
/**
* Current scope (store Id)
*
* @var int
*/
protected $_storeId;
/**
* Store manager
*
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $_storeManager;
/**
* @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
* @param \Psr\Log\LoggerInterface $logger
* @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
* @param \Magento\Framework\Event\ManagerInterface $eventManager
* @param \Magento\Eav\Model\Config $eavConfig
* @param \Magento\Framework\App\ResourceConnection $resource
* @param \Magento\Eav\Model\EntityFactory $eavEntityFactory
* @param \Magento\Eav\Model\ResourceModel\Helper $resourceHelper
* @param \Magento\Framework\Validator\UniversalFactory $universalFactory
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\DB\Adapter\AdapterInterface|null $connection
*/
public function __construct(
\Magento\Framework\Data\Collection\EntityFactory $entityFactory,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
\Magento\Framework\Event\ManagerInterface $eventManager,
\Magento\Eav\Model\Config $eavConfig,
\Magento\Framework\App\ResourceConnection $resource,
\Magento\Eav\Model\EntityFactory $eavEntityFactory,
\Magento\Eav\Model\ResourceModel\Helper $resourceHelper,
\Magento\Framework\Validator\UniversalFactory $universalFactory,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null
) {
$this->_storeManager = $storeManager;
parent::__construct(
$entityFactory,
$logger,
$fetchStrategy,
$eventManager,
$eavConfig,
$resource,
$eavEntityFactory,
$resourceHelper,
$universalFactory,
$connection
);
}
/**
* Retrieve Entity Primary Key
*
* @param \Magento\Eav\Model\Entity\AbstractEntity $entity
* @return string
*/
protected function getEntityPkName(\Magento\Eav\Model\Entity\AbstractEntity $entity)
{
return $entity->getLinkField();
}
/**
* Set store scope
*
* @param int|string|\Magento\Store\Model\Store $store
* @return $this
*/
public function setStore($store)
{
$this->setStoreId($this->_storeManager->getStore($store)->getId());
return $this;
}
/**
* Set store scope
*
* @param int|string|\Magento\Store\Api\Data\StoreInterface $storeId
* @return $this
*/
public function setStoreId($storeId)
{
if ($storeId instanceof \Magento\Store\Api\Data\StoreInterface) {
$storeId = $storeId->getId();
}
$this->_storeId = (int)$storeId;
return $this;
}
/**
* Return current store id
*
* @return int
*/
public function getStoreId()
{
if ($this->_storeId === null) {
$this->setStoreId($this->_storeManager->getStore()->getId());
}
return $this->_storeId;
}
/**
* Retrieve default store id
*
* @return int
*/
public function getDefaultStoreId()
{
return \Magento\Store\Model\Store::DEFAULT_STORE_ID;
}
/**
* Retrieve attributes load select
*
* @param string $table
* @param array|int $attributeIds
* @return \Magento\Eav\Model\Entity\Collection\AbstractCollection
*/
protected function _getLoadAttributesSelect($table, $attributeIds = [])
{
if (empty($attributeIds)) {
$attributeIds = $this->_selectAttributes;
}
$storeId = $this->getStoreId();
$connection = $this->getConnection();
$entityTable = $this->getEntity()->getEntityTable();
$indexList = $connection->getIndexList($entityTable);
$entityIdField = $indexList[$connection->getPrimaryKeyName($entityTable)]['COLUMNS_LIST'][0];
if ($storeId) {
$joinCondition = [
't_s.attribute_id = t_d.attribute_id',
"t_s.{$entityIdField} = t_d.{$entityIdField}",
$connection->quoteInto('t_s.store_id = ?', $storeId),
];
$select = $connection->select()->from(
['t_d' => $table],
['attribute_id']
)->join(
['e' => $entityTable],
"e.{$entityIdField} = t_d.{$entityIdField}",
['e.entity_id']
)->where(
"e.entity_id IN (?)",
array_keys($this->_itemsById)
)->where(
't_d.attribute_id IN (?)',
$attributeIds
)->joinLeft(
['t_s' => $table],
implode(' AND ', $joinCondition),
[]
)->where(
't_d.store_id = ?',
$connection->getIfNullSql('t_s.store_id', \Magento\Store\Model\Store::DEFAULT_STORE_ID)
);
} else {
$select = $connection->select()->from(
['t_d' => $table],
['attribute_id']
)->join(
['e' => $entityTable],
"e.{$entityIdField} = t_d.{$entityIdField}",
['e.entity_id']
)->where(
"e.entity_id IN (?)",
array_keys($this->_itemsById)
)->where(
'attribute_id IN (?)',
$attributeIds
)->where(
'store_id = ?',
$this->getDefaultStoreId()
);
}
return $select;
}
/**
* @param \Magento\Framework\DB\Select $select
* @param string $table
* @param string $type
* @return \Magento\Framework\DB\Select
*/
protected function _addLoadAttributesSelectValues($select, $table, $type)
{
$storeId = $this->getStoreId();
if ($storeId) {
$connection = $this->getConnection();
$valueExpr = $connection->getCheckSql('t_s.value_id IS NULL', 't_d.value', 't_s.value');
$select->columns(
['default_value' => 't_d.value', 'store_value' => 't_s.value', 'value' => $valueExpr]
);
} else {
$select = parent::_addLoadAttributesSelectValues($select, $table, $type);
}
return $select;
}
/**
* Adding join statement to collection select instance
*
* @param string $method
* @param object $attribute
* @param string $tableAlias
* @param array $condition
* @param string $fieldCode
* @param string $fieldAlias
* @return \Magento\Eav\Model\Entity\Collection\AbstractCollection
*/
protected function _joinAttributeToSelect($method, $attribute, $tableAlias, $condition, $fieldCode, $fieldAlias)
{
if (isset($this->_joinAttributes[$fieldCode]['store_id'])) {
$storeId = $this->_joinAttributes[$fieldCode]['store_id'];
} else {
$storeId = $this->getStoreId();
}
$connection = $this->getConnection();
if ($storeId != $this->getDefaultStoreId() && !$attribute->isScopeGlobal()) {
/**
* Add joining default value for not default store
* if value for store is null - we use default value
*/
$defCondition = '(' . implode(') AND (', $condition) . ')';
$defAlias = $tableAlias . '_default';
$defAlias = $this->getConnection()->getTableName($defAlias);
$defFieldAlias = str_replace($tableAlias, $defAlias, $fieldAlias);
$tableAlias = $this->getConnection()->getTableName($tableAlias);
$defCondition = str_replace($tableAlias, $defAlias, $defCondition);
$defCondition .= $connection->quoteInto(
" AND " . $connection->quoteColumnAs("{$defAlias}.store_id", null) . " = ?",
$this->getDefaultStoreId()
);
$this->getSelect()->{$method}(
[$defAlias => $attribute->getBackend()->getTable()],
$defCondition,
[]
);
$method = 'joinLeft';
$fieldAlias = $this->getConnection()->getCheckSql(
"{$tableAlias}.value_id > 0",
$fieldAlias,
$defFieldAlias
);
$this->_joinAttributes[$fieldCode]['condition_alias'] = $fieldAlias;
$this->_joinAttributes[$fieldCode]['attribute'] = $attribute;
} else {
$storeId = $this->getDefaultStoreId();
}
$condition[] = $connection->quoteInto(
$connection->quoteColumnAs("{$tableAlias}.store_id", null) . ' = ?',
$storeId
);
return parent::_joinAttributeToSelect($method, $attribute, $tableAlias, $condition, $fieldCode, $fieldAlias);
}
/**
* Add store availability filter. Include availability product
* for store website
*
* @param null|string|bool|int|Store $store
* @return $this
*/
public function addStoreFilter($store = null)
{
if ($store === null) {
$store = $this->getStoreId();
}
$store = $this->_storeManager->getStore($store);
if ($store->getId() != Store::DEFAULT_STORE_ID) {
$this->setStoreId($store);
$this->_productLimitationFilters['store_id'] = $store->getId();
}
return $this;
}
}
+273
View File
@@ -0,0 +1,273 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Model\Source;
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\CacheInterface;
use Magento\Framework\DB\Helper as DbHelper;
use Magento\Catalog\Model\Category as CategoryModel;
class Categories
{
/**#@+
* Category tree cache id
*/
const CATEGORY_TREE_ID = 'MAGEZON_CATEGORY_TREE';
/**
* @var CacheInterface
*/
private $cacheManager;
/**
* @var CategoryCollectionFactory
*/
private $categoryCollectionFactory;
/**
* @var DbHelper
*/
private $dbHelper;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
private $storeManager;
/**
* @var \Magezon\Core\Helper\Data
*/
private $coreHelper;
/**
* @param CategoryCollectionFactory $categoryCollectionFactory
* @param DbHelper $dbHelper
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magezon\Core\Helper\Data $coreHelper
*/
public function __construct(
CategoryCollectionFactory $categoryCollectionFactory,
DbHelper $dbHelper,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magezon\Core\Helper\Data $coreHelper
) {
$this->categoryCollectionFactory = $categoryCollectionFactory;
$this->dbHelper = $dbHelper;
$this->storeManager = $storeManager;
$this->coreHelper = $coreHelper;
}
public function getConfig()
{
return $this->getOptions();
}
public function getOptions()
{
$categoryTree = $this->getCacheManager()->load(self::CATEGORY_TREE_ID);
if ($categoryTree) {
return $this->coreHelper->unserialize($categoryTree);
}
$collection = $this->categoryCollectionFactory->create();
$collection->addAttributeToSelect('name');
$options = [];
foreach ($collection as $category) {
$categoryLabel = $this->getSpaces($category['level']) . '(ID:' . $category->getId() . ') ' . $category->getName();
$category['label'] = $categoryLabel;
$options[] = [
'value' => $category->getId(),
'label' => $categoryLabel,
'short_label' => '(ID:' . $category->getId() . ')' . $category->getName()
];
}
$this->getCacheManager()->save(
$this->coreHelper->serialize($options),
self::CATEGORY_TREE_ID,
[
\Magento\Framework\App\Cache\Type\Block::CACHE_TAG
]
);
return $options;
}
protected function getSpaces($number)
{
$s = '';
for($i = 0; $i < $number; $i++) {
$s .= '_ ';
}
return $s;
}
/**
* Retrieve cache interface
*
* @return CacheInterface
* @deprecated 101.0.3
*/
private function getCacheManager()
{
if (!$this->cacheManager) {
$this->cacheManager = ObjectManager::getInstance()
->get(CacheInterface::class);
}
return $this->cacheManager;
}
/**
* Retrieve categories tree
*
* @param string|null $filter
* @return array
* @since 101.0.0
*/
public function getCategoriesTree($storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID)
{
$categoryTree = $this->getCacheManager()->load(self::CATEGORY_TREE_ID . '_' . $storeId);
if ($categoryTree) {
//return $this->coreHelper->unserialize($categoryTree);
}
/* @var $matchingNamesCollection \Magento\Catalog\Model\ResourceModel\Category\Collection */
$matchingNamesCollection = $this->categoryCollectionFactory->create();
$matchingNamesCollection->addAttributeToSelect('path')
->addAttributeToFilter('entity_id', ['neq' => CategoryModel::TREE_ROOT_ID])
->addIsActiveFilter()
->setStoreId($storeId);
$shownCategoriesIds = [];
/** @var \Magento\Catalog\Model\Category $category */
foreach ($matchingNamesCollection as $category) {
foreach (explode('/', $category->getPath()) as $parentId) {
$shownCategoriesIds[$parentId] = 1;
}
}
/* @var $collection \Magento\Catalog\Model\ResourceModel\Category\Collection */
$collection = $this->categoryCollectionFactory->create();
$collection->addAttributeToFilter('entity_id', ['in' => array_keys($shownCategoriesIds)])
->addAttributeToSelect(['name', 'is_active', 'parent_id'])
->addIsActiveFilter()
->setStoreId($storeId);
$categoryById = [
CategoryModel::TREE_ROOT_ID => [
'value' => CategoryModel::TREE_ROOT_ID,
'optgroup' => null,
],
];
foreach ($collection as $category) {
foreach ([$category->getId(), $category->getParentId()] as $categoryId) {
if (!isset($categoryById[$categoryId])) {
$categoryById[$categoryId] = ['value' => $categoryId];
}
}
$categoryById[$category->getId()]['is_active'] = $category->getIsActive();
$categoryById[$category->getId()]['label'] = $category->getName();
$categoryById[$category->getId()]['name'] = $category->getName();
$categoryById[$category->getId()]['id'] = $category->getId();
$categoryById[$category->getId()]['url'] = $category->getUrl();
$categoryById[$category->getId()]['product_count'] = $category->getProductCount();
$categoryById[$category->getId()]['children_cout'] = $category->getChildrenCount();
$categoryById[$category->getParentId()]['optgroup'][] = &$categoryById[$category->getId()];
}
$this->getCacheManager()->save(
$this->coreHelper->serialize($categoryById[CategoryModel::TREE_ROOT_ID]['optgroup']),
self::CATEGORY_TREE_ID . '_' . $storeId,
[
\Magento\Catalog\Model\Category::CACHE_TAG,
\Magento\Framework\App\Cache\Type\Block::CACHE_TAG
]
);
return $categoryById[CategoryModel::TREE_ROOT_ID]['optgroup'];
}
private function _prepareChildren($list, $collection)
{
$children = [];
foreach ($list as $item) {
$category = $item['category'];
if (isset($item['children'])) {
$category->setSubCategories($this->_prepareChildren($item['children'], $collection));
}
$children[] = $category;
}
return $children;
}
public function getCategoriesCollection($ids, $loadCount)
{
$storeId = $this->storeManager->getStore()->getId();
$categories = $this->categoryCollectionFactory->create();
$categories->addAttributeToSelect(['name', 'is_active', 'parent_id']);
$categories->setStoreId($storeId);
$attributes[] = [
'attribute' => 'entity_id', 'in' => $ids
];
foreach ($ids as $k => $v) {
$attributes[] = [
'attribute' => 'path', 'like' => '%/' . $v . '/%'
];
}
$categories->addAttributeToFilter($attributes);
$categories->addUrlRewriteToResult();
$categories->addIsActiveFilter();
if ($loadCount) {
$categories->getSelect()
->joinLeft(
[
'aggregation' => $categories->getResource()->getTable('catalog_category_product'),
],
"e.entity_id = aggregation.category_id",
[
'product_count' => 'COUNT(aggregation.product_id)'
]
)->group('e.entity_id')->group($categories->getResource()->getTable('url_rewrite'). '.request_path');
}
return $categories;
}
public function getCategories($ids, $loadCount)
{
$categories = $this->getCategoriesCollection($ids, $loadCount);
$list = [];
foreach ($categories as $category) {
$list[$category->getId()]['category'] = $category;
$list[$category->getParentId()]['children'][] = &$list[$category->getId()];
}
$result = [];
foreach ($ids as $id) {
$category = $categories->getItemById($id);
if ($category) {
if (isset($list[$id]['children'])) {
$category->setSubCategories($this->_prepareChildren($list[$id]['children'], $categories));
}
$result[] = $category;
}
}
return $result;
}
}
+72
View File
@@ -0,0 +1,72 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Model\Source;
use Magento\Framework\Data\OptionSourceInterface;
class CustomerGroup implements OptionSourceInterface
{
/**
* @var array
*/
protected $options;
/**
* @var \Magento\Customer\Api\GroupRepositoryInterface
*/
protected $_groupRepository;
/**
* @var \Magento\Framework\Api\SearchCriteriaBuilder
*/
protected $_searchCriteriaBuilder;
/**
* @var \Magento\Framework\Convert\DataObject
*/
protected $_objectConverter;
/**
* @param \Magento\Customer\Api\GroupRepositoryInterface $groupRepository
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
* @param \Magento\Framework\Convert\DataObject $objectConverter
*/
public function __construct(
\Magento\Customer\Api\GroupRepositoryInterface $groupRepository,
\Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
\Magento\Framework\Convert\DataObject $objectConverter
) {
$this->_groupRepository = $groupRepository;
$this->_searchCriteriaBuilder = $searchCriteriaBuilder;
$this->_objectConverter = $objectConverter;
}
/**
* Get options
*
* @return array
*/
public function toOptionArray()
{
if ($this->options !== null) {
return $this->options;
}
$groups = $this->_groupRepository->getList($this->_searchCriteriaBuilder->create())->getItems();
$this->options = $this->_objectConverter->toOptionArray($groups, 'id', 'code');
return $this->options;
}
}
+709
View File
@@ -0,0 +1,709 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Model\Source;
class FontAwesomeList implements \Magento\Framework\Data\OptionSourceInterface
{
public function toOptionArray()
{
$list = [
'fa-glass' => '\f000',
'fa-music' => '\f001',
'fa-search' => '\f002',
'fa-envelope-o' => '\f003',
'fa-heart' => '\f004',
'fa-star' => '\f005',
'fa-star-o' => '\f006',
'fa-user' => '\f007',
'fa-film' => '\f008',
'fa-th-large' => '\f009',
'fa-th' => '\f00a',
'fa-th-list' => '\f00b',
'fa-check' => '\f00c',
'fa-times' => '\f00d',
'fa-search-plus' => '\f00e',
'fa-search-minus' => '\f010',
'fa-power-off' => '\f011',
'fa-signal' => '\f012',
'fa-cog' => '\f013',
'fa-trash-o' => '\f014',
'fa-home' => '\f015',
'fa-file-o' => '\f016',
'fa-clock-o' => '\f017',
'fa-road' => '\f018',
'fa-download' => '\f019',
'fa-arrow-circle-o-down' => '\f01a',
'fa-arrow-circle-o-up' => '\f01b',
'fa-inbox' => '\f01c',
'fa-play-circle-o' => '\f01d',
'fa-repeat' => '\f01e',
'fa-refresh' => '\f021',
'fa-list-alt' => '\f022',
'fa-lock' => '\f023',
'fa-flag' => '\f024',
'fa-headphones' => '\f025',
'fa-volume-off' => '\f026',
'fa-volume-down' => '\f027',
'fa-volume-up' => '\f028',
'fa-qrcode' => '\f029',
'fa-barcode' => '\f02a',
'fa-tag' => '\f02b',
'fa-tags' => '\f02c',
'fa-book' => '\f02d',
'fa-bookmark' => '\f02e',
'fa-print' => '\f02f',
'fa-camera' => '\f030',
'fa-font' => '\f031',
'fa-bold' => '\f032',
'fa-italic' => '\f033',
'fa-text-height' => '\f034',
'fa-text-width' => '\f035',
'fa-align-left' => '\f036',
'fa-align-center' => '\f037',
'fa-align-right' => '\f038',
'fa-align-justify' => '\f039',
'fa-list' => '\f03a',
'fa-outdent' => '\f03b',
'fa-indent' => '\f03c',
'fa-video-camera' => '\f03d',
'fa-picture-o' => '\f03e',
'fa-pencil' => '\f040',
'fa-map-marker' => '\f041',
'fa-adjust' => '\f042',
'fa-tint' => '\f043',
'fa-pencil-square-o' => '\f044',
'fa-share-square-o' => '\f045',
'fa-check-square-o' => '\f046',
'fa-arrows' => '\f047',
'fa-step-backward' => '\f048',
'fa-fast-backward' => '\f049',
'fa-backward' => '\f04a',
'fa-play' => '\f04b',
'fa-pause' => '\f04c',
'fa-stop' => '\f04d',
'fa-forward' => '\f04e',
'fa-fast-forward' => '\f050',
'fa-step-forward' => '\f051',
'fa-eject' => '\f052',
'fa-chevron-left' => '\f053',
'fa-chevron-right' => '\f054',
'fa-plus-circle' => '\f055',
'fa-minus-circle' => '\f056',
'fa-times-circle' => '\f057',
'fa-check-circle' => '\f058',
'fa-question-circle' => '\f059',
'fa-info-circle' => '\f05a',
'fa-crosshairs' => '\f05b',
'fa-times-circle-o' => '\f05c',
'fa-check-circle-o' => '\f05d',
'fa-ban' => '\f05e',
'fa-arrow-left' => '\f060',
'fa-arrow-right' => '\f061',
'fa-arrow-up' => '\f062',
'fa-arrow-down' => '\f063',
'fa-share' => '\f064',
'fa-expand' => '\f065',
'fa-compress' => '\f066',
'fa-plus' => '\f067',
'fa-minus' => '\f068',
'fa-asterisk' => '\f069',
'fa-exclamation-circle' => '\f06a',
'fa-gift' => '\f06b',
'fa-leaf' => '\f06c',
'fa-fire' => '\f06d',
'fa-eye' => '\f06e',
'fa-eye-slash' => '\f070',
'fa-exclamation-triangle' => '\f071',
'fa-plane' => '\f072',
'fa-calendar' => '\f073',
'fa-random' => '\f074',
'fa-comment' => '\f075',
'fa-magnet' => '\f076',
'fa-chevron-up' => '\f077',
'fa-chevron-down' => '\f078',
'fa-retweet' => '\f079',
'fa-shopping-cart' => '\f07a',
'fa-folder' => '\f07b',
'fa-folder-open' => '\f07c',
'fa-arrows-v' => '\f07d',
'fa-arrows-h' => '\f07e',
'fa-bar-chart' => '\f080',
'fa-twitter-square' => '\f081',
'fa-facebook-square' => '\f082',
'fa-camera-retro' => '\f083',
'fa-key' => '\f084',
'fa-cogs' => '\f085',
'fa-comments' => '\f086',
'fa-thumbs-o-up' => '\f087',
'fa-thumbs-o-down' => '\f088',
'fa-star-half' => '\f089',
'fa-heart-o' => '\f08a',
'fa-sign-out' => '\f08b',
'fa-linkedin-square' => '\f08c',
'fa-thumb-tack' => '\f08d',
'fa-external-link' => '\f08e',
'fa-sign-in' => '\f090',
'fa-trophy' => '\f091',
'fa-github-square' => '\f092',
'fa-upload' => '\f093',
'fa-lemon-o' => '\f094',
'fa-phone' => '\f095',
'fa-square-o' => '\f096',
'fa-bookmark-o' => '\f097',
'fa-phone-square' => '\f098',
'fa-twitter' => '\f099',
'fa-facebook' => '\f09a',
'fa-github' => '\f09b',
'fa-unlock' => '\f09c',
'fa-credit-card' => '\f09d',
'fa-rss' => '\f09e',
'fa-hdd-o' => '\f0a0',
'fa-bullhorn' => '\f0a1',
'fa-bell' => '\f0f3',
'fa-certificate' => '\f0a3',
'fa-hand-o-right' => '\f0a4',
'fa-hand-o-left' => '\f0a5',
'fa-hand-o-up' => '\f0a6',
'fa-hand-o-down' => '\f0a7',
'fa-arrow-circle-left' => '\f0a8',
'fa-arrow-circle-right' => '\f0a9',
'fa-arrow-circle-up' => '\f0aa',
'fa-arrow-circle-down' => '\f0ab',
'fa-globe' => '\f0ac',
'fa-wrench' => '\f0ad',
'fa-tasks' => '\f0ae',
'fa-filter' => '\f0b0',
'fa-briefcase' => '\f0b1',
'fa-arrows-alt' => '\f0b2',
'fa-users' => '\f0c0',
'fa-link' => '\f0c1',
'fa-cloud' => '\f0c2',
'fa-flask' => '\f0c3',
'fa-scissors' => '\f0c4',
'fa-files-o' => '\f0c5',
'fa-paperclip' => '\f0c6',
'fa-floppy-o' => '\f0c7',
'fa-square' => '\f0c8',
'fa-bars' => '\f0c9',
'fa-list-ul' => '\f0ca',
'fa-list-ol' => '\f0cb',
'fa-strikethrough' => '\f0cc',
'fa-underline' => '\f0cd',
'fa-table' => '\f0ce',
'fa-magic' => '\f0d0',
'fa-truck' => '\f0d1',
'fa-pinterest' => '\f0d2',
'fa-pinterest-square' => '\f0d3',
'fa-google-plus-square' => '\f0d4',
'fa-google-plus' => '\f0d5',
'fa-money' => '\f0d6',
'fa-caret-down' => '\f0d7',
'fa-caret-up' => '\f0d8',
'fa-caret-left' => '\f0d9',
'fa-caret-right' => '\f0da',
'fa-columns' => '\f0db',
'fa-sort' => '\f0dc',
'fa-sort-desc' => '\f0dd',
'fa-sort-asc' => '\f0de',
'fa-envelope' => '\f0e0',
'fa-linkedin' => '\f0e1',
'fa-undo' => '\f0e2',
'fa-gavel' => '\f0e3',
'fa-tachometer' => '\f0e4',
'fa-comment-o' => '\f0e5',
'fa-comments-o' => '\f0e6',
'fa-bolt' => '\f0e7',
'fa-sitemap' => '\f0e8',
'fa-umbrella' => '\f0e9',
'fa-clipboard' => '\f0ea',
'fa-lightbulb-o' => '\f0eb',
'fa-exchange' => '\f0ec',
'fa-cloud-download' => '\f0ed',
'fa-cloud-upload' => '\f0ee',
'fa-user-md' => '\f0f0',
'fa-stethoscope' => '\f0f1',
'fa-suitcase' => '\f0f2',
'fa-bell-o' => '\f0a2',
'fa-coffee' => '\f0f4',
'fa-cutlery' => '\f0f5',
'fa-file-text-o' => '\f0f6',
'fa-building-o' => '\f0f7',
'fa-hospital-o' => '\f0f8',
'fa-ambulance' => '\f0f9',
'fa-medkit' => '\f0fa',
'fa-fighter-jet' => '\f0fb',
'fa-beer' => '\f0fc',
'fa-h-square' => '\f0fd',
'fa-plus-square' => '\f0fe',
'fa-angle-double-left' => '\f100',
'fa-angle-double-right' => '\f101',
'fa-angle-double-up' => '\f102',
'fa-angle-double-down' => '\f103',
'fa-angle-left' => '\f104',
'fa-angle-right' => '\f105',
'fa-angle-up' => '\f106',
'fa-angle-down' => '\f107',
'fa-desktop' => '\f108',
'fa-laptop' => '\f109',
'fa-tablet' => '\f10a',
'fa-mobile' => '\f10b',
'fa-circle-o' => '\f10c',
'fa-quote-left' => '\f10d',
'fa-quote-right' => '\f10e',
'fa-spinner' => '\f110',
'fa-circle' => '\f111',
'fa-reply' => '\f112',
'fa-github-alt' => '\f113',
'fa-folder-o' => '\f114',
'fa-folder-open-o' => '\f115',
'fa-smile-o' => '\f118',
'fa-frown-o' => '\f119',
'fa-meh-o' => '\f11a',
'fa-gamepad' => '\f11b',
'fa-keyboard-o' => '\f11c',
'fa-flag-o' => '\f11d',
'fa-flag-checkered' => '\f11e',
'fa-terminal' => '\f120',
'fa-code' => '\f121',
'fa-reply-all' => '\f122',
'fa-star-half-o' => '\f123',
'fa-location-arrow' => '\f124',
'fa-crop' => '\f125',
'fa-code-fork' => '\f126',
'fa-chain-broken' => '\f127',
'fa-question' => '\f128',
'fa-info' => '\f129',
'fa-exclamation' => '\f12a',
'fa-superscript' => '\f12b',
'fa-subscript' => '\f12c',
'fa-eraser' => '\f12d',
'fa-puzzle-piece' => '\f12e',
'fa-microphone' => '\f130',
'fa-microphone-slash' => '\f131',
'fa-shield' => '\f132',
'fa-calendar-o' => '\f133',
'fa-fire-extinguisher' => '\f134',
'fa-rocket' => '\f135',
'fa-maxcdn' => '\f136',
'fa-chevron-circle-left' => '\f137',
'fa-chevron-circle-right' => '\f138',
'fa-chevron-circle-up' => '\f139',
'fa-chevron-circle-down' => '\f13a',
'fa-html5' => '\f13b',
'fa-css3' => '\f13c',
'fa-anchor' => '\f13d',
'fa-unlock-alt' => '\f13e',
'fa-bullseye' => '\f140',
'fa-ellipsis-h' => '\f141',
'fa-ellipsis-v' => '\f142',
'fa-rss-square' => '\f143',
'fa-play-circle' => '\f144',
'fa-ticket' => '\f145',
'fa-minus-square' => '\f146',
'fa-minus-square-o' => '\f147',
'fa-level-up' => '\f148',
'fa-level-down' => '\f149',
'fa-check-square' => '\f14a',
'fa-pencil-square' => '\f14b',
'fa-external-link-square' => '\f14c',
'fa-share-square' => '\f14d',
'fa-compass' => '\f14e',
'fa-caret-square-o-down' => '\f150',
'fa-caret-square-o-up' => '\f151',
'fa-caret-square-o-right' => '\f152',
'fa-eur' => '\f153',
'fa-gbp' => '\f154',
'fa-usd' => '\f155',
'fa-inr' => '\f156',
'fa-jpy' => '\f157',
'fa-rub' => '\f158',
'fa-krw' => '\f159',
'fa-btc' => '\f15a',
'fa-file' => '\f15b',
'fa-file-text' => '\f15c',
'fa-sort-alpha-asc' => '\f15d',
'fa-sort-alpha-desc' => '\f15e',
'fa-sort-amount-asc' => '\f160',
'fa-sort-amount-desc' => '\f161',
'fa-sort-numeric-asc' => '\f162',
'fa-sort-numeric-desc' => '\f163',
'fa-thumbs-up' => '\f164',
'fa-thumbs-down' => '\f165',
'fa-youtube-square' => '\f166',
'fa-youtube' => '\f167',
'fa-xing' => '\f168',
'fa-xing-square' => '\f169',
'fa-youtube-play' => '\f16a',
'fa-dropbox' => '\f16b',
'fa-stack-overflow' => '\f16c',
'fa-instagram' => '\f16d',
'fa-flickr' => '\f16e',
'fa-adn' => '\f170',
'fa-bitbucket' => '\f171',
'fa-bitbucket-square' => '\f172',
'fa-tumblr' => '\f173',
'fa-tumblr-square' => '\f174',
'fa-long-arrow-down' => '\f175',
'fa-long-arrow-up' => '\f176',
'fa-long-arrow-left' => '\f177',
'fa-long-arrow-right' => '\f178',
'fa-apple' => '\f179',
'fa-windows' => '\f17a',
'fa-android' => '\f17b',
'fa-linux' => '\f17c',
'fa-dribbble' => '\f17d',
'fa-skype' => '\f17e',
'fa-foursquare' => '\f180',
'fa-trello' => '\f181',
'fa-female' => '\f182',
'fa-male' => '\f183',
'fa-gratipay' => '\f184',
'fa-sun-o' => '\f185',
'fa-moon-o' => '\f186',
'fa-archive' => '\f187',
'fa-bug' => '\f188',
'fa-vk' => '\f189',
'fa-weibo' => '\f18a',
'fa-renren' => '\f18b',
'fa-pagelines' => '\f18c',
'fa-stack-exchange' => '\f18d',
'fa-arrow-circle-o-right' => '\f18e',
'fa-arrow-circle-o-left' => '\f190',
'fa-caret-square-o-left' => '\f191',
'fa-dot-circle-o' => '\f192',
'fa-wheelchair' => '\f193',
'fa-vimeo-square' => '\f194',
'fa-try' => '\f195',
'fa-plus-square-o' => '\f196',
'fa-space-shuttle' => '\f197',
'fa-slack' => '\f198',
'fa-envelope-square' => '\f199',
'fa-wordpress' => '\f19a',
'fa-openid' => '\f19b',
'fa-university' => '\f19c',
'fa-graduation-cap' => '\f19d',
'fa-yahoo' => '\f19e',
'fa-google' => '\f1a0',
'fa-reddit' => '\f1a1',
'fa-reddit-square' => '\f1a2',
'fa-stumbleupon-circle' => '\f1a3',
'fa-stumbleupon' => '\f1a4',
'fa-delicious' => '\f1a5',
'fa-digg' => '\f1a6',
'fa-pied-piper-pp' => '\f1a7',
'fa-pied-piper-alt' => '\f1a8',
'fa-drupal' => '\f1a9',
'fa-joomla' => '\f1aa',
'fa-language' => '\f1ab',
'fa-fax' => '\f1ac',
'fa-building' => '\f1ad',
'fa-child' => '\f1ae',
'fa-paw' => '\f1b0',
'fa-spoon' => '\f1b1',
'fa-cube' => '\f1b2',
'fa-cubes' => '\f1b3',
'fa-behance' => '\f1b4',
'fa-behance-square' => '\f1b5',
'fa-steam' => '\f1b6',
'fa-steam-square' => '\f1b7',
'fa-recycle' => '\f1b8',
'fa-car' => '\f1b9',
'fa-taxi' => '\f1ba',
'fa-tree' => '\f1bb',
'fa-spotify' => '\f1bc',
'fa-deviantart' => '\f1bd',
'fa-soundcloud' => '\f1be',
'fa-database' => '\f1c0',
'fa-file-pdf-o' => '\f1c1',
'fa-file-word-o' => '\f1c2',
'fa-file-excel-o' => '\f1c3',
'fa-file-powerpoint-o' => '\f1c4',
'fa-file-image-o' => '\f1c5',
'fa-file-archive-o' => '\f1c6',
'fa-file-audio-o' => '\f1c7',
'fa-file-video-o' => '\f1c8',
'fa-file-code-o' => '\f1c9',
'fa-vine' => '\f1ca',
'fa-codepen' => '\f1cb',
'fa-jsfiddle' => '\f1cc',
'fa-life-ring' => '\f1cd',
'fa-circle-o-notch' => '\f1ce',
'fa-rebel' => '\f1d0',
'fa-empire' => '\f1d1',
'fa-git-square' => '\f1d2',
'fa-git' => '\f1d3',
'fa-hacker-news' => '\f1d4',
'fa-tencent-weibo' => '\f1d5',
'fa-qq' => '\f1d6',
'fa-weixin' => '\f1d7',
'fa-paper-plane' => '\f1d8',
'fa-paper-plane-o' => '\f1d9',
'fa-history' => '\f1da',
'fa-circle-thin' => '\f1db',
'fa-header' => '\f1dc',
'fa-paragraph' => '\f1dd',
'fa-sliders' => '\f1de',
'fa-share-alt' => '\f1e0',
'fa-share-alt-square' => '\f1e1',
'fa-bomb' => '\f1e2',
'fa-futbol-o' => '\f1e3',
'fa-tty' => '\f1e4',
'fa-binoculars' => '\f1e5',
'fa-plug' => '\f1e6',
'fa-slideshare' => '\f1e7',
'fa-twitch' => '\f1e8',
'fa-yelp' => '\f1e9',
'fa-newspaper-o' => '\f1ea',
'fa-wifi' => '\f1eb',
'fa-calculator' => '\f1ec',
'fa-paypal' => '\f1ed',
'fa-google-wallet' => '\f1ee',
'fa-cc-visa' => '\f1f0',
'fa-cc-mastercard' => '\f1f1',
'fa-cc-discover' => '\f1f2',
'fa-cc-amex' => '\f1f3',
'fa-cc-paypal' => '\f1f4',
'fa-cc-stripe' => '\f1f5',
'fa-bell-slash' => '\f1f6',
'fa-bell-slash-o' => '\f1f7',
'fa-trash' => '\f1f8',
'fa-copyright' => '\f1f9',
'fa-at' => '\f1fa',
'fa-eyedropper' => '\f1fb',
'fa-paint-brush' => '\f1fc',
'fa-birthday-cake' => '\f1fd',
'fa-area-chart' => '\f1fe',
'fa-pie-chart' => '\f200',
'fa-line-chart' => '\f201',
'fa-lastfm' => '\f202',
'fa-lastfm-square' => '\f203',
'fa-toggle-off' => '\f204',
'fa-toggle-on' => '\f205',
'fa-bicycle' => '\f206',
'fa-bus' => '\f207',
'fa-ioxhost' => '\f208',
'fa-angellist' => '\f209',
'fa-cc' => '\f20a',
'fa-ils' => '\f20b',
'fa-meanpath' => '\f20c',
'fa-buysellads' => '\f20d',
'fa-connectdevelop' => '\f20e',
'fa-dashcube' => '\f210',
'fa-forumbee' => '\f211',
'fa-leanpub' => '\f212',
'fa-sellsy' => '\f213',
'fa-shirtsinbulk' => '\f214',
'fa-simplybuilt' => '\f215',
'fa-skyatlas' => '\f216',
'fa-cart-plus' => '\f217',
'fa-cart-arrow-down' => '\f218',
'fa-diamond' => '\f219',
'fa-ship' => '\f21a',
'fa-user-secret' => '\f21b',
'fa-motorcycle' => '\f21c',
'fa-street-view' => '\f21d',
'fa-heartbeat' => '\f21e',
'fa-venus' => '\f221',
'fa-mars' => '\f222',
'fa-mercury' => '\f223',
'fa-transgender' => '\f224',
'fa-transgender-alt' => '\f225',
'fa-venus-double' => '\f226',
'fa-mars-double' => '\f227',
'fa-venus-mars' => '\f228',
'fa-mars-stroke' => '\f229',
'fa-mars-stroke-v' => '\f22a',
'fa-mars-stroke-h' => '\f22b',
'fa-neuter' => '\f22c',
'fa-genderless' => '\f22d',
'fa-facebook-official' => '\f230',
'fa-pinterest-p' => '\f231',
'fa-whatsapp' => '\f232',
'fa-server' => '\f233',
'fa-user-plus' => '\f234',
'fa-user-times' => '\f235',
'fa-bed' => '\f236',
'fa-viacoin' => '\f237',
'fa-train' => '\f238',
'fa-subway' => '\f239',
'fa-medium' => '\f23a',
'fa-y-combinator' => '\f23b',
'fa-optin-monster' => '\f23c',
'fa-opencart' => '\f23d',
'fa-expeditedssl' => '\f23e',
'fa-battery-full' => '\f240',
'fa-battery-three-quarters' => '\f241',
'fa-battery-half' => '\f242',
'fa-battery-quarter' => '\f243',
'fa-battery-empty' => '\f244',
'fa-mouse-pointer' => '\f245',
'fa-i-cursor' => '\f246',
'fa-object-group' => '\f247',
'fa-object-ungroup' => '\f248',
'fa-sticky-note' => '\f249',
'fa-sticky-note-o' => '\f24a',
'fa-cc-jcb' => '\f24b',
'fa-cc-diners-club' => '\f24c',
'fa-clone' => '\f24d',
'fa-balance-scale' => '\f24e',
'fa-hourglass-o' => '\f250',
'fa-hourglass-start' => '\f251',
'fa-hourglass-half' => '\f252',
'fa-hourglass-end' => '\f253',
'fa-hourglass' => '\f254',
'fa-hand-rock-o' => '\f255',
'fa-hand-paper-o' => '\f256',
'fa-hand-scissors-o' => '\f257',
'fa-hand-lizard-o' => '\f258',
'fa-hand-spock-o' => '\f259',
'fa-hand-pointer-o' => '\f25a',
'fa-hand-peace-o' => '\f25b',
'fa-trademark' => '\f25c',
'fa-registered' => '\f25d',
'fa-creative-commons' => '\f25e',
'fa-gg' => '\f260',
'fa-gg-circle' => '\f261',
'fa-tripadvisor' => '\f262',
'fa-odnoklassniki' => '\f263',
'fa-odnoklassniki-square' => '\f264',
'fa-get-pocket' => '\f265',
'fa-wikipedia-w' => '\f266',
'fa-safari' => '\f267',
'fa-chrome' => '\f268',
'fa-firefox' => '\f269',
'fa-opera' => '\f26a',
'fa-internet-explorer' => '\f26b',
'fa-television' => '\f26c',
'fa-contao' => '\f26d',
'fa-500px' => '\f26e',
'fa-amazon' => '\f270',
'fa-calendar-plus-o' => '\f271',
'fa-calendar-minus-o' => '\f272',
'fa-calendar-times-o' => '\f273',
'fa-calendar-check-o' => '\f274',
'fa-industry' => '\f275',
'fa-map-pin' => '\f276',
'fa-map-signs' => '\f277',
'fa-map-o' => '\f278',
'fa-map' => '\f279',
'fa-commenting' => '\f27a',
'fa-commenting-o' => '\f27b',
'fa-houzz' => '\f27c',
'fa-vimeo' => '\f27d',
'fa-black-tie' => '\f27e',
'fa-fonticons' => '\f280',
'fa-reddit-alien' => '\f281',
'fa-edge' => '\f282',
'fa-credit-card-alt' => '\f283',
'fa-codiepie' => '\f284',
'fa-modx' => '\f285',
'fa-fort-awesome' => '\f286',
'fa-usb' => '\f287',
'fa-product-hunt' => '\f288',
'fa-mixcloud' => '\f289',
'fa-scribd' => '\f28a',
'fa-pause-circle' => '\f28b',
'fa-pause-circle-o' => '\f28c',
'fa-stop-circle' => '\f28d',
'fa-stop-circle-o' => '\f28e',
'fa-shopping-bag' => '\f290',
'fa-shopping-basket' => '\f291',
'fa-hashtag' => '\f292',
'fa-bluetooth' => '\f293',
'fa-bluetooth-b' => '\f294',
'fa-percent' => '\f295',
'fa-gitlab' => '\f296',
'fa-wpbeginner' => '\f297',
'fa-wpforms' => '\f298',
'fa-envira' => '\f299',
'fa-universal-access' => '\f29a',
'fa-wheelchair-alt' => '\f29b',
'fa-question-circle-o' => '\f29c',
'fa-blind' => '\f29d',
'fa-audio-description' => '\f29e',
'fa-volume-control-phone' => '\f2a0',
'fa-braille' => '\f2a1',
'fa-assistive-listening-systems' => '\f2a2',
'fa-american-sign-language-interpreting' => '\f2a3',
'fa-deaf' => '\f2a4',
'fa-glide' => '\f2a5',
'fa-glide-g' => '\f2a6',
'fa-sign-language' => '\f2a7',
'fa-low-vision' => '\f2a8',
'fa-viadeo' => '\f2a9',
'fa-viadeo-square' => '\f2aa',
'fa-snapchat' => '\f2ab',
'fa-snapchat-ghost' => '\f2ac',
'fa-snapchat-square' => '\f2ad',
'fa-pied-piper' => '\f2ae',
'fa-first-order' => '\f2b0',
'fa-yoast' => '\f2b1',
'fa-themeisle' => '\f2b2',
'fa-google-plus-official' => '\f2b3',
'fa-font-awesome' => '\f2b4',
'fa-handshake-o' => '\f2b5',
'fa-envelope-open' => '\f2b6',
'fa-envelope-open-o' => '\f2b7',
'fa-linode' => '\f2b8',
'fa-address-book' => '\f2b9',
'fa-address-book-o' => '\f2ba',
'fa-address-card' => '\f2bb',
'fa-address-card-o' => '\f2bc',
'fa-user-circle' => '\f2bd',
'fa-user-circle-o' => '\f2be',
'fa-user-o' => '\f2c0',
'fa-id-badge' => '\f2c1',
'fa-id-card' => '\f2c2',
'fa-id-card-o' => '\f2c3',
'fa-quora' => '\f2c4',
'fa-free-code-camp' => '\f2c5',
'fa-telegram' => '\f2c6',
'fa-thermometer-full' => '\f2c7',
'fa-thermometer-three-quarters' => '\f2c8',
'fa-thermometer-half' => '\f2c9',
'fa-thermometer-quarter' => '\f2ca',
'fa-thermometer-empty' => '\f2cb',
'fa-shower' => '\f2cc',
'fa-bath' => '\f2cd',
'fa-podcast' => '\f2ce',
'fa-window-maximize' => '\f2d0',
'fa-window-minimize' => '\f2d1',
'fa-window-restore' => '\f2d2',
'fa-window-close' => '\f2d3',
'fa-window-close-o' => '\f2d4',
'fa-bandcamp' => '\f2d5',
'fa-grav' => '\f2d6',
'fa-etsy' => '\f2d7',
'fa-imdb' => '\f2d8',
'fa-ravelry' => '\f2d9',
'fa-eercast' => '\f2da',
'fa-microchip' => '\f2db',
'fa-snowflake-o' => '\f2dc',
'fa-superpowers' => '\f2dd',
'fa-wpexplorer' => '\f2de',
'fa-meetup' => '\f2e0'
];
$options = [];
foreach ($list as $k => $v) {
$options[] = [
'value' => $k,
'label' => $k
];
}
return $options;
}
}
+43
View File
@@ -0,0 +1,43 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Model\Source;
use Magento\Framework\Data\OptionSourceInterface;
class IsActive implements OptionSourceInterface
{
const STATUS_ENABLED = 1;
const STATUS_DISABLED = 0;
/**
* Get options
*
* @return array
*/
public function toOptionArray()
{
$options = [
[
'label' => __('Enabled'),
'value' => self::STATUS_ENABLED,
],
[
'label' => __('Disabled'),
'value' => self::STATUS_DISABLED,
]
];
return $options;
}
}
+58
View File
@@ -0,0 +1,58 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Model\Source;
use Magento\Framework\Data\OptionSourceInterface;
class Pages implements OptionSourceInterface
{
/**
* @var \Magento\Cms\Model\ResourceModel\Page\CollectionFactory
*/
protected $collectionFactory;
/**
* @param \Magento\Cms\Model\ResourceModel\Page\CollectionFactory $collectionFactory
*/
public function __construct(
\Magento\Cms\Model\ResourceModel\Page\CollectionFactory $collectionFactory
) {
$this->collectionFactory = $collectionFactory;
}
public function getOptions()
{
return $this->toOptionArray();
}
/**
* Get options
*
* @return array
*/
public function toOptionArray()
{
$options = [];
$collection = $this->collectionFactory->create();
foreach ($collection as $page) {
$options[] = [
'label' => $page->getTitle(),
'value' => $page->getId(),
'path' => ''
];
}
return $options;
}
}
+43
View File
@@ -0,0 +1,43 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Model\Source;
use Magento\Framework\Data\OptionSourceInterface;
class YesNo implements OptionSourceInterface
{
const STATUS_ENABLED = 1;
const STATUS_DISABLED = 0;
/**
* Get options
*
* @return array
*/
public function toOptionArray()
{
$options = [
[
'label' => __('Yes'),
'value' => self::STATUS_ENABLED,
],
[
'label' => __('No'),
'value' => self::STATUS_DISABLED,
]
];
return $options;
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Plugin\Block;
class Menu
{
public function aroundRenderNavigation(
\Magento\Backend\Block\Menu $menuBlock,
callable $proceed,
$menu, $level = 0, $limit = 0, $colBrakes = []
) {
foreach ($menu as $item) {
if ($item->getId() == 'Magezon_Core::extensions' && (!$item->hasChildren() || !$item->getChildren()->getFirstAvailable())) {
$menu->remove('Magezon_Core::extensions');
break;
}
}
$result = $proceed($menu, $level, $limit, $colBrakes);
return $result;
}
}
@@ -0,0 +1,62 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Plugin\Filter\DirectiveProcessor;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Filter\VariableResolverInterface;
class IfDirective
{
/**
* @var \Magento\Framework\Filter\VariableResolverInterface
*/
private $_variableResolver;
public function aroundProcess(
$subject,
callable $proceed,
$construction,
$filter,
$templateVariables
) {
if (!empty($templateVariables)) {
$variables = explode('==', $construction[1]);
if (count($variables) >= 2) {
$variable = trim($variables[0]);
$value = trim($variables[1]);
if ($this->getVariableResolver()->resolve($variable, $filter, $templateVariables) == $value) {
return $filter->filter($construction[2]);
} else {
if (isset($construction[3]) && isset($construction[4])) {
return $filter->filter($construction[4]);
}
return '';
}
} else {
return $proceed($construction, $filter, $templateVariables);
}
} else {
return $proceed($construction, $filter, $templateVariables);
}
}
private function getVariableResolver()
{
if (!$this->_variableResolver) {
$this->_variableResolver = ObjectManager::getInstance()->get(VariableResolverInterface::class);
}
return $this->_variableResolver;
}
}
+92
View File
@@ -0,0 +1,92 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Plugin\View\Result;
class Layout
{
public function aroundRenderResult(
$subject,
callable $proceed,
$httpResponse
) {
$result = $proceed($httpResponse);
$html = $httpResponse->getBody();
$html = $this->minify($html);
$httpResponse->setBody($html);
return $result;
}
public function minify($html)
{
$regex = '@(?:<style class="mgz-style">)(.*)</style>@msU';
preg_match_all($regex, $html, $matches);
if ($matches[0]) {
$stylesHtml = '';
foreach ($matches[0] as $_style) {
$stylesHtml .= str_replace(['<style class="mgz-style">', '</style>'], [], $_style);
}
$stylesHtml = $this->minifyCss($stylesHtml);
$html = preg_replace($regex, '', $html);
$html = str_replace('</head>', '<style>' . $stylesHtml . '</style>' . '</head>', $html);
}
return $html;
}
/**
* https://gist.github.com/webgefrickel/3339063
* This function takes a css-string and compresses it, removing
* unneccessary whitespace, colons, removing unneccessary px/em
* declarations etc.
*
* @param string $css
* @return string compressed css content
* @author Steffen Becker
*/
function minifyCss($css) {
// some of the following functions to minimize the css-output are directly taken
// from the awesome CSS JS Booster: https://github.com/Schepp/CSS-JS-Booster
// all credits to Christian Schaefer: http://twitter.com/derSchepp
// remove comments
$css = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css);
// backup values within single or double quotes
preg_match_all('/(\'[^\']*?\'|"[^"]*?")/ims', $css, $hit, PREG_PATTERN_ORDER);
for ($i=0; $i < count($hit[1]); $i++) {
$css = str_replace($hit[1][$i], '##########' . $i . '##########', $css);
}
// remove traling semicolon of selector's last property
$css = preg_replace('/;[\s\r\n\t]*?}[\s\r\n\t]*/ims', "}\r\n", $css);
// remove any whitespace between semicolon and property-name
$css = preg_replace('/;[\s\r\n\t]*?([\r\n]?[^\s\r\n\t])/ims', ';$1', $css);
// remove any whitespace surrounding property-colon
$css = preg_replace('/[\s\r\n\t]*:[\s\r\n\t]*?([^\s\r\n\t])/ims', ':$1', $css);
// remove any whitespace surrounding selector-comma
$css = preg_replace('/[\s\r\n\t]*,[\s\r\n\t]*?([^\s\r\n\t])/ims', ',$1', $css);
// remove any whitespace surrounding opening parenthesis
$css = preg_replace('/[\s\r\n\t]*{[\s\r\n\t]*?([^\s\r\n\t])/ims', '{$1', $css);
// remove any whitespace between numbers and units
$css = preg_replace('/([\d\.]+)[\s\r\n\t]+(px|em|pt|%)/ims', '$1$2', $css);
// shorten zero-values
$css = preg_replace('/([^\d\.]0)(px|em|pt|%)/ims', '$1', $css);
// constrain multiple whitespaces
$css = preg_replace('/\p{Zs}+/ims',' ', $css);
// remove newlines
$css = str_replace(array("\r\n", "\r", "\n"), '', $css);
// Restore backupped values within single or double quotes
for ($i=0; $i < count($hit[1]); $i++) {
$css = str_replace('##########' . $i . '##########', $hit[1][$i], $css);
}
return $css;
}
}
+2
View File
@@ -0,0 +1,2 @@
# Magezon Core extension for Magento 2
Content is coming soon.
@@ -0,0 +1,71 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Ui\Component\Listing\Columns;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Framework\View\Element\UiComponentFactory;
use Magento\Ui\Component\Listing\Columns\Column;
use Magento\Framework\UrlInterface;
class Statuses extends Column
{
/**
* @var UrlInterface
*/
protected $urlBuilder;
/**
* @param ContextInterface $context
* @param UiComponentFactory $uiComponentFactory
* @param UrlInterface $urlBuilder
* @param array $components
* @param array $data
*/
public function __construct(
ContextInterface $context,
UiComponentFactory $uiComponentFactory,
UrlInterface $urlBuilder,
array $components = [],
array $data = []
) {
$this->urlBuilder = $urlBuilder;
parent::__construct($context, $uiComponentFactory, $components, $data);
}
/**
* Prepare Data Source
*
* @param array $dataSource
* @return array
*/
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
$availableOptions = $this->getOptions()->toOptionArray();
foreach ($dataSource['data']['items'] as &$item) {
foreach ($availableOptions as $k => $status) {
if (!isset($item['is_active'])) {
$item['is_active'] = 0;
}
if ($status['value'] == $item['is_active'] && is_numeric($item['is_active'])) {
$item['is_active'] = '<span class="mgz-status mgz-status_' . $status['value'] . '">' . $status['label'] . '</span>';
continue;
}
}
}
}
return $dataSource;
}
}
@@ -0,0 +1,88 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
namespace Magezon\Core\Ui\DataProvider\Form;
use Magento\Framework\App\ObjectManager;
use Magezon\Core\Framework\Stdlib\ArrayManager;
use Magento\Catalog\Model\Attribute\ScopeOverriddenValue;
class AbstractModifier extends \Magento\Ui\DataProvider\AbstractDataProvider
{
const META_CONFIG_PATH = '/arguments/data/config';
/**
* Container fieldset prefix
*/
const CONTAINER_PREFIX = 'container_';
/**
* @var ArrayManager
*/
private $arrayManager;
/**
* @var Filesystem
*/
private $fileInfo;
/**
* @var ScopeOverriddenValue
*/
private $scopeOverriddenValue;
/**
* Retrieve array manager
*
* @return ArrayManager
*/
protected function getArrayManager()
{
if (null === $this->arrayManager) {
$this->arrayManager = ObjectManager::getInstance()->get(
ArrayManager::class
);
}
return $this->arrayManager;
}
/**
* Get FileInfo instance
*
* @return FileInfo
*/
protected function getFileInfo()
{
if ($this->fileInfo === null) {
$this->fileInfo = ObjectManager::getInstance()->get(\Magezon\Core\Model\FileInfo::class);
}
return $this->fileInfo;
}
/**
* Retrieve scope overridden value
*
* @return ScopeOverriddenValue
*/
protected function getScopeOverriddenValue()
{
if (null === $this->scopeOverriddenValue) {
$this->scopeOverriddenValue = ObjectManager::getInstance()->get(
ScopeOverriddenValue::class
);
}
return $this->scopeOverriddenValue;
}
}
+21
View File
@@ -0,0 +1,21 @@
{
"name": "magezon/module-core",
"description": "N/A",
"require": {
"php": "~7.3.0||~7.4.0||~8.1.0||~8.2.0"
},
"type": "magento2-module",
"version": "1.0.1",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Magezon\\Core\\": ""
}
}
}
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<!--
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Magezon_Core::extensions" title="Magezon"/>
</resource>
</resources>
</acl>
</config>
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!--
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Backend\Block\Menu">
<plugin name="remove_empty_item" type="Magezon\Core\Plugin\Block\Menu" />
</type>
</config>
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!--
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<add id="Magezon_Core::extensions" title="Magezon" translate="title" module="Magezon_Core" sortOrder="20" resource="Magezon_Core::extensions"/>
</menu>
</config>
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<!--
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="mgzcore" frontName="mgzcore">
<module name="Magezon_Core" before="Magezon_Core" />
</route>
</router>
</config>
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<!--
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="magezon" translate="label" sortOrder="200" class="magezon-extensions">
<label><![CDATA[Magezon Extensions]]></label>
</tab>
</system>
</config>
+43
View File
@@ -0,0 +1,43 @@
<?xml version="1.0"?>
<!--
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<mgz_chooser_widget>
<chooser_defaults>
<catalog_product_widget_chooser>
<input_label>Product</input_label>
<button_text>Select Product...</button_text>
</catalog_product_widget_chooser>
<catalog_category_widget_chooser>
<input_label>Category</input_label>
<button_text>Select Category...</button_text>
</catalog_category_widget_chooser>
<cms_block_widget_chooser>
<input_label>Block</input_label>
<button_text>Select Block...</button_text>
</cms_block_widget_chooser>
<cms_page_widget_chooser>
<input_label>CMS Page</input_label>
<button_text>Select CMS Page...</button_text>
</cms_page_widget_chooser>
<default>
<input_label>Element</input_label>
<button_text>Select...</button_text>
</default>
</chooser_defaults>
</mgz_chooser_widget>
</default>
</config>
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp:etc/csp_whitelist.xsd">
<policies>
<policy id="img-src">
<values>
<value id="magezon" type="host">https://www.magezon.com</value>
</values>
</policy>
</policies>
</csp_whitelist>
+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<!--
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magezon\Core\framework\SearchCriteria\CollectionProcessorInterface" type="Magezon\Core\framework\SearchCriteria\CollectionProcessor" />
<type name="Magento\Framework\Filter\DirectiveProcessor\IfDirective">
<plugin name="addIfStatement" type="\Magezon\Core\Plugin\Filter\DirectiveProcessor\IfDirective" />
</type>
</config>
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!--
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\View\Result\Layout">
<plugin name="magezon_head_styles" type="Magezon\Core\Plugin\View\Result\Layout" />
</type>
</config>
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!--
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magezon_Core" setup_version="1.0.1">
</module>
</config>
+9
View File
@@ -0,0 +1,9 @@
"Insert Image","Insert Image"
"The file is too large. Maximum upload file size: %1MB","The file is too large. Maximum upload file size: %1MB"
"File '%1' is not an image.","File '%1' is not an image."
Enabled,Enabled
Disabled,Disabled
"Select Image","Select Image"
"Are you sure you want to do this?","Are you sure you want to do this?"
Magezon,Magezon
"<span class=""mgz-logo"">Magezon Extensions</span>","<span class=""mgz-logo"">Magezon Extensions</span>"
1 Insert Image Insert Image
2 The file is too large. Maximum upload file size: %1MB The file is too large. Maximum upload file size: %1MB
3 File '%1' is not an image. File '%1' is not an image.
4 Enabled Enabled
5 Disabled Disabled
6 Select Image Select Image
7 Are you sure you want to do this? Are you sure you want to do this?
8 Magezon Magezon
9 <span class="mgz-logo">Magezon Extensions</span> <span class="mgz-logo">Magezon Extensions</span>
+19
View File
@@ -0,0 +1,19 @@
<?php
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Magezon_Core',
__DIR__
);
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!--
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="Magezon_Core::css/minicolors/jquery.minicolors.css"/>
</head>
</page>
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<!--
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="after.body.start">
<block class="Magezon\Core\Block\Adminhtml\Head" name="global.html" template="head.phtml"/>
</referenceContainer>
</body>
</page>
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<!--
/**
* Magezon
*
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to https://www.magezon.com for more information.
*
* @category Magezon
* @package Magezon_Core
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
*/
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<update handle="cms_wysiwyg_images_index"/>
<referenceBlock name="wysiwyg_images.content">
<action method="setTemplate">
<argument name="template" xsi:type="string">Magezon_Core::browser/content.phtml</argument>
</action>
</referenceBlock>
</layout>
+12
View File
@@ -0,0 +1,12 @@
var config = {
map: {
"*": {
"mgzmediabrowser": "Magezon_Core/js/mage/browser",
}
},
shim: {
'produclabels': {
'deps': ['jquery']
}
}
};
@@ -0,0 +1,28 @@
<?php
/**
* @var $block dynamic|\Magento\Backend\Block\Template
*/
$blockGrid = $block->getBlockGrid();
$gridJsObjectName = $blockGrid->getJsObjectName();
$id = 'in_items' . time() . uniqid();
?>
<?= $block->getGridHtml() ?>
<?php if ($block->getElementName() && $block->getFormPart()): ?>
<input type="hidden" name="<?php echo $block->getElementName(); ?>" id="<?php echo $id ?>" data-form-part="<?php echo $block->getFormPart() ?>" value="" />
<script type="text/x-magento-init">
{
"*": {
"Magezon_Core/js/form/assign-items": {
"selectedItems": <?= /* @escapeNotVerified */ $block->getJson() ?>,
"gridJsObjectName": <?= /* @escapeNotVerified */ '"' . $gridJsObjectName . '"' ?: '{}' ?>,
"selector": "<?php echo $id ?>",
"ajaxParam": "<?php echo $block->getAjaxParam() ? $block->getAjaxParam() : 'selected_products' ?>"
}
}
}
</script>
<!-- @todo remove when "UI components" will support such initialization -->
<script>
require('mage/apply/main').apply();
</script>
<?php endif; ?>
@@ -0,0 +1,26 @@
<?php
/**
* @var $block \Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content
*/
$options = json_decode($block->getFilebrowserSetupObject(), true);
$options['onInsertUrl'] = str_replace("/cms", "/mgzcore", $options['onInsertUrl']);
$options = json_encode($options);
$buttonsHtml = str_replace('MediabrowserUtility', 'MgzMediabrowserUtility', $block->getButtonsHtml());
?>
<div data-mage-init='{"mgzmediabrowser": <?php echo $block->escapeHtml($options); ?>}'>
<div class="side-col"><?php echo $block->getChildHtml('wysiwyg_images.tree') ?></div>
<div class="main-col">
<div class="insert-title" id="content_header">
<div class="insert-title-inner">
<div class="insert-actions">
<?= $buttonsHtml ?>
</div>
<div class="title"><?php /* @escapeNotVerified */ echo $block->getHeaderText() ?></div>
</div>
</div>
<div id="error-message" data-action="show-error"></div>
<div id="contents-uploader" class="contents-uploader"><?php echo $block->getChildHtml('wysiwyg_images.uploader') ?></div>
<div id="contents"></div>
</div>
</div>
@@ -0,0 +1,70 @@
<?php
$formName = $this->getFormName();
?>
<?= $this->getButtonHtml() ?>
<script type="text/javascript">
require(
[
'jquery',
'underscore',
'uiRegistry'
],
function($, _, uiRegistry) {
/**
* Collect form data.
*
* @param {Array} items
* @returns {Object}
*/
function collectData(items) {
var result = {},
name;
items = Array.prototype.slice.call(items);
items.forEach(function (item) {
switch (item.type) {
case 'checkbox':
result[item.name] = +!!item.checked;
break;
case 'radio':
if (item.checked) {
result[item.name] = item.value;
}
break;
case 'select-multiple':
name = item.name.substring(0, item.name.length - 2); //remove [] from the name ending
result[name] = _.pluck(item.selectedOptions, 'value');
break;
default:
result[item.name] = item.value;
}
});
return result;
}
$('#mgz_conditions_preview_btn').click(function () {
var data = uiRegistry.get('<?= $formName ?>.<?= $formName ?>_data_source').get('data');
var additionalFields = $('[data-form-part=<?= $formName ?>]');
var additional = collectData(additionalFields);
var post = {...data, ...additional};
post['mgz_conditions_grid_id'] = '<?= $this->getRequest()->getParam('mgz_conditions_grid_id') ?>';
var url = "<?= $this->getUrl('mgzcore/conditions/productlist') ?>";
$.ajax({
type: "POST",
dataType: "html",
url: url,
data: post,
showLoader: true,
success: function (html) {
$('#mgz_conditions_product').replaceWith(html);
}
});
});
});
</script>
@@ -0,0 +1,7 @@
<?php
/**
* @var $block dynamic|\Magento\Backend\Block\Template
*/
$blockGrid = $block->getBlockGrid();
?>
<?= $block->getGridHtml() ?>
@@ -0,0 +1,4 @@
<script>
window.mgzMediaUrl = '<?php echo $block->getMediaUrl() ?>';
window.mgzFilesBrowserWindowUrl = '<?php echo $block->getFilesBrowserWindowUrl() ?>';
</script>
+67
View File
@@ -0,0 +1,67 @@
<?php
/**
* @var $block \Magezon\Core\Block\Adminhtml\TopMenu
*/
$titleId = ($block->getTitleId()) ? ' id="' . $block->getTitleId() . '"' : '';
$titleClass = ($block->getTitleClass()) ? ' ' . $block->getTitleClass() : '';
$title = $block->escapeHtml($block->getPageTitle());
$links = [];
if ($block->getLinks()) {
$links = $block->getLinks();
}
$total = count($links);
foreach ($links as $_columnLinks) {
foreach ($_columnLinks as $_link) {
$total++;
}
}
?>
<?php if ($total) { ?>
<div class="mgz-menu admin__action-dropdown-wrap">
<a
href="<?= $block->getUrl('adminhtml/system_account/index') ?>"
class="admin__action-dropdown"
data-mage-init='{"dropdown":{}}'
data-toggle="dropdown">
<span class="admin__action-dropdown-text">
<span class="page-title-wrapper<?= $titleClass ?>">
<h1 class="page-title"<?= $titleId ?>><?= $title ?></h1>
<?= $block->getChildHtml() ?>
</span>
</span>
</a>
<ul class="admin__action-dropdown-menu">
<?php foreach ($links as $_link) { ?>
<?php if (is_array($_link) && isset($_link[0])) { ?>
<?php foreach ($_link as $_link1) { ?>
<?php if (isset($_link1['class']) || isset($_link1['title']) || isset($_link1['link'])) { ?>
<li <?php if (isset($_link1['class'])): ?>class="<?php echo $_link1['class'] ?>"<?php endif; ?>>
<?php if (isset($_link1['link']) && $_link1['title']) { ?>
<a <?php if (isset($_link1['target'])): ?>target="<?php echo $_link1['target'] ?>"<?php endif; ?> href="<?php echo $_link1['link'] ?>"><?php echo $_link1['title'] ?></a>
<?php } ?>
</li>
<?php } ?>
<?php } ?>
<?php } else { ?>
<?php if (isset($_link['class']) || isset($_link['title']) || isset($_link['link'])) { ?>
<li <?php if (isset($_link['class'])): ?>class="<?php echo $_link['class'] ?>"<?php endif; ?>>
<?php if (isset($_link['link']) && $_link['title']) { ?>
<a <?php if (isset($_link['target'])): ?>target="<?php echo $_link['target'] ?>"<?php endif; ?> href="<?php echo $_link['link'] ?>"><?php echo $_link['title'] ?></a>
<?php } ?>
</li>
<?php } ?>
<?php } ?>
<?php } ?>
</ul>
</div>
<?php } else { ?>
<div class="page-title-wrapper<?= $titleClass ?>">
<h1 class="page-title"<?= $titleId ?>><?= $title ?></h1>
<?= $block->getChildHtml() ?>
</div>
<?php } ?>
<script>
require(['jquery'], function($) {
$('body').addClass('mgz-extention');
});
</script>
@@ -0,0 +1,13 @@
<div id="mgzreport" class="<?= $block->getAdditionalClasses() ?>" data-bind="scope:'mgzreport'">
<!-- ko template: getTemplate() --><!-- /ko -->
<script type="text/x-magento-init">
{
"#mgzreport": {
"Magento_Ui/js/core/app": <?= $block->getJsLayout() ?>
}
}
</script>
<script>
window.mgzReportsConfig = <?= $block->getConfig() ?>;
</script>
</div>
+925
View File
@@ -0,0 +1,925 @@
.container {
margin-right: auto;
margin-left: auto;
padding-left: 15px;
padding-right: 15px;
max-width: 100%;
}
@media (min-width: 768px) {
.container {
width: 750px;
}
}
@media (min-width: 992px) {
.container {
width: 970px;
}
}
@media (min-width: 1200px) {
.container {
width: 1280px;
}
}
.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
position: relative;
min-height: 1px;
padding-left: 15px;
padding-right: 15px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 {
float: left;
}
.col-xs-12 {
width: 100%;
}
.col-xs-11 {
width: 91.66666667%;
}
.col-xs-10 {
width: 83.33333333%;
}
.col-xs-9 {
width: 75%;
}
.col-xs-8 {
width: 66.66666667%;
}
.col-xs-7 {
width: 58.33333333%;
}
.col-xs-6 {
width: 50%;
}
.col-xs-5 {
width: 41.66666667%;
}
.col-xs-4 {
width: 33.33333333%;
}
.col-xs-3 {
width: 25%;
}
.col-xs-2 {
width: 16.66666667%;
}
.col-xs-1 {
width: 8.33333333%;
}
.col-xs-pull-12 {
right: 100%;
}
.col-xs-pull-11 {
right: 91.66666667%;
}
.col-xs-pull-10 {
right: 83.33333333%;
}
.col-xs-pull-9 {
right: 75%;
}
.col-xs-pull-8 {
right: 66.66666667%;
}
.col-xs-pull-7 {
right: 58.33333333%;
}
.col-xs-pull-6 {
right: 50%;
}
.col-xs-pull-5 {
right: 41.66666667%;
}
.col-xs-pull-4 {
right: 33.33333333%;
}
.col-xs-pull-3 {
right: 25%;
}
.col-xs-pull-2 {
right: 16.66666667%;
}
.col-xs-pull-1 {
right: 8.33333333%;
}
.col-xs-pull-0 {
right: auto;
}
.col-xs-push-12 {
left: 100%;
}
.col-xs-push-11 {
left: 91.66666667%;
}
.col-xs-push-10 {
left: 83.33333333%;
}
.col-xs-push-9 {
left: 75%;
}
.col-xs-push-8 {
left: 66.66666667%;
}
.col-xs-push-7 {
left: 58.33333333%;
}
.col-xs-push-6 {
left: 50%;
}
.col-xs-push-5 {
left: 41.66666667%;
}
.col-xs-push-4 {
left: 33.33333333%;
}
.col-xs-push-3 {
left: 25%;
}
.col-xs-push-2 {
left: 16.66666667%;
}
.col-xs-push-1 {
left: 8.33333333%;
}
.col-xs-push-0 {
left: auto;
}
.col-xs-offset-12 {
margin-left: 100%;
}
.col-xs-offset-11 {
margin-left: 91.66666667%;
}
.col-xs-offset-10 {
margin-left: 83.33333333%;
}
.col-xs-offset-9 {
margin-left: 75%;
}
.col-xs-offset-8 {
margin-left: 66.66666667%;
}
.col-xs-offset-7 {
margin-left: 58.33333333%;
}
.col-xs-offset-6 {
margin-left: 50%;
}
.col-xs-offset-5 {
margin-left: 41.66666667%;
}
.col-xs-offset-4 {
margin-left: 33.33333333%;
}
.col-xs-offset-3 {
margin-left: 25%;
}
.col-xs-offset-2 {
margin-left: 16.66666667%;
}
.col-xs-offset-1 {
margin-left: 8.33333333%;
}
.col-xs-offset-0 {
margin-left: 0%;
}
@media (min-width: 768px) {
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
float: left;
}
.col-sm-12 {
width: 100%;
}
.col-sm-11 {
width: 91.66666667%;
}
.col-sm-10 {
width: 83.33333333%;
}
.col-sm-9 {
width: 75%;
}
.col-sm-8 {
width: 66.66666667%;
}
.col-sm-7 {
width: 58.33333333%;
}
.col-sm-6 {
width: 50%;
}
.col-sm-5 {
width: 41.66666667%;
}
.col-sm-4 {
width: 33.33333333%;
}
.col-sm-3 {
width: 25%;
}
.col-sm-2 {
width: 16.66666667%;
}
.col-sm-1 {
width: 8.33333333%;
}
.col-sm-pull-12 {
right: 100%;
}
.col-sm-pull-11 {
right: 91.66666667%;
}
.col-sm-pull-10 {
right: 83.33333333%;
}
.col-sm-pull-9 {
right: 75%;
}
.col-sm-pull-8 {
right: 66.66666667%;
}
.col-sm-pull-7 {
right: 58.33333333%;
}
.col-sm-pull-6 {
right: 50%;
}
.col-sm-pull-5 {
right: 41.66666667%;
}
.col-sm-pull-4 {
right: 33.33333333%;
}
.col-sm-pull-3 {
right: 25%;
}
.col-sm-pull-2 {
right: 16.66666667%;
}
.col-sm-pull-1 {
right: 8.33333333%;
}
.col-sm-pull-0 {
right: auto;
}
.col-sm-push-12 {
left: 100%;
}
.col-sm-push-11 {
left: 91.66666667%;
}
.col-sm-push-10 {
left: 83.33333333%;
}
.col-sm-push-9 {
left: 75%;
}
.col-sm-push-8 {
left: 66.66666667%;
}
.col-sm-push-7 {
left: 58.33333333%;
}
.col-sm-push-6 {
left: 50%;
}
.col-sm-push-5 {
left: 41.66666667%;
}
.col-sm-push-4 {
left: 33.33333333%;
}
.col-sm-push-3 {
left: 25%;
}
.col-sm-push-2 {
left: 16.66666667%;
}
.col-sm-push-1 {
left: 8.33333333%;
}
.col-sm-push-0 {
left: auto;
}
.col-sm-offset-12 {
margin-left: 100%;
}
.col-sm-offset-11 {
margin-left: 91.66666667%;
}
.col-sm-offset-10 {
margin-left: 83.33333333%;
}
.col-sm-offset-9 {
margin-left: 75%;
}
.col-sm-offset-8 {
margin-left: 66.66666667%;
}
.col-sm-offset-7 {
margin-left: 58.33333333%;
}
.col-sm-offset-6 {
margin-left: 50%;
}
.col-sm-offset-5 {
margin-left: 41.66666667%;
}
.col-sm-offset-4 {
margin-left: 33.33333333%;
}
.col-sm-offset-3 {
margin-left: 25%;
}
.col-sm-offset-2 {
margin-left: 16.66666667%;
}
.col-sm-offset-1 {
margin-left: 8.33333333%;
}
.col-sm-offset-0 {
margin-left: 0%;
}
}
@media (min-width: 992px) {
.col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
float: left;
}
.col-md-12 {
width: 100%;
}
.col-md-11 {
width: 91.66666667%;
}
.col-md-10 {
width: 83.33333333%;
}
.col-md-9 {
width: 75%;
}
.col-md-8 {
width: 66.66666667%;
}
.col-md-7 {
width: 58.33333333%;
}
.col-md-6 {
width: 50%;
}
.col-md-5 {
width: 41.66666667%;
}
.col-md-4 {
width: 33.33333333%;
}
.col-md-3 {
width: 25%;
}
.col-md-2 {
width: 16.66666667%;
}
.col-md-1 {
width: 8.33333333%;
}
.col-md-pull-12 {
right: 100%;
}
.col-md-pull-11 {
right: 91.66666667%;
}
.col-md-pull-10 {
right: 83.33333333%;
}
.col-md-pull-9 {
right: 75%;
}
.col-md-pull-8 {
right: 66.66666667%;
}
.col-md-pull-7 {
right: 58.33333333%;
}
.col-md-pull-6 {
right: 50%;
}
.col-md-pull-5 {
right: 41.66666667%;
}
.col-md-pull-4 {
right: 33.33333333%;
}
.col-md-pull-3 {
right: 25%;
}
.col-md-pull-2 {
right: 16.66666667%;
}
.col-md-pull-1 {
right: 8.33333333%;
}
.col-md-pull-0 {
right: auto;
}
.col-md-push-12 {
left: 100%;
}
.col-md-push-11 {
left: 91.66666667%;
}
.col-md-push-10 {
left: 83.33333333%;
}
.col-md-push-9 {
left: 75%;
}
.col-md-push-8 {
left: 66.66666667%;
}
.col-md-push-7 {
left: 58.33333333%;
}
.col-md-push-6 {
left: 50%;
}
.col-md-push-5 {
left: 41.66666667%;
}
.col-md-push-4 {
left: 33.33333333%;
}
.col-md-push-3 {
left: 25%;
}
.col-md-push-2 {
left: 16.66666667%;
}
.col-md-push-1 {
left: 8.33333333%;
}
.col-md-push-0 {
left: auto;
}
.col-md-offset-12 {
margin-left: 100%;
}
.col-md-offset-11 {
margin-left: 91.66666667%;
}
.col-md-offset-10 {
margin-left: 83.33333333%;
}
.col-md-offset-9 {
margin-left: 75%;
}
.col-md-offset-8 {
margin-left: 66.66666667%;
}
.col-md-offset-7 {
margin-left: 58.33333333%;
}
.col-md-offset-6 {
margin-left: 50%;
}
.col-md-offset-5 {
margin-left: 41.66666667%;
}
.col-md-offset-4 {
margin-left: 33.33333333%;
}
.col-md-offset-3 {
margin-left: 25%;
}
.col-md-offset-2 {
margin-left: 16.66666667%;
}
.col-md-offset-1 {
margin-left: 8.33333333%;
}
.col-md-offset-0 {
margin-left: 0%;
}
}
@media (min-width: 1200px) {
.col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 {
float: left;
}
.col-lg-12 {
width: 100%;
}
.col-lg-11 {
width: 91.66666667%;
}
.col-lg-10 {
width: 83.33333333%;
}
.col-lg-9 {
width: 75%;
}
.col-lg-8 {
width: 66.66666667%;
}
.col-lg-7 {
width: 58.33333333%;
}
.col-lg-6 {
width: 50%;
}
.col-lg-5 {
width: 41.66666667%;
}
.col-lg-4 {
width: 33.33333333%;
}
.col-lg-3 {
width: 25%;
}
.col-lg-2 {
width: 16.66666667%;
}
.col-lg-1 {
width: 8.33333333%;
}
.col-lg-pull-12 {
right: 100%;
}
.col-lg-pull-11 {
right: 91.66666667%;
}
.col-lg-pull-10 {
right: 83.33333333%;
}
.col-lg-pull-9 {
right: 75%;
}
.col-lg-pull-8 {
right: 66.66666667%;
}
.col-lg-pull-7 {
right: 58.33333333%;
}
.col-lg-pull-6 {
right: 50%;
}
.col-lg-pull-5 {
right: 41.66666667%;
}
.col-lg-pull-4 {
right: 33.33333333%;
}
.col-lg-pull-3 {
right: 25%;
}
.col-lg-pull-2 {
right: 16.66666667%;
}
.col-lg-pull-1 {
right: 8.33333333%;
}
.col-lg-pull-0 {
right: auto;
}
.col-lg-push-12 {
left: 100%;
}
.col-lg-push-11 {
left: 91.66666667%;
}
.col-lg-push-10 {
left: 83.33333333%;
}
.col-lg-push-9 {
left: 75%;
}
.col-lg-push-8 {
left: 66.66666667%;
}
.col-lg-push-7 {
left: 58.33333333%;
}
.col-lg-push-6 {
left: 50%;
}
.col-lg-push-5 {
left: 41.66666667%;
}
.col-lg-push-4 {
left: 33.33333333%;
}
.col-lg-push-3 {
left: 25%;
}
.col-lg-push-2 {
left: 16.66666667%;
}
.col-lg-push-1 {
left: 8.33333333%;
}
.col-lg-push-0 {
left: auto;
}
.col-lg-offset-12 {
margin-left: 100%;
}
.col-lg-offset-11 {
margin-left: 91.66666667%;
}
.col-lg-offset-10 {
margin-left: 83.33333333%;
}
.col-lg-offset-9 {
margin-left: 75%;
}
.col-lg-offset-8 {
margin-left: 66.66666667%;
}
.col-lg-offset-7 {
margin-left: 58.33333333%;
}
.col-lg-offset-6 {
margin-left: 50%;
}
.col-lg-offset-5 {
margin-left: 41.66666667%;
}
.col-lg-offset-4 {
margin-left: 33.33333333%;
}
.col-lg-offset-3 {
margin-left: 25%;
}
.col-lg-offset-2 {
margin-left: 16.66666667%;
}
.col-lg-offset-1 {
margin-left: 8.33333333%;
}
.col-lg-offset-0 {
margin-left: 0%;
}
}
.clearfix:before,
.clearfix:after,
.container:before,
.container:after,
.container-fluid:before,
.container-fluid:after,
.row:before,
.row:after {
content: " ";
display: table;
}
.clearfix:after,
.container:after,
.container-fluid:after,
.row:after {
clear: both;
}
.row {
margin-left: -15px;
margin-right: -15px;
}
.center-block {
display: block;
margin-left: auto;
margin-right: auto;
}
.pull-right {
float: right !important;
}
.pull-left {
float: left !important;
}
.hide {
display: none !important;
}
.show {
display: block !important;
}
.invisible {
visibility: hidden;
}
.text-hide {
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.hidden {
display: none !important;
}
.affix {
position: fixed;
}
@-ms-viewport {
width: device-width;
}
.visible-xs,
.visible-sm,
.visible-md,
.visible-lg {
display: none !important;
}
.visible-xs-block,
.visible-xs-inline,
.visible-xs-inline-block,
.visible-sm-block,
.visible-sm-inline,
.visible-sm-inline-block,
.visible-md-block,
.visible-md-inline,
.visible-md-inline-block,
.visible-lg-block,
.visible-lg-inline,
.visible-lg-inline-block {
display: none !important;
}
@media (max-width: 767px) {
.visible-xs {
display: block !important;
}
table.visible-xs {
display: table;
}
tr.visible-xs {
display: table-row !important;
}
th.visible-xs,
td.visible-xs {
display: table-cell !important;
}
}
@media (max-width: 767px) {
.visible-xs-block {
display: block !important;
}
}
@media (max-width: 767px) {
.visible-xs-inline {
display: inline !important;
}
}
@media (max-width: 767px) {
.visible-xs-inline-block {
display: inline-block !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm {
display: block !important;
}
table.visible-sm {
display: table;
}
tr.visible-sm {
display: table-row !important;
}
th.visible-sm,
td.visible-sm {
display: table-cell !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-block {
display: block !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-inline {
display: inline !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-inline-block {
display: inline-block !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md {
display: block !important;
}
table.visible-md {
display: table;
}
tr.visible-md {
display: table-row !important;
}
th.visible-md,
td.visible-md {
display: table-cell !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-block {
display: block !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-inline {
display: inline !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-inline-block {
display: inline-block !important;
}
}
@media (min-width: 1200px) {
.visible-lg {
display: block !important;
}
table.visible-lg {
display: table;
}
tr.visible-lg {
display: table-row !important;
}
th.visible-lg,
td.visible-lg {
display: table-cell !important;
}
}
@media (min-width: 1200px) {
.visible-lg-block {
display: block !important;
}
}
@media (min-width: 1200px) {
.visible-lg-inline {
display: inline !important;
}
}
@media (min-width: 1200px) {
.visible-lg-inline-block {
display: inline-block !important;
}
}
@media (max-width: 767px) {
.hidden-xs {
display: none !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.hidden-sm {
display: none !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.hidden-md {
display: none !important;
}
}
@media (min-width: 1200px) {
.hidden-lg {
display: none !important;
}
}
.visible-print {
display: none !important;
}
@media print {
.visible-print {
display: block !important;
}
table.visible-print {
display: table;
}
tr.visible-print {
display: table-row !important;
}
th.visible-print,
td.visible-print {
display: table-cell !important;
}
}
.visible-print-block {
display: none !important;
}
@media print {
.visible-print-block {
display: block !important;
}
}
.visible-print-inline {
display: none !important;
}
@media print {
.visible-print-inline {
display: inline !important;
}
}
.visible-print-inline-block {
display: none !important;
}
@media print {
.visible-print-inline-block {
display: inline-block !important;
}
}
@media print {
.hidden-print {
display: none !important;
}
}
@@ -0,0 +1,435 @@
.daterangepicker {
position: absolute;
color: inherit;
background-color: #fff;
border-radius: 4px;
border: 1px solid #ddd;
width: 278px;
max-width: none;
padding: 0;
margin-top: 7px;
top: 100px;
left: 20px;
z-index: 3001;
display: none;
font-size: 15px;
line-height: 1em;
}
.daterangepicker:before, .daterangepicker:after {
position: absolute;
display: inline-block;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.daterangepicker:before {
top: -7px;
border-right: 7px solid transparent;
border-left: 7px solid transparent;
border-bottom: 7px solid #ccc;
}
.daterangepicker:after {
top: -6px;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
}
.daterangepicker.opensleft:before {
right: 9px;
}
.daterangepicker.opensleft:after {
right: 10px;
}
.daterangepicker.openscenter:before {
left: 0;
right: 0;
width: 0;
margin-left: auto;
margin-right: auto;
}
.daterangepicker.openscenter:after {
left: 0;
right: 0;
width: 0;
margin-left: auto;
margin-right: auto;
}
.daterangepicker.opensright:before {
left: 9px;
}
.daterangepicker.opensright:after {
left: 10px;
}
.daterangepicker.drop-up {
margin-top: -7px;
}
.daterangepicker.drop-up:before {
top: initial;
bottom: -7px;
border-bottom: initial;
border-top: 7px solid #ccc;
}
.daterangepicker.drop-up:after {
top: initial;
bottom: -6px;
border-bottom: initial;
border-top: 6px solid #fff;
}
.daterangepicker.single .daterangepicker .ranges, .daterangepicker.single .drp-calendar {
float: none;
}
.daterangepicker.single .drp-selected {
display: none;
}
.daterangepicker.show-calendar .drp-calendar {
display: block;
}
.daterangepicker.show-calendar .drp-buttons {
display: block;
}
.daterangepicker.auto-apply .drp-buttons {
display: none;
}
.daterangepicker .drp-calendar {
display: none;
max-width: 270px;
}
.daterangepicker .drp-calendar.left {
padding: 8px 0 8px 8px;
}
.daterangepicker .drp-calendar.right {
padding: 8px;
}
.daterangepicker .drp-calendar.single .calendar-table {
border: none;
}
.daterangepicker .calendar-table .next span, .daterangepicker .calendar-table .prev span {
color: #fff;
border: solid black;
border-width: 0 2px 2px 0;
border-radius: 0;
display: inline-block;
padding: 3px;
}
.daterangepicker .calendar-table .next span {
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
}
.daterangepicker .calendar-table .prev span {
transform: rotate(135deg);
-webkit-transform: rotate(135deg);
}
.daterangepicker .calendar-table th, .daterangepicker .calendar-table td {
white-space: nowrap;
text-align: center;
vertical-align: middle;
min-width: 32px;
width: 32px;
height: 24px;
line-height: 24px;
font-size: 12px;
border-radius: 4px;
white-space: nowrap;
cursor: pointer;
}
.daterangepicker .calendar-table {
border: 1px solid #fff;
border-radius: 4px;
background-color: #fff;
}
.daterangepicker .calendar-table table {
width: 100%;
margin: 0;
border-spacing: 0;
border-collapse: collapse;
}
.daterangepicker td.available:hover, .daterangepicker th.available:hover {
background-color: #eee;
border-color: transparent;
color: inherit;
}
.daterangepicker td.week, .daterangepicker th.week {
font-size: 80%;
color: #ccc;
}
.daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date {
background-color: #fff;
border-color: transparent;
color: #999;
}
.daterangepicker td.in-range {
background-color: #ebf4f8;
border-color: transparent;
color: #000;
border-radius: 0;
}
.daterangepicker td.start-date {
border-radius: 4px 0 0 4px;
}
.daterangepicker td.end-date {
border-radius: 0 4px 4px 0;
}
.daterangepicker td.start-date.end-date {
border-radius: 4px;
}
.daterangepicker td.active, .daterangepicker td.active:hover {
background-color: #357ebd;
border-color: transparent;
color: #fff;
}
.daterangepicker th.month {
width: auto;
}
.daterangepicker td.disabled, .daterangepicker option.disabled {
color: #999;
cursor: not-allowed;
text-decoration: line-through;
}
.daterangepicker select.monthselect, .daterangepicker select.yearselect {
font-size: 12px;
padding: 1px;
height: auto;
margin: 0;
cursor: default;
}
.daterangepicker select.monthselect {
margin-right: 2%;
width: 56%;
}
.daterangepicker select.yearselect {
width: 40%;
}
.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect {
width: 50px;
margin: 0 auto;
background: #eee;
border: 1px solid #eee;
padding: 2px;
outline: 0;
font-size: 12px;
}
.daterangepicker .calendar-time {
text-align: center;
margin: 4px auto 0 auto;
line-height: 30px;
position: relative;
}
.daterangepicker .calendar-time select.disabled {
color: #ccc;
cursor: not-allowed;
}
.daterangepicker .drp-buttons {
clear: both;
text-align: right;
padding: 8px;
border-top: 1px solid #ddd;
display: none;
line-height: 12px;
vertical-align: middle;
}
.daterangepicker .drp-selected {
display: inline-block;
font-size: 12px;
padding-right: 8px;
}
.daterangepicker .drp-buttons .btn {
margin-left: 8px;
font-size: 12px;
font-weight: bold;
padding: 4px 8px;
}
.daterangepicker.show-ranges .drp-calendar.left {
border-left: 1px solid #ddd;
}
.daterangepicker .ranges {
float: none;
text-align: left;
margin: 0;
}
.daterangepicker.show-calendar .ranges {
margin-top: 8px;
}
.daterangepicker .ranges ul {
list-style: none;
margin: 0 auto;
padding: 0;
width: 100%;
}
.daterangepicker .ranges li {
font-size: 12px;
padding: 8px 12px;
cursor: pointer;
}
.daterangepicker .ranges li:hover {
background-color: #eee;
}
.daterangepicker .ranges li.active {
background-color: #08c;
color: #fff;
}
/* Larger Screen Styling */
@media (min-width: 564px) {
.daterangepicker {
width: auto;
}
.daterangepicker .ranges ul {
width: 140px;
}
.daterangepicker.single .ranges ul {
width: 100%;
}
.daterangepicker.single .drp-calendar.left {
clear: none;
}
.daterangepicker.single.ltr .ranges, .daterangepicker.single.ltr .drp-calendar {
float: left;
}
.daterangepicker.single.rtl .ranges, .daterangepicker.single.rtl .drp-calendar {
float: right;
}
.daterangepicker.ltr {
direction: ltr;
text-align: left;
}
.daterangepicker.ltr .drp-calendar.left {
clear: left;
margin-right: 0;
}
.daterangepicker.ltr .drp-calendar.left .calendar-table {
border-right: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.daterangepicker.ltr .drp-calendar.right {
margin-left: 0;
}
.daterangepicker.ltr .drp-calendar.right .calendar-table {
border-left: none;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.daterangepicker.ltr .drp-calendar.left .calendar-table {
padding-right: 8px;
}
.daterangepicker.ltr .ranges, .daterangepicker.ltr .drp-calendar {
float: left;
}
.daterangepicker.rtl {
direction: rtl;
text-align: right;
}
.daterangepicker.rtl .drp-calendar.left {
clear: right;
margin-left: 0;
}
.daterangepicker.rtl .drp-calendar.left .calendar-table {
border-left: none;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.daterangepicker.rtl .drp-calendar.right {
margin-right: 0;
}
.daterangepicker.rtl .drp-calendar.right .calendar-table {
border-right: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.daterangepicker.rtl .drp-calendar.left .calendar-table {
padding-left: 12px;
}
.daterangepicker.rtl .ranges, .daterangepicker.rtl .drp-calendar {
text-align: right;
float: right;
}
}
@media (min-width: 730px) {
.daterangepicker .ranges {
width: auto;
}
.daterangepicker.ltr .ranges {
float: left;
}
.daterangepicker.rtl .ranges {
float: right;
}
.daterangepicker .drp-calendar.left {
clear: none !important;
}
}
@@ -0,0 +1,322 @@
.minicolors {
position: relative;
}
.minicolors-sprite {
background-image: url(jquery.minicolors.png);
}
.minicolors-swatch {
position: absolute;
vertical-align: middle;
background-position: -80px 0;
border: solid 1px #ccc;
cursor: text;
padding: 0;
margin: 0;
display: inline-block;
}
.minicolors-swatch-color {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.minicolors input[type=hidden] + .minicolors-swatch {
width: 28px;
position: static;
cursor: pointer;
}
.minicolors input[type=hidden][disabled] + .minicolors-swatch {
cursor: default;
}
/* Panel */
.minicolors-panel {
position: absolute;
width: 173px;
background: white;
border: solid 1px #CCC;
box-shadow: 0 0 20px rgba(0, 0, 0, .2);
z-index: 99999;
box-sizing: content-box;
display: none;
}
.minicolors-panel.minicolors-visible {
display: block;
}
/* Panel positioning */
.minicolors-position-top .minicolors-panel {
top: -154px;
}
.minicolors-position-right .minicolors-panel {
right: 0;
}
.minicolors-position-bottom .minicolors-panel {
top: auto;
}
.minicolors-position-left .minicolors-panel {
left: 0;
}
.minicolors-with-opacity .minicolors-panel {
width: 194px;
}
.minicolors .minicolors-grid {
position: relative;
top: 1px;
left: 1px;
width: 150px;
height: 150px;
background-position: -120px 0;
cursor: crosshair;
}
.minicolors .minicolors-grid-inner {
position: absolute;
top: 0;
left: 0;
width: 150px;
height: 150px;
}
.minicolors-slider-saturation .minicolors-grid {
background-position: -420px 0;
}
.minicolors-slider-saturation .minicolors-grid-inner {
background-position: -270px 0;
background-image: inherit;
}
.minicolors-slider-brightness .minicolors-grid {
background-position: -570px 0;
}
.minicolors-slider-brightness .minicolors-grid-inner {
background-color: black;
}
.minicolors-slider-wheel .minicolors-grid {
background-position: -720px 0;
}
.minicolors-slider,
.minicolors-opacity-slider {
position: absolute;
top: 1px;
left: 152px;
width: 20px;
height: 150px;
background-color: white;
background-position: 0 0;
cursor: row-resize;
}
.minicolors-slider-saturation .minicolors-slider {
background-position: -60px 0;
}
.minicolors-slider-brightness .minicolors-slider {
background-position: -20px 0;
}
.minicolors-slider-wheel .minicolors-slider {
background-position: -20px 0;
}
.minicolors-opacity-slider {
left: 173px;
background-position: -40px 0;
display: none;
}
.minicolors-with-opacity .minicolors-opacity-slider {
display: block;
}
/* Pickers */
.minicolors-grid .minicolors-picker {
position: absolute;
top: 70px;
left: 70px;
width: 12px;
height: 12px;
border: solid 1px black;
border-radius: 10px;
margin-top: -6px;
margin-left: -6px;
background: none;
}
.minicolors-grid .minicolors-picker > div {
position: absolute;
top: 0;
left: 0;
width: 8px;
height: 8px;
border-radius: 8px;
border: solid 2px white;
box-sizing: content-box;
}
.minicolors-picker {
position: absolute;
top: 0;
left: 0;
width: 18px;
height: 2px;
background: white;
border: solid 1px black;
margin-top: -2px;
box-sizing: content-box;
}
/* Swatches */
.minicolors-swatches,
.minicolors-swatches li {
margin: 5px 0 3px 5px;
padding: 0;
list-style: none;
overflow: hidden;
}
.minicolors-swatches .minicolors-swatch {
position: relative;
float: left;
cursor: pointer;
margin:0 4px 0 0;
}
.minicolors-with-opacity .minicolors-swatches .minicolors-swatch {
margin-right: 7px;
}
.minicolors-swatch.selected {
border-color: #000;
}
/* Inline controls */
.minicolors-inline {
display: inline-block;
}
.minicolors-inline .minicolors-input {
display: none !important;
}
.minicolors-inline .minicolors-panel {
position: relative;
top: auto;
left: auto;
box-shadow: none;
z-index: auto;
display: inline-block;
}
/* Default theme */
.minicolors-theme-default .minicolors-swatch {
top: 5px;
left: 5px;
width: 18px;
height: 18px;
}
.minicolors-theme-default .minicolors-swatches .minicolors-swatch {
margin-bottom: 2px;
top: 0;
left: 0;
width: 18px;
height: 18px;
}
.minicolors-theme-default.minicolors-position-right .minicolors-swatch {
left: auto;
right: 5px;
}
.minicolors-theme-default.minicolors {
width: auto;
display: inline-block;
}
.minicolors-theme-default .minicolors-input {
padding-left: 26px;
}
.minicolors-theme-default.minicolors-position-right .minicolors-input {
padding-right: 26px;
padding-left: inherit;
}
/* Bootstrap theme */
.minicolors-theme-bootstrap .minicolors-swatch {
z-index: 2;
top: 3px;
left: 3px;
width: 28px;
height: 28px;
border-radius: 3px;
}
.minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch {
margin-bottom: 2px;
top: 0;
left: 0;
width: 20px;
height: 20px;
}
.minicolors-theme-bootstrap .minicolors-swatch-color {
border-radius: inherit;
}
.minicolors-theme-bootstrap.minicolors-position-right > .minicolors-swatch {
left: auto;
right: 3px;
}
.minicolors-theme-bootstrap .minicolors-input {
float: none;
padding-left: 44px;
}
.minicolors-theme-bootstrap.minicolors-position-right .minicolors-input {
padding-right: 44px;
padding-left: 12px;
}
.minicolors-theme-bootstrap .minicolors-input.input-lg + .minicolors-swatch {
top: 4px;
left: 4px;
width: 37px;
height: 37px;
border-radius: 5px;
}
.minicolors-theme-bootstrap .minicolors-input.input-sm + .minicolors-swatch {
width: 24px;
height: 24px;
}
.minicolors-theme-bootstrap .minicolors-input.input-xs + .minicolors-swatch {
width: 18px;
height: 18px;
}
.input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
/* Semantic Ui theme */
.minicolors-theme-semanticui .minicolors-swatch {
top: 0;
left: 0;
padding: 18px;
}
.minicolors-theme-semanticui input {
text-indent: 30px;
}
.adminhtml-system-config-edit .minicolors-theme-bootstrap .minicolors-swatch {
height: 26px;
width: 26px;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

@@ -0,0 +1,366 @@
@import 'module/_checkbox-radio.less';
@import 'module/_actions-switcher.less';
@import 'module/_mixins.less';
@import 'module/_reports.less';
@font-face {
font-family: 'Magezon-Icons';
src: url('../Magezon_Core/fonts/mgz_icons.eot');
src: url('../Magezon_Core/fonts/mgz_icons.eot?#iefix') format('embedded-opentype'), url('../Magezon_Core/fonts/mgz_icons.woff') format('woff'), url('../Magezon_Core/fonts/mgz_icons.woff') format('woff'), url('../Magezon_Core/fonts/mgz_icons.ttf') format('truetype'), url('../Magezon_Core/fonts/mgz_icons.svg#fonts') format('svg');
font-weight: normal;
font-style: normal;
}
.magezon-icon {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'Magezon-Icons' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
display: inline-block;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.MgzFontAwesome {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
#menu-magezon-core-extensions {
> a {
&:before {
content: url('../Magezon_Core/images/logo.svg');
}
&:after {
content: url('../Magezon_Core/images/logo_hover.svg');
border: 0;
clip: rect(0, 0, 0, 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
}
&:hover,
&._active {
> a:before {
content: url('../Magezon_Core/images/logo_hover.svg');
}
}
}
.submenu li[data-ui-id*="menu-magezon-"] > a,
#nav li li[data-ui-id*="menu-magezon-"].parent > a,
#nav li li[data-ui-id*="menu-magezon-"].parent > strong {
position: relative;
}
.submenu li[data-ui-id*="menu-magezon-"] > a > span:after,
#nav li li[data-ui-id*="menu-magezon-"].parent > a > span:after,
#nav li li[data-ui-id*="menu-magezon-"].parent > strong:after {
content: url('../Magezon_Core/images/logo.svg');
float: right;
margin-top: -3px;
position: absolute;
right: 5px;
}
#menu-magezon-core-extensions .submenu li[data-ui-id*="menu-magezon-"] a > span:after,
#menu-magezon-core-extensions .submenu li[data-ui-id*="menu-magezon-"] strong:after,
.submenu li[data-ui-id*="menu-magezon-"].parent li[data-ui-id*="menu-magezon-"] > a > span:after {
display: none;
}
#mgz-tabs {
.admin__page-nav-item {
display: inline-block;
border-left: 0;
border-top: 3px solid transparent;
a {
border-bottom: 0;
text-align: center;
padding: 2rem;
}
&._active,
&.ui-state-active {
.admin__page-nav-link
{
font-weight: normal;
}
}
&:hover {
border-top-color: #e4e4e4
}
&.ui-state-active {
border-top-color: #eb5202;
border-left: 0;
}
}
.admin__page-nav-items {
padding: 0;
}
}
.admin__field-control.control {
position: relative;
}
.mgz-form_image {
input {
width: 100%;
padding-right: 120px !important;
}
.action-add-image {
position: absolute;
top: 0;
right: 0;
background: #514943;
color: #FFF;
border-color: #514943;
font-weight: normal;
&:hover {
background-color: #35302c;
border-color: #35302c;
box-shadow: 0 0 0 1px #007bdb;
}
}
.image-preview {
display: none;
margin-top: 15px;
}
}
.minicolors {
width: 100% !important;
input {
padding-left: 32px !important;
}
}
.minicolors-theme-default {
.minicolors-swatch {
height: 26px !important;
width: 26px !important;
top: 3px !important;
left: 3px !important;
cursor: pointer;
}
}
.admin__menu .item-extensions .submenu .column:only-of-type .submenu-group-title,
.admin__menu .item-extensions.level-0 > .submenu > ul > .level-1:only-of-type > .submenu-group-title {
display: block;
}
.mgz-status {
display: block;
font-weight: bold;
line-height: 17px;
padding: 0 3px;
text-align: center;
text-transform: uppercase;
border: 1px solid transparent;
max-width: 90px;
margin: 0 auto;
}
.mgz-status_1 {
background: #d0e5a9 none repeat scroll 0 0;
border-color: #5b8116;
color: #185b00;
}
.mgz-status_0 {
background: #f9d4d4 none repeat scroll 0 0;
border-color: #e22626;
color: #e22626;
}
.data-grid td._date {
width: 180px;
}
.data-grid td._center {
text-align: center;
}
.data-grid td._select {
width: 120px;
}
.mgz-menu.admin__action-dropdown-wrap {
z-index: 499;
a.admin__action-dropdown h1 {
background: url('../Magezon_Core/images/logo.png') no-repeat left center;
padding-left: 35px;
background-size: 25px;
}
.admin__action-dropdown-menu {
left: 0;
right: auto;
width: 500px;
}
.admin__action-dropdown-text:after {
left: 0;
right: -6px;
}
.admin__action-dropdown-menu > li {
width: 50%;
float: left;
> a {
padding: 1.1rem 0.5rem;
&:hover {
background-color: #e0f6fe;
color: #41362f;
}
}
&.separator {
border-top: 1px solid #d1d1d1;
margin: 1.8rem 0;
width: 100%;
}
&.wide {
width: 100%;
}
}
}
.admin__data-grid-action-columns-menu .col_store_id {
display: none !important;
}
.mgz-filemanager._disabled button {
opacity: .6;
}
.mgz-ui {
.admin__action-multiselect-wrap li {
display: block;
}
.admin__action-multiselect-crumb .action-close {
padding: 0;
&:before {
font-size: inherit;
}
}
}
.mgz-heading {
margin: 30px 0;
padding: 15px 0;
text-align: center;
background: #373330;
color: #FFF;
font-size: 1.6rem;
}
.mgz-system-heading {
font-size: 15px;
border-left: #eb5202 solid 5px;
padding: 8px 12px;
text-align: left !important;
margin-left: 10%;
margin-top: 20px;
background: #373330;
color: #FFF;
font-weight: 400;
}
.mgz-action-menu {
list-style: none;
margin-bottom: 0;
li {
margin-bottom: 8px;
&:last-child {
margin-bottom: 0;
}
}
}
.hide-control-value .admin__grid-control-value {
display: none;
}
.admin__grid-control .mgz-position {
width: 80px;
}
.mgz-extention .page-actions._fixed {
background: url('../Magezon_Core/images/logo.png') no-repeat 10px center #f8f8f8;
padding-left: 45px;
background-size: 25px;
}
.magezon-extensions {
.admin__page-nav-title {
background-image: url('../Magezon_Core/images/logo.png') !important;
background-repeat: no-repeat !important;
background-position: 1.8rem center !important;
padding-left: 42px;
background-size: 20px !important;
&:hover {
background-color: #f1f1f1 !important;
}
}
}
.mgz-text-left {
text-align: left;
}
.mgz-text-right {
text-align: right;
}
.mgz-text-center {
text-align: center;
}
.mgz-text-justify {
text-align: justify;
}
.mgz-hidden {
display: none;
}
.mgz-hide {
display: none;
}
.mgz-visible {
display: block;
}
.mgz_fit {
width: 1% !important;
}
.mgz_center {
text-align: center;
}
@@ -0,0 +1,146 @@
// /**
// * Copyright © Magento, Inc. All rights reserved.
// * See COPYING.txt for license details.
// */
//
// Yes/no switcher
// _____________________________________________
//
// Variables
// _____________________________________________
@mgz-toggle-color-gray89: #e3e3e3;
@mgz-toggle-color-white: #fff;
@mgz-toggle-color-green-apple: #79a22e;
@mgz-toggle-disabled__opacity: .5;
@mgz-toggle-color-gray65-lighten: #aaa6a0;
@mgz-toggle-action__height: 3.2rem;
@mgz-toggle-field-size__m: 34rem;
@mgz-toggle-actions-switcher-speed: .2s;
@mgz-toggle-color-blue-pure: #007bdb;
@mgz-toggle-field-control__focus__border-color: @mgz-toggle-color-blue-pure;
@mgz-toggle-color-tomato-brick: #e22626;
@mgz-toggle-field-error-control__border-color: @mgz-toggle-color-tomato-brick;
@mgz-toggle-actions-switcher__background-color: @mgz-toggle-color-gray89;
@mgz-toggle-actions-switcher__border-radius: 12px;
@mgz-toggle-actions-switcher__border: 1px solid @mgz-toggle-color-gray65-lighten;
@mgz-toggle-actions-switcher__height: 22px;
@mgz-toggle-actions-switcher__width: 37px;
@mgz-toggle-actions-switcher-control__background-color: @mgz-toggle-color-white;
@mgz-toggle-actions-switcher-handler__background-color: @mgz-toggle-color-white;
@mgz-toggle-actions-switcher-handler__height: @mgz-toggle-actions-switcher__height;
@mgz-toggle-actions-switcher-handler__width: @mgz-toggle-actions-switcher__height;
//
.mgz__actions-switch {
display: inline-block;
position: relative;
vertical-align: middle;
.admin__field-control & {
line-height: @mgz-toggle-action__height;
}
+ .admin__field-service {
min-width: @mgz-toggle-field-size__m;
}
}
.mgz__actions-switch-checkbox {
&:extend(.abs-visually-hidden all);
position: absolute !important;
._disabled &,
&.disabled {
+ .mgz__actions-switch-label {
cursor: not-allowed;
opacity: @mgz-toggle-disabled__opacity;
pointer-events: none;
}
}
&:checked {
+ .mgz__actions-switch-label {
&:before {
left: (@mgz-toggle-actions-switcher__width - @mgz-toggle-actions-switcher-handler__width);
}
&:after {
background: @mgz-toggle-color-green-apple;
}
.mgz__actions-switch-text {
&:before {
content: attr(data-text-on);
}
}
}
}
._error & {
+ .mgz__actions-switch-label {
&:before,
&:after {
border-color: @mgz-toggle-field-error-control__border-color;
}
}
}
}
.mgz__actions-switch-label {
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
cursor: pointer;
display: inline-block;
height: @mgz-toggle-actions-switcher__height;
line-height: @mgz-toggle-actions-switcher__height;
position: relative;
user-select: none;
vertical-align: middle;
&:before,
&:after {
left: 0;
position: absolute;
right: auto;
top: 0;
}
&:before {
background: @mgz-toggle-actions-switcher-handler__background-color;
border: @mgz-toggle-actions-switcher__border;
border-radius: 100%;
content: '';
display: block;
height: @mgz-toggle-actions-switcher-handler__height;
transition: left @mgz-toggle-actions-switcher-speed ease-in 0s;
width: @mgz-toggle-actions-switcher-handler__width;
z-index: 1;
}
&:after {
background: @mgz-toggle-actions-switcher__background-color;
border: @mgz-toggle-actions-switcher__border;
border-radius: @mgz-toggle-actions-switcher__border-radius;
content: '';
display: block;
height: @mgz-toggle-actions-switcher__height;
transition: background @mgz-toggle-actions-switcher-speed ease-in 0s;
width: @mgz-toggle-actions-switcher__width;
z-index: 0;
}
}
.mgz__actions-switch-text {
&:before {
content: attr(data-text-off);
padding-left: (@mgz-toggle-actions-switcher__width + 10);
white-space: nowrap;
}
}
@@ -0,0 +1,193 @@
// /**
// * Copyright © Magento, Inc. All rights reserved.
// * See COPYING.txt for license details.
// */
@mgz-control-checkbox-radio__background-color: #FFF;
@mgz-field-control__border-color: #adadad;
@mgz-control-checkbox-radio__size: 1.6rem;
@mgz-field-label__indent: 1rem;
@mgz-control-checkbox-radio-mark__color: #514943;
@mgz-field-control__color: #303030;
@mgz-field-control__disabled__background-color: #e9e9e9;
@mgz-field-control__focus__border-color: #007bdb;
@mgz-field-control__hover__border-color: darken(#adadad, 15%);
@mgz-smooth__border-color: border-color .1s linear;
@mgz-icon-check-mage__content: '\e62d';
//
// Variables
// _____________________________________________
.bfb-checkbox-item,
.bfb-radio-item {
margin-top: 0.7rem;
}
// Checkbox & radio
.mgz-control-radio,
.mgz-control-checkbox {
cursor: pointer;
opacity: .01; // hack for successful selenium tests
overflow: hidden;
position: absolute !important;
vertical-align: top;
&:after { // ToDo UI: Should be deleted with old styles that generate styles for this element
display: none;
}
+ label {
cursor: pointer;
display: inline-block;
vertical-align: sub;
&:before {
.magezon-icon();
.mgz-box-sizing(border-box);
background-color: @mgz-control-checkbox-radio__background-color;
border: 1px solid @mgz-field-control__border-color;
color: transparent;
float: left;
height: @mgz-control-checkbox-radio__size;
text-align: center;
vertical-align: top;
width: @mgz-control-checkbox-radio__size;
}
}
// Label with text content
+ label {
padding-left: @mgz-control-checkbox-radio__size + @mgz-field-label__indent - .4;
&:before {
margin: 1px 0 0 -(@mgz-control-checkbox-radio__size + @mgz-field-label__indent - .4);
}
}
// Checked state
&:checked {
+ label {
&:before {
color: @mgz-control-checkbox-radio-mark__color;
}
}
}
// Disabled state
&.disabled,
&[disabled] {
+ label {
color: @mgz-field-control__color;
cursor: default;
opacity: .5;
&:before {
background-color: @mgz-field-control__disabled__background-color;
border-color: @mgz-field-control__border-color;
cursor: default;
}
}
}
&:not([disabled]),
&:not(.disabled) {
// Focus state
&:focus {
+ label {
&:before {
._keyfocus & {
border-color: @mgz-field-control__focus__border-color;
}
}
}
}
// Hover state
&:hover {
+ label {
&:before {
border-color: @mgz-field-control__hover__border-color;
}
}
}
}
}
// Radio
.mgz-control-radio {
+ label {
&:before {
border-radius: @mgz-control-checkbox-radio__size;
content: '';
transition: @mgz-smooth__border-color, color .1s ease-in;
}
}
// Discard extend line-height 1, to fix animation
&.mgz-control-radio {
+ label {
&:before {
line-height: 140%;
}
}
}
// Radio checked state
&:checked {
+ label {
position: relative;
&:after {
background-color: @mgz-control-checkbox-radio-mark__color;
border-radius: 50%;
content: '';
height: 10px;
left: 3px;
position: absolute;
top: 4px;
width: 10px;
}
}
&:not([disabled]),
&:not(.disabled) {
// Prevent hover effects for checked radio
&:hover {
cursor: default;
+ label {
cursor: default;
&:before {
border-color: @mgz-field-control__border-color;
}
}
}
}
}
}
// Checkbox
.mgz-control-checkbox {
+ label {
&:before {
&:extend(.abs-icon all);
border-radius: 1px;
content: '';
font-size: 0;
transition: font-size .1s ease-out, color .1s ease-out, @mgz-smooth__border-color;
}
}
&:checked {
+ label {
&:before {
content: @mgz-icon-check-mage__content;
font-size: 1.1rem;
line-height: 125%;
}
}
}
}
@@ -0,0 +1,189 @@
.mgz-text-shadow (@string: 0 1px 3px rgba(0, 0, 0, 0.25)) {
text-shadow: @string;
}
.mgz-box-shadow (@string) {
-webkit-box-shadow: @string;
-moz-box-shadow: @string;
box-shadow: @string;
}
.mgz-drop-shadow (@x: 0, @y: 1px, @blur: 2px, @spread: 0, @alpha: 0.25) {
-webkit-box-shadow: @x @y @blur @spread rgba(0, 0, 0, @alpha);
-moz-box-shadow: @x @y @blur @spread rgba(0, 0, 0, @alpha);
box-shadow: @x @y @blur @spread rgba(0, 0, 0, @alpha);
}
.mgz-inner-shadow (@x: 0, @y: 1px, @blur: 2px, @spread: 0, @alpha: 0.25) {
-webkit-box-shadow: inset @x @y @blur @spread rgba(0, 0, 0, @alpha);
-moz-box-shadow: inset @x @y @blur @spread rgba(0, 0, 0, @alpha);
box-shadow: inset @x @y @blur @spread rgba(0, 0, 0, @alpha);
}
.mgz-box-sizing (@type: border-box) {
-webkit-box-sizing: @type;
-moz-box-sizing: @type;
box-sizing: @type;
}
.mgz-border-radius (@radius: 5px) {
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
border-radius: @radius;
-moz-background-clip: padding;
-webkit-background-clip: padding-box;
background-clip: padding-box;
}
.mgz-border-radiuses (@topright: 0, @bottomright: 0, @bottomleft: 0, @topleft: 0) {
-webkit-border-top-right-radius: @topright;
-webkit-border-bottom-right-radius: @bottomright;
-webkit-border-bottom-left-radius: @bottomleft;
-webkit-border-top-left-radius: @topleft;
-moz-border-radius-topright: @topright;
-moz-border-radius-bottomright: @bottomright;
-moz-border-radius-bottomleft: @bottomleft;
-moz-border-radius-topleft: @topleft;
border-top-right-radius: @topright;
border-bottom-right-radius: @bottomright;
border-bottom-left-radius: @bottomleft;
border-top-left-radius: @topleft;
-moz-background-clip: padding;
-webkit-background-clip: padding-box;
background-clip: padding-box;
}
.mgz-opacity (@opacity: 0.5) {
-webkit-opacity: @opacity;
-moz-opacity: @opacity;
opacity: @opacity;
}
.mgz-gradient (@startColor: #eee, @endColor: white) {
background-color: @startColor;
background: -webkit-gradient(linear, left top, left bottom, from(@startColor), to(@endColor));
background: -webkit-linear-gradient(top, @startColor, @endColor);
background: -moz-linear-gradient(top, @startColor, @endColor);
background: -ms-linear-gradient(top, @startColor, @endColor);
background: -o-linear-gradient(top, @startColor, @endColor);
}
.mgz-horizontal-gradient (@startColor: #eee, @endColor: white) {
background-color: @startColor;
background-image: -webkit-gradient(linear, left top, right top, from(@startColor), to(@endColor));
background-image: -webkit-linear-gradient(left, @startColor, @endColor);
background-image: -moz-linear-gradient(left, @startColor, @endColor);
background-image: -ms-linear-gradient(left, @startColor, @endColor);
background-image: -o-linear-gradient(left, @startColor, @endColor);
}
.mgz-animation (@name, @duration: 300ms, @delay: 0, @ease: ease) {
-webkit-animation: @name @duration @delay @ease;
-moz-animation: @name @duration @delay @ease;
-ms-animation: @name @duration @delay @ease;
}
.mgz-transition (@transition) {
-webkit-transition: @transition;
-moz-transition: @transition;
-ms-transition: @transition;
-o-transition: @transition;
}
.mgz-transform(@string) {
-webkit-transform: @string;
-moz-transform: @string;
-ms-transform: @string;
-o-transform: @string;
}
.mgz-scale (@factor) {
-webkit-transform: scale(@factor);
-moz-transform: scale(@factor);
-ms-transform: scale(@factor);
-o-transform: scale(@factor);
}
.mgz-rotate (@deg) {
-webkit-transform: rotate(@deg);
-moz-transform: rotate(@deg);
-ms-transform: rotate(@deg);
-o-transform: rotate(@deg);
}
.mgz-skew (@deg, @deg2) {
-webkit-transform: skew(@deg, @deg2);
-moz-transform: skew(@deg, @deg2);
-ms-transform: skew(@deg, @deg2);
-o-transform: skew(@deg, @deg2);
}
.mgz-translate (@x, @y:0) {
-webkit-transform: translate(@x, @y);
-moz-transform: translate(@x, @y);
-ms-transform: translate(@x, @y);
-o-transform: translate(@x, @y);
}
.mgz-translate3d (@x, @y: 0, @z: 0) {
-webkit-transform: translate3d(@x, @y, @z);
-moz-transform: translate3d(@x, @y, @z);
-ms-transform: translate3d(@x, @y, @z);
-o-transform: translate3d(@x, @y, @z);
}
.mgz-perspective (@value: 1000) {
-webkit-perspective: @value;
-moz-perspective: @value;
-ms-perspective: @value;
perspective: @value;
}
.mgz-transform-origin (@x:center, @y:center) {
-webkit-transform-origin: @x @y;
-moz-transform-origin: @x @y;
-ms-transform-origin: @x @y;
-o-transform-origin: @x @y;
}
.mgzFlex {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.mgz-center (@percent: 50%) {
.mgz-transform(translate(-@percent,-@percent));
position: absolute;
top: @percent;
left: @percent;
}
//
// Clearfix
// ---------------------------------------------
.mgz-clearfix() {
&:before,
&:after {
content: " ";
display: table;
clear: both;
}
}
.mgz-invisible {
border: 0;
clip: rect(0, 0, 0, 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
@@ -0,0 +1,314 @@
#mgzreport {
.mgzreport-header {
.mgz-clearfix();
background: #f8f8f8;
border-bottom: 1px solid #e3e3e3;
border-top: 1px solid #e3e3e3;
padding: 1.5rem;
margin: 0 0 3rem;
> div {
margin-right: 10px;
float: left;
cursor: pointer;
}
.admin__action-multiselect-wrap {
display: inline-block;
min-width: 200px;
.action-menu {
min-width: 400px;
}
}
}
}
// Stores
#mgzreport-store {
display: inline-block;
.admin__action-multiselect-dropdown:before {
display: none;
}
.admin__action-dropdown-wrap {
z-index: 99;
}
.admin__action-dropdown-menu {
min-width: 220px;
left: 0;
}
ul {
list-style: none;
}
li > ul {
padding-left: 2.2rem;
}
.admin__action-dropdown-menu {
padding-left: 1rem;
padding-right: 1rem;
margin-bottom: 0;
li {
> .action-menu-item {
.action-dropdown-menu-link-pattern();
padding-left: .5em;
padding-right: 1.8rem;
white-space: nowrap;
cursor: pointer;
transition: @smooth__background-color;
padding: @action-dropdown-menu-link__padding-vertical @action-dropdown-menu-link__padding-horizontal;
&:hover {
background-color: @user-account-menu__hover__background-color;
color: @action-dropdown__color;
}
}
&._parent > .action-menu-item {
color: #adadad;
&:hover {
background: transparent;
}
}
}
}
.admin__action-dropdown-wrap {
.admin__action-dropdown {
background: #fff;
border: 1px solid #adadad;
border-radius: 2px;
padding: .6rem 2.5em .6rem 1rem;
font-size: 1.4rem;
font-weight: 400;
max-width: 180px;
}
&.active {
.admin__action-dropdown {
border: 1px solid #007bdb;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);
}
.admin__action-dropdown-text:after {
left: 0;
}
}
}
}
#mgzreports-datepicker {
box-sizing: border-box;
display: none;
opacity: @component-modal__opacity;
padding: @ui-datepicker__padding + @ui-datepicker__indent @ui-datepicker__padding;
width: auto;
z-index: 999999 !important;
margin: 0;
&:before {
background: @ui-datepicker__background;
border: @ui-datepicker__border;
bottom: @ui-datepicker__indent;
box-shadow: @ui-datepicker__shadow;
content: '';
display: block;
left: 0;
position: absolute;
right: 0;
top: @ui-datepicker__indent;
z-index: -1;
}
&:after {
display: none;
}
.calendar-time {
.hourselect,
.minuteselect,
.ampmselect {
font-size: 14px;
}
}
select.monthselect,
select.yearselect {
&:extend(.admin__control-select all);
}
select.monthselect {
margin-right: 6%;
}
&.daterangepicker {
.calendar-table {
th, td {
width: 38px;
height: 38px;
font-size: 14px;
font-weight: 600;
}
thead {
tr th {
font-weight: 700;
}
}
tbody {
td {
border: 1px solid #adadad;
}
}
.next span,
.prev span {
padding: 5px;
}
}
td.available:hover,
th.available:hover {
//background-color: transparent;
}
td.off,
td.disabled,
option.disabled {
background: #f5f5f5;
color: #999999;
text-decoration: none;
cursor: default;
}
.drp-calendar {
max-width: 100%;
}
td {
&.in-range,
&.active,
&.active:hover {
background: #007dbd;
color: #FFF;
}
&.active,
&.start-date,
&.end-date {
border-radius: 0;
}
}
}
.drp-selected {
font-size: @font-size__base;
}
.drp-buttons {
padding-top: 20px;
.btn {
font-size: @font-size__base;
padding: 0.6rem 1em 0.6rem;
}
}
.ranges {
li {
&.active {
background: #007dbd;
}
}
}
}
// Date Range Picker
.mgzreport-daterangepicker {
display: inline-block;
margin-right: 10px;
position: relative;
.admin__control-text {
border-radius: 2px;
display: block !important;
}
.datepicker-active {
border-color: #007bdb;
}
.arrow {
display: block;
float: right;
margin-left: 10px;
margin-top: 2px;
&:after {
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij48cGF0aCBmaWxsPSIjMDEwMjAyIiBkPSJNMCA2aDN2M0gwVjZ6bTQgM2gzVjZINHYzem00IDBoM1Y2SDh2M3ptNCAwaDNWNmgtM3Yzem0wLTd2M2gzVjJoLTN6TTggNWgzVjJIOHYzek00IDVoM1YySDR2M3ptLTQgOGgzdi0zSDB2M3ptNCAwaDN2LTNINHYzem00IDBoM3YtM0g4djN6Ii8+PC9zdmc+");
content: ' ';
display: block;
width: 16px;
height: 16px
}
}
}
.mgzreport-chart-wrapper {
width: 800px;
margin: 0 auto 5rem auto;
position: relative;
}
.mgzreport-chart-header {
text-align: center;
> div {
padding: 2.75em 0;
height: 26%;
text-align: center;
width: 22%;
display: inline-block;
.one {
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
-moz-osx-font-smoothing: grayscale;
display: block;
font-size: 2em;
}
}
.mgzreport-views {
.two {
color: #ed8542;
}
}
.mgzreport-clicks {
.two {
color: #6497f3;
}
}
.mgzreport-closes {
.two {
color: #34D7A1;
}
}
.mgzreport-conversion {
.two {
color: #5da85d;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="D" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 23 20.4" style="enable-background:new 0 0 23 20.4;" xml:space="preserve" width="23" height="20">
<style type="text/css">
.st0{fill:#FF5701;}
.st1{fill:#0B61A4;}
</style>
<g>
<path class="st0" d="M22.7,11.3l-4.6,8c-0.4,0.7-1.1,1.1-1.9,1.1l0,0c-1.7,0-2.8-1.8-1.9-3.3l3.3-5.8c0.4-0.7,0.4-1.5,0-2.2
l-3.3-5.8C13.4,1.8,14.5,0,16.2,0l0,0c0.8,0,1.5,0.4,1.9,1.1l4.6,8C23.1,9.8,23.1,10.6,22.7,11.3z"/>
<path class="st0" d="M8.1,0L8.1,0C6.4,0,5.3,1.8,6.2,3.3l3.3,5.8c0.4,0.7,0.4,1.5,0,2.2l-3.3,5.8c-0.9,1.5,0.2,3.3,1.9,3.3h0
c0.8,0,1.5-0.4,1.9-1.1l4.6-8c0.4-0.7,0.4-1.5,0-2.2l-4.6-8C9.6,0.4,8.9,0,8.1,0z"/>
<g>
<path class="st1" d="M6.8,11c0.3-0.5,0.3-1.1,0-1.6L6,8.2L4.8,6.1c-0.6-1-2.1-1-2.7,0L0.9,8.2L0.2,9.4c-0.3,0.5-0.3,1.1,0,1.6
l0.7,1.3l1.2,2.1c0.6,1,2.1,1,2.7,0L6,12.3L6.8,11z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="D" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 23 20.4" style="enable-background:new 0 0 23 20.4;" xml:space="preserve" width="23" height="20">
<style type="text/css">
.st0{fill:#FF5701;}
.st1{fill:#0B61A4;}
</style>
<g>
<path class="st0" d="M22.7,11.3l-4.6,8c-0.4,0.7-1.1,1.1-1.9,1.1l0,0c-1.7,0-2.8-1.8-1.9-3.3l3.3-5.8c0.4-0.7,0.4-1.5,0-2.2
l-3.3-5.8C13.4,1.8,14.5,0,16.2,0l0,0c0.8,0,1.5,0.4,1.9,1.1l4.6,8C23.1,9.8,23.1,10.6,22.7,11.3z"/>
<path class="st0" d="M8.1,0L8.1,0C6.4,0,5.3,1.8,6.2,3.3l3.3,5.8c0.4,0.7,0.4,1.5,0,2.2l-3.3,5.8c-0.9,1.5,0.2,3.3,1.9,3.3h0
c0.8,0,1.5-0.4,1.9-1.1l4.6-8c0.4-0.7,0.4-1.5,0-2.2l-4.6-8C9.6,0.4,8.9,0,8.1,0z"/>
<g>
<path class="st1" d="M6.8,11c0.3-0.5,0.3-1.1,0-1.6L6,8.2L4.8,6.1c-0.6-1-2.1-1-2.7,0L0.9,8.2L0.2,9.4c-0.3,0.5-0.3,1.1,0,1.6
l0.7,1.3l1.2,2.1c0.6,1,2.1,1,2.7,0L6,12.3L6.8,11z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because one or more lines are too long
@@ -0,0 +1,48 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Catalog/js/components/import-handler',
'underscore',
'uiRegistry'
], function (Element, _, registry) {
'use strict';
return Element.extend({
/**
* Update field with mask value, if it's allowed.
*
* @param {Object} placeholder
* @param {Object} component
*/
updateValue: function (placeholder, component) {
var string = this.mask || '',
nonEmptyValueFlag = false;
if (placeholder) {
this.values[placeholder] = component.getPreview() || '';
}
if (!this.allowImport) {
return;
}
_.each(this.values, function (propertyValue, propertyName) {
string = string.replace('{{' + propertyName + '}}', propertyValue);
nonEmptyValueFlag = nonEmptyValueFlag || !!propertyValue;
});
if (nonEmptyValueFlag) {
string = string.replace(/(<([^>]+)>)/ig, ''); // Remove html tags
string = string.replace(/ /g, '-');
string = string.toLowerCase();
this.value(string);
} else {
this.value('');
}
}
});
});
@@ -0,0 +1,81 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Ui/js/form/element/ui-select'
], function (Select) {
'use strict';
/**
* Processing options list
*
* @param {Array} array - Property array
* @param {String} separator - Level separator
* @param {Array} created - list to add new options
*
* @return {Array} Plain options list
*/
function flattenCollection(array, separator, created) {
var i = 0,
length,
childCollection;
array = _.compact(array);
length = array.length;
created = created || [];
for (i; i < length; i++) {
created.push(array[i]);
if (array[i].hasOwnProperty(separator)) {
childCollection = array[i][separator];
delete array[i][separator];
flattenCollection.call(this, childCollection, separator, created);
}
}
return created;
}
return Select.extend({
defaults: {
listens: {
'${ $.namespace }.${ $.namespace }:responseData': 'setParsed',
'newOption': 'toggleOptionSelected'
},
},
/**
* Parse data and set it to options.
*
* @param {Object} data - Response data object.
* @returns {Object}
*/
setParsed: function (data) {
var option = this.parseData(data);
if (data.error) {
return this;
}
this.options.push(option);
this.value.push(option.value);
},
/**
* Normalize option object.
*
* @param {Object} data - Option object.
* @returns {Object}
*/
parseData: function (data) {
return {
'is_active': data.brand['is_active'],
value: data.brand['entity_id'],
label: data.brand.name,
};
}
});
});
@@ -0,0 +1,120 @@
define([
'jquery',
'Magezon_Core/js/moment',
'uiComponent',
'Magezon_Core/js/daterangepicker/daterangepicker.min'
], function ($, moment, Component) {
'use strict';
var startDate, endDate;
if (window.mgzReportsConfig.from) {
startDate = moment(window.mgzReportsConfig.from, 'YYYY-MM-DD');
} else {
startDate = moment().startOf('month').hours(0).minutes(0);
}
if (window.mgzReportsConfig.to) {
endDate = moment(window.mgzReportsConfig.to, 'YYYY-MM-DD');
} else {
endDate = moment().endOf('month').hours(23).minutes(59);
}
return Component.extend({
defaults: {
template: 'Magezon_Core/daterangepicker',
from: startDate.format('YYYY-MM-DD'),
to: endDate.format('YYYY-MM-DD'),
startDate: startDate,
endDate: endDate,
minDate: '',
maxDate: '',
exports: {
from: '${ $.provider }:params.from',
to: '${ $.provider }:params.to',
startDate: '${ $.provider }:data.startDate',
endDate: '${ $.provider }:data.endDate'
}
},
/**
* @inheritdoc
*/
initObservable: function () {
this._super()
.observe([
'from',
'to',
'startDate',
'endDate',
'isSameYear',
'isSameMonth',
'isSameDay'
]);
return this;
},
onElementRender: function (element) {
this.initDateRangePicker(element);
},
initDateRangePicker: function (element) {
var self = this;
var start = this.startDate();
var end = this.endDate();
function cb(start, end) {
$(element).find('.date-range-field').html(start.format('MMM D, YYYY') + ' - ' + end.format('MMM D, YYYY'));
}
$(element).daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Today': [moment().hours(0).minutes(0), moment().hours(23).minutes(59)],
'Yesterday': [moment().add(-1, 'days').hours(0).minutes(0), moment().add(-1, 'days').hours(23).minutes(59)],
'This Week': [moment().startOf('week').hours(0).minutes(0), moment().endOf('week').hours(23).minutes(59)],
'This Month': [moment().startOf('month').hours(0).minutes(0), moment().endOf('month').hours(23).minutes(59)],
'Last Week': [moment().subtract(1, 'weeks').startOf('week').hours(0).minutes(0), moment().subtract(1, 'weeks').endOf('week').hours(23).minutes(59)],
'Last Month': [moment().add(-1, 'month').startOf('month').hours(0).minutes(0), moment().add(-1, 'month').endOf('month').hours(23).minutes(59)]
},
showDropdowns: true,
alwaysShowCalendars: true,
minDate: self.minDate,
maxDate: self.maxDate,
template: '<div id="mgzreports-datepicker" class="daterangepicker ' + self.reportType + '">' +
'<div class="ranges"></div>' +
'<div class="drp-calendar left">' +
'<div class="calendar-table"></div>' +
'<div class="calendar-time"></div>' +
'</div>' +
'<div class="drp-calendar right">' +
'<div class="calendar-table"></div>' +
'<div class="calendar-time"></div>' +
'</div>' +
'<div class="drp-buttons">' +
'<span class="drp-selected"></span>' +
'<button class="cancelBtn" type="button"></button>' +
'<button class="applyBtn" disabled="disabled" type="button"></button> ' +
'</div>' +
'</div>',
applyButtonClasses: 'primary',
cancelClass: 'action-secondary'
}).on('apply.daterangepicker', function(ev, picker) {
cb(picker.startDate, picker.endDate);
var from = picker.startDate.second(0).format('YYYY-MM-DD');
var to = picker.endDate.second(0).format('YYYY-MM-DD');
self.from(from);
self.to(to);
self.startDate(picker.startDate);
self.endDate(picker.endDate);
}).on('show.daterangepicker', function () {
$(element).addClass('datepicker-active');
}).on('hide.daterangepicker', function () {
$(element).removeClass('datepicker-active');
});
cb(start, end);
}
})
});
File diff suppressed because one or more lines are too long
@@ -0,0 +1,94 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'jquery',
'underscore'
], function ($, _) {
'use strict';
var buttons = {
'reset': '#reset',
'save': '#save_and_close',
'saveAndContinue': '#save-button',
'saveAndDuplicate': '#save_and_duplicate',
'saveAndNew': '#save_and_new',
'saveAndSendEmail': '#save_and_send_email'
},
selectorPrefix = '',
eventPrefix;
/**
* Initialize listener.
*
* @param {Function} callback
* @param {String} action
*/
function initListener(callback, action) {
var selector = selectorPrefix ? selectorPrefix + ' ' + buttons[action] : buttons[action],
elem = $(selector)[0];
if (!elem) {
return;
}
if (elem.onclick) {
elem.onclick = null;
}
$(elem).on('click' + eventPrefix, callback);
}
/**
* Destroy listener.
*
* @param {String} action
*/
function destroyListener(action) {
var selector = selectorPrefix ? selectorPrefix + ' ' + buttons[action] : buttons[action],
elem = $(selector)[0];
if (!elem) {
return;
}
if (elem.onclick) {
elem.onclick = null;
}
$(elem).off('click' + eventPrefix);
}
return {
/**
* Attaches events handlers.
*
* @param {Object} handlers
* @param {String} selectorPref
* @param {String} eventPref
*/
on: function (handlers, selectorPref, eventPref) {
selectorPrefix = selectorPrefix || selectorPref;
eventPrefix = eventPref;
_.each(handlers, initListener);
selectorPrefix = '';
},
/**
* Removes events handlers.
*
* @param {Object} handlers
* @param {String} eventPref
*/
off: function (handlers, eventPref) {
eventPrefix = eventPref;
_.each(handlers, destroyListener);
}
};
});
@@ -0,0 +1,120 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/* global $, $H */
define([
'jquery',
'mage/adminhtml/grid'
], function (jquery) {
'use strict';
return function (config) {
var selectedItems = $H(config.selectedItems),
gridJsObject = window[config.gridJsObjectName],
selector = config.selector,
tabIndex = 1000;
$(selector).value = Object.toJSON(selectedItems);
/**
* @param {Object} grid
* @param {Object} element
* @param {Boolean} checked
*/
function registerRow(grid, element, checked) {
if (checked) {
if (element.positionElement) {
element.positionElement.disabled = false;
selectedItems.set(element.value, element.positionElement.value);
}
} else {
if (element.positionElement) {
element.positionElement.disabled = true;
}
selectedItems.unset(element.value);
}
$(selector).value = Object.toJSON(selectedItems);
var items = {};
items[config.ajaxParam + '[]'] = selectedItems.keys();
grid.reloadParams = items;
}
/**
* Click on product row
*
* @param {Object} grid
* @param {String} event
*/
function rowClick(grid, event) {
var trElement = Event.findElement(event, 'tr'),
isInput = Event.element(event).tagName === 'INPUT',
checked = false,
checkbox = null,
colAction = Event.findElement(event, '.col-action > a');
if (trElement) {
if(!colAction){
checkbox = Element.getElementsBySelector(trElement, 'input');
if (checkbox[0]) {
checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
gridJsObject.setCheckboxChecked(checkbox[0], checked);
}
}
}
}
/**
* Change product position
*
* @param {String} event
*/
function positionChange(event) {
var element = Event.element(event);
if (element && element.checkboxElement && element.checkboxElement.checked) {
selectedItems.set(element.checkboxElement.value, element.value);
$(selector).value = Object.toJSON(selectedItems);
}
}
/**
* @param {Object} grid
* @param {String} row
*/
function rowInit(grid, row) {
var checkbox = $(row).getElementsByClassName('checkbox')[0],
position = $(row).getElementsByClassName('input-text')[0];
var arr = Object.values(selectedItems)[0];
for (var k in arr) {
if (k == checkbox.value) {
$(position).value = arr[k];
gridJsObject.setCheckboxChecked(checkbox, true);
}
}
if (checkbox && position) {
checkbox.positionElement = position;
position.checkboxElement = checkbox;
position.disabled = !checkbox.checked;
position.tabIndex = tabIndex++;
Event.observe(position, 'keyup', positionChange);
}
}
gridJsObject.rowClickCallback = rowClick;
gridJsObject.initRowCallback = rowInit;
gridJsObject.checkboxCheckCallback = registerRow;
if (gridJsObject.rows) {
gridJsObject.rows.each(function (row) {
rowInit(gridJsObject, row);
});
}
};
});
@@ -0,0 +1,150 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'jquery',
'ko',
'Magento_Ui/js/form/element/abstract',
'mage/translate',
'Magezon_Core/js/mage/browser'
], function ($, ko, Element, $t) {
'use strict';
return Element.extend({
defaults: {
chooseBtnLabel: $t('Select Image'),
tmp: null,
showPreview: false,
fileUrl: '',
fileName: '',
fileSize: '',
previewHeight: '',
previewWidth: '',
tracks: {
showPreview: true,
fileUrl: true,
fileName: true,
fileSize: true,
previewHeight: true,
previewWidth: true,
}
},
/**
* Initializes UISelect component.
*
* @returns {UISelect} Chainable.
*/
initialize: function () {
this._super();
if (this.tmp && this.tmp.name) {
this.fileSize = this.formatSize(this.tmp.size);
this.fileName = this.processFileName(this.tmp.name);
this.fileUrl = this.tmp.url;
this.showPreview = true;
}
return this;
},
/**
* Removes provided file from thes files list.
*
* @param {Object} file
* @returns {FileUploader} Chainable.
*/
chooseImage: function () {
if (!this.disabled()) {
window.MgzMediabrowserUtility.openDialog(window.mgzFilesBrowserWindowUrl + 'target_element_id/' + this.uid + '/', false, false, 'Insert Image', {closed: function() { jQuery('#mceModalBlocker').show()}})
}
return this;
},
/**
* Formats incoming bytes value to a readable format.
*
* @param {Number} bytes
* @returns {String}
*/
formatSize: function (bytes) {
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'],
i;
if (bytes === 0) {
return '0 Byte';
}
i = window.parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
},
/**
* Removes provided file from thes files list.
*
* @param {Object} file
* @returns {FileUploader} Chainable.
*/
removeFile: function (file) {
if (!this.disabled()) {
this.showPreview = false;
this.value('');
}
return this;
},
/**
* Handler of the preview image load event.
*
* @param {Object} file - File associated with an image.
* @param {Event} e
*/
onPreviewLoad: function (element, event) {
var img = event.currentTarget;
this.previewWidth = img.naturalWidth;
this.previewHeight = img.naturalHeight;
},
/**
* Update the preview, submit ajax get file size
*/
reloadImage: function(element, event) {
var self = this;
var input = event.currentTarget;
var file = $(input).val();
if (file) {
this.showPreview = true;
this.fileUrl = window.mgzMediaUrl + file;
this.fileName = this.processFileName(file);
$.ajax({
type: 'HEAD',
url: this.fileUrl,
complete: function(xhr) {
var size = self.formatSize(xhr.getResponseHeader('Content-Length'));
if (size) {
self.fileSize = size;
} else {
self.fileSize = '';
}
}
});
}
},
/**
* Convert real image, remove wysiwyg
*/
processFileName: function(name) {
var nameE = name.split("/");
return nameE[nameE.length-1];
}
});
});
+31
View File
@@ -0,0 +1,31 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @api
*/
define([
'jquery',
'Magento_Ui/js/form/form',
'Magezon_Core/js/form/adapter'
], function ($, Collection, adapter) {
return Collection.extend({
/** @inheritdoc */
initialize: function () {
this._super();
adapter.on({
'reset': this.reset.bind(this),
'save': this.save.bind(this, true, {}),
'saveAndContinue': this.save.bind(this, false, {}),
'saveAndDuplicate': this.save.bind(this, true, {'back': 'duplicate'}),
'saveAndNew': this.save.bind(this, true, {'back': 'new'}),
'saveAndSendEmail': this.save.bind(this, true, {'back': 'save_and_send_email'}),
}, this.selectorPrefix, this.eventPrefix);
return this;
},
});
})

Some files were not shown because too many files have changed in this diff Show More