Commit c30d152e866c167ef4f7cb6af3370688d2178d0e

Authored by Adrian
1 parent 719d6fb4

Añadimos una opción para poder importar EANs desde un archivo .csv.

FuncionesImaxMultiEAN.php
@@ -13,14 +13,12 @@ class FuncionesImaxMultiEAN { @@ -13,14 +13,12 @@ class FuncionesImaxMultiEAN {
13 } 13 }
14 14
15 public function storeEAN($productId, $ean, $combinationId = 0) { 15 public function storeEAN($productId, $ean, $combinationId = 0) {
16 - global $imax;  
17 - $sql = 'INSERT INTO '._DB_PREFIX_.$imax::prefijo."multiean (id_product, id_product_attribute, ean13) VALUES ('$productId', '$combinationId', '$ean')"; 16 + $sql = 'INSERT INTO ' . _DB_PREFIX_.$this->modulo->prefijo . "multiean (id_product, id_product_attribute, ean13) VALUES ('$productId', '$combinationId', '$ean')";
18 return Db::getInstance()->execute($sql); 17 return Db::getInstance()->execute($sql);
19 } 18 }
20 19
21 public function deleteEAN($productId, $ean, $combinationId = 0) { 20 public function deleteEAN($productId, $ean, $combinationId = 0) {
22 - global $imax;  
23 - $sql = 'DELETE FROM '._DB_PREFIX_.$imax::prefijo."multiean WHERE id_product = '$productId' AND id_product_attribute = '$combinationId' AND ean13 = '$ean'"; 21 + $sql = 'DELETE FROM ' . _DB_PREFIX_ . $this->modulo->prefijo . "multiean WHERE id_product = '$productId' AND id_product_attribute = '$combinationId' AND ean13 = '$ean'";
24 return Db::getInstance()->execute($sql); 22 return Db::getInstance()->execute($sql);
25 } 23 }
26 } 24 }
clases/accesoDatos/AccesoDatosCSV.php 0 → 100644
  1 +<?php
  2 +namespace clases\accesoDatos;
  3 +
  4 +/**
  5 + * Obtiene datos de un archivo CSV.
  6 + */
  7 +class AccesoDatosCSV implements iAccesoDatos {
  8 + private $fh, $separadorCampos, $separadorTexto, $caracterEscape;
  9 +
  10 + /**
  11 + *
  12 + * @param string $archivo
  13 + * @param int $posicionActual
  14 + * @param int $numLineasCabecera
  15 + * @param string $separadorCampos
  16 + * @param string $separadorTexto
  17 + * @param string $caracterEscape
  18 + */
  19 + function __construct($archivo, $posicionActual, $numLineasCabecera = 1, $separadorCampos = ',', $separadorTexto = '"', $caracterEscape = '\\') {
  20 + if(is_file($archivo)) {
  21 + $this->fh = fopen($archivo, 'r');
  22 + }
  23 +
  24 + $this->separadorCampos = $separadorCampos;
  25 + $this->separadorTexto = $separadorTexto;
  26 + $this->caracterEscape = $caracterEscape;
  27 +
  28 + $this->saltarLineas($posicionActual, $numLineasCabecera);
  29 + }
  30 +
  31 + public function obtenerFila() {
  32 + return fgetcsv($this->fh, 0, $this->separadorCampos, $this->separadorTexto, $this->caracterEscape);
  33 + }
  34 +
  35 + /**
  36 + * Avanza el puntero en el archivo CSV.
  37 + * @param int $posicionActual La linea a procesar.
  38 + * @param int $numLineasCabecera
  39 + */
  40 + private function saltarLineas($posicionActual, $numLineasCabecera) {
  41 + if (!$posicionActual) {
  42 + $posicionActual = $numLineasCabecera;
  43 + }
  44 +
  45 + for ($i = 0; $i < $posicionActual; $i++) {
  46 + fgetcsv($this->fh, 0, $this->separadorCampos, $this->separadorTexto, $this->caracterEscape);
  47 + }
  48 + }
  49 +
  50 + /**
  51 + * Cierra el fichero.
  52 + */
  53 + public function cerrarArchivo() {
  54 + if($this->fh) {
  55 + fclose($this->fh);
  56 + }
  57 + }
  58 +}
clases/accesoDatos/AccesoDatosExcel.php 0 → 100644
  1 +<?php
  2 +namespace clases\accesoDatos;
  3 +
  4 +require_once dirname(__FILE__).'/../PHPExcel.php';
  5 +
  6 +use \PHPExcel_Settings;
  7 +use \PHPExcel_IOFactory;
  8 +use \PHPExcel_CachedObjectStorageFactory;
  9 +use \PHPExcel_Worksheet;
  10 +
  11 +/**
  12 + * Obtiene datos de un archivo CSV.
  13 + */
  14 +class AccesoDatosExcel implements iAccesoDatos {
  15 + private $hoja, $iterador;
  16 +
  17 + /**
  18 + *
  19 + * @param string $archivo
  20 + * @param int $posicionActual
  21 + * @param int $cantidadProcesable
  22 + * @param int $numLineasCabecera
  23 + */
  24 + function __construct($archivo, $posicionActual, $cantidadProcesable, $numLineasCabecera = 1) {
  25 + $this->hoja = $this->cargarExcel($archivo, $posicionActual + $numLineasCabecera, $cantidadProcesable);
  26 + $this->iterador = $this->hoja->getRowIterator();
  27 + $this->saltarLineas($posicionActual, $numLineasCabecera);
  28 + }
  29 +
  30 + public function obtenerFila() {
  31 + $resultado = false;
  32 +
  33 + if($this->iterador->valid()) {
  34 + $fila = $this->iterador->current();
  35 + $iteradorCelda = $fila->getCellIterator();
  36 + $iteradorCelda->setIterateOnlyExistingCells(false);
  37 + $resultado = array();
  38 + foreach ($iteradorCelda as $celda) {
  39 + $resultado[] = $celda->getValue();
  40 + }
  41 +
  42 + $this->iterador->next();
  43 + }
  44 +
  45 + return $resultado;
  46 + }
  47 +
  48 + /**
  49 + * Avanza el puntero hasta una linea.
  50 + * @param int $posicionActual La linea a procesar.
  51 + * @param int $numLineasCabecera
  52 + */
  53 + private function saltarLineas($posicionActual, $numLineasCabecera) {
  54 + $posicionActual += $numLineasCabecera;
  55 +
  56 + $this->iterador->rewind();
  57 + for ($i = 0; $i < $posicionActual; $i++) {
  58 + if($this->iterador->valid()) {
  59 + $this->iterador->next();
  60 + }
  61 + else {
  62 + break;
  63 + }
  64 + }
  65 + }
  66 +
  67 + /**
  68 + * Cierra el fichero.
  69 + */
  70 + public function cerrarArchivo() {
  71 + if($this->hoja) {
  72 + $this->hoja->disconnectCells();
  73 + }
  74 + }
  75 +
  76 + /**
  77 + * Devuelve una hoja activa del archivo indicado.
  78 + * @param string $archivo
  79 + * @param int $comienzo
  80 + * @param int $lineasLeibles
  81 + * @return PHPExcel_Worksheet
  82 + */
  83 + private function cargarExcel($archivo, $comienzo, $lineasLeibles) {
  84 + //Podría ser que esto no fuese compatible con todos los servidores
  85 + PHPExcel_Settings::setCacheStorageMethod(PHPExcel_CachedObjectStorageFactory::cache_to_sqlite3);
  86 +
  87 + $inputFileType = PHPExcel_IOFactory::identify($archivo);
  88 + $objReader = PHPExcel_IOFactory::createReader($inputFileType);
  89 + $chunkFilter = new ChunkReadFilter();
  90 + $objReader->setReadFilter($chunkFilter);
  91 + $chunkFilter->setRows($comienzo, $lineasLeibles);
  92 + $objPHPExcel = $objReader->load($archivo);
  93 +
  94 + return $objPHPExcel->getActiveSheet();
  95 + }
  96 +}
0 \ No newline at end of file 97 \ No newline at end of file
clases/accesoDatos/AccesoDatosXML.php 0 → 100644
  1 +<?php
  2 +namespace clases\accesoDatos;
  3 +
  4 +/**
  5 + * Obtiene datos de un archivo XML.
  6 + */
  7 +class AccesoDatosXML implements iAccesoDatos {
  8 + private $posicionActual;
  9 + private $handle;
  10 + public $totalBytes;
  11 + public $readBytes = 0;
  12 + private $nodeIndex = 0;
  13 + private $chunk = "";
  14 + private $chunkSize;
  15 + private $readFromChunkPos;
  16 + private $rootNode;
  17 + private $customRootNode;
  18 + private $procesando = false;
  19 +
  20 +
  21 + /**
  22 + *
  23 + * @param mixed $mixed Path to XML file OR file handle
  24 + * @param int $posicionActual
  25 + * @param int $chunkSize Bytes to read per cycle (Optional, default is 32 KiB)
  26 + * @param string $customRootNode Specific root node to use (Optional)
  27 + * @param int $totalBytes Xml file size - Required if supplied file handle
  28 + * @param string $customChildNode
  29 + * @throws Exception
  30 + */
  31 + public function __construct($mixed, $posicionActual = 0, $chunkSize = 32768, $customRootNode = null, $totalBytes = null, $customChildNode = null) {
  32 + if (is_string($mixed)) {
  33 + $this->handle = fopen($mixed, "r");
  34 + if (isset($totalBytes)) {
  35 + $this->totalBytes = $totalBytes;
  36 + } else {
  37 + $this->totalBytes = filesize($mixed);
  38 + }
  39 + } else if (is_resource($mixed)) {
  40 + $this->handle = $mixed;
  41 + if (!isset($totalBytes)) {
  42 + throw new Exception("totalBytes parameter required when supplying a file handle.");
  43 + }
  44 + $this->totalBytes = $totalBytes;
  45 + }
  46 +
  47 + $this->chunkSize = $chunkSize;
  48 + $this->customRootNode = $customRootNode;
  49 + $this->customChildNode = $customChildNode;
  50 +
  51 + $this->posicionActual = $posicionActual;
  52 + }
  53 +
  54 + /**
  55 + * Gets the total read bytes so far
  56 + */
  57 + public function getReadBytes() {
  58 + return $this->readBytes;
  59 + }
  60 +
  61 + /**
  62 + * Gets the total file size of the xml
  63 + */
  64 + public function getTotalBytes() {
  65 + return $this->totalBytes;
  66 + }
  67 +
  68 + /**
  69 + * Starts the streaming and parsing of the XML file
  70 + */
  71 + public function obtenerFila() {
  72 + $elementWithChildren = null;
  73 +
  74 + $continue = true;
  75 + while ($continue) {
  76 + if(!$this->procesando) {
  77 + $continue = $this->readNextChunk();
  78 + if (!isset($this->rootNode)) {
  79 + // Find root node
  80 + if (isset($this->customRootNode)) {
  81 + $customRootNodePos = strpos($this->chunk, "<{$this->customRootNode}");
  82 + if ($customRootNodePos !== false) {
  83 + // Found custom root node
  84 + // Support attributes
  85 + $closer = strpos(substr($this->chunk, $customRootNodePos), ">");
  86 + $readFromChunkPos = $customRootNodePos + $closer + 1;
  87 +
  88 + // Custom child node?
  89 + if (isset($this->customChildNode)) {
  90 + // Find it in the chunk
  91 + $customChildNodePos = strpos(substr($this->chunk, $readFromChunkPos), "<{$this->customChildNode}");
  92 + if ($customChildNodePos !== false) {
  93 + // Found it!
  94 + $readFromChunkPos = $readFromChunkPos + $customChildNodePos;
  95 + } else {
  96 + // Didn't find it - read a larger chunk and do everything again
  97 + continue;
  98 + }
  99 + }
  100 +
  101 + $this->rootNode = $this->customRootNode;
  102 + $this->readFromChunkPos = $readFromChunkPos;
  103 + } else {
  104 + // Clear chunk to save memory, it doesn't contain the root anyway
  105 + $this->readFromChunkPos = 0;
  106 + $this->chunk = "";
  107 + continue;
  108 + }
  109 + } else {
  110 +
  111 + // $$-- Valiton change: changed pattern. XML1.0 standard allows almost all
  112 + // Unicode characters even Chinese and Cyrillic.
  113 + // see:
  114 + // http://en.wikipedia.org/wiki/XML#International_use
  115 + preg_match('/<([^>\?]+)>/', $this->chunk, $matches);
  116 + // --$$
  117 + if (isset($matches[1])) {
  118 + // Found root node
  119 + $this->rootNode = $matches[1];
  120 + $this->readFromChunkPos = strpos($this->chunk, $matches[0]) + strlen($matches[0]);
  121 + } else {
  122 + // Clear chunk to save memory, it doesn't contain the root anyway
  123 + $this->readFromChunkPos = 0;
  124 + $this->chunk = "";
  125 + continue;
  126 + }
  127 + }
  128 + }
  129 + }
  130 +
  131 + while (true) {
  132 + $fromChunkPos = substr($this->chunk, $this->readFromChunkPos);
  133 + preg_match('/<([^>]+)>/', $fromChunkPos, $matches);
  134 + if (isset($matches[1])) {
  135 + $element = $matches[1];
  136 + $spacePos = strpos($element, " ");
  137 + $crPos = strpos($element, "\r");
  138 + $lfPos = strpos($element, "\n");
  139 + $tabPos = strpos($element, "\t");
  140 + $aPositionsIn = array($spacePos, $crPos, $lfPos, $tabPos);
  141 + foreach ($aPositionsIn as $iPos) {
  142 + if ($iPos !== false) {
  143 + $aPositions[] = $iPos;
  144 + }
  145 + }
  146 + if(!empty($aPositions) && is_array($aPositions)) {
  147 + $minPos = min($aPositions);
  148 + }else {
  149 + $minPos = 0;
  150 + }
  151 + if ($minPos !== false && $minPos != 0) {
  152 + $sElementName = substr($element, 0, $minPos);
  153 + $endTag = "</" . $sElementName . ">";
  154 + } else {
  155 + $sElementName = $element;
  156 + $endTag = "</$sElementName>";
  157 + }
  158 +
  159 + $endTagPos = false;
  160 + $lastCharPos = strlen($element) - 1;
  161 + if (substr($element, $lastCharPos) == "/") {
  162 + $endTag = "/>";
  163 + $endTagPos = $lastCharPos;
  164 +
  165 + $iPos = strpos($fromChunkPos, "<");
  166 + if ($iPos !== false) {
  167 + $endTagPos += $iPos + 1;
  168 + }
  169 + }
  170 +
  171 + if ($endTagPos === false) {
  172 + $endTagPos = strpos($fromChunkPos, $endTag);
  173 + }
  174 + if ($endTagPos !== false) {
  175 + $endTagEndPos = $endTagPos + strlen($endTag);
  176 + $elementWithChildren = substr($fromChunkPos, 0, $endTagEndPos);
  177 + $elementWithChildren = trim($elementWithChildren);
  178 + if($this->readFromChunkPos) {
  179 + $this->chunk = $fromChunkPos;
  180 + }
  181 + $this->chunk = substr($this->chunk, strpos($this->chunk, $endTag) + strlen($endTag));
  182 + $this->readFromChunkPos = 0;
  183 +
  184 + if ($this->nodeIndex >= $this->posicionActual) {
  185 + $this->procesando = true;
  186 + break(2);
  187 + }
  188 +
  189 + $this->nodeIndex++;
  190 + } else {
  191 + $this->procesando = false;
  192 + break;
  193 + }
  194 + } else {
  195 + $this->procesando = false;
  196 + break;
  197 + }
  198 + }
  199 + }
  200 +
  201 + if($elementWithChildren === NULL) {
  202 + fclose($this->handle);
  203 + }
  204 +
  205 + return $elementWithChildren;
  206 + }
  207 +
  208 + private function readNextChunk() {
  209 + $this->chunk .= fread($this->handle, $this->chunkSize);
  210 + $this->readBytes += $this->chunkSize;
  211 + if ($this->readBytes >= $this->totalBytes) {
  212 + $this->readBytes = $this->totalBytes;
  213 + return false;
  214 + }
  215 +
  216 + return true;
  217 + }
  218 +
  219 + /**
  220 + * Cierra el fichero.
  221 + */
  222 + public function cerrarArchivo() {
  223 + if($this->handle) {
  224 + fclose($this->handle);
  225 + }
  226 + }
  227 +}
clases/accesoDatos/ChunkReadFilter.php 0 → 100644
  1 +<?php
  2 +namespace clases\accesoDatos;
  3 +
  4 +/**
  5 + * Filtro de lectura para PHPExcel que permite saltarse lineas e indicar la cantidad a leer.
  6 + */
  7 +class ChunkReadFilter implements \PHPExcel_Reader_IReadFilter {
  8 +
  9 + private $_startRow = 1;
  10 + private $_endRow = 1;
  11 +
  12 + /**
  13 + * Indica la primera linea a leer y la cantidad de ellas.
  14 + * @param int $startRow
  15 + * @param int $chunkSize
  16 + */
  17 + public function setRows($startRow, $chunkSize) {
  18 + $this->_startRow = $startRow + 1;
  19 + $this->_endRow = $startRow + $chunkSize + 1;
  20 + }
  21 +
  22 + public function readCell($column, $row, $worksheetName = '') {
  23 + if ($row >= $this->_startRow && $row < $this->_endRow) {
  24 + return true;
  25 + }
  26 +
  27 + return false;
  28 + }
  29 +}
clases/accesoDatos/iAccesoDatos.php 0 → 100644
  1 +<?php
  2 +namespace clases\accesoDatos;
  3 +
  4 +/**
  5 + * Las clases para acceder a los datos del proveedor deben cumplir este interfaz.
  6 + */
  7 +interface iAccesoDatos {
  8 + /**
  9 + * Devuelve la fila necesaria para crear un elemento.
  10 + * @return array Devuelve un array con datos, FALSE en caso de error o de finalizar el archivo.
  11 + */
  12 + public function obtenerFila();
  13 +}
config.xml
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <module> 2 <module>
3 <name>imaxmultiean</name> 3 <name>imaxmultiean</name>
4 <displayName><![CDATA[Gestor de EANs Múltiples]]></displayName> 4 <displayName><![CDATA[Gestor de EANs Múltiples]]></displayName>
5 - <version><![CDATA[1.1]]></version> 5 + <version><![CDATA[1.2]]></version>
6 <description><![CDATA[Permite añadir y gestionar múltiples códigos EAN para cada producto y combinación.]]></description> 6 <description><![CDATA[Permite añadir y gestionar múltiples códigos EAN para cada producto y combinación.]]></description>
7 <author><![CDATA[Informax]]></author> 7 <author><![CDATA[Informax]]></author>
8 <tab><![CDATA[administration]]></tab> 8 <tab><![CDATA[administration]]></tab>
imaxmultiean.php
@@ -16,11 +16,13 @@ class ImaxMultiEAN extends Module { @@ -16,11 +16,13 @@ class ImaxMultiEAN extends Module {
16 private static $funciones; 16 private static $funciones;
17 17
18 const prefijo = 'imaxmultiean_'; 18 const prefijo = 'imaxmultiean_';
  19 + const ARCHIVO_CSV = 0, ARCHIVO_EXCEL = 1;
19 20
20 public function __construct() { 21 public function __construct() {
21 $this->name = 'imaxmultiean'; 22 $this->name = 'imaxmultiean';
22 $this->tab = 'administration'; 23 $this->tab = 'administration';
23 - $this->version = '1.1'; 24 + $this->path = _PS_MODULE_DIR_ . $this->name . '/';
  25 + $this->version = '1.2';
24 $this->author = 'Informax'; 26 $this->author = 'Informax';
25 $this->need_instance = 0; 27 $this->need_instance = 0;
26 $this->idManual = ''; 28 $this->idManual = '';
@@ -147,7 +149,46 @@ class ImaxMultiEAN extends Module { @@ -147,7 +149,46 @@ class ImaxMultiEAN extends Module {
147 $accion = Tools::getValue("accion"); 149 $accion = Tools::getValue("accion");
148 $this->idTab = Tools::getValue("idTab"); 150 $this->idTab = Tools::getValue("idTab");
149 $html = ""; 151 $html = "";
150 - switch ($accion) { 152 + switch ($accion) {
  153 + case 'importacion':
  154 + ini_set('auto_detect_line_endings', 1);
  155 +
  156 + $error = false;
  157 + $file_import = dirname(__FILE__) . '/import/' . $_FILES['file']['name'] . '.' . date('Ymdhis') . '.csv';
  158 + if (move_uploaded_file($_FILES['file']['tmp_name'], $file_import)) {
  159 + require_once dirname(__FILE__).'/clases/accesoDatos/iAccesoDatos.php';
  160 + switch ($this->detectarTipoArchivo($file_import)) {
  161 + case self::ARCHIVO_CSV:
  162 + require_once dirname(__FILE__).'/clases/accesoDatos/AccesoDatosCSV.php';
  163 + $acceso = new clases\accesoDatos\AccesoDatosCSV($file_import, 0, 1, ';');
  164 + break;
  165 +
  166 + case self::ARCHIVO_EXCEL:
  167 + require_once dirname(__FILE__).'/clases/accesoDatos/AccesoDatosExcel.php';
  168 + require_once dirname(__FILE__).'/clases/accesoDatos/ChunkReadFilter.php';
  169 + $acceso = new clases\accesoDatos\AccesoDatosExcel($file_import, 0, 32768, 1);
  170 + break;
  171 +
  172 + default:
  173 + require_once dirname(__FILE__).'/clases/accesoDatos/AccesoDatosCSV.php';
  174 + $acceso = new clases\accesoDatos\AccesoDatosCSV($file_import, 0, 1, ';');
  175 + break;
  176 + }
  177 +
  178 + while (($data = $acceso->obtenerFila()) !== FALSE) {
  179 + $this->getFunciones()->storeEAN($data[0], $data[2], $data[1]);
  180 + }
  181 + unlink($file_import);
  182 + }
  183 + else {
  184 + $error = true;
  185 + }
  186 + if(!$error) {
  187 + $html .= $this->displayConfirmation($this->l('EANs cargados correctamente.'));
  188 + } else {
  189 + $html .= $this->displayError($this->l('Error al cargar os EANs.'));
  190 + }
  191 + break;
151 case 'gestionLicencia': 192 case 'gestionLicencia':
152 $this->forceCheck = 1; 193 $this->forceCheck = 1;
153 if (Configuration::updateGlobalValue(self::prefijo . 'LICENCIA', trim(Tools::getValue('licencia')))) { 194 if (Configuration::updateGlobalValue(self::prefijo . 'LICENCIA', trim(Tools::getValue('licencia')))) {
@@ -219,6 +260,14 @@ class ImaxMultiEAN extends Module { @@ -219,6 +260,14 @@ class ImaxMultiEAN extends Module {
219 $form->createSubmitButton('opcionesConfiguracion', $this->l('Guardar')); 260 $form->createSubmitButton('opcionesConfiguracion', $this->l('Guardar'));
220 $html = $acordeon->renderAcordeon($this->l('Configuracion'), $form->renderForm()); 261 $html = $acordeon->renderAcordeon($this->l('Configuracion'), $form->renderForm());
221 262
  263 + unset($form);
  264 + $form = new imaxForm($this, $this->_path, Tools::safeOutput($_SERVER['REQUEST_URI']), 'post', 'uploadFile', "multipart/form-data", false, false, $this->path);
  265 + $form->createHidden("accion", "importacion");
  266 + $form->createHidden("idTab", "1");
  267 + $form->addToForm('<p><a href="../modules/imaxmultiean/sampleFiles/sampeFileAddEan.csv">'.$this->l('Pulsa este enlace para bajar un archivo de ejemplo.').'</a></p>');
  268 + $form->createFormUploadFile('file', $this->l('Fichero con EANs'), '');
  269 + $form->createSubmitButton('opcionesConfiguracion', $this->l('Guardar'));
  270 + $html .= $acordeon->renderAcordeon($this->l('Importacion'), $form->renderForm());
222 return $html; 271 return $html;
223 } 272 }
224 273
@@ -311,4 +360,27 @@ class ImaxMultiEAN extends Module { @@ -311,4 +360,27 @@ class ImaxMultiEAN extends Module {
311 return $url; 360 return $url;
312 } 361 }
313 362
  363 + /**
  364 + * Devuelve el tipo de archivo.
  365 + * @param string $rutaArchivo
  366 + * @return int
  367 + */
  368 + public static function detectarTipoArchivo($rutaArchivo) {
  369 + $resultado = false;
  370 +
  371 + $ext = explode(',', $rutaArchivo);
  372 + $ext = end($ext);
  373 + $mime = mime_content_type($rutaArchivo);
  374 + if ($mime == 'text/plain') {
  375 + $resultado = self::ARCHIVO_CSV;
  376 + } elseif ($mime == 'application/vnd.ms-excel' || $mime == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
  377 + $resultado = self::ARCHIVO_EXCEL;
  378 + } elseif ($ext == 'csv') {
  379 + $resultado = self::ARCHIVO_CSV;
  380 + } elseif ($ext == 'xls' || $ext == 'xlsx') {
  381 + $resultado = self::ARCHIVO_EXCEL;
  382 + }
  383 +
  384 + return $resultado;
  385 + }
314 } 386 }
import/index.php 0 → 100644
  1 +<?php
  2 +?>
0 \ No newline at end of file 3 \ No newline at end of file
sampleFiles/sampeFileAddEan.csv 0 → 100644
  1 +ID del Producto;ID del Atributo;Codigo EAN-13
  2 +1;1;978020137962
  3 +1;2;978020431891
  4 +1;3;978020430134
  5 +1;4;978020137897
0 \ No newline at end of file 6 \ No newline at end of file