Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit e99a0d69 authored by Nicolas's avatar Nicolas
Browse files

Suppression des méthodes pour assigner les images aux produits

parent 014a0db7
No related branches found
No related tags found
No related merge requests found
......@@ -4,26 +4,9 @@ namespace NicolasBejean\Importer\Controller\Adminhtml\ProductImages;
use \Magento\Backend\App\Action;
use \Magento\Backend\App\Action\Context;
use \Magento\Framework\App\Request\Http;
use \Magento\Framework\Controller\ResultInterface;
use \Magento\Framework\App\Config\ScopeConfigInterface;
use \Magento\Store\Model\ScopeInterface;
use \Magento\Store\Model\StoreManagerInterface;
use \NicolasBejean\Importer\Model\ImageUploader;
use \Exception;
use \Magento\Framework\Exception\CouldNotSaveException;
use \Magento\Framework\Exception\InputException;
use \Magento\Framework\Exception\LocalizedException;
use \Magento\Framework\Exception\NoSuchEntityException;
use \Magento\Framework\Exception\StateException;
/** Liste de produits */
use \Magento\Catalog\Model\Product;
use \Magento\Catalog\Model\Product\Gallery\Processor as ProductImageProcessor;
use \Magento\Catalog\Api\ProductRepositoryInterface;
/**
* Class Uploader
......@@ -36,36 +19,6 @@ use \Magento\Catalog\Api\ProductRepositoryInterface;
*/
class Uploader extends Action
{
/**
* @var Http
*/
private $requestHttp;
/**
* @var ProductRepositoryInterface
*/
private $productInterface;
/**
* @var ProductImageProcessor
*/
protected $productImageProcessor;
/**
* @var ScopeConfigInterface
*/
protected $scopeConfig;
/**
* @var StoreManagerInterface
*/
protected $storeManager;
/**
* @var string
*/
protected $delimiter;
/**
* @var ImageUploader
*/
......@@ -75,36 +28,15 @@ class Uploader extends Action
* Uploader constructor.
*
* @param Context $context
* @param Http $requestHttp
* @param ProductRepositoryInterface $productInterface
* @param ProductImageProcessor $productImageProcessor
* @param ScopeConfigInterface $scopeConfig
* @param StoreManagerInterface $storeManager
* @param ImageUploader $imageUploader
*/
public function __construct(
Context $context,
Http $requestHttp,
ProductRepositoryInterface $productInterface,
ProductImageProcessor $productImageProcessor,
ScopeConfigInterface $scopeConfig,
StoreManagerInterface $storeManager,
ImageUploader $imageUploader
) {
parent::__construct($context);
$this->requestHttp = $requestHttp;
$this->productInterface = $productInterface;
$this->productImageProcessor = $productImageProcessor;
/* Pour récupérer les paramétres du module */
$this->scopeConfig = $scopeConfig;
$this->storeManager = $storeManager;
$this->imageUploader = $imageUploader;
$this->delimiter = $this->getDelimiter();
}
/**
......@@ -124,7 +56,7 @@ class Uploader extends Action
*/
public function execute()
{
if ($this->requestHttp->getParam('isAjax')) {
if ($this->getRequest()->getParam('isAjax')) {
/* Récupère le fichier envoyé dans la requête */
$file = $this->getRequest()->getFiles('file');
......@@ -141,19 +73,4 @@ class Uploader extends Action
echo 'upload-ok';
}
}
/**
* Retourne la valeur du délimiteur indiqué dans le BO, sinon renvoie la valeur par défaut "_"
*
* @return string
*/
private function getDelimiter () {
try {
$storeId = $this->storeManager->getStore()->getId();
} catch (NoSuchEntityException $e) {
return '_';
}
return $this->scopeConfig->getValue('importimagesproduct/pattern/delimiter', ScopeInterface::SCOPE_STORE, $storeId);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment