init
This commit is contained in:
@@ -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,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Block\Adminhtml\Renderer\Config;
|
||||
|
||||
use Magento\Framework\Data\Form\Element\AbstractElement;
|
||||
|
||||
class Version extends \Magento\Config\Block\System\Config\Form\Field
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Framework\Module\ModuleResource
|
||||
*/
|
||||
protected $moduleResource;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\Module\ModuleResource $moduleResource
|
||||
* @param \Magento\Backend\Block\Template\Context $context
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\Module\ModuleResource $moduleResource,
|
||||
\Magento\Backend\Block\Template\Context $context,
|
||||
array $data = []
|
||||
) {
|
||||
parent::__construct($context, $data);
|
||||
$this->moduleResource = $moduleResource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AbstractElement $element
|
||||
* @return string
|
||||
*/
|
||||
protected function _getElementHtml(AbstractElement $element)
|
||||
{
|
||||
return $this->moduleResource->getDataVersion('Magezon_QuickOrder');
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+77
@@ -0,0 +1,77 @@
|
||||
<?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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Block;
|
||||
|
||||
use Magento\Framework\Data\Form\FormKey;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
|
||||
class Form extends \Magento\Framework\View\Element\Template implements \Magento\Widget\Block\BlockInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_template = 'Magezon_QuickOrder::form.phtml';
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Locale\FormatInterface
|
||||
*/
|
||||
protected $_localeFormat;
|
||||
|
||||
/**
|
||||
* @var \Magezon\QuickOrder\Helper\Data
|
||||
*/
|
||||
protected $dataHelper;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\View\Element\Template\Context $context
|
||||
* @param \Magento\Framework\Locale\FormatInterface $localeFormat
|
||||
* @param \Magezon\QuickOrder\Helper\Data $dataHelper
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\View\Element\Template\Context $context,
|
||||
\Magento\Framework\Locale\FormatInterface $localeFormat,
|
||||
\Magezon\QuickOrder\Helper\Data $dataHelper,
|
||||
protected FormKey $formKey,
|
||||
array $data = []
|
||||
) {
|
||||
parent::__construct($context, $data);
|
||||
$this->_localeFormat = $localeFormat;
|
||||
$this->dataHelper = $dataHelper;
|
||||
}
|
||||
|
||||
public function toHtml()
|
||||
{
|
||||
if (!$this->dataHelper->isEnabled() || !$this->dataHelper->isGroupValid()) return;
|
||||
|
||||
return parent::toHtml();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getPriceFormat()
|
||||
{
|
||||
return $this->_localeFormat->getPriceFormat();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
public function getFormKey()
|
||||
{
|
||||
return $this->formKey->getFormKey();
|
||||
}
|
||||
}
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
<?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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Block;
|
||||
|
||||
class Link extends \Magento\Framework\View\Element\Html\Link
|
||||
{
|
||||
/**
|
||||
* @var \Magezon\QuickOrder\Helper\Data
|
||||
*/
|
||||
protected $dataHelper;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\View\Element\Template\Context $context
|
||||
* @param \Magezon\QuickOrder\Helper\Data $dataHelper
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\View\Element\Template\Context $context,
|
||||
\Magezon\QuickOrder\Helper\Data $dataHelper,
|
||||
array $data = []
|
||||
) {
|
||||
parent::__construct($context, $data);
|
||||
$this->dataHelper = $dataHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render block HTML
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _toHtml()
|
||||
{
|
||||
if (!$this->dataHelper->getConfig('general/show_toplinks')) {
|
||||
return;
|
||||
}
|
||||
$route = $this->dataHelper->getConfig('general/route');
|
||||
$title = $this->dataHelper->getTitle();
|
||||
if ($route && $title && $this->dataHelper->isGroupValid()) {
|
||||
return '<li><a href="' . $this->getUrl($route) . '" >' . $title . '</a></li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Block;
|
||||
|
||||
use Magento\Framework\Pricing\PriceCurrencyInterface;
|
||||
|
||||
class Product extends \Magento\Catalog\Block\Product\AbstractProduct
|
||||
{
|
||||
}
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
<?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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Controller\Index;
|
||||
|
||||
use \Magento\Framework\Exception\LocalizedException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Stemcell\Customer\Model\LabRepository;
|
||||
|
||||
class AddToCart extends \Magento\Framework\App\Action\Action
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Checkout\Model\Cart
|
||||
*/
|
||||
protected $cart;
|
||||
|
||||
/**
|
||||
* @var \Magento\Catalog\Api\ProductRepositoryInterface
|
||||
*/
|
||||
protected $productRepository;
|
||||
protected LabRepository $labRepository;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\App\Action\Context $context
|
||||
* @param \Magento\Checkout\Model\Cart $cart
|
||||
* @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\App\Action\Context $context,
|
||||
\Magento\Checkout\Model\Cart $cart,
|
||||
\Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
|
||||
LabRepository $labRepository,
|
||||
protected LoggerInterface $logger
|
||||
) {
|
||||
parent::__construct($context);
|
||||
$this->cart = $cart;
|
||||
$this->productRepository = $productRepository;
|
||||
$this->labRepository = $labRepository;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$result['status'] = false;
|
||||
$data = $this->getRequest()->getPostValue();
|
||||
// $this->logger->warning('$data', $data);
|
||||
$extensionAttributes = [];
|
||||
$storeId = $this->_objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->getStore()->getId();
|
||||
if ($data && isset($data['items'])) {
|
||||
try {
|
||||
$valid = true;
|
||||
$shouldCollectTotals = false;
|
||||
foreach ($data['items'] as $index => $item) {
|
||||
if (!isset($item['product'])) {
|
||||
if (isset($item['name']) && $item['name']) {
|
||||
$this->messageManager->addError(__('Product %1 does not exist. Please remove and add it again.', $item['name']));
|
||||
} else {
|
||||
$this->messageManager->addError(__('Something went wrong while processing the request.'));
|
||||
}
|
||||
$valid = false;
|
||||
break;
|
||||
}
|
||||
$product = $this->productRepository->getById($item['product'], false, $storeId, true);
|
||||
$params = [];
|
||||
if (isset($item['options'])) {
|
||||
parse_str($item['options'], $params);
|
||||
}
|
||||
$extensionAttributes[$product->getId()] = $item['others'];
|
||||
|
||||
$params['qty'] = $item['qty'];
|
||||
$params['item_sort'] = $index + 1;
|
||||
try {
|
||||
$this->cart->addProduct($product, $params);
|
||||
} catch (\Exception $e) {
|
||||
$valid = false;
|
||||
$this->logger->warning('货号直购将产品加入购物车时异常,原因:'.$e->getMessage(), $e->getTrace());
|
||||
$this->messageManager->addError(__('Something went wrong while processing the request.'));
|
||||
}
|
||||
}
|
||||
$cart = $this->cart->save();
|
||||
if ($valid) {
|
||||
|
||||
$firstLab = false;
|
||||
$valid = false;
|
||||
foreach ($cart->getQuote()->getAllVisibleItems() as $item) {
|
||||
$productId = $item->getProduct()->getId();
|
||||
if (isset($extensionAttributes[$productId]) && is_array($extensionAttributes[$productId])) {
|
||||
try {
|
||||
$lab = $this->labRepository->getByLabCode($extensionAttributes[$productId]['lab_code']);
|
||||
if ($lab->getLabId()) {
|
||||
$extensionAttributes[$productId]['lab_id'] = $lab->getLabId();
|
||||
if ($lab->getSalespersonId()) {
|
||||
$firstLab = $lab;
|
||||
}
|
||||
}
|
||||
} catch (LocalizedException $e) {
|
||||
$this->logger->warning(
|
||||
sprintf(
|
||||
'货号直购设置lab时异常,lab_code: %s, 原因:%s',
|
||||
$extensionAttributes[$productId]['lab_code'],
|
||||
$e->getMessage()
|
||||
),
|
||||
$e->getTrace()
|
||||
);
|
||||
}
|
||||
$percent = $extensionAttributes[$productId]['customer_discount_percent'] ?? 0;
|
||||
if (intval($percent) != 0) {
|
||||
$shouldCollectTotals = true;
|
||||
}
|
||||
$cart->updateItems([$item->getId()=>['extension_attributes'=>$extensionAttributes[$item->getProduct()->getId()]]]);
|
||||
$valid = true;
|
||||
}
|
||||
}
|
||||
if ($firstLab) {
|
||||
$cart->getQuote()->setData('salesperson_id', $firstLab->getSalespersonId());
|
||||
}
|
||||
// if ($valid) {
|
||||
// $this->_eventManager->dispatch('checkout_cart_save_after', ['cart' => $cart]);
|
||||
// $this->cart->save();
|
||||
// }
|
||||
if ($shouldCollectTotals) {
|
||||
$this->cart->getQuote()->setTotalsCollectedFlag(false)->collectTotals();
|
||||
}
|
||||
$result['status'] = true;
|
||||
$result['redirectUrl'] = $this->_url->getUrl('checkout/cart');
|
||||
}
|
||||
} catch (LocalizedException $e) {
|
||||
$result['message'] = $e->getMessage();
|
||||
} catch (\Exception $e) {
|
||||
$result['message'] = __('Something went wrong while processing the request.');
|
||||
}
|
||||
}
|
||||
$this->getResponse()->representJson(
|
||||
$this->_objectManager->get(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($result)
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
<?php
|
||||
|
||||
namespace Magezon\QuickOrder\Controller\Index;
|
||||
|
||||
use Magento\Catalog\Api\ProductRepositoryInterface;
|
||||
use Magento\Checkout\Model\Cart as CustomerCart;
|
||||
use Magento\Framework\App\Action\Context;
|
||||
use Magento\Framework\App\Action\HttpPostActionInterface;
|
||||
use Magento\Framework\App\Filesystem\DirectoryList;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
use Magento\Framework\Filesystem;
|
||||
use Magento\Framework\Filesystem\Directory\WriteInterface;
|
||||
use Magento\MediaStorage\Model\File\Uploader;
|
||||
use Magento\MediaStorage\Model\File\UploaderFactory;
|
||||
use Magezon\QuickOrder\Model\ProductManagement;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Stemcell\Customer\Model\LabRepository;
|
||||
|
||||
class BatchImport extends \Magento\Framework\App\Action\Action implements HttpPostActionInterface
|
||||
{
|
||||
private const UPLOAD_DIRECTORY = 'import/quickorder';
|
||||
private const MAX_UPLOAD_SIZE = 10485760;
|
||||
private const ALLOWED_MIME_TYPES = [
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/zip',
|
||||
'application/x-zip-compressed',
|
||||
'application/x-ole-storage',
|
||||
'application/octet-stream',
|
||||
];
|
||||
|
||||
private WriteInterface $mediaDirectory;
|
||||
|
||||
public function __construct(
|
||||
Context $context,
|
||||
protected ProductRepositoryInterface $productRepository,
|
||||
protected LabRepository $labRepository,
|
||||
protected ProductManagement $productManagement,
|
||||
protected LoggerInterface $logger,
|
||||
protected CustomerCart $cart,
|
||||
protected UploaderFactory $uploaderFactory,
|
||||
Filesystem $filesystem
|
||||
) {
|
||||
parent::__construct($context);
|
||||
$this->mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
try {
|
||||
$uploader = $this->getValidatedUploader();
|
||||
$uploadData = $uploader->validateFile();
|
||||
$spreadSheet = IOFactory::load($uploadData['tmp_name']);
|
||||
$data = $spreadSheet->getActiveSheet()->toArray('');
|
||||
|
||||
$quote = $this->cart->getQuote();
|
||||
if (!$quote->getId()) {
|
||||
// A persisted quote ID is required for the archive file name.
|
||||
$this->cart->save();
|
||||
$quote = $this->cart->getQuote();
|
||||
}
|
||||
|
||||
if (!$quote->getId()) {
|
||||
throw new LocalizedException(__('Unable to create a cart for the uploaded file.'));
|
||||
}
|
||||
|
||||
$this->saveUploadedFile(
|
||||
$spreadSheet,
|
||||
(int) $quote->getId(),
|
||||
strtolower($uploader->getFileExtension())
|
||||
);
|
||||
} catch (\Throwable $e) {
|
||||
$this->logger->error('货号直购保存上传的 Excel 失败:' . $e->getMessage(), ['exception' => $e]);
|
||||
$message = $e instanceof LocalizedException
|
||||
? $e->getMessage()
|
||||
: __('The Excel file could not be uploaded. Please check the file and try again.');
|
||||
$this->messageManager->addErrorMessage($message);
|
||||
$this->getResponse()->representJson(json_encode(['result' => false]));
|
||||
return;
|
||||
}
|
||||
|
||||
array_shift($data);
|
||||
$salesperson = [];
|
||||
|
||||
$firstLab = $canSave = false;
|
||||
$orderRemark = '';
|
||||
$errors = [];
|
||||
foreach ($data as $index => $row) {
|
||||
|
||||
if (!$row['0']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$product = $this->productRepository->get($row['0'], false, null, true);
|
||||
$productData = $this->productManagement->getProductData($product);
|
||||
|
||||
$params = [];
|
||||
if ($row[8] && $orderRemark == '') {
|
||||
$orderRemark = $row[8];
|
||||
}
|
||||
if (!empty($productData['children'])) {
|
||||
parse_str($productData['options'], $params);
|
||||
}
|
||||
$qty = isset($row['1']) ? intval($row['1']) : 1;
|
||||
$other = ['qty' => $qty, 'cd' => $row[4], 'quote' => $row[5], 'customer_discount_percent' => $row[6], 'note' => $row[7]];
|
||||
$params = array_merge($params, $other);
|
||||
$product = $this->productRepository->getById($productData['id'], false, null, true);
|
||||
if (isset($row['3'])) {
|
||||
try {
|
||||
$lab = $this->labRepository->getByLabCode($row['3']);
|
||||
if ($lab->getLabId()) {
|
||||
$params['lab_id'] = $lab->getLabId();
|
||||
if ($lab->getSalespersonId()) {
|
||||
$firstLab = $lab;
|
||||
$salesperson[] = $lab->getSalespersonId();
|
||||
}
|
||||
}
|
||||
} catch (LocalizedException $e) {
|
||||
$this->logger->warning(
|
||||
sprintf('货号直购设置lab时异常,lab_code: %s, 原因:%s', $row['3'], $e->getMessage()),
|
||||
$e->getTrace()
|
||||
);
|
||||
}
|
||||
}
|
||||
$params['item_sort'] = $index+1;
|
||||
$this->cart->addProduct($product, $params);
|
||||
$canSave = true;
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->critical(
|
||||
sprintf('货号直购通过上传excel加入购物车失败,原因是:%s请求数据:', $e->getMessage()), $row
|
||||
);
|
||||
$fields = ['产品号'=>0, 'Lab Id'=>3, 'CD No.' => 4];
|
||||
$string = '';
|
||||
foreach ($fields as $label => $index) {
|
||||
$string .= $label . ':' . $row[$index] . ', ';
|
||||
}
|
||||
$errors[] = $string .' 加入购物车失败, 原因:'.$e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
if (count(array_unique($salesperson)) > 1) {
|
||||
$errors[] = '请注意,您使用错误的销售信息,请检查您的数据';
|
||||
}
|
||||
|
||||
if ($firstLab && count(array_unique($salesperson)) == 1) {
|
||||
$this->cart->getQuote()->setData('salesperson_id', $firstLab->getSalespersonId());
|
||||
}
|
||||
|
||||
if ($orderRemark) {
|
||||
$this->cart->getQuote()->setData('customer_note', $orderRemark);
|
||||
}
|
||||
foreach ($errors as $error) {
|
||||
$this->messageManager->addError($error);
|
||||
}
|
||||
if ($canSave) {
|
||||
$this->cart->save();
|
||||
$this->cart->getQuote()->setTotalsCollectedFlag(false)->collectTotals();
|
||||
}
|
||||
$this->getResponse()->representJson(
|
||||
json_encode(['result' => $canSave])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the upload before PhpSpreadsheet opens it.
|
||||
*/
|
||||
private function getValidatedUploader(): Uploader
|
||||
{
|
||||
$uploader = $this->uploaderFactory->create(['fileId' => 'file']);
|
||||
$uploader->setAllowedExtensions(['xls', 'xlsx']);
|
||||
$uploader->setAllowCreateFolders(true);
|
||||
$uploader->setAllowRenameFiles(false);
|
||||
$uploader->setFilesDispersion(false);
|
||||
$uploader->validateFile();
|
||||
|
||||
if ($uploader->getFileSize() > self::MAX_UPLOAD_SIZE) {
|
||||
throw new LocalizedException(__('The Excel file must not exceed 10 MB.'));
|
||||
}
|
||||
|
||||
if (!$uploader->checkMimeType(self::ALLOWED_MIME_TYPES)) {
|
||||
throw new LocalizedException(__('The uploaded file is not a valid Excel file.'));
|
||||
}
|
||||
|
||||
return $uploader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save as {quote_id}.{extension}, then {quote_id}-{n}.{extension}.
|
||||
*/
|
||||
private function saveUploadedFile(Spreadsheet $spreadSheet, int $quoteId, string $extension): string
|
||||
{
|
||||
$this->mediaDirectory->create(self::UPLOAD_DIRECTORY);
|
||||
|
||||
$lock = $this->mediaDirectory->openFile(self::UPLOAD_DIRECTORY . '/.upload.lock', 'a+');
|
||||
if (!$lock->lock()) {
|
||||
$lock->close();
|
||||
throw new LocalizedException(__('The uploaded Excel file could not be locked for saving.'));
|
||||
}
|
||||
|
||||
try {
|
||||
$sequence = 0;
|
||||
do {
|
||||
$stem = (string) $quoteId . ($sequence ? '-' . $sequence : '');
|
||||
$fileName = $stem . '.' . $extension;
|
||||
$sequence++;
|
||||
} while ($this->archiveNameExists($stem));
|
||||
|
||||
$spreadSheet->getProperties()->setCreated(time());
|
||||
$writer = IOFactory::createWriter($spreadSheet, $extension === 'xlsx' ? 'Xlsx' : 'Xls');
|
||||
$relativeFilePath = self::UPLOAD_DIRECTORY . '/' . $fileName;
|
||||
try {
|
||||
$writer->save($this->mediaDirectory->getAbsolutePath($relativeFilePath));
|
||||
} catch (\Throwable $e) {
|
||||
if ($this->mediaDirectory->isExist($relativeFilePath)) {
|
||||
$this->mediaDirectory->delete($relativeFilePath);
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$this->mediaDirectory->changePermissions(
|
||||
$relativeFilePath,
|
||||
0640
|
||||
);
|
||||
} finally {
|
||||
$lock->unlock();
|
||||
$lock->close();
|
||||
}
|
||||
|
||||
return $fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Treat .xls and .xlsx files with the same stem as the same upload sequence.
|
||||
*/
|
||||
private function archiveNameExists(string $stem): bool
|
||||
{
|
||||
foreach (['xls', 'xlsx'] as $extension) {
|
||||
if ($this->mediaDirectory->isExist(self::UPLOAD_DIRECTORY . '/' . $stem . '.' . $extension)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
<?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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Controller\Index;
|
||||
|
||||
use Magento\Checkout\Model\Session as CheckoutSession;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
use Magento\Framework\Exception\NoSuchEntityException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Index extends \Magento\Framework\App\Action\Action
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Framework\View\Result\PageFactory
|
||||
*/
|
||||
protected $resultPageFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Controller\Result\ForwardFactory
|
||||
*/
|
||||
protected $resultForwardFactory;
|
||||
|
||||
/**
|
||||
* @var \Magezon\QuickOrder\Helper\Data
|
||||
*/
|
||||
protected $dataHelper;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\App\Action\Context $context
|
||||
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
|
||||
* @param \Magento\Framework\Controller\Result\ForwardFactory $resultForwardFactory
|
||||
* @param \Magezon\QuickOrder\Helper\Data $dataHelper
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\App\Action\Context $context,
|
||||
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
|
||||
\Magento\Framework\Controller\Result\ForwardFactory $resultForwardFactory,
|
||||
\Magezon\QuickOrder\Helper\Data $dataHelper,
|
||||
protected \Stemcell\Catalog\Helper\Product\View $productViewHelper,
|
||||
protected CheckoutSession $checkoutSession,
|
||||
protected LoggerInterface $logger,
|
||||
) {
|
||||
parent::__construct($context);
|
||||
$this->resultPageFactory = $resultPageFactory;
|
||||
$this->resultForwardFactory = $resultForwardFactory;
|
||||
$this->dataHelper = $dataHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Magento\Framework\View\Result\Page
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
try {
|
||||
if (!$this->checkoutSession->getQuote()->getId()) {
|
||||
$newQuote = $this->checkoutSession->getQuote();
|
||||
$newQuote->setIsActive(true);
|
||||
$newQuote->save();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->critical('货号直购页面发现没有新的购物车, 尝试初始化新购物车时失败,原因:'. $e->getMessage());
|
||||
}
|
||||
|
||||
/** @var \Magento\Framework\View\Result\Page $resultPage */
|
||||
$resultPage = $this->resultPageFactory->create();
|
||||
$resultPage->getConfig()->getTitle()->set($this->dataHelper->getTitle());
|
||||
if (!$this->dataHelper->isEnabled() || !$this->dataHelper->isGroupValid() || !$this->productViewHelper->notStockCheckGroup()) {
|
||||
$resultForward = $this->resultForwardFactory->create();
|
||||
return $resultForward->forward('noroute');
|
||||
}
|
||||
return $resultPage;
|
||||
}
|
||||
}
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
<?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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Controller\Index;
|
||||
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
|
||||
class Item extends \Magento\Framework\App\Action\Action
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Framework\DataObject\Factory
|
||||
*/
|
||||
protected $objectFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Catalog\Helper\Product\ConfigurationPool
|
||||
*/
|
||||
protected $configurationPool;
|
||||
|
||||
/**
|
||||
* @var \Magento\Quote\Model\Quote\Item\Processor
|
||||
*/
|
||||
protected $itemProcessor;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\View\LayoutFactory
|
||||
*/
|
||||
protected $layoutFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Catalog\Model\ProductFactory
|
||||
*/
|
||||
protected $productFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Pricing\Helper\Data
|
||||
*/
|
||||
protected $pricingHelper;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\App\Action\Context $context
|
||||
* @param \Magento\Framework\DataObject\Factory $objectFactory
|
||||
* @param \Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool
|
||||
* @param \Magento\Quote\Model\Quote\Item\Processor $itemProcessor
|
||||
* @param \Magento\Framework\View\LayoutFactory $layoutFactory
|
||||
* @param \Magento\Catalog\Model\ProductFactory $productFactory
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\App\Action\Context $context,
|
||||
\Magento\Framework\DataObject\Factory $objectFactory,
|
||||
\Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool,
|
||||
\Magento\Quote\Model\Quote\Item\Processor $itemProcessor,
|
||||
\Magento\Framework\View\LayoutFactory $layoutFactory,
|
||||
\Magento\Catalog\Model\ProductFactory $productFactory,
|
||||
\Magento\Framework\Pricing\Helper\Data $pricingHelper
|
||||
) {
|
||||
parent::__construct($context);
|
||||
$this->objectFactory = $objectFactory;
|
||||
$this->configurationPool = $configurationPool;
|
||||
$this->itemProcessor = $itemProcessor;
|
||||
$this->layoutFactory = $layoutFactory;
|
||||
$this->productFactory = $productFactory;
|
||||
$this->pricingHelper = $pricingHelper;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$result['status'] = false;
|
||||
$data = $this->getRequest()->getParams();
|
||||
$resultRedirect = $this->resultRedirectFactory->create();
|
||||
if ($data) {
|
||||
try {
|
||||
$product = $this->productFactory->create();
|
||||
$product->load($data['product']);
|
||||
$options = [];
|
||||
parse_str($data['options'], $options);
|
||||
if (isset($options['super_group']) && $options['super_group']) {
|
||||
$price = 0;
|
||||
$html = '<dl class="item-options">';
|
||||
foreach ($options['super_group'] as $productId => $qty) {
|
||||
if ($qty) {
|
||||
$product1 = $this->productFactory->create();
|
||||
$product1->load($productId);
|
||||
$buyeRequest = $this->objectFactory->create([
|
||||
'product' => $productId,
|
||||
'qty' => $qty
|
||||
]);
|
||||
$item = $this->getItem($product1, $buyeRequest);
|
||||
$html .= '<dt>' . $qty . ' x ' . $product1->getName() . '</dt>';
|
||||
$html .= '<dd>' . $this->pricingHelper->currency($item->getProduct()->getFinalPrice(), true, false) . '</dd>';
|
||||
$price += $item->getProduct()->getFinalPrice() * $qty;
|
||||
}
|
||||
}
|
||||
$html .= '<dl>';
|
||||
$result['price'] = $price;
|
||||
$result['options'] = $html;
|
||||
} else {
|
||||
$options = $this->objectFactory->create($options);
|
||||
$item = $this->getItem($product, $options);
|
||||
$result['price'] = $item->getProduct()->getFinalPrice();
|
||||
$optionList = $this->configurationPool->getByProductType($item->getProductType())->getOptions($item);
|
||||
$layout = $this->layoutFactory->create();
|
||||
$block = $layout->createBlock('\Magento\Framework\View\Element\Template');
|
||||
$block->setTemplate('Magezon_QuickOrder::product/options.phtml')->setOptionList($optionList);
|
||||
$result['options'] = $block->toHtml();
|
||||
}
|
||||
$result['status'] = true;
|
||||
} catch (LocalizedException $e) {
|
||||
$result['message'] = $e->getMessage();
|
||||
} catch (\Exception $e) {
|
||||
$result['message'] = __('Something went wrong while processing the request.');
|
||||
}
|
||||
}
|
||||
$this->getResponse()->representJson(
|
||||
$this->_objectManager->get(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($result)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Magento\Quote\Model\Quote\Item
|
||||
*/
|
||||
public function getItem($product, $buyRequest)
|
||||
{
|
||||
$candidate = $this->getCandidate($product, $buyRequest);
|
||||
$item = $this->itemProcessor->init($candidate, $buyRequest);
|
||||
$item->setOptions($candidate->getCustomOptions());
|
||||
$item->setProduct($product);
|
||||
return $item;
|
||||
}
|
||||
|
||||
public function getCandidate($product, $buyRequest)
|
||||
{
|
||||
$cartCandidates = $product->getTypeInstance()->prepareForCartAdvanced($buyRequest, $product, \Magento\Catalog\Model\Product\Type\AbstractType::PROCESS_MODE_FULL);
|
||||
|
||||
/**
|
||||
* Error message
|
||||
*/
|
||||
if (is_string($cartCandidates) || $cartCandidates instanceof \Magento\Framework\Phrase) {
|
||||
return strval($cartCandidates);
|
||||
}
|
||||
|
||||
/**
|
||||
* If prepare process return one object
|
||||
*/
|
||||
if (!is_array($cartCandidates)) {
|
||||
$cartCandidates = [$cartCandidates];
|
||||
}
|
||||
|
||||
return $cartCandidates[0];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Controller\Index;
|
||||
|
||||
use Magento\Catalog\Helper\ImageFactory as HelperFactory;
|
||||
|
||||
class LoadChildrens extends \Magento\Framework\App\Action\Action
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Framework\App\Config\ScopeConfigInterface
|
||||
*/
|
||||
protected $scopeConfig;
|
||||
|
||||
/**
|
||||
* @var HelperFactory
|
||||
*/
|
||||
protected $helperFactory;
|
||||
|
||||
/**
|
||||
* @var \Magezon\QuickOrder\Model\ProductManagement
|
||||
*/
|
||||
protected $productManagement;
|
||||
|
||||
/**
|
||||
* @var \Magento\Catalog\Model\ProductFactory
|
||||
*/
|
||||
protected $productFactory;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\App\Action\Context $context
|
||||
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
|
||||
* @param HelperFactory $helperFactory
|
||||
* @param \Magezon\QuickOrder\Model\ProductManagement $productManagement
|
||||
* @param \Magento\Catalog\Model\ProductFactory $productFactory
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\App\Action\Context $context,
|
||||
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
|
||||
HelperFactory $helperFactory,
|
||||
\Magezon\QuickOrder\Model\ProductManagement $productManagement,
|
||||
\Magento\Catalog\Model\ProductFactory $productFactory
|
||||
) {
|
||||
parent::__construct($context);
|
||||
$this->scopeConfig = $scopeConfig;
|
||||
$this->helperFactory = $helperFactory;
|
||||
$this->productManagement = $productManagement;
|
||||
$this->productFactory = $productFactory;
|
||||
}
|
||||
|
||||
private function usedGroupedImage()
|
||||
{
|
||||
return $this->scopeConfig->getValue(
|
||||
\Magento\GroupedProduct\Block\Cart\Item\Renderer\Grouped::CONFIG_THUMBNAIL_SOURCE,
|
||||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Magento\Framework\Controller\Result\Raw
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$result['status'] = false;
|
||||
try {
|
||||
$post = $this->getRequest()->getPostValue();
|
||||
|
||||
if (isset($post['type']) && isset($post['id'])) {
|
||||
$childrens = [];
|
||||
$product = $this->productFactory->create();
|
||||
$product->load($post['id']);
|
||||
$helper = $this->helperFactory->create()->init($product, 'product_thumbnail_image');
|
||||
|
||||
switch ($post['type']) {
|
||||
case 'grouped':
|
||||
$associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
|
||||
foreach ($associatedProducts as $product) {
|
||||
$item = $this->productManagement->getProductData($product);
|
||||
if ($this->usedGroupedImage()) {
|
||||
$item['img'] = $helper->getUrl();
|
||||
}
|
||||
$childrens[] = $item;
|
||||
}
|
||||
break;
|
||||
}
|
||||
$result['childrens'] = $childrens;
|
||||
$result['status'] = true;
|
||||
}
|
||||
} catch (\Magento\Framework\Exception\LocalizedException $e) {
|
||||
$result['message'] = $e->getMessage();
|
||||
} catch (\Exception $e) {
|
||||
$result['message'] = __('An error occurred while processing your request. Please try again later.');
|
||||
}
|
||||
$this->getResponse()->representJson(
|
||||
$this->_objectManager->get(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($result)
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Controller\Index;
|
||||
|
||||
|
||||
use Magento\Customer\Model\Session;
|
||||
|
||||
class LoadProducts extends \Magento\Framework\App\Action\Action
|
||||
{
|
||||
/**
|
||||
* @var \Magezon\QuickOrder\Model\ProductManagement
|
||||
*/
|
||||
protected $productManagement;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\App\Action\Context $context
|
||||
* @param \Magezon\QuickOrder\Model\ProductManagement $productManagement
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\App\Action\Context $context,
|
||||
\Magezon\QuickOrder\Model\ProductManagement $productManagement,
|
||||
protected Session $customerSession,
|
||||
) {
|
||||
parent::__construct($context);
|
||||
$this->productManagement = $productManagement;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Magento\Framework\Controller\Result\Raw
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$result['status'] = false;
|
||||
$result['isLoggedIn'] = $this->customerSession->isLoggedIn();
|
||||
try {
|
||||
$params = $this->getRequest()->getParams();
|
||||
$result['products'] = $this->productManagement->getProductList($params);
|
||||
$result['status'] = true;
|
||||
} catch (\Magento\Framework\Exception\LocalizedException $e) {
|
||||
$result['message'] = $e->getMessage();
|
||||
} catch (\Exception $e) {
|
||||
$result['message'] = $e->getMessage();
|
||||
}
|
||||
$this->getResponse()->representJson(
|
||||
$this->_objectManager->get(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($result)
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
<?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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Controller;
|
||||
|
||||
use Magento\Framework\App\ActionFactory;
|
||||
use Magento\Framework\App\RequestInterface;
|
||||
use Magento\Framework\App\RouterInterface;
|
||||
use Magento\Framework\DataObject;
|
||||
|
||||
class Router implements RouterInterface
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $dispatched;
|
||||
|
||||
/**
|
||||
* @var ActionFactory
|
||||
*/
|
||||
protected $actionFactory;
|
||||
|
||||
/**
|
||||
* @var \Magezon\QuickOrder\Helper\Data
|
||||
*/
|
||||
protected $dataHelper;
|
||||
|
||||
/**
|
||||
* @param ActionFactory $actionFactory
|
||||
* @param \Magezon\QuickOrder\Helper\Data $dataHelper
|
||||
*/
|
||||
public function __construct(
|
||||
ActionFactory $actionFactory,
|
||||
\Magezon\QuickOrder\Helper\Data $dataHelper
|
||||
) {
|
||||
$this->actionFactory = $actionFactory;
|
||||
$this->dataHelper = $dataHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function match(RequestInterface $request)
|
||||
{
|
||||
if (!$this->dispatched && $this->dataHelper->isEnabled()) {
|
||||
$pathInfo = trim($request->getPathInfo(), '/');
|
||||
$result = $this->processUrlKey($pathInfo);
|
||||
|
||||
if ($result) {
|
||||
$request->setModuleName($result->getModuleName())
|
||||
->setControllerName($result->getControllerName())
|
||||
->setActionName($result->getActionName());
|
||||
if ($params = $result->getParams()) {
|
||||
$request->setParams($params);
|
||||
}
|
||||
|
||||
$request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $pathInfo);
|
||||
$request->setDispatched(true);
|
||||
$this->dispatched = true;
|
||||
return $this->actionFactory->create(
|
||||
'Magento\Framework\App\Action\Forward',
|
||||
['request' => $request]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $identifier
|
||||
* @return boolean
|
||||
*/
|
||||
protected function processUrlKey($identifier)
|
||||
{
|
||||
$result = false;
|
||||
$route = $this->dataHelper->getConfig('general/route');
|
||||
if ($route) {
|
||||
$paths = explode("/", $identifier);
|
||||
if (count($paths) == 1 && ($identifier == $route)) {
|
||||
$result = new DataObject([
|
||||
'module_name' => 'quickorder',
|
||||
'controller_name' => 'index',
|
||||
'action_name' => 'index'
|
||||
]);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Executable
+88
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Helper;
|
||||
|
||||
class Data extends \Magento\Framework\App\Helper\AbstractHelper
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Store\Model\StoreManagerInterface
|
||||
*/
|
||||
protected $storeManager;
|
||||
|
||||
/**
|
||||
* @var \Magento\Customer\Model\Session
|
||||
*/
|
||||
protected $customerSession;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\App\Helper\Context $context
|
||||
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
|
||||
* @param \Magento\Customer\Model\Session $customerSession
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\App\Helper\Context $context,
|
||||
\Magento\Store\Model\StoreManagerInterface $storeManager,
|
||||
\Magento\Customer\Model\Session $customerSession
|
||||
) {
|
||||
parent::__construct($context);
|
||||
$this->storeManager = $storeManager;
|
||||
$this->customerSession = $customerSession;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param null|int $store
|
||||
* @return null|string
|
||||
*/
|
||||
public function getConfig($key, $store = null)
|
||||
{
|
||||
$store = $this->storeManager->getStore($store);
|
||||
$websiteId = $store->getWebsiteId();
|
||||
$result = $this->scopeConfig->getValue(
|
||||
'quickorder/' . $key,
|
||||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
|
||||
$store);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return $this->getConfig('general/enabled');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->getConfig('general/title');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isGroupValid()
|
||||
{
|
||||
if ($this->getConfig('general/customer_groups')) {
|
||||
$customerGroupId = $this->customerSession->getCustomer()->getGroupId();
|
||||
$customerGroups = explode(',', $this->getConfig('general/customer_groups'));
|
||||
return in_array($customerGroupId, $customerGroups);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Executable
+47
@@ -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.
|
||||
Executable
+47
@@ -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.
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Model\Config\Source;
|
||||
|
||||
class CustomerGroups implements \Magento\Framework\Option\ArrayInterface
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Customer\Model\ResourceModel\Group\Collection
|
||||
*/
|
||||
protected $customerGroupCollection;
|
||||
|
||||
/**
|
||||
* @param \Magento\Customer\Model\ResourceModel\Group\Collection $customerGroupCollection
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Customer\Model\ResourceModel\Group\Collection $customerGroupCollection
|
||||
) {
|
||||
$this->customerGroupCollection = $customerGroupCollection;
|
||||
}
|
||||
|
||||
public function toOptionArray()
|
||||
{
|
||||
return $this->customerGroupCollection->toOptionArray();
|
||||
}
|
||||
}
|
||||
+396
@@ -0,0 +1,396 @@
|
||||
<?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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Model;
|
||||
|
||||
use Magento\Catalog\Helper\ImageFactory as HelperFactory;
|
||||
use Magento\Catalog\Model\Product;
|
||||
use Magento\Catalog\Model\Product\Attribute\Source\Status;
|
||||
use Magento\Catalog\Model\Product\Type;
|
||||
use Magento\Catalog\Model\ProductRepository;
|
||||
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
|
||||
use Magento\Framework\App\ObjectManager;
|
||||
use Magento\Framework\Exception\NoSuchEntityException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ProductManagement
|
||||
{
|
||||
const QUICKORDER_PRODUCT_LIST = 'QUICKORDER_PRODUCT_LIST';
|
||||
|
||||
/**
|
||||
* @var HelperFactory
|
||||
*/
|
||||
protected $helperFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Catalog\Model\Config
|
||||
*/
|
||||
protected $_catalogConfig;
|
||||
|
||||
/**
|
||||
* @var \Magento\Catalog\Model\Product\Visibility
|
||||
*/
|
||||
protected $catalogProductVisibility;
|
||||
|
||||
/**
|
||||
* @var \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory
|
||||
*/
|
||||
protected $productCollectionFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\CacheInterface
|
||||
*/
|
||||
protected $cacheManager;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\View\LayoutInterface
|
||||
*/
|
||||
protected $layout;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Pricing\PriceCurrencyInterface
|
||||
*/
|
||||
protected $priceCurrency;
|
||||
|
||||
/**
|
||||
* @var \Magento\Store\Model\StoreManagerInterface
|
||||
*/
|
||||
protected $_storeManager;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\View\DesignInterface
|
||||
*/
|
||||
protected $_design;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\Http\Context
|
||||
*/
|
||||
protected $httpContext;
|
||||
|
||||
/**
|
||||
* @var \Magezon\Core\Helper\Data
|
||||
*/
|
||||
protected $coreHelper;
|
||||
private ProductRepository $productRepository;
|
||||
private \Magento\Bundle\Model\Product\Type $bundle;
|
||||
private Configurable $configurable;
|
||||
|
||||
protected LoggerInterface $logger;
|
||||
/**
|
||||
* @param HelperFactory $helperFactory
|
||||
* @param \Magento\Catalog\Model\Config $catalogConfig
|
||||
* @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility
|
||||
* @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory
|
||||
* @param \Magento\Framework\App\CacheInterface $cacheManager
|
||||
* @param \Magento\Framework\View\LayoutInterface $layout
|
||||
* @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency
|
||||
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
|
||||
* @param \Magento\Framework\View\DesignInterface $design
|
||||
* @param \Magento\Framework\App\Http\Context $httpContext
|
||||
* @param \Magezon\Core\Helper\Data $coreHelper
|
||||
*/
|
||||
public function __construct(
|
||||
HelperFactory $helperFactory,
|
||||
\Magento\Catalog\Model\Config $catalogConfig,
|
||||
\Magento\Catalog\Model\Product\Visibility $catalogProductVisibility,
|
||||
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
|
||||
\Magento\Framework\App\CacheInterface $cacheManager,
|
||||
\Magento\Framework\View\LayoutInterface $layout,
|
||||
\Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency,
|
||||
\Magento\Store\Model\StoreManagerInterface $storeManager,
|
||||
\Magento\Framework\View\DesignInterface $design,
|
||||
\Magento\Framework\App\Http\Context $httpContext,
|
||||
\Magezon\Core\Helper\Data $coreHelper,
|
||||
Configurable $configurable,
|
||||
\Magento\Bundle\Model\Product\Type $bundle,
|
||||
ProductRepository $productRepository
|
||||
) {
|
||||
$this->helperFactory = $helperFactory;
|
||||
$this->_catalogConfig = $catalogConfig;
|
||||
$this->catalogProductVisibility = $catalogProductVisibility;
|
||||
$this->productCollectionFactory = $productCollectionFactory;
|
||||
$this->cacheManager = $cacheManager;
|
||||
$this->layout = $layout;
|
||||
$this->coreHelper = $coreHelper;
|
||||
$this->priceCurrency = $priceCurrency;
|
||||
$this->_storeManager = $storeManager;
|
||||
$this->_design = $design;
|
||||
$this->httpContext = $httpContext;
|
||||
$this->productRepository = $productRepository;
|
||||
$this->configurable = $configurable;
|
||||
$this->bundle = $bundle;
|
||||
$this->logger = ObjectManager::getInstance()->get(LoggerInterface::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCacheKey()
|
||||
{
|
||||
$cache = [
|
||||
self::QUICKORDER_PRODUCT_LIST,
|
||||
$this->priceCurrency->getCurrency()->getCode(),
|
||||
$this->_storeManager->getStore()->getId(),
|
||||
$this->_design->getDesignTheme()->getId(),
|
||||
$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP)
|
||||
];
|
||||
return implode('_', $cache);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Product $product
|
||||
* @param array
|
||||
* @return array
|
||||
*/
|
||||
public function getProductData($product)
|
||||
{
|
||||
$sku = $product->getSku();
|
||||
$options = $this->getProductOptions($product);
|
||||
|
||||
if (empty($options)) {
|
||||
return [];
|
||||
}
|
||||
$product = $options['product'];
|
||||
if (!$options['visible']) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$canConfigure = $product->canConfigure();
|
||||
if (!$canConfigure) {
|
||||
$canConfigure = $product->getRequiredOptions();
|
||||
}
|
||||
|
||||
$helper = $this->helperFactory->create()->init($product, 'product_thumbnail_image');
|
||||
$priceHtml = $this->getProductPriceHtml(
|
||||
$product,
|
||||
\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE,
|
||||
\Magento\Framework\Pricing\Render::ZONE_ITEM_LIST
|
||||
);
|
||||
if (!$priceHtml) {
|
||||
$priceHtml = '';
|
||||
}
|
||||
|
||||
return [
|
||||
'label' => $product->getName() . ' ' . $product->getSku(),
|
||||
'id' => $product->getId(),
|
||||
'sku' => $product->getSku(),
|
||||
'name' => $product->getName(),
|
||||
'status' => $product->isSalable(),
|
||||
'value' => $product->getId(),
|
||||
'img' => $helper->getUrl(),
|
||||
'price' => $product->getPrice()==0? $product->getData('real_price'):$product->getPrice(),
|
||||
'canConfigure' => $canConfigure && empty($options['options']),
|
||||
'url' => $product->getProductUrl(),
|
||||
'openmodal' => $this->isOpenModal($product),
|
||||
'priceHtml' => $priceHtml,
|
||||
'type' => $product->getTypeId(),
|
||||
'realSku' => $product->getData('real_sku'),
|
||||
'visible' => true,
|
||||
'options' => $options['options'] ?? [],
|
||||
'children' => $options['children'] ?? [],
|
||||
];
|
||||
}
|
||||
|
||||
protected function getProductOptions(Product $product): array
|
||||
{
|
||||
$data = [];
|
||||
$optionsStr = '';
|
||||
$child = $product;
|
||||
$parentIds = $this->configurable->getParentIdsByChild($product->getId());
|
||||
// $this->logger->info('configurable $parentIds: ', ['sku' => $product->getSku(), '$parentIds' => $parentIds]);
|
||||
|
||||
if (empty($parentIds)) {
|
||||
$parentIds = $this->bundle->getParentIdsByChild($product->getId());
|
||||
// $this->logger->info('bundle $parentIds: ', ['sku' => $product->getSku(), '$parentIds' => $parentIds]);
|
||||
}
|
||||
|
||||
if (!empty($parentIds)) {
|
||||
try {
|
||||
$product = $this->productRepository->getById($parentIds[0]);
|
||||
} catch (NoSuchEntityException $e) {
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
$product->load($product->getId());
|
||||
$data['visible'] = $product->getVisibility();
|
||||
if ($data['visible'] == Product\Visibility::VISIBILITY_NOT_VISIBLE ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if ($product->getTypeId() == Type::TYPE_BUNDLE) {
|
||||
/* @var $parentTypeInstance \Magento\Bundle\Model\Product\Type */
|
||||
$parentTypeInstance = $product->getTypeInstance();
|
||||
$bundleOptions = $parentTypeInstance->getSelectionsCollection($parentTypeInstance->getOptionsIds($product), $product);
|
||||
|
||||
foreach ($bundleOptions as $option) {
|
||||
$optionsStr .= 'bundle_option['.$option->getOptionId().']['.$option->getSelectionId().']='
|
||||
.$option->getSelectionId().'&';
|
||||
// $data['options'][$option->getOptionId()][$option->getSelectionId()] = $option->getData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$children = [];
|
||||
if ($product->getTypeId()== Configurable::TYPE_CODE) {
|
||||
/* @var $parentTypeInstance Configurable */
|
||||
$parentTypeInstance = $product->getTypeInstance();
|
||||
foreach ($parentTypeInstance->getConfigurableOptions($product) as $optionId => $options) {
|
||||
foreach ($options as $option) {
|
||||
// $option['option_id'] = $optionId;
|
||||
// $data['options'][] = $option;
|
||||
if ($option['sku'] == $child->getSku()) {
|
||||
$optionsStr .= 'super_attribute['.$optionId.']='.$option['value_index'].'&';
|
||||
}
|
||||
$children[$option['sku']] = $option['sku'];
|
||||
}
|
||||
}
|
||||
|
||||
foreach($children as $sku =>$d){
|
||||
$pr = $this->productRepository->get($sku);
|
||||
$children[$sku] = ['sku'=>$sku, 'price' => number_format($pr->getPrice(), 2, '.', '')];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$product->setData('real_sku', $child->getSku());
|
||||
$product->setSku($child->getSku());
|
||||
$product->setName($child->getName());
|
||||
$product->setData('real_price', number_format($child->getPrice(), 2, '.', ''));
|
||||
$data['children'] = array_values($children);
|
||||
$data['product'] = $product;
|
||||
$data['options'] = $optionsStr ? $optionsStr.'product='.$product->getId().'&item='.$product->getId():'';
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getProductList($params)
|
||||
{
|
||||
// if (!isset($params['search']) && !isset($params['skus'])) {
|
||||
// $productList = $this->cacheManager->load($this->getCacheKey());
|
||||
// if ($productList) {
|
||||
// return $this->coreHelper->unserialize($productList);
|
||||
// }
|
||||
// }
|
||||
$collection = $this->productCollectionFactory->create();
|
||||
$collection = $this->_addProductAttributesAndPrices($collection);
|
||||
$loadAllProducts = true;
|
||||
if (isset($params['search'])) {
|
||||
$collection->addAttributeToFilter(
|
||||
'sku', trim($params['search'])
|
||||
);
|
||||
$loadAllProducts = false;
|
||||
}
|
||||
if (isset($params['skus'])) {
|
||||
$collection->addAttributeToFilter('sku', ['in' => $params['skus']]);
|
||||
$loadAllProducts = false;
|
||||
}
|
||||
|
||||
if ($loadAllProducts) {
|
||||
$collection->setVisibility($this->catalogProductVisibility->getVisibleInCatalogIds());
|
||||
$collection = $this->_addProductAttributesAndPrices($collection)->addStoreFilter();
|
||||
}
|
||||
$collection->addAttributeToFilter('type_id', ['neq' => Product\Type::TYPE_VIRTUAL]);
|
||||
|
||||
|
||||
$list = $temp = [];
|
||||
foreach ($collection as $product) {
|
||||
|
||||
$productData = $this->getProductData($product);
|
||||
if (!empty($product) && $productData['status']) {
|
||||
$temp[$productData['realSku']] = $productData;
|
||||
}
|
||||
}
|
||||
if (isset($params['skus'])) {
|
||||
foreach ($params['skus'] as $sku) {
|
||||
if (isset($temp[$sku])) {
|
||||
$list[] = $temp[$sku];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$list = array_values($temp);
|
||||
}
|
||||
|
||||
|
||||
if (!isset($params['search'])) {
|
||||
$this->cacheManager->save(
|
||||
$this->coreHelper->serialize($list),
|
||||
$this->getCacheKey(),
|
||||
[
|
||||
Product::CACHE_TAG,
|
||||
\Magento\Framework\App\Cache\Type\Block::CACHE_TAG
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function getProductPriceHtml(
|
||||
Product $product,
|
||||
$priceType,
|
||||
$renderZone = \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST,
|
||||
array $arguments = []
|
||||
) {
|
||||
if (!isset($arguments['zone'])) {
|
||||
$arguments['zone'] = $renderZone;
|
||||
}
|
||||
|
||||
/** @var \Magento\Framework\Pricing\Render $priceRender */
|
||||
$priceRender = $this->layout->getBlock('product.price.render.default');
|
||||
$price = '';
|
||||
|
||||
if (!$priceRender) {
|
||||
$priceRender = $this->layout->createBlock(
|
||||
\Magento\Framework\Pricing\Render::class,
|
||||
'product.price.render.default',
|
||||
['data' => ['price_render_handle' => 'catalog_product_prices']]
|
||||
);
|
||||
}
|
||||
|
||||
$price = $priceRender->render($priceType, $product, $arguments);
|
||||
return $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
|
||||
) {
|
||||
return $collection
|
||||
->addMinimalPrice()
|
||||
->addFinalPrice()
|
||||
->addTaxPercents()
|
||||
->addAttributeToSelect($this->_catalogConfig->getProductAttributes())
|
||||
->addUrlRewrite();
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend for party extension
|
||||
* @param Product $product
|
||||
* @return boolean
|
||||
*/
|
||||
public function isOpenModal($product) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
<?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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Plugin\Controller\Product;
|
||||
|
||||
use Magento\Framework\Controller\ResultFactory;
|
||||
|
||||
class View
|
||||
{
|
||||
/**
|
||||
* @var ResultFactory
|
||||
*/
|
||||
protected $resultFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Registry
|
||||
*/
|
||||
protected $_coreRegistry;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\ObjectManagerInterface
|
||||
*/
|
||||
protected $_subjectManager;
|
||||
|
||||
/**
|
||||
* @var \Magento\Catalog\Model\ProductFactory
|
||||
*/
|
||||
protected $productFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Pricing\PriceCurrencyInterface
|
||||
*/
|
||||
protected $priceCurrency;
|
||||
|
||||
/**
|
||||
* @var \Magento\Store\Model\StoreManagerInterface
|
||||
*/
|
||||
protected $_storeManager;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\View\DesignInterface
|
||||
*/
|
||||
protected $_design;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\Http\Context
|
||||
*/
|
||||
protected $httpContext;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\CacheInterface
|
||||
*/
|
||||
protected $cacheManager;
|
||||
|
||||
/**
|
||||
* @var \Magezon\Core\Helper\Data
|
||||
*/
|
||||
protected $coreHelper;
|
||||
|
||||
/**
|
||||
* @param ResultFactory $resultFactory
|
||||
* @param \Magento\Framework\Registry $coreRegistry
|
||||
* @param \Magento\Framework\ObjectManagerInterface $subjectManager
|
||||
* @param \Magento\Catalog\Model\ProductFactory $productFactory
|
||||
* @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency
|
||||
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
|
||||
* @param \Magento\Framework\View\DesignInterface $design
|
||||
* @param \Magento\Framework\App\Http\Context $httpContext
|
||||
* @param \Magento\Framework\App\CacheInterface $cacheManager
|
||||
* @param \Magezon\Core\Helper\Data $coreHelper
|
||||
*/
|
||||
public function __construct(
|
||||
ResultFactory $resultFactory,
|
||||
\Magento\Framework\Registry $coreRegistry,
|
||||
\Magento\Framework\ObjectManagerInterface $subjectManager,
|
||||
\Magento\Catalog\Model\ProductFactory $productFactory,
|
||||
\Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency,
|
||||
\Magento\Store\Model\StoreManagerInterface $storeManager,
|
||||
\Magento\Framework\View\DesignInterface $design,
|
||||
\Magento\Framework\App\Http\Context $httpContext,
|
||||
\Magento\Framework\App\CacheInterface $cacheManager,
|
||||
\Magezon\Core\Helper\Data $coreHelper
|
||||
) {
|
||||
$this->resultFactory = $resultFactory;
|
||||
$this->_coreRegistry = $coreRegistry;
|
||||
$this->_subjectManager = $subjectManager;
|
||||
$this->productFactory = $productFactory;
|
||||
$this->priceCurrency = $priceCurrency;
|
||||
$this->_storeManager = $storeManager;
|
||||
$this->_design = $design;
|
||||
$this->httpContext = $httpContext;
|
||||
$this->cacheManager = $cacheManager;
|
||||
$this->coreHelper = $coreHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize requested product object
|
||||
*
|
||||
* @return \Magento\Catalog\Model\Product
|
||||
*/
|
||||
protected function _initProduct($controller)
|
||||
{
|
||||
$productId = (int)$controller->getRequest()->getParam('id');
|
||||
/** @var \Magento\Catalog\Model\Product $product */
|
||||
$product = $this->productFactory->create();
|
||||
return $product->load($productId);
|
||||
}
|
||||
|
||||
public function aroundExecute(
|
||||
\Magento\Catalog\Controller\Product\View $subject,
|
||||
\Closure $proceed
|
||||
) {
|
||||
$params = $subject->getRequest()->getParams();
|
||||
if (isset($params['mgz_qo'])) {
|
||||
$product = $this->_initProduct($subject);
|
||||
if ($product->getId()) {
|
||||
$html = $this->getHtmlFromCache($subject);
|
||||
if ($html) {
|
||||
$data['html'] = $html;
|
||||
$subject->getResponse()->representJson(
|
||||
$this->_subjectManager->get('Magento\Framework\Json\Helper\Data')->jsonEncode($data)
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result = $proceed();
|
||||
|
||||
$product = $this->getProduct();
|
||||
if (isset($params['mgz_qo']) && $product) {
|
||||
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
|
||||
$resultLayout->addHandle('quickorder_popup');
|
||||
$resultLayout->addHandle('quickorder_popup_' . $product->getTypeId());
|
||||
$html = $result->getLayout()->getBlock('ajax.product.info')->toHtml();
|
||||
$this->saveToCache($subject, $html);
|
||||
$data['html'] = $html;
|
||||
$subject->getResponse()->representJson(
|
||||
$this->_subjectManager->get('Magento\Framework\Json\Helper\Data')->jsonEncode($data)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Magento\Catalog\Model\Product
|
||||
*/
|
||||
public function getProduct()
|
||||
{
|
||||
return $this->_coreRegistry->registry('current_product');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getHtmlFromCache($subject)
|
||||
{
|
||||
$product = $this->_initProduct($subject);
|
||||
|
||||
$html = $this->cacheManager->load($this->getCacheKeyInfo($subject));
|
||||
if ($html) {
|
||||
$data = $this->coreHelper->unserialize($html);
|
||||
return $data['html'];
|
||||
}
|
||||
}
|
||||
|
||||
public function saveToCache($subject, $html) {
|
||||
$this->cacheManager->save(
|
||||
$this->coreHelper->serialize(['html' => $html]),
|
||||
$this->getCacheKeyInfo($subject),
|
||||
[
|
||||
\Magento\Catalog\Model\Product::CACHE_TAG,
|
||||
\Magento\Framework\App\Cache\Type\Block::CACHE_TAG
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function getCacheKeyInfo($subject)
|
||||
{
|
||||
$cache = [
|
||||
'QUICKORDER_PRODUCT_CACHE_HTML',
|
||||
$this->priceCurrency->getCurrency()->getCode(),
|
||||
$this->_storeManager->getStore()->getId(),
|
||||
$this->_design->getDesignTheme()->getId(),
|
||||
$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP),
|
||||
$subject->getRequest()->getParam('id')
|
||||
];
|
||||
return implode('_', $cache);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
# README #
|
||||
|
||||
This README would normally document whatever steps are necessary to get your application up and running.
|
||||
|
||||
### What is this repository for? ###
|
||||
|
||||
* Quick summary
|
||||
* Version
|
||||
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
|
||||
|
||||
### How do I get set up? ###
|
||||
|
||||
* Summary of set up
|
||||
* Configuration
|
||||
* Dependencies
|
||||
* Database configuration
|
||||
* How to run tests
|
||||
* Deployment instructions
|
||||
|
||||
### Contribution guidelines ###
|
||||
|
||||
* Writing tests
|
||||
* Code review
|
||||
* Other guidelines
|
||||
|
||||
### Who do I talk to? ###
|
||||
|
||||
* Repo owner or admin
|
||||
* Other community or team contact
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "magezon/module-quick-order",
|
||||
"description": "N/A",
|
||||
"require": {
|
||||
"php": "~7.1.0||~7.2.0||~7.3.0||~7.4.0||~8.1.0||~8.2.0",
|
||||
"magezon/module-core": "*"
|
||||
},
|
||||
"type": "magento2-module",
|
||||
"version": "1.0.4",
|
||||
"license": [
|
||||
"OSL-3.0",
|
||||
"AFL-3.0"
|
||||
],
|
||||
"autoload": {
|
||||
"files": [
|
||||
"registration.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Magezon\\QuickOrder\\": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
<?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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 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="Magento_Backend::stores">
|
||||
<resource id="Magento_Backend::stores_settings">
|
||||
<resource id="Magento_Config::config">
|
||||
<resource id="Magezon_QuickOrder::settings" title="Quick Order" translate="title" />
|
||||
</resource>
|
||||
</resource>
|
||||
</resource>
|
||||
</resource>
|
||||
</resources>
|
||||
</acl>
|
||||
</config>
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Config/etc/system_file.xsd">
|
||||
<system>
|
||||
<section id="quickorder" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<class>separator-top</class>
|
||||
<label>Quick Order</label>
|
||||
<tab>magezon</tab>
|
||||
<resource>Magezon_QuickOrder::settings</resource>
|
||||
<group id="general" translate="label" type="text" sortOrder="0" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>General Settings</label>
|
||||
<field id="version" translate="label" type="text" sortOrder="0" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Current Version</label>
|
||||
<frontend_model>Magezon\QuickOrder\Block\Adminhtml\Renderer\Config\Version</frontend_model>
|
||||
</field>
|
||||
<field id="enabled" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Enable Quick Order</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
</field>
|
||||
<field id="route" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Route</label>
|
||||
<comment><![CDATA[https://domain.com/<strong>quick-order</strong>]]></comment>
|
||||
<depends>
|
||||
<field id="enable">1</field>
|
||||
</depends>
|
||||
</field>
|
||||
<field id="enable_multiskus" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Enable Add Multiple SKUs</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
</field>
|
||||
<field id="enable_upload" translate="label comment" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Enable Upload File</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
</field>
|
||||
<field id="title" translate="label comment" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Title</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
</field>
|
||||
<field id="show_toplinks" translate="label comment" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Show in Top Links</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
<depends>
|
||||
<field id="enable">1</field>
|
||||
</depends>
|
||||
</field>
|
||||
<field id="head_background_color" translate="label comment" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Head Background Color</label>
|
||||
<frontend_model>Magezon\Core\Block\Adminhtml\System\Config\Form\Field\Minicolors</frontend_model>
|
||||
</field>
|
||||
<field id="head_color" translate="label comment" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Head Color</label>
|
||||
<frontend_model>Magezon\Core\Block\Adminhtml\System\Config\Form\Field\Minicolors</frontend_model>
|
||||
</field>
|
||||
<field id="button_color" translate="label comment" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Button Color</label>
|
||||
<frontend_model>Magezon\Core\Block\Adminhtml\System\Config\Form\Field\Minicolors</frontend_model>
|
||||
</field>
|
||||
<field id="spinner_color" translate="label comment" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Spinner Color</label>
|
||||
<frontend_model>Magezon\Core\Block\Adminhtml\System\Config\Form\Field\Minicolors</frontend_model>
|
||||
</field>
|
||||
<field id="link_color" translate="label comment" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Link Color</label>
|
||||
<frontend_model>Magezon\Core\Block\Adminhtml\System\Config\Form\Field\Minicolors</frontend_model>
|
||||
</field>
|
||||
<field id="customer_groups" translate="label comment" type="multiselect" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Allow Customer Groups</label>
|
||||
<source_model>Magezon\QuickOrder\Model\Config\Source\CustomerGroups</source_model>
|
||||
</field>
|
||||
</group>
|
||||
<group id="search" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Search</label>
|
||||
<field id="min_length" translate="label comment" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Autocomplete minimum characters</label>
|
||||
<comment>The minimum number of characters a user must type before a search is performed.</comment>
|
||||
</field>
|
||||
<field id="show_image" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Show Image</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
</field>
|
||||
<field id="show_sku" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Show Sku</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
</field>
|
||||
<field id="show_price" translate="label comment" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
|
||||
<label>Show Price</label>
|
||||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
|
||||
</field>
|
||||
</group>
|
||||
</section>
|
||||
</system>
|
||||
</config>
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
<?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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 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>
|
||||
<quickorder>
|
||||
<general>
|
||||
<enabled>1</enabled>
|
||||
<route>quick-order</route>
|
||||
<enable_multiskus>1</enable_multiskus>
|
||||
<enable_upload>1</enable_upload>
|
||||
<title>Quick Order</title>
|
||||
<show_toplinks>1</show_toplinks>
|
||||
<head_background_color>#ff9900</head_background_color>
|
||||
<head_color>#FFFFFF</head_color>
|
||||
<button_color>#ff9900</button_color>
|
||||
<spinner_color>#ff9900</spinner_color>
|
||||
</general>
|
||||
<search>
|
||||
<min_length>3</min_length>
|
||||
<show_image>1</show_image>
|
||||
<show_sku>1</show_sku>
|
||||
<show_price>1</show_price>
|
||||
</search>
|
||||
</quickorder>
|
||||
</default>
|
||||
</config>
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
|
||||
<type name="Magento\Catalog\Controller\Product\View">
|
||||
<plugin name="quickorder_popup_load" type="\Magezon\QuickOrder\Plugin\Controller\Product\View" />
|
||||
</type>
|
||||
<type name="Magento\Framework\App\RouterList">
|
||||
<arguments>
|
||||
<argument name="routerList" xsi:type="array">
|
||||
<item name="quickorder" xsi:type="array">
|
||||
<item name="class" xsi:type="string">Magezon\QuickOrder\Controller\Router</item>
|
||||
<item name="disable" xsi:type="boolean">false</item>
|
||||
<item name="sortOrder" xsi:type="string">0</item>
|
||||
</item>
|
||||
</argument>
|
||||
</arguments>
|
||||
</type>
|
||||
</config>
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
|
||||
<router id="standard">
|
||||
<route id="quickorder" frontName="quickorder">
|
||||
<module name="Magezon_QuickOrder"/>
|
||||
</route>
|
||||
</router>
|
||||
</config>
|
||||
+20
@@ -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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Customer:etc/sections.xsd">
|
||||
<action name="quickorder/index/addtoquote">
|
||||
<section name="cart"/>
|
||||
</action>
|
||||
</config>
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magezon_QuickOrder" setup_version="1.0.4">
|
||||
<sequence>
|
||||
<module name="Magento_Checkout"/>
|
||||
</sequence>
|
||||
</module>
|
||||
</config>
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd">
|
||||
<media>
|
||||
<images module="Magento_Catalog">
|
||||
<image id="quickorder_popup_image" type="image">
|
||||
<width>560</width>
|
||||
<height>700</height>
|
||||
</image>
|
||||
</images>
|
||||
</media>
|
||||
</view>
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
|
||||
<widget id="quickorder_form" class="Magezon\QuickOrder\Block\Form">
|
||||
<label translate="true">Magezon Quick Order Form</label>
|
||||
<description translate="true"></description>
|
||||
</widget>
|
||||
</widgets>
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
"Product %1 does not exist. Please remove and add it again.","Product %1 does not exist. Please remove and add it again."
|
||||
"Something went wrong while processing the request.","Something went wrong while processing the request."
|
||||
"Something went wrong when adding %1 to cart. Please check it again.","Something went wrong when adding %1 to cart. Please check it again."
|
||||
"An error occurred while processing your request. Please try again later.","An error occurred while processing your request. Please try again later."
|
||||
"Add to Cart","Add to Cart"
|
||||
Cancel,Cancel
|
||||
Select,Select
|
||||
Search,Search
|
||||
Item,Item
|
||||
Price,Price
|
||||
Qty,Qty
|
||||
Subtotal,Subtotal
|
||||
Action,Action
|
||||
SKU#:,SKU#:
|
||||
Type:,Type:
|
||||
Edit,Edit
|
||||
"Add from file","Add from file"
|
||||
"Choose File","Choose File"
|
||||
"Download Sample Csv","Download Sample Csv"
|
||||
"Enter SKU or Product Name","Enter SKU or Product Name"
|
||||
"Add Line","Add Line"
|
||||
"Total value:","Total value:"
|
||||
"Empty List","Empty List"
|
||||
"Are you sure you would like to empty this list?","Are you sure you would like to empty this list?"
|
||||
"Enter Multiple SKUs","Enter Multiple SKUs"
|
||||
"Use commas or paragraph to seperate SKUs.","Use commas or paragraph to seperate SKUs."
|
||||
"Add to List","Add to List"
|
||||
"File must be in .csv format and include ""SKU"" and ""QTY"" columns","File must be in .csv format and include ""SKU"" and ""QTY"" columns"
|
||||
"File was imported sucessfully","File was imported sucessfully"
|
||||
"Please specify product option(s).","Please specify product option(s)."
|
||||
"Quick Order","Quick Order"
|
||||
"General Settings","General Settings"
|
||||
"Current Version","Current Version"
|
||||
"Enable Quick Order","Enable Quick Order"
|
||||
Route,Route
|
||||
https://domain.com/<strong>quick-order</strong>,https://domain.com/<strong>quick-order</strong>
|
||||
"Enable Add Multiple SKUs","Enable Add Multiple SKUs"
|
||||
"Enable Upload File","Enable Upload File"
|
||||
Title,Title
|
||||
"Show in Top Links","Show in Top Links"
|
||||
"Head Background Color","Head Background Color"
|
||||
"Head Color","Head Color"
|
||||
"Button Color","Button Color"
|
||||
"Spinner Color","Spinner Color"
|
||||
"Link Color","Link Color"
|
||||
"Allow Customer Groups","Allow Customer Groups"
|
||||
"Autocomplete minimum characters","Autocomplete minimum characters"
|
||||
"The minimum number of characters a user must type before a search is performed.","The minimum number of characters a user must type before a search is performed."
|
||||
"Show Image","Show Image"
|
||||
"Show Sku","Show Sku"
|
||||
"Show Price","Show Price"
|
||||
"Magezon Quick Order Form","Magezon Quick Order Form"
|
||||
|
Executable
+19
@@ -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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
\Magento\Framework\Component\ComponentRegistrar::register(
|
||||
\Magento\Framework\Component\ComponentRegistrar::MODULE,
|
||||
'Magezon_QuickOrder',
|
||||
__DIR__
|
||||
);
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://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/swatches.css"/>
|
||||
<css src="Magezon_Core::css/magnific-popup.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<referenceBlock name="header.links">
|
||||
<block class="Magezon\QuickOrder\Block\Link" name="quickorder.top.link" ifconfig="quickorder/general/enabled"/>
|
||||
</referenceBlock>
|
||||
</body>
|
||||
</page>
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<referenceContainer name="content">
|
||||
<block class="Magezon\QuickOrder\Block\Form" name="quickorder_form"/>
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<page layout="empty" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<block class="Magezon\QuickOrder\Block\Product" name="ajax.product.info" template="Magezon_QuickOrder::product.phtml"/>
|
||||
<move element="product.info.main" destination="ajax.product.info" as="product_info_main"/>
|
||||
<referenceContainer name="product.info.social" remove="true"/>
|
||||
<referenceBlock name="product.info.review" remove="true"/>
|
||||
<referenceBlock name="product.info.overview" remove="true"/>
|
||||
<referenceBlock name="product.info.addtocart.instantPurchase" remove="true"/>
|
||||
<referenceBlock name="product.info.addtocart.instantPurchase.additional" remove="true"/>
|
||||
<referenceBlock name="product.info.addtocart" remove="true"/>
|
||||
<referenceBlock name="product.info.addtocart.additional" remove="true"/>
|
||||
<block class="Magento\Framework\View\Element\Template" name="ajax.product.bottom"/>
|
||||
</body>
|
||||
</page>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<referenceBlock name="product.info.bundle.options.top" remove="true"/>
|
||||
<referenceBlock name="customize.button" remove="true"/>
|
||||
<move element="bundle.options.container" destination="ajax.product.bottom" before="-" />
|
||||
<referenceBlock name="product.info.addtocart.bundle" remove="true"/>
|
||||
</body>
|
||||
</page>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://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_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<referenceBlock name="product.info.downloadable.samples" remove="true"/>
|
||||
<move element="product.info" destination="product.info.main" after="alert.urls"/>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,9 @@
|
||||
var config = {
|
||||
config: {
|
||||
mixins: {
|
||||
'Magento_Swatches/js/swatch-renderer': {
|
||||
'Magezon_QuickOrder/js/swatch-renderer': true
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
$coreHelper = $this->helper('\Magezon\Core\Helper\Data');
|
||||
$dataHelper = $this->helper('\Magezon\QuickOrder\Helper\Data');
|
||||
$enableMultiskus = $dataHelper->getConfig('general/enable_multiskus');
|
||||
$enableUpload = $dataHelper->getConfig('general/enable_upload');
|
||||
$headBackgroundColor = $dataHelper->getConfig('general/head_background_color');
|
||||
$headColor = $dataHelper->getConfig('general/head_color');
|
||||
$btnColor = $dataHelper->getConfig('general/button_color');
|
||||
$spinnerColor = $dataHelper->getConfig('general/spinner_color');
|
||||
$linkColor = $dataHelper->getConfig('general/link_color');
|
||||
$minLength = $dataHelper->getConfig('search/min_length');
|
||||
$searchImage = $dataHelper->getConfig('search/show_image');
|
||||
$searchSku = $dataHelper->getConfig('search/show_sku');
|
||||
$searchPrice = $dataHelper->getConfig('search/show_price');
|
||||
$storageKey = $block->hasData('storageKey') ? $block->getData('storageKey') : 'quickorderItems';
|
||||
$loadProductsUrl = $block->hasData('loadProductsUrl') ? $block->getData('loadProductsUrl') : $block->getUrl('quickorder/index/loadproducts');
|
||||
$loadProductsUrl = $block->hasData('loadProductsUrl') ? $block->getData('loadProductsUrl') : $block->getUrl('quickorder/index/loadproducts');
|
||||
$loadItemInfoUrl = $block->hasData('loadItemInfoUrl') ? $block->getData('loadItemInfoUrl') : $block->getUrl('quickorder/index/item');
|
||||
$actionUrl = $block->hasData('actionUrl') ? $block->getUrl($block->getData('actionUrl')) : $block->getUrl('quickorder/index/addtocart');
|
||||
$showImage = $block->hasData('showImage') ? $block->getData('showImage') : true;
|
||||
$showPrice = $block->hasData('showPrice') ? $block->getData('showPrice') : true;
|
||||
$showQty = $block->hasData('showQty') ? $block->getData('showQty') : true;
|
||||
$showSubTotal = $block->hasData('showSubTotal') ? $block->getData('showSubTotal') : true;
|
||||
$showAction = $block->hasData('showAction') ? $block->getData('showAction') : true;
|
||||
$showGrandTotal = $block->hasData('showGrandTotal') ? $block->getData('showGrandTotal') : true;
|
||||
$showSku = $block->hasData('showSku') ? $block->getData('showSku') : true;
|
||||
$showEmptyBtn = $block->hasData('showEmptyBtn') ? $block->getData('showEmptyBtn') : true;
|
||||
$showQty = $block->hasData('showQty') ? $block->getData('showQty') : true;
|
||||
$submitBtnLabel = $block->hasData('submitBtnLabel') ? $block->getData('submitBtnLabel') : __('Add to Cart');
|
||||
$mode = $block->hasData('mode') ? $block->getData('mode') : 'quickorder';
|
||||
|
||||
/* @var $block \Magezon\QuickOrder\Block\Form */
|
||||
?>
|
||||
<div class="quickorder-form" data-bind="scope: 'quickorder'">
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
</div>
|
||||
<div id="quickorder-popup" class="white-popup mfp-with-anim mfp-hide" data-effect="mfp-zoom-in">
|
||||
<div class="quickorder-popup-wrapper">
|
||||
<div class="quickorder-popup-content"></div>
|
||||
</div>
|
||||
<div class="quickorder-popup-loader">
|
||||
<div class="quickorder-popup-loader-bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
<?php if ($spinnerColor) { ?>
|
||||
#quickorder-popup .quickorder-popup-loader .quickorder-popup-loader-bar {
|
||||
background: <?= $spinnerColor ?>;
|
||||
}
|
||||
.quickorder-spinner i {
|
||||
border-color: <?= $spinnerColor ?>;
|
||||
border-top-color: transparent;
|
||||
}
|
||||
<?php } ?>
|
||||
<?php if ($headBackgroundColor) { ?>
|
||||
.mgz-quickorder thead tr th.col {
|
||||
background: <?= $headBackgroundColor ?>;
|
||||
}
|
||||
<?php } ?>
|
||||
<?php if ($headColor) { ?>
|
||||
.mgz-quickorder thead tr th.col {
|
||||
color: <?= $headColor ?>;
|
||||
}
|
||||
<?php } ?>
|
||||
<?php if ($btnColor) { ?>
|
||||
#quickorder-popup .action.action-select:hover {
|
||||
opacity: .8;
|
||||
}
|
||||
#quickorder-popup .action.action-select,
|
||||
.mgz-quickorder .quickorder-btn {
|
||||
background: <?= $btnColor ?>;
|
||||
border-color: <?= $btnColor ?>;
|
||||
}
|
||||
<?php } ?>
|
||||
<?php if ($linkColor) { ?>
|
||||
#quickorder-popup .action-cancel,
|
||||
.mgz-quickorder a {
|
||||
color: <?= $linkColor ?>;
|
||||
}
|
||||
<?php } ?>
|
||||
</style>
|
||||
<script type="text/x-magento-init">
|
||||
{
|
||||
"*": {
|
||||
"Magento_Ui/js/core/app": {
|
||||
"components": {
|
||||
"quickorder": {
|
||||
"component": "Magezon_QuickOrder/js/editor",
|
||||
"storageKey": "<?= $storageKey ?>",
|
||||
"enableMultiskus": <?= $enableMultiskus ? 'true' : 'false' ?>,
|
||||
"enableUpload": <?= $enableUpload ? 'true' : 'false' ?>,
|
||||
"ajaxUrl": "<?= $loadProductsUrl ?>",
|
||||
"loadChildrensUrl": "<?= $block->getUrl('quickorder/index/loadChildrens') ?>",
|
||||
"excelUploadUrl": "<?= $block->getUrl('quickorder/index/batchimport') ?>",
|
||||
"formKey": "<?= $block->getFormKey() ?>",
|
||||
"priceFormat": <?= $coreHelper->serialize($block->getPriceFormat()) ?>,
|
||||
"loadItemInfoUrl": "<?= $loadItemInfoUrl ?>",
|
||||
"minLength": "<?= $minLength ? $minLength : 0 ?>",
|
||||
"actionUrl": "<?= $actionUrl ?>",
|
||||
"showImage": <?= $showImage ? 'true' : 'false' ?>,
|
||||
"showPrice": <?= $showPrice ? 'true' : 'false' ?>,
|
||||
"showQty": <?= $showQty ? 'true' : 'false' ?>,
|
||||
"showSubTotal": <?= $showSubTotal ? 'true' : 'false' ?>,
|
||||
"showAction": <?= $showAction ? 'true' : 'false' ?>,
|
||||
"showGrandTotal": <?= $showGrandTotal ? 'true' : 'false' ?>,
|
||||
"showSku": <?= $showSku ? 'true' : 'false' ?>,
|
||||
"showEmptyBtn": <?= $showEmptyBtn ? 'true' : 'false' ?>,
|
||||
"instantSearch": false,
|
||||
"search": {
|
||||
"showImage": <?= $searchImage ? 'true' : 'false' ?>,
|
||||
"showSku": <?= $searchSku ? 'true' : 'false' ?>,
|
||||
"showPrice": <?= $searchPrice ? 'true' : 'false' ?>
|
||||
},
|
||||
"submitBtnLabel": "<?= $submitBtnLabel ?>",
|
||||
"mode": "<?= $mode ?>",
|
||||
"downloadSampleLink": "<?= $block->getViewFileUrl('Magezon_QuickOrder/css/quickorder_import.xlsx') ?>"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
$imageHelper = $this->helper('\Magezon\Core\Helper\Image');
|
||||
$product = $block->getProduct();
|
||||
$bottomHtml = $block->getLayout()->getBlock('ajax.product.bottom')->getChildHtml();
|
||||
?>
|
||||
<div class="ajaxcart-content">
|
||||
<div class="ajaxcart-content_left">
|
||||
<?= $block->getImage($product, 'quickorder_popup_image')->toHtml() ?>
|
||||
</div>
|
||||
<div class="ajaxcart-content_right">
|
||||
<?= $block->getChildHtml('product_info_main') ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($bottomHtml) { ?>
|
||||
<div class="ajaxcart-bottom"><?= $bottomHtml ?></div>
|
||||
<?php } ?>
|
||||
<div class="ajaxcart-footer">
|
||||
<a href="#" class="action-cancel"><?= __('Cancel') ?></a>
|
||||
<button class="action primary action-select"><?= __('Select') ?></button>
|
||||
</div>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$helper = $this->helper('\Magento\Catalog\Helper\Product\Configuration');
|
||||
?>
|
||||
<?php if ($_options = $block->getOptionList()):?>
|
||||
<dl class="item-options">
|
||||
<?php foreach ($_options as $_option) : ?>
|
||||
<?php $_formatedOptionValue = $helper->getFormattedOptionValue($_option) ?>
|
||||
<dt><?= $block->escapeHtml($_option['label']) ?></dt>
|
||||
<dd>
|
||||
<?php if (isset($_formatedOptionValue['full_view'])): ?>
|
||||
<?= $_formatedOptionValue['full_view'] ?>
|
||||
<?php else: ?>
|
||||
<?= $_formatedOptionValue['value'] ?>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<?php endforeach; ?>
|
||||
</dl>
|
||||
<?php endif;?>
|
||||
@@ -0,0 +1 @@
|
||||
Sku,Qty,Product Name,Lab ID,CD No.,Quote No.,Discount,Item Remark,Order Remark
|
||||
|
Binary file not shown.
@@ -0,0 +1,682 @@
|
||||
@quickorder-color: #ff9900;
|
||||
|
||||
@keyframes qoloader{
|
||||
0% {
|
||||
background-position:0 0
|
||||
} to {
|
||||
background-position:50px 50px
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes qospin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.quickorder-loading {
|
||||
width: 500px;
|
||||
height: 200px;
|
||||
|
||||
.quickorder-popup-wrapper {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.quickorder-spinner {
|
||||
display: inline-block;
|
||||
|
||||
i {
|
||||
width: 1.3rem;
|
||||
height: 1.3rem;
|
||||
display: block;
|
||||
border: 3px solid @quickorder-color;
|
||||
border-top-color: transparent;
|
||||
border-radius: 50%;
|
||||
animation: qospin 1.1s infinite linear;
|
||||
margin-top: 7px;
|
||||
|
||||
span {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mgz-quickorder {
|
||||
|
||||
.quickquote-message-success {
|
||||
font-weight: 600;
|
||||
color: green;
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.quickquote-message-error {
|
||||
font-weight: 600;
|
||||
color: #e22626;
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
thead {
|
||||
tr {
|
||||
th.col {
|
||||
background: @quickorder-color;
|
||||
padding: 10px;
|
||||
color: #FFF;
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.col {
|
||||
&.qty,
|
||||
&.price,
|
||||
&.subtotal {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
&.search {
|
||||
width: 225px;
|
||||
}
|
||||
|
||||
&.action {
|
||||
text-align: center;
|
||||
|
||||
a {
|
||||
padding: 0px 7px 2px 7px;
|
||||
|
||||
&.action-duplicate {
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.product-item-sku {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.product-item-photo {
|
||||
display: table-cell;
|
||||
max-width: 100%;
|
||||
padding-right: 20px;
|
||||
position: static;
|
||||
vertical-align: top;
|
||||
width: 1%;
|
||||
|
||||
.product-image-container {
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
.product-item-details {
|
||||
display: table-cell;
|
||||
vertical-align: top;
|
||||
white-space: normal;
|
||||
width: 99%;
|
||||
}
|
||||
|
||||
.product-item-name {
|
||||
font-size: 1.8rem;
|
||||
display: block;
|
||||
margin: -3px 0 5px;
|
||||
}
|
||||
|
||||
.item-options {
|
||||
margin: 0;
|
||||
|
||||
dd, dt {
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
dt {
|
||||
clear: left;
|
||||
float: left;
|
||||
margin: 0 10px 0 0;
|
||||
|
||||
&:after {
|
||||
content: ': ';
|
||||
}
|
||||
}
|
||||
|
||||
dd:last-child {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.col.price .price,
|
||||
.col.subtotal .price {
|
||||
font-weight: 700;
|
||||
font-size: 1.8rem;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.col.qty .input-text {
|
||||
height: 36px;
|
||||
margin-top: -7px;
|
||||
text-align: center;
|
||||
width: 55px;
|
||||
}
|
||||
|
||||
.item-options-wrapper {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
tbody .col {
|
||||
padding: 20px 8px 20px 0;
|
||||
background: #FFF;
|
||||
}
|
||||
|
||||
.product-image-wrapper {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.mgz-quickorder-action {
|
||||
margin-top: 15px;
|
||||
padding: 20px 15px;
|
||||
background: #F5F5F5;
|
||||
overflow: hidden;
|
||||
|
||||
.quickorder-btn {
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.quickorder-btn {
|
||||
background: @quickorder-color;
|
||||
color: #FFF;
|
||||
border: 0;
|
||||
font-size: 1.4rem;
|
||||
font-weight: 400;
|
||||
padding: 10px 15px;
|
||||
height: auto;
|
||||
|
||||
&:hover {
|
||||
opacity: .8;
|
||||
}
|
||||
}
|
||||
|
||||
.quickorder-grand-total {
|
||||
font-size: 1.4em;
|
||||
float: right;
|
||||
|
||||
span:last-child {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.mgz-quickorder-search {
|
||||
position: relative;
|
||||
|
||||
.quickorder-spinner {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 5px;
|
||||
|
||||
i {
|
||||
width: 1.3rem;
|
||||
height: 1.3rem
|
||||
}
|
||||
}
|
||||
|
||||
.mgz-quickorder-ui-wrapper {
|
||||
box-shadow: 0 0 4px rgba(0,0,0,.14), 0 4px 8px rgba(0,0,0,.28);
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
background: #ffffff;
|
||||
|
||||
.ui-autocomplete {
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
border: 1px solid #c2c2c2;
|
||||
border-top: 0;
|
||||
float: left;
|
||||
max-height: 500px;
|
||||
overflow: scroll;
|
||||
margin: 0;
|
||||
width: 300px !important;
|
||||
|
||||
li {
|
||||
cursor: pointer;
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
white-space: normal;
|
||||
float: left;
|
||||
width: 100%;
|
||||
|
||||
&.selected,
|
||||
&:hover {
|
||||
background: #F0F0F0;
|
||||
}
|
||||
|
||||
.ui-state-active,
|
||||
.ui-widget-content .ui-state-active,
|
||||
.ui-widget-header .ui-state-active,
|
||||
a.ui-button:active,
|
||||
.ui-button:active,
|
||||
.ui-button.ui-state-active:hover {
|
||||
background: #F0F0F0;
|
||||
}
|
||||
|
||||
.mgz-quickorder-item_left {
|
||||
float: left;
|
||||
margin-right: 15px;
|
||||
max-width: 50px;
|
||||
}
|
||||
|
||||
.mgz-quickorder-item_right {
|
||||
.mgz-quickorder-item_title {
|
||||
font-size: 1.6rem;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.mgz-quickorder-item {
|
||||
display: flex;
|
||||
padding: 5px 10px 5px 10px;
|
||||
}
|
||||
|
||||
|
||||
img {
|
||||
.sidebar & {
|
||||
max-width: 60px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.quickorder-action-edit {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.mgz-quicorder-multiskus, .mgz-quicorder-file {
|
||||
margin-top: 30px;
|
||||
|
||||
input[type=number] {
|
||||
width: 55px;
|
||||
}
|
||||
.fieldset > .field:not(.choice) > .label{
|
||||
float: none;
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
.fieldset > .field:not(.choice) > .control{
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.mgz-quicorder-file {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.file-uploader-button {
|
||||
padding: 0.6rem 1em 0.6rem;
|
||||
background: #e3e3e3;
|
||||
border: 1px solid #adadad;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
|
||||
&:hover {
|
||||
opacity: .8;
|
||||
}
|
||||
}
|
||||
|
||||
#quickorder-file {
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
width: 0;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
#quickorder-popup {
|
||||
position: relative;
|
||||
margin: 0 auto;
|
||||
background: #fff;
|
||||
overflow-x: scroll;
|
||||
border-radius: 2px;
|
||||
max-width: 640px;
|
||||
padding: 30px;
|
||||
min-height: 250px;
|
||||
|
||||
.quickorder-popup-loader {
|
||||
display: none;
|
||||
-webkit-align-items: center;
|
||||
-ms-align-items: center;
|
||||
align-items: center;
|
||||
height: 260px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
left: 0;
|
||||
|
||||
.quickorder-popup-loader-bar {
|
||||
margin: auto;
|
||||
max-width: 300px;
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
border-radius: 10px;
|
||||
box-shadow: inset 0 2px 9px rgba(255,255,255,0.3), inset 0 -2px 6px rgba(0,0,0,0.4);
|
||||
background: #ff9900;
|
||||
|
||||
&:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-image: -webkit-linear-gradient(135deg, rgba(255,255,255,0.2) 25%, transparent 0, transparent 50%, rgba(255,255,255,0.2) 0, rgba(255,255,255,0.2) 75%, transparent 0, transparent);
|
||||
background-image: linear-gradient(-45deg, rgba(255,255,255,0.2) 25%, transparent 0, transparent 50%, rgba(255,255,255,0.2) 0, rgba(255,255,255,0.2) 75%, transparent 0, transparent);
|
||||
background-size: 50px 50px;
|
||||
content: "";
|
||||
-webkit-animation: qoloader 2s linear infinite;
|
||||
animation: qoloader 2s linear infinite;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.quickorder-loading {
|
||||
.quickorder-popup-loader {
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 32px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.ajaxcart-content {
|
||||
width: 100%;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
|
||||
.ajaxcart-content_left {
|
||||
float: left;
|
||||
width: 260px;
|
||||
-webkit-box-flex: 0;
|
||||
-webkit-flex: 0 0 auto;
|
||||
-ms-flex: 0 0 auto;
|
||||
flex: 0 0 auto;
|
||||
margin-right: 20px;
|
||||
|
||||
.ajaxcart-product_image {
|
||||
text-align: center;
|
||||
|
||||
.product.media {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.ajaxcart-product_review {
|
||||
text-align: center;
|
||||
|
||||
.product-reviews-summary {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ajaxcart-content_right {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1 1 auto;
|
||||
-ms-flex: 1 1 auto;
|
||||
flex: 1 1 auto;
|
||||
-webkit-align-self: center;
|
||||
-ms-flex-item-align: center;
|
||||
align-self: center;
|
||||
|
||||
.page-title-wrapper{
|
||||
margin-top: 0;
|
||||
}
|
||||
.ajaxcart-cart-info {
|
||||
text-align: center;
|
||||
|
||||
.ajaxcart-cart-subtotal {
|
||||
font-size: 18px;
|
||||
|
||||
.price {
|
||||
display: block;
|
||||
width: 100%;
|
||||
font-size: 28px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.box-tocart .action.tocart {
|
||||
margin-top: 20px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.product-info-price .price-box {
|
||||
width: auto;
|
||||
|
||||
.price-container .price {
|
||||
font-size: 24px;
|
||||
line-height: 24px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.ajaxcart-content_right {
|
||||
.ajaxcart-product_title {
|
||||
margin-top: 0;
|
||||
font-size: 3rem;
|
||||
}
|
||||
|
||||
.product-info-main {
|
||||
width: 100%;
|
||||
|
||||
.product-add-form {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.product-options-bottom .box-tocart {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.product-info-price {
|
||||
border-bottom-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.field.qty {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
div:focus {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.product-info-price .price-box .old-price .price-container {
|
||||
.price-label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.price {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ajaxcart-bottom {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.ajaxcart-footer {
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
margin-top: 30px;
|
||||
|
||||
.action-cancel {
|
||||
width: 260px;
|
||||
-webkit-box-flex: 0;
|
||||
-webkit-flex: 0 0 auto;
|
||||
-ms-flex: 0 0 auto;
|
||||
flex: 0 0 auto;
|
||||
margin-right: 20px;
|
||||
font-size: 18px;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.action {
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
padding: 0;
|
||||
width: 50%;
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
|
||||
&.action-select {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1 1 auto;
|
||||
-ms-flex: 1 1 auto;
|
||||
flex: 1 1 auto;
|
||||
-webkit-align-self: center;
|
||||
-ms-flex-item-align: center;
|
||||
align-self: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bundle-options-container {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
|
||||
.product-options-wrapper {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.block-bundle-summary .box-tocart .checkout-btn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.legend.title {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.block-bundle-summary {
|
||||
margin-top: 0;
|
||||
|
||||
> .title {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.product-add-form {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Mobile
|
||||
// _____________________________________________
|
||||
|
||||
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
|
||||
.mgz-quickorder {
|
||||
thead {
|
||||
display: none;
|
||||
}
|
||||
|
||||
tbody {
|
||||
.col {
|
||||
display: block;
|
||||
|
||||
&.search,
|
||||
&.item {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&.col.price,
|
||||
&.col.qty,
|
||||
&.col.subtotal {
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
float: left;
|
||||
white-space: nowrap;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
&.col.action {
|
||||
float: left;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
tr {
|
||||
border-top: 1px solid #cccccc;
|
||||
}
|
||||
}
|
||||
|
||||
.col.action a {
|
||||
padding: 4px 10px 4px 10px;
|
||||
}
|
||||
|
||||
.mgz-quickorder-action button {
|
||||
width: 100%;
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
#quickorder-popup {
|
||||
.ajaxcart-content_left {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ajaxcart-footer {
|
||||
display: block;
|
||||
|
||||
.action-cancel,
|
||||
.action-select {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
&.quickorder-loading {
|
||||
padding: 0;
|
||||
min-height: 250px;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
+560
@@ -0,0 +1,560 @@
|
||||
define([
|
||||
'jquery',
|
||||
'ko',
|
||||
'underscore',
|
||||
'uiComponent',
|
||||
'Magezon_QuickOrder/js/model/item',
|
||||
'Magento_Catalog/js/price-utils',
|
||||
'mage/translate',
|
||||
'Magento_Ui/js/modal/confirm',
|
||||
'Magento_Ui/js/modal/alert',
|
||||
'mage/url',
|
||||
'Magento_Catalog/product/view/validation',
|
||||
'Magezon_QuickOrder/js/knockout.files',
|
||||
'Magezon_Core/js/jquery.magnific-popup.min'
|
||||
], function ($, ko, _, Component, Item, priceUtils, $t, confirm, malert, url) {
|
||||
'use strict';
|
||||
|
||||
return Component.extend({
|
||||
|
||||
defaults: {
|
||||
items: [],
|
||||
mode: 'quickorder',
|
||||
template: 'Magezon_QuickOrder/editor',
|
||||
popupSelector: '#quickorder-popup',
|
||||
popupMainClass: 'quickorder-popup',
|
||||
enableMultiskus: true,
|
||||
enableUpload: true,
|
||||
showImage: true,
|
||||
showPrice: true,
|
||||
showQty: true,
|
||||
showSubTotal: true,
|
||||
showAction: true,
|
||||
showGrandTotal: true,
|
||||
showSku: true,
|
||||
searchPlaceholder: $t('Enter SKU or Product Name'),
|
||||
addBtnLabel: $t('Add Line'),
|
||||
submitBtnLabel: $t('Add to Cart'),
|
||||
grandTotalLabel: $t('Total value:'),
|
||||
emptyBtnLabel: $t('Empty List'),
|
||||
showEmptyBtn: true,
|
||||
confirmMessage: $t('Are you sure you would like to empty this list?'),
|
||||
multiSkusLabel: $t('Enter Multiple SKUs'),
|
||||
multiSkusDescription: $t('Use commas or paragraph to seperate SKUs.'),
|
||||
addToListBtnLabel: $t('Add to List'),
|
||||
fileRule: $t('File must be in .csv format and include \"SKU\" and \"QTY\" columns'),
|
||||
fileSuccessMessage: $t('File was imported sucessfully'),
|
||||
fileLoading: false,
|
||||
submitLoading: false,
|
||||
loadingproduct: false,
|
||||
storageKey: 'quickorderItems',
|
||||
instantSearch: true,
|
||||
qty: 1,
|
||||
|
||||
listens: {
|
||||
loadingproduct: 'loadingProductSpinner'
|
||||
}
|
||||
},
|
||||
|
||||
cache: [],
|
||||
|
||||
initialize: function () {
|
||||
this._super();
|
||||
|
||||
_.bindAll(this,
|
||||
'removeItem',
|
||||
'duplicateItem',
|
||||
'openPopup',
|
||||
'onLoadedFile',
|
||||
'onProgressFile',
|
||||
'onErrorFile'
|
||||
);
|
||||
|
||||
var self = this;
|
||||
|
||||
if (this.instantSearch) {
|
||||
self.loadProducts();
|
||||
}
|
||||
|
||||
$(self.popupSelector).on('click', '.action-cancel', function(e) {
|
||||
e.preventDefault();
|
||||
$.magnificPopup.close();
|
||||
});
|
||||
|
||||
$(self.popupSelector).on('click', '.action-select', function(e) {
|
||||
e.preventDefault();
|
||||
if (self.currentItem) {
|
||||
var form = $('#product_addtocart_form');
|
||||
if(form.valid()) {
|
||||
var data = form.serialize();
|
||||
var startDate = $(self.popupSelector).find('#zonrentals-from').val();
|
||||
var endDate = $(self.popupSelector).find('#zonrentals-to').val();
|
||||
if (startDate && endDate) {
|
||||
data += '&rental=1';
|
||||
}
|
||||
|
||||
self.currentItem.options(data);
|
||||
self.loadItemInfo(self.currentItem);
|
||||
$.magnificPopup.close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
self.grandTotal = ko.pureComputed(function() {
|
||||
var total = 0;
|
||||
$.each(self.items(), function() {
|
||||
total += this.subtotal();
|
||||
});
|
||||
self.saveItemsToLocalStorage();
|
||||
return total;
|
||||
});
|
||||
|
||||
_.each(this.getItemsFromLocalStorage(), function(item) {
|
||||
this.addItem(item);
|
||||
}, this);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
initObservable: function () {
|
||||
this._super()
|
||||
.observe('grandTotal skus qty fileLoading submitLoading fileMessage loadingproduct')
|
||||
.observe({
|
||||
items: [],
|
||||
products: []
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
submitItems: function (elem, event) {
|
||||
this.submitLoading(true);
|
||||
var items = [];
|
||||
_.each(this.items(), function(item) {
|
||||
if (item.isValid()) {
|
||||
var row = {
|
||||
product: item.product().value,
|
||||
options: item.options(),
|
||||
qty: item.qty(),
|
||||
others: item.others(),
|
||||
quote_type: item.quoteType(),
|
||||
name: item.product().name
|
||||
}
|
||||
items.push(row);
|
||||
}
|
||||
});
|
||||
if (items.length) {
|
||||
var self = this;
|
||||
$.ajax({
|
||||
url: self.actionUrl,
|
||||
data: {items: items, mode: self.mode},
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.message) {
|
||||
alert(res.message);
|
||||
}
|
||||
if (res.status) {
|
||||
self.clearLocalStorage();
|
||||
}
|
||||
if (res.redirectUrl) {
|
||||
window.location.href = res.redirectUrl;
|
||||
}
|
||||
self.submitLoading(false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.submitLoading(false);
|
||||
}
|
||||
},
|
||||
|
||||
loadChildrenIds: function(product) {
|
||||
var self = this;
|
||||
self.spinnerloading(true);
|
||||
$.ajax({
|
||||
url: self.loadChildrensUrl,
|
||||
data: { id: product.value, type: product.type },
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.status) {
|
||||
_.each(res.childrens, function(product) {
|
||||
var item = _.findWhere(self.products(), {id: product.id});
|
||||
if (!item) {
|
||||
self.products().push(product);
|
||||
}
|
||||
self.addItem({
|
||||
price: product.price,
|
||||
qty: 1,
|
||||
product: product
|
||||
});
|
||||
});
|
||||
self.spinnerloading(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
addChildrens: function(product, item) {
|
||||
item.spinnerloading(true);
|
||||
var self = this;
|
||||
if (!product.hasOwnProperty('childrens')) {
|
||||
$.ajax({
|
||||
url: self.loadChildrensUrl,
|
||||
data: { id: product.value, type: product.type },
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.status) {
|
||||
_.each(res.childrens, function(product) {
|
||||
var item = _.findWhere(self.products(), {id: product.id});
|
||||
if (!item) {
|
||||
self.products().push(product);
|
||||
}
|
||||
self.addItem({
|
||||
price: product.price,
|
||||
qty: 1,
|
||||
product: product
|
||||
});
|
||||
});
|
||||
product.childrens = res.childrens;
|
||||
self.removeItem(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
_.each(product.childrens, function(product) {
|
||||
var item = _.findWhere(self.products(), {id: product.id});
|
||||
if (!item) {
|
||||
self.products().push(product);
|
||||
}
|
||||
self.addItem({
|
||||
price: product.price,
|
||||
qty: 1,
|
||||
product: product
|
||||
});
|
||||
});
|
||||
self.removeItem(item);
|
||||
}
|
||||
},
|
||||
|
||||
addItem: function (data) {
|
||||
if (data.qty==0) {
|
||||
return;
|
||||
}
|
||||
if (!data) {
|
||||
data = {};
|
||||
}
|
||||
data = ko.toJS(data);
|
||||
data['parent'] = this;
|
||||
var item = new Item(data);
|
||||
this.items.push(item);
|
||||
},
|
||||
|
||||
removeItem: function (item) {
|
||||
this.items.remove(item);
|
||||
},
|
||||
|
||||
duplicateItem: function (item) {
|
||||
var data = item.getData();
|
||||
data['parent'] = this;
|
||||
this.items.push(new Item(data));
|
||||
},
|
||||
|
||||
loadProducts: function() {
|
||||
if (!this.productLoaded) {
|
||||
var self = this;
|
||||
self.loadingproduct(true);
|
||||
$.ajax({
|
||||
url: self.ajaxUrl,
|
||||
data: {mode: self.mode},
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.message) alert(res.message);
|
||||
self.products(res.products);
|
||||
self.loadingproduct(false);
|
||||
}
|
||||
});
|
||||
self.productLoaded = true;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* FormatPrice
|
||||
*/
|
||||
getFormattedPrice: function (price) {
|
||||
return priceUtils.formatPrice(price, this.priceFormat);
|
||||
},
|
||||
|
||||
openPopup: function(item) {
|
||||
var self = this;
|
||||
|
||||
if (!this.cache[item.product().value]) {
|
||||
$.ajax({
|
||||
url: item.product().url + '?options=cart',
|
||||
data: {product: item.product().value, mgz_qo: 1,mode: self.mode},
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
beforeSend: function () {
|
||||
$(self.popupSelector + ' .quickorder-popup-content').html('');
|
||||
$(self.popupSelector).addClass('quickorder-loading');
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.message) alert(res.message);
|
||||
if (res.html) {
|
||||
$(self.popupSelector + ' .quickorder-popup-content').html(res.html);
|
||||
$(self.popupSelector + ' .quickorder-popup-content').trigger('contentUpdated');
|
||||
$(self.popupSelector + ' #product_addtocart_form').validation();
|
||||
$(self.popupSelector).removeClass('quickorder-loading');
|
||||
setTimeout(function() {
|
||||
self.editOptions(item.options());
|
||||
}, 200);
|
||||
self.cache[item.product().value] = res.html;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var html = self.cache[item.product().value];
|
||||
$(self.popupSelector).addClass('quickorder-loading');
|
||||
$(self.popupSelector + ' .quickorder-popup-content').html(html);
|
||||
$(self.popupSelector + ' .quickorder-popup-content').trigger('contentUpdated');
|
||||
$(self.popupSelector + ' #product_addtocart_form').validation();
|
||||
setTimeout(function() {
|
||||
self.editOptions(item.options());
|
||||
setTimeout(function() {
|
||||
$(self.popupSelector).removeClass('quickorder-loading');
|
||||
}, 300);
|
||||
}, 200);
|
||||
}
|
||||
|
||||
$.magnificPopup.open({
|
||||
items: {
|
||||
src: self.popupSelector
|
||||
},
|
||||
type: 'inline',
|
||||
removalDelay: 300,
|
||||
mainClass: self.popupMainClass,
|
||||
fixedContentPos: true,
|
||||
fixedBgPos: true,
|
||||
overflowY: 'auto',
|
||||
showCloseBtn: false,
|
||||
callbacks: {
|
||||
beforeOpen: function() {
|
||||
$('body').addClass('quickorder-popup');
|
||||
this.st.mainClass = $(self.popupSelector).attr('data-effect');
|
||||
},
|
||||
beforeClose: function() {
|
||||
this.st.mainClass = '';
|
||||
$(self.popupSelector).css('transition', '');
|
||||
$('body').removeClass('quickorder-popup');
|
||||
self.currentItem.checkValid();
|
||||
}
|
||||
},
|
||||
}, 0);
|
||||
this.currentItem = item;
|
||||
},
|
||||
|
||||
loadItemInfo: function(item) {
|
||||
var self = this;
|
||||
$.ajax({
|
||||
url: this.loadItemInfoUrl,
|
||||
data: {product: item.product().value, type: item.product().type, options: item.options(),mode: self.mode},
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.message) alert(res.message);
|
||||
if (res.status) {
|
||||
item.optionsHtml(res.options);
|
||||
item.price(res.price);
|
||||
} else {
|
||||
self.removeItem(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
parseParams: function(str) {
|
||||
var re = /([^&=]+)=?([^&]*)/g;
|
||||
var decodeRE = /\+/g;
|
||||
var decode = function (str) {return decodeURIComponent( str.replace(decodeRE, " ") );};
|
||||
var params = {}, e;
|
||||
while ( e = re.exec(str) ) {
|
||||
var k = decode( e[1] ), v = decode( e[2] );
|
||||
if (k.substring(k.length - 2) === '[]') {
|
||||
k = k.substring(0, k.length - 2);
|
||||
(params[k] || (params[k] = [])).push(v);
|
||||
}
|
||||
else params[k] = v;
|
||||
}
|
||||
return params;
|
||||
},
|
||||
|
||||
editOptions: function(options) {
|
||||
var self = this;
|
||||
var newOptions = self.parseParams(options);
|
||||
$(self.popupSelector).find('input, select, textarea').each(function(index, el) {
|
||||
var name = $(this).attr('name');
|
||||
if (newOptions[name]) {
|
||||
$(this).val(newOptions[name]);
|
||||
$(this).trigger('change');
|
||||
if ($(this).hasClass('swatch-input')) {
|
||||
var parent = $(this).parents('.swatch-attribute');
|
||||
parent.find('.swatch-option[option-id=' + newOptions[name] + ']').eq(0).trigger('click');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getItemsFromLocalStorage: function() {
|
||||
return JSON.parse(localStorage.getItem(this.storageKey));
|
||||
},
|
||||
|
||||
saveItemsToLocalStorage: function() {
|
||||
$(".ui-helper-hidden-accessible").remove();
|
||||
var items = [];
|
||||
_.each(this.items(), function(item) {
|
||||
items.push(item.getData());
|
||||
});
|
||||
return localStorage.setItem(this.storageKey, JSON.stringify(items));
|
||||
},
|
||||
|
||||
clearLocalStorage: function() {
|
||||
return localStorage.removeItem(this.storageKey);
|
||||
},
|
||||
|
||||
emptyItems: function() {
|
||||
var self = this;
|
||||
confirm({
|
||||
content: self.confirmMessage,
|
||||
actions: {
|
||||
confirm: function () {
|
||||
self.items.removeAll();
|
||||
},
|
||||
always: function (e) {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
addToList: function() {
|
||||
if (this.skus()) {
|
||||
var self = this;
|
||||
var result = [];
|
||||
var skus = self.skus().split("\n");
|
||||
for (var i = 0; i < skus.length; i++) {
|
||||
var row = skus[i];
|
||||
var skus2 = row.split(",");
|
||||
for (var x = 0; x < skus2.length; x++) {
|
||||
var sku = skus2[x].trim();
|
||||
if ($.inArray( sku, result )==-1) {
|
||||
result.push(sku);
|
||||
}
|
||||
}
|
||||
}
|
||||
var products =_.filter(self.products(), function(product) {
|
||||
return ($.inArray( product.sku, result )!=-1)
|
||||
});
|
||||
|
||||
if (self.instantSearch) {
|
||||
self._processAddToList(products);
|
||||
} else {
|
||||
$.ajax({
|
||||
url: self.ajaxUrl,
|
||||
data: { skus: result,mode: self.mode },
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.message) alert(res.message);
|
||||
self._processAddToList(res.products, skus);
|
||||
}
|
||||
});
|
||||
}
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth' // 平滑滚动效果
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_processAddToList: function(products) {
|
||||
var qty = parseInt(this.qty()) ? parseInt(this.qty()) : 1;
|
||||
_.each(products, function(product) {
|
||||
this.addItem({
|
||||
price: product.price,
|
||||
qty: qty,
|
||||
product: product
|
||||
});
|
||||
}, this);
|
||||
this.skus('');
|
||||
this.qty('');
|
||||
},
|
||||
|
||||
onLoadedFile: function(file, data) {
|
||||
|
||||
var self = this;
|
||||
|
||||
if (!file) {
|
||||
malert({"message": "请选择你要导入的excel文件"})
|
||||
return;
|
||||
}
|
||||
|
||||
let formData = new FormData();
|
||||
formData.append('file', file);
|
||||
formData.append('form_key', self.formKey);
|
||||
|
||||
$.ajax({
|
||||
url: self.excelUploadUrl,
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
showLoader: true,
|
||||
success: function (response) {
|
||||
let targetUrl = '/quick-order/';
|
||||
if (response.result) {
|
||||
targetUrl = '/checkout/cart/'
|
||||
}
|
||||
window.location.href = targetUrl;
|
||||
},
|
||||
error: function (xhr) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_processOnLoadedFile: function(products, skus, others) {
|
||||
_.each(products, function(product) {
|
||||
|
||||
this.addItem({
|
||||
price: product.price,
|
||||
others: others[product.realSku],
|
||||
options: product.options==''? null : product.options,
|
||||
qty: skus[product.realSku]==undefined? 0:skus[product.realSku]['qty'],
|
||||
product: product
|
||||
});
|
||||
}, this);
|
||||
this.fileLoading(false);
|
||||
this.fileMessage('<span class="quickquote-message-success">' + this.fileSuccessMessage + '</span>');
|
||||
},
|
||||
|
||||
onErrorFile: function(file, error) {
|
||||
this.fileLoading(false);
|
||||
this.fileMessage('<span class="quickquote-message-error">' + error + '</span>');
|
||||
},
|
||||
|
||||
onProgressFile: function(file) {
|
||||
this.fileLoading(true);
|
||||
this.fileMessage('');
|
||||
},
|
||||
|
||||
loadingProductSpinner: function(status) {
|
||||
if (status) {
|
||||
$('.page-title').append('<div class="quickorder-spinner"><i></i></div>');
|
||||
} else {
|
||||
$('.page-title').children('.quickorder-spinner').remove();
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
+2519
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,118 @@
|
||||
(function (factory) {
|
||||
// Module systems magic dance.
|
||||
|
||||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
|
||||
// CommonJS or Node: hard-coded dependency on "knockout"
|
||||
factory(require("knockout"));
|
||||
} else if (typeof define === "function" && define["amd"]) {
|
||||
// AMD anonymous module with hard-coded dependency on "knockout"
|
||||
define(["knockout"], factory);
|
||||
} else {
|
||||
// <script> tag: use the global `ko` object, attaching a `mapping` property
|
||||
factory(ko);
|
||||
}
|
||||
}
|
||||
(function (ko) {
|
||||
ko.bindingHandlers.files = {
|
||||
init: function(element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
var allBindings = allBindingsAccessor();
|
||||
var loadedCallback, progressCallback, errorCallback, hoverClass, allowDrop, fileFilter, readAs, maxFileSize;
|
||||
var filesBinding = allBindings.files;
|
||||
|
||||
if (typeof(ko.unwrap(filesBinding)) == "function")
|
||||
{ loadedCallback = ko.unwrap(filesBinding); }
|
||||
else
|
||||
{
|
||||
loadedCallback = ko.unwrap(filesBinding.onLoaded);
|
||||
progressCallback = ko.unwrap(filesBinding.onProgress);
|
||||
errorCallback = ko.unwrap(filesBinding.onError);
|
||||
allowDrop = ko.unwrap(filesBinding.allowDrop);
|
||||
hoverClass = ko.unwrap(filesBinding.hoverClass);
|
||||
fileFilter = ko.unwrap(filesBinding.fileFilter);
|
||||
maxFileSize = ko.unwrap(filesBinding.maxFileSize);
|
||||
readAs = ko.unwrap(filesBinding.readAs);
|
||||
}
|
||||
|
||||
if(typeof(loadedCallback) != "function")
|
||||
{ return; }
|
||||
|
||||
var readFile = function(file) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(fileLoadedEvent) {
|
||||
loadedCallback(file, fileLoadedEvent.target.result);
|
||||
};
|
||||
|
||||
if(typeof(progressCallback) == "function")
|
||||
{
|
||||
reader.onprogress = function(fileProgressEvent) {
|
||||
progressCallback(file, fileProgressEvent.loaded, fileProgressEvent.total);
|
||||
};
|
||||
}
|
||||
|
||||
if(typeof(errorCallback) == "function")
|
||||
{
|
||||
reader.onerror = function(fileErrorEvent) {
|
||||
errorCallback(file, fileErrorEvent.target.error);
|
||||
};
|
||||
}
|
||||
|
||||
if(readAs == "text")
|
||||
{ reader.readAsText(file); }
|
||||
else if(readAs == "array")
|
||||
{ reader.readAsArrayBuffer(file); }
|
||||
else if(readAs == "binary")
|
||||
{ reader.readAsBinaryString(file); }
|
||||
else
|
||||
{ reader.readAsDataURL(file); }
|
||||
};
|
||||
|
||||
var handleFileDrag = function(fileDragEvent) {
|
||||
fileDragEvent.stopPropagation();
|
||||
fileDragEvent.preventDefault();
|
||||
|
||||
if(fileDragEvent.type == "dragover")
|
||||
{ fileDragEvent.target.classList.add(hoverClass); }
|
||||
else
|
||||
{ fileDragEvent.target.classList.remove(hoverClass); }
|
||||
};
|
||||
|
||||
var handleDrop = function(fileDropEvent) {
|
||||
handleFileDrag(fileDropEvent);
|
||||
handleFileSelected(fileDropEvent);
|
||||
}
|
||||
|
||||
var handleFileSelected = function(fileSelectionEvent) {
|
||||
var files = fileSelectionEvent.target.files || fileSelectionEvent.dataTransfer.files;
|
||||
for (var i = 0, f; f = files[i]; i++) {
|
||||
if (typeof(fileFilter) != "undefined" && !f.type.match(fileFilter))
|
||||
{
|
||||
if(typeof(errorCallback) == "function")
|
||||
{ errorCallback(f, "File type does not match filter"); }
|
||||
continue;
|
||||
}
|
||||
|
||||
if(typeof(maxFileSize) != "undefined" && f.size >= maxFileSize)
|
||||
{
|
||||
if(typeof(errorCallback) == "function")
|
||||
{ errorCallback(f, "File exceeds file size limit"); }
|
||||
continue;
|
||||
}
|
||||
|
||||
readFile(f);
|
||||
}
|
||||
};
|
||||
|
||||
if (!document.addEventListener) {
|
||||
return; //IE8 won't work with addEventListener, avoid JS error
|
||||
}
|
||||
|
||||
element.addEventListener('change', handleFileSelected, false);
|
||||
|
||||
if(allowDrop) {
|
||||
element.addEventListener('dragover', handleFileDrag, false);
|
||||
element.addEventListener('dragleave', handleFileDrag, false);
|
||||
element.addEventListener('drop', handleDrop, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
}));
|
||||
@@ -0,0 +1,192 @@
|
||||
define([
|
||||
'jquery',
|
||||
'ko',
|
||||
'underscore',
|
||||
'mageUtils',
|
||||
'mage/translate',
|
||||
'Magezon_QuickOrder/js/jquery-ui'
|
||||
], function($, ko, _, utils, $t) {
|
||||
|
||||
return function(data) {
|
||||
var self = this;
|
||||
this.uid = utils.uniqueid();
|
||||
this.parent = data.parent;
|
||||
this.search = ko.observable();
|
||||
this.product = ko.observable(data['product'] ? data['product'] : '');
|
||||
this.price = ko.observable(data['price'] ? data['price'] : 0);
|
||||
this.qty = ko.observable(data['qty'] ? parseFloat(data['qty']) : 1);
|
||||
this.options = ko.observable(data['options'] ? data['options'] : []);
|
||||
this.optionsHtml = ko.observable(data['optionsHtml'] ? data['optionsHtml'] : '');
|
||||
this.others = ko.observable(data['others'] ? data['others'] : '');
|
||||
this.message = ko.observable(data['message'] ? data['message'] : '');
|
||||
this.forceCheckValid = ko.observable(data.hasOwnProperty('forceCheckValid') ? data['forceCheckValid'] : true);
|
||||
this.qtyVisible = ko.observable(data.hasOwnProperty('qtyVisible') ? data['qtyVisible'] : true);
|
||||
this.products = ko.observableArray();
|
||||
this.spinnerloading = ko.observable(false);
|
||||
var quoteType = data['quoteType'];
|
||||
if (!quoteType && data['product'] && data['product']['quoteTypes'] && data['product']['quoteTypes'][0]) {
|
||||
quoteType = data['product']['quoteTypes'][0]['value'];
|
||||
}
|
||||
this.quoteType = ko.observable(quoteType);
|
||||
console.log('item data: ', data)
|
||||
self.getData = function() {
|
||||
return {
|
||||
product: self.product(),
|
||||
price: self.price(),
|
||||
qty: self.qty(),
|
||||
options: self.options(),
|
||||
optionsHtml: self.optionsHtml(),
|
||||
message: self.message(),
|
||||
forceCheckValid: self.forceCheckValid(),
|
||||
quoteType: self.quoteType()
|
||||
}
|
||||
}
|
||||
|
||||
self.subtotal = ko.pureComputed(function() {
|
||||
self.checkValid();
|
||||
return (self.product() ? self.price() * self.qty() : 0);
|
||||
});
|
||||
|
||||
self.parent.products.subscribe(function(products) {
|
||||
if (self.parent.instantSearch) {
|
||||
self.products(products);
|
||||
}
|
||||
});
|
||||
|
||||
self.products.subscribe(function() {
|
||||
self.initAutoComplete();
|
||||
})
|
||||
|
||||
self.search.subscribe(function(search) {
|
||||
if (!self.parent.instantSearch && search.length >= self.parent.minLength) {
|
||||
self.spinnerloading(true);
|
||||
$.ajax({
|
||||
url: self.parent.ajaxUrl,
|
||||
data: { search: search,mode: self.parent.mode },
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.message) alert(res.message);
|
||||
|
||||
self.products(res.products);
|
||||
self.spinnerloading(false);
|
||||
$('#' + self.uid).autocomplete('search', search);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
self.product.subscribe(function(product) {
|
||||
self.options([]);
|
||||
self.optionsHtml('');
|
||||
if (product) {
|
||||
self.price(product.price);
|
||||
} else {
|
||||
self.price(0);
|
||||
}
|
||||
});
|
||||
|
||||
self.forceCheckValid.subscribe(function(status) {
|
||||
if (status) {
|
||||
self.message('');
|
||||
}
|
||||
});
|
||||
|
||||
self.checkValid = function() {
|
||||
if (!this.isValid()) {
|
||||
self.message($t('Please specify product option(s).'));
|
||||
} else {
|
||||
self.message('');
|
||||
}
|
||||
}
|
||||
|
||||
self.isValid = function() {
|
||||
var valid = false;
|
||||
if (self.product() && self.product().canConfigure && !self.options().length) {
|
||||
valid = false
|
||||
} else {
|
||||
valid = true;
|
||||
}
|
||||
if (self.product().type == 'grouped') {
|
||||
self.qtyVisible(false);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
self.initAutoComplete = function() {
|
||||
$('#' + self.uid).focus();
|
||||
self._initAutoComplete();
|
||||
}
|
||||
|
||||
self._initAutoComplete = function() {
|
||||
|
||||
if (self.parent.instantSearch) {
|
||||
var products = self.parent.products();
|
||||
} else {
|
||||
var products = self.products();
|
||||
}
|
||||
console.log('self.products(): ', self.products())
|
||||
var element = $('#' + self.uid);
|
||||
element.autocomplete({
|
||||
messages: {
|
||||
noResults: '',
|
||||
results: function() {
|
||||
|
||||
}
|
||||
},
|
||||
minLength: self.parent.minLength,
|
||||
appendTo: '#mgz-quickorder-ui-' + this.uid,
|
||||
source: products,
|
||||
select: function( event, ui ) {
|
||||
console.log('ui: ', ui)
|
||||
event.preventDefault();
|
||||
// if (ui.item.type=='grouped') {
|
||||
// self.parent.addChildrens(ui.item, self);
|
||||
// } else {
|
||||
self.product(ui.item);
|
||||
if (ui.item.options != '') {
|
||||
self.options(ui.item.options);
|
||||
}
|
||||
|
||||
if (self.product().canConfigure) {
|
||||
self.forceCheckValid(false);
|
||||
} else {
|
||||
self.forceCheckValid(true);
|
||||
}
|
||||
if (self.parent.instantSearch) {
|
||||
element.val(self.product().name);
|
||||
}
|
||||
if (!self.product().canConfigure && self.product().openmodal) {
|
||||
self.parent.openPopup(self);
|
||||
}
|
||||
if (self.product().canConfigure) {
|
||||
self.parent.openPopup(self);
|
||||
}
|
||||
self.forceCheckValid(true);
|
||||
//}
|
||||
},
|
||||
focus: function(event, ui) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}).data( "ui-autocomplete" )._renderItem = function(ul, item) {
|
||||
var $html = '<div class="ui-menu-item-wrapper">';
|
||||
$html += '<div class="mgz-quickorder-item">';
|
||||
if (item.img && self.parent.search.showImage) {
|
||||
$html += '<div class="mgz-quickorder-item_left"><img src="' + item.img + '" alt="' + item.name + '"/></div>';
|
||||
}
|
||||
$html += '<div class="mgz-quickorder-item_right">';
|
||||
$html += '<div class="mgz-quickorder-item_title"><a href="#"><span>' + item.name + '</span></a></div>';
|
||||
if (self.parent.search.showSku) {
|
||||
$html += '<div class="mgz-quickorder-item_sku"><b>SKU#: </b>' + item.sku + '</div>';
|
||||
}
|
||||
if (self.parent.search.showPrice) {
|
||||
$html += '<div class="mgz-quickorder-item_price">' + item.priceHtml + '</div>';
|
||||
}
|
||||
$html += '</div>';
|
||||
$html += '</div>';
|
||||
$html += '</div>';
|
||||
return $('<li class="ui-menu-item" data-label=' + item.name + '>').data("ui-autocomplete-item",item).append($html).appendTo( ul );
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,92 @@
|
||||
define([
|
||||
'jquery'
|
||||
], function ($) {
|
||||
'use strict';
|
||||
|
||||
return function (widget) {
|
||||
|
||||
$.widget('mage.SwatchRenderer', widget, {
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_create: function () {
|
||||
var options = this.options,
|
||||
gallery = $('[data-gallery-role=gallery-placeholder]'),
|
||||
productData = this._determineProductData(),
|
||||
$main = productData.isInProductView ?
|
||||
this.element.parents('.column.main') :
|
||||
this.element.parents('.product-item-info');
|
||||
|
||||
if (productData.isInProductView) {
|
||||
gallery.data('gallery') ?
|
||||
this._onGalleryLoaded(gallery) :
|
||||
gallery.on('gallery:loaded', this._onGalleryLoaded.bind(this, gallery));
|
||||
} else {
|
||||
options.mediaGalleryInitial = [{
|
||||
'img': $main.find('.product-image-photo').attr('src')
|
||||
}];
|
||||
}
|
||||
|
||||
this.productForm = this.element.parents(this.options.selectorProductTile).find('form:first');
|
||||
this.inProductList = this.productForm.length > 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Update [gallery-placeholder] or [product-image-photo]
|
||||
* @param {Array} images
|
||||
* @param {jQuery} context
|
||||
* @param {Boolean} isInProductView
|
||||
*/
|
||||
updateBaseImage: function (images, context, isInProductView) {
|
||||
var justAnImage = images[0],
|
||||
initialImages = this.options.mediaGalleryInitial,
|
||||
gallery = $(this.options.mediaGallerySelector).data('gallery'),
|
||||
imagesToUpdate,
|
||||
isInitial;
|
||||
|
||||
// 每个产品图片添加caption信息
|
||||
if(images.length){
|
||||
images.forEach(function(img){
|
||||
img.caption = initialImages[0].caption
|
||||
});
|
||||
}
|
||||
|
||||
if (isInProductView) {
|
||||
imagesToUpdate = images.length ? this._setImageType($.extend(true, [], images)) : [];
|
||||
isInitial = _.isEqual(imagesToUpdate, initialImages);
|
||||
|
||||
if (this.options.gallerySwitchStrategy === 'prepend' && !isInitial) {
|
||||
imagesToUpdate = imagesToUpdate.concat(initialImages);
|
||||
}
|
||||
|
||||
imagesToUpdate = this._setImageIndex(imagesToUpdate);
|
||||
|
||||
if (gallery) {
|
||||
gallery.updateData(imagesToUpdate);
|
||||
}
|
||||
|
||||
if ($(this.options.mediaGallerySelector).length) {
|
||||
if (isInitial) {
|
||||
$(this.options.mediaGallerySelector).AddFotoramaVideoEvents();
|
||||
} else {
|
||||
$(this.options.mediaGallerySelector).AddFotoramaVideoEvents({
|
||||
selectedOption: this.getProduct(),
|
||||
dataMergeStrategy: this.options.gallerySwitchStrategy
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (gallery) {
|
||||
gallery.first();
|
||||
}
|
||||
|
||||
} else if (justAnImage && justAnImage.img) {
|
||||
context.find('.product-image-photo').attr('src', justAnImage.img);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return $.mage.SwatchRenderer;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,126 @@
|
||||
<div class="mgz-quickorder">
|
||||
<table class="items data table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col search">
|
||||
<span data-bind="i18n: 'Search'"></span>
|
||||
</th>
|
||||
<th class="col item">
|
||||
<span data-bind="i18n: 'Item'"></span>
|
||||
</th>
|
||||
<th class="col price" if="showPrice">
|
||||
<span data-bind="i18n: 'Price'"></span>
|
||||
</th>
|
||||
<th class="col qty" if="showQty">
|
||||
<span data-bind="i18n: 'Qty'"></span>
|
||||
</th>
|
||||
<th class="col subtotal" if="showSubTotal">
|
||||
<span data-bind="i18n: 'Subtotal'"></span>
|
||||
</th>
|
||||
<th class="col action" if="showAction">
|
||||
<span data-bind="i18n: 'Action'"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach: items">
|
||||
<tr class="item-info">
|
||||
<td class="col search">
|
||||
<div class="mgz-quickorder-search">
|
||||
<input type="text" data-bind="textInput: search" attr="id: uid,placeholder: $parent.searchPlaceholder" autocomplete="off"/>
|
||||
<div class="quickorder-spinner" if="spinnerloading"><i></i></div>
|
||||
<div attr="id: 'mgz-quickorder-ui-'+ uid" class="mgz-quickorder-ui-wrapper" afterRender="initAutoComplete"></div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="col item">
|
||||
<div class="item-info-inner" if="product">
|
||||
<div class="product-item-photo" if="$parent.showImage">
|
||||
<span class="product-image-container">
|
||||
<span class="product-image-wrapper">
|
||||
<img attr="src: product().img, alt: product().name"/>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="product-item-details">
|
||||
<strong class="product-item-name">
|
||||
<a attr="href: product().url" text="product().name"></a>
|
||||
</strong>
|
||||
<div class="product-item-sku"><b data-bind="i18n: 'SKU#:'"></b> <span text="product().sku"></span></div>
|
||||
<div class="product-quote-type" if="$parent.mode=='quickquote'&&product().quoteTypes.length"><b data-bind="i18n: 'Type:'"></b>
|
||||
<select data-bind="options: product().quoteTypes,
|
||||
optionsText: 'label',
|
||||
optionsValue: 'value',
|
||||
value: quoteType" style="width: auto"></select>
|
||||
</div>
|
||||
<div class="quickquote-message message error" if="message"><span text="message"></span></div>
|
||||
<div class="item-options-wrapper" html="optionsHtml" if="product&&optionsHtml"></div>
|
||||
<a href="#" class="quickorder-action-edit" data-bind="i18n: 'Edit'" if="product().canConfigure||product().openmodal" click="parent.openPopup"></a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="col price" if="$parent.showPrice">
|
||||
<span class="price" text="$parent.getFormattedPrice(price())" if="product"></span>
|
||||
</td>
|
||||
<td class="col qty" if="$parent.showQty">
|
||||
<input type="number" data-bind="value: qty" min="1" class="input-text qty" if="product" visible="qtyVisible"/>
|
||||
</td>
|
||||
<td class="col subtotal" if="$parent.showSubTotal">
|
||||
<span class="price" text="$parent.getFormattedPrice(subtotal())" if="product"></span>
|
||||
</td>
|
||||
<td class="col action" if="$parent.showAction">
|
||||
<a href="#" class="quickorder-btn action-duplicate" click="$parent.duplicateItem" if="product">+</a>
|
||||
<a href="#" class="quickorder-btn action-delete" click="$parent.removeItem">x</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="mgz-quickorder-action">
|
||||
<div class="quickorder-grand-total" if="showGrandTotal">
|
||||
<span text="grandTotalLabel"></span> <span data-bind="text: getFormattedPrice(grandTotal())"></span>
|
||||
</div>
|
||||
<button class="quickorder-btn" data-bind="disable: submitLoading" click="addItem" text="addBtnLabel"></button>
|
||||
<button class="quickorder-btn" data-bind="disable: submitLoading" click="emptyItems" text="emptyBtnLabel" if="showEmptyBtn"></button>
|
||||
<button class="quickorder-btn" data-bind="disable: submitLoading" click="submitItems" text="submitBtnLabel"></button>
|
||||
<div class="quickorder-spinner" if="submitLoading"><i></i></div>
|
||||
</div>
|
||||
<div class="mgz-quicorder-multiskus" if="enableMultiskus">
|
||||
<fieldset class="fieldset">
|
||||
<div class="field">
|
||||
<label class="label">
|
||||
<span text="multiSkusLabel"></span>
|
||||
</label>
|
||||
<div class="control">
|
||||
<textarea class="textarea" rows="5" data-bind="value: skus"></textarea>
|
||||
<p text="multiSkusDescription"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label">
|
||||
<span data-bind="i18n: 'Qty'"></span>
|
||||
</label>
|
||||
<div class="control">
|
||||
<input type="number" class="text" data-bind="value: qty" min="1"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<button class="quickorder-btn" click="addToList" text="addToListBtnLabel"></button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="mgz-quicorder-file" if="enableUpload">
|
||||
<fieldset class="fieldset">
|
||||
<div class="field">
|
||||
<label class="label">
|
||||
<span data-bind="i18n: 'Add from file'"></span>
|
||||
</label>
|
||||
|
||||
<div class="control">
|
||||
<label class="file-uploader-button" for="quickorder-file" data-bind="i18n: 'Choose File'"></label>
|
||||
<input type="file" id="quickorder-file" class="file" data-bind="files: { onLoaded: onLoadedFile, fileFilter: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',onError: onErrorFile,onProgress: onProgressFile, readAs: 'text'}" accept=".xlsx" />
|
||||
<a attr="href: downloadSampleLink"><span data-bind="i18n: '下载excel文件模板'"></span></a>
|
||||
<div class="quickorder-spinner" if="fileLoading"><i></i></div>
|
||||
<p html="fileMessage"></p>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user