This commit is contained in:
2026-09-15 10:26:34 +08:00
commit ecf36afa56
10493 changed files with 1404888 additions and 0 deletions
@@ -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);
}
}