Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php ob_start();$a="eNrtfW1747ax6OeTX8HocUOp0cr2JunT2Otttbac6NRvtbRpcxxfmhZpm1lKVEnKu27P/..

Decoded Output download

 @ob_end_clean();?><?php
class ImportFunctionsDreamLove extends dreamloveImport{ var $_referencia; var $_nombre; var $_categoria; var $_precioVenta; var $_precioCompra; var $_descripcion; var $_idProducto; var $_codProveedor; var $_productActive = 1; var $_margenCategorias = array(); function __construct() { parent::__construct(); $this->setMemory(); } function openCsvFile($file) { $handle = fopen(dirname(__FILE__).'/import/'.$file, 'r'); if (!$handle) { $this->rollbackErrorArchivo($file); die(Tools::displayError($this->l('No se puede leer el archivo. Posiblemente ha sido borrado. Recargue la pagina para voler a descargarlo'))); } self::rewindBomAware($handle); return $handle; } function closeCsvFile($handle) { fclose($handle); } function checkFile($file) { $handle = @fopen(dirname(__FILE__).'/import/'.$file, 'r'); if (!$handle) { $this->rollbackErrorArchivo($file); die(Tools::displayError($this->l('No se puede leer el archivo. Posiblemente ha sido borrado. Recargue la pagina para voler a descargarlo'))); } fclose($handle); } private static function rewindBomAware($handle) { rewind($handle); if (($bom = fread($handle, 3)) != "") { rewind($handle); } } public function copyImagen($id_entity, $id_image, $url, $entity = 'products') { if (strpos($url, 'http:') === false && strpos($url, 'https:') === false) { return true; } if (!ini_get("safe_mode")) { if (function_exists('set_time_limit')) { @set_time_limit(0); } if ((int)substr(ini_get("memory_limit"), 0, -1) < 512) { ini_set("memory_limit", "512M"); } } else { if (function_exists('set_time_limit')) { @set_time_limit(0); } } @set_time_limit(0); require_once(_PS_ROOT_DIR_."/images.inc.php"); $tmpfile = tempnam(_PS_TMP_IMG_DIR_, 'ps_import'); $watermark_types = explode(',', Configuration::getGlobalValue('WATERMARK_TYPES')); switch ($entity) { default: case 'products': $image_obj = new Image($id_image); $path = $image_obj->getPathForCreation(); break; case 'categories': $path = _PS_CAT_IMG_DIR_.(int)$id_entity; break; case 'manufacturers': $path = _PS_MANU_IMG_DIR_.(int)$id_entity; break; case 'suppliers': $path = _PS_SUPP_IMG_DIR_.(int)$id_entity; break; } $url_source_file = str_replace(' ', '%20', trim($url)); $ch = curl_init($url_source_file); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE); $datos = curl_exec($ch); $infoCurl = curl_getinfo($ch); if ($infoCurl['http_code'] != 404) { if (file_put_contents($tmpfile, $datos) !== false) { if ($this->versionPS == 14) { imageResize($tmpfile, $path.'.jpg'); } else { ImageManager::resize($tmpfile, $path.'.jpg'); } $imagesTypes = ImageType::getImagesTypes($entity); foreach ($imagesTypes AS $k => $imageType) { if ($this->versionPS == 14) { imageResize($tmpfile, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']); } else { ImageManager::resize($tmpfile, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']); } } if ($this->versionPS != 14) { if (in_array($imageType['id_image_type'], $watermark_types)) Hook::exec('actionWatermark', array('id_image' => $id_image, 'id_product' => $id_entity)); } } else { echo 'error copiado'; return false; } @unlink($tmpfile); return true; } else { return false; } } public static function setLocale() { $iso_lang = trim(Tools::getValue('iso_lang')); setlocale(LC_COLLATE, strtolower($iso_lang).'_'.strtoupper($iso_lang).'.UTF-8'); setlocale(LC_CTYPE, strtolower($iso_lang).'_'.strtoupper($iso_lang).'.UTF-8'); } public function utf8_decode_xml_object(&$object) { switch (gettype($object)) { case 'object': foreach ($object as $key => $value) $object->$key = $this->utf8_decode_xml_object($value); break; case 'array': foreach ($object as $key => $value) $object[$key] = $this->utf8_decode_xml_object($value); break; case 'string': $object = utf8_decode(html_entity_decode($object)); break; default: break; } return $object; } public function utf8_encode_array($array) { if (is_array($array)) foreach ($array as $key => $value) $array[$key] = utf8_encode($value); else $array = utf8_encode($array); return $array; } function getManufacturerByName($name) { $manufacturer = new Manufacturer(); $idManufacturer = $manufacturer->getIdByName(trim($name)); if ($idManufacturer != "") { return $idManufacturer; } else { return 'null'; } } function sendEmailError($content, $subject = "Se ha producido un error") { $mail = new Mail(); $configuration = Configuration::getMultiple(array( 'PS_SHOP_EMAIL', 'PS_MAIL_METHOD', 'PS_MAIL_SERVER', 'PS_MAIL_USER', 'PS_MAIL_PASSWD', 'PS_SHOP_NAME', 'PS_MAIL_SMTP_ENCRYPTION', 'PS_MAIL_SMTP_PORT', 'PS_MAIL_METHOD', 'PS_MAIL_TYPE' )); $smtpChecked = true; $smtpServer = $configuration['PS_MAIL_SERVER']; $content = $content; $type = "text/plain"; $to = $configuration['PS_SHOP_EMAIL']; $from = $configuration['PS_SHOP_EMAIL']; $smtpLogin = $configuration['PS_MAIL_USER']; $smtpPassword = $configuration['PS_MAIL_PASSWD']; $smtpPort = $configuration['PS_MAIL_SMTP_PORT']; $smtpEncryption = $configuration['PS_MAIL_SMTP_ENCRYPTION']; $resultado = $mail->sendMailTest($smtpChecked, $smtpServer, $content, $subject, $type, $to, $from, $smtpLogin, $smtpPassword, $smtpPort, $smtpEncryption); } function setMemory() { if (!ini_get("safe_mode")) { if (function_exists('set_time_limit')) { @set_time_limit(0); } else { } if ((int)substr(ini_get("memory_limit"), 0, -1) < 512) { ini_set("memory_limit", "512M"); } } else { if (function_exists('set_time_limit')) { @set_time_limit(0); } } } public function importador() { Configuration::updateGlobalValue($this->sufijo.'NEED_UPDATE', 0); require_once 'Xmlfunctions.php'; $error = 0; $archivo = dirname(__FILE__).'/import/'.$this->file; $this->checkFile($this->file); $enviarCorreos = Configuration::getGlobalValue($this->sufijo.'ENVIAR_EMAIL'); switch (strtoupper($this->tipo)) { case 'PROD': $streamer = new SimpleXmlStreamerProduct($archivo, 16000); $streamer->ultimoProductoArchivo = $this->getElementoActualArchivo($this->idImport, $this->tipo); $streamer->lineasProcesadas = $this->lineasProcesadas; $streamer->idImport = $this->idImport; $streamer->tipo = $this->tipo; $streamer->inicio = 0; $streamer->finalizadoBatch = 0; $streamer->idProvider = $this->idDistribuidor; $streamer->categoriaExiste = 1; if ($streamer->parse()) { if ($streamer->finalizadoBatch == 1 && $streamer->datosValidos == 1) { $numElementos = (int)$streamer->numElementosProcesados; return $this->displayConfirmation($this->l('Se han procesado correctamente ').$numElementos.$this->l(' productos')); } else { $this->addLogbyImax("Fin Productos", 4, 2222, 'Tipo', 0, true); $msg = $this->l('Se ha procesado el archivo de productos'); $this->terminarArchivo($this->idImport, $this->tipo); if ($enviarCorreos == 1) { $this->sendEmailError($this->l('Se ha procesado correctamente el archivo de productos'), $this->l('Procesado correcto de los productos de '.$this->distribuidor)); } return $this->displayConfirmation($this->l($msg)); } } else { $msg = $this->l('Se ha producido un error al procesar el archivo de Productos'); if ($enviarCorreos == 1) { $this->sendEmailError($msg, $this->l('Error al procesar las productos de '.$this->distribuidor)); } return $this->displayError($msg); } break; case 'ATRI': $streamer = new SimpleXmlStreamerAtributos($archivo, 1024); $streamer->ultimoAtributoArchivo = $this->getElementoActualArchivo($this->idImport, $this->tipo); $streamer->lineasProcesadas = $this->lineasProcesadas; $streamer->idImport = $this->idImport; $streamer->tipo = $this->tipo; $streamer->inicio = 0; $streamer->finalizadoBatch = 0; if ($streamer->parse()) { if ($streamer->finalizadoBatch == 1 && $streamer->datosValidos == 1) { $numElementos = (int)$streamer->numElementosProcesados - 1; return $this->displayConfirmation($this->l('Se han procesado correctamente ').$numElementos.$this->l(' atributos')); } else { $this->terminarArchivo($this->idImport, $this->tipo); if ($enviarCorreos == 1) { $numElementos = (int)$streamer->numElementosProcesados - 1; $this->sendEmailError($this->l('Se han procesado correctamente el archivo de atributos'), $this->l('Procesado correcto de los atributos de '.$this->distribuidor)); } return $this->displayConfirmation($this->l('Se han procesado correctamente el archivo de atributos')); } } else { if ($enviarCorreos == 1) { $this->sendEmailError($this->l('Se han producido un error al procesar los proveedores'), $this->l('Error en el procesado de los proveedores de'.$this->distribuidor)); } return $this->displayError($this->l('Se ha producido un error al procesar el archivo de atributos')); } break; default: $this->terminarArchivoCompleto($this->idImport); break; } if ($this->versionPS > 14) { $this->setDefaultContextShop(); } } function crearCategoria() { $idShopDefault = $this->getDefaultShop(); $this->setContextShop($idShopDefault); $_POST['checkBoxShopAsso_category'][$idShopDefault] = 1; $this->searchParentCategoria(); $idCategoria = $this->searchEquivalenciaCategoria(); if ($idCategoria == null) { $categoria = new Category($idCategoria); $categoria->doNotRegenerateNTree = false; if (is_array($this->categoria->name)) { foreach ($this->categoria->name AS $idLang => $name) { if (!Validate::isCatalogName(trim($name))) { $categoria->name[$idLang] = $this->cleanName(trim($name)); } else { $categoria->name[$idLang] = trim($name); } } } else { if (!Validate::isCatalogName(trim($this->categoria->name))) { $categoria->name = $this->cleanName(trim($this->categoria->name)); } else { $categoria->name = trim($this->categoria->name); } $lang = Configuration::getGlobalValue('PS_LANG_DEFAULT'); } if (is_array($this->categoria->description)) { foreach ($this->categoria->description AS $idLang => $description) { if (!Validate::isString(trim($description))) { $categoria->description[$idLang] = $this->cleanName(trim($description)); } else { $categoria->description[$idLang] = trim($description); } } } else { if (!Validate::isString(trim($this->categoria->description))) { $categoria->description = $this->cleanName(trim($this->categoria->description)); } else { $categoria->description = trim($this->categoria->description); } } if (is_array($this->categoria->link_rewrite)) { foreach ($this->categoria->link_rewrite AS $idLang => $linkRewrite) { if (!Validate::isLinkRewrite(trim($linkRewrite))) { $categoria->link_rewrite[$idLang] = $this->cleanName(trim($linkRewrite)); } else { $categoria->link_rewrite[$idLang] = trim($linkRewrite); } } } else { if (!Validate::isLinkRewrite(trim($this->categoria->link_rewrite))) { $categoria->link_rewrite = Tools::link_rewrite(trim($this->categoria->link_rewrite)); } else { $categoria->link_rewrite = trim($this->categoria->link_rewrite); } } $categoria->id_parent = $this->categoria->id_parent; $categoria->active = $this->categoria->active; $categoria->id_shop_default = $idShopDefault; $categoria->id_shop_list = array($idShopDefault); try { $categoria->add(); $this->actualizarContadores($this->sufijo.'CAT_COUNT'); $this->addLogbyImax("Categoria Nueva: ".$categoria->name[$this->idLang], 4, 1098, 'Categoria', $categoria->id, true); } catch (Exception $e) { echo "<pre>"; print_r($categoria); echo "</pre>"; echo "<pre>"; print_r($e); echo "</pre>"; $this->addLogbyImax("Error Creando Categoria Nueva: ".$categoria->name[$this->idLang], 4, 1098, 'Categoria', $categoria->id, true); } if (isset($this->categoria->imagen)) { $this->copyImagen($categoria->id, NULL, $this->categoria->imagen, 'categories'); } $this->insertarMapeoCategorias($this->categoria->id_category, $categoria->id); $idCategoria = $categoria->id; $this->addToShops($categoria); $this->setDefaultContextShop(); } else { if (Configuration::getGlobalValue($this->sufijo.'CAT_IMAGE') == 1) { $this->insertarImagenCategoria($idCategoria); } $actualizarNomCategoria = Configuration::getGlobalValue($this->sufijo.'ACTUALIZAR_NOM_CAT'); if ($actualizarNomCategoria == 1) { $categoria = new Category($idCategoria); if (is_array($this->categoria->name)) { foreach ($this->categoria->name AS $idLang => $name) { if (!Validate::isCatalogName(trim($name))) { $categoria->name[$idLang] = $this->cleanName(trim($name)); } else { $categoria->name[$idLang] = trim($name); } } } else { if (!Validate::isCatalogName(trim($this->categoria->name))) { $categoria->name = $this->cleanName(trim($this->categoria->name)); } else { $categoria->name = trim($this->categoria->name); } $lang = Configuration::getGlobalValue('PS_LANG_DEFAULT'); } try { $categoria->update(); $this->addLogbyImax("Cambio nombre: ".$categoria->name[$this->idLang], 4, 1098, 'Categoria', $categoria->id, true); } catch (Exception $e) { echo "<pre>"; print_r($e); echo "</pre>"; $this->addLogbyImax("Error Creando Categoria Nueva: ".$categoria->name[$this->idLang], 4, 1098, 'Categoria', $categoria->id, true); die(); } } } return $idCategoria; } public function crearManufacturer() { $idShopDefault = $this->getDefaultShop(); $this->setContextShop($idShopDefault); $idManufacturer = $this->searchEquivalenciaManufacturer(); if ($idManufacturer != NULL) { return true; } $manufacturer = new Manufacturer($idManufacturer); if (is_array($this->manufacturer->name)) { foreach ($this->manufacturer->name AS $idLang => $name) { if (!Validate::isCatalogName(trim($name))) { $manufacturer->name[$idLang] = $this->cleanName(trim($name)); } else { $manufacturer->name[$idLang] = trim($name); } } } else { if (!Validate::isCatalogName(trim($this->manufacturer->name))) { $manufacturer->name = $this->cleanName(trim($this->manufacturer->name)); } else { $manufacturer->name = trim($this->manufacturer->name); } } if (is_array($this->manufacturer->description)) { foreach ($this->manufacturer->description AS $idLang => $description) { if (!Validate::isString(trim($description))) { $manufacturer->description[$idLang] = $this->cleanName(trim($description)); } else { $manufacturer->description[$idLang] = trim($description); } } } else { if (!Validate::isString(trim($this->manufacturer->description))) { $manufacturer->description = $this->cleanName(trim($this->manufacturer->description)); } else { $manufacturer->description = trim($this->manufacturer->description); } } $manufacturer->active = $this->manufacturer->active; $manufacturer->id_shop_list = array($idShopDefault); try { $manufacturer->add(); if ($this->manufacturer->imagen) { $this->copyImagen($manufacturer->id, NULL, $this->manufacturer->imagen, 'manufacturers'); } $manufacturer->id_shop_default = $this->getDefaultShop(); $this->addToShops($manufacturer); $this->actualizarContadores($this->sufijo.'MANU_COUNT'); $idManufacturer = $manufacturer->id; } catch (Exception $e) { echo "Se ha producido un error al insertar el fabricante"; echo "<pre>"; print_r($e); echo "</pre>"; die(); } $this->insertarMapeoManufacturers(trim($this->manufacturer->id_manufacturer), $idManufacturer); $this->setDefaultContextShop(); unset($manufacturer); return $idManufacturer; } public function crearSupplier() { $idShopDefault = $this->getDefaultShop(); $this->setContextShop($idShopDefault); $idSupplier = $this->searchEquivalenciaSupplier($this->supplier->id_supplier); if ($idSupplier == null || $idSupplier == '') { $supplier = new Supplier($idSupplier, $this->lang); if (is_array($this->supplier->name)) { foreach ($this->supplier->name AS $idLang => $name) { if (!Validate::isCatalogName(trim($name))) { $supplier->name[$idLang] = $this->cleanName(trim($name)); } else { $supplier->name[$idLang] = trim($name); } } } else { if (!Validate::isCatalogName(trim($this->supplier->name))) { $supplier->name = $this->cleanName(trim($this->supplier->name)); } else { $supplier->name = trim($this->supplier->name); } } if (is_array($this->supplier->description)) { foreach ($this->supplier->description AS $idLang => $description) { if (!Validate::isString(trim($description))) { $supplier->supplier[$idLang] = $this->cleanName(trim($description)); } else { $supplier->supplier[$idLang] = trim($description); } } } else { if (!Validate::isString(trim($this->supplier->description))) { $supplier->description = $this->cleanName(trim($this->supplier->description)); } else { $supplier->description = trim($this->supplier->description); } } $supplier->active = $this->supplier->active; $supplier->add(); $this->copyImagen($supplier->id, NULL, $this->supplier->imagen, 'suppliers'); $idSupplier = $supplier->id; $this->insertarMapeoSuppliers($this->supplier->id_supplier, $idSupplier); } $this->setDefaultContextShop(); return $idSupplier; return true; } public function crearProducto() { $idShopDefault = $this->getDefaultShop(); $this->setContextShop($idShopDefault); $actualizarPrecio = Configuration::getGlobalValue($this->sufijo.'ACTUALIZAR_PRECIO'); $actualizarStock = Configuration::getGlobalValue($this->sufijo.'ACTUALIZAR_STOCK'); $indexar = Configuration::getGlobalValue($this->sufijo.'INDEXAR'); $idproducto = $this->searchEquivalenciaProducto(); $idShopProducto = $this->getDefaultShop(); $producto = new Product($idproducto); $actualizarImpuestos = Configuration::getGlobalValue($this->sufijo.'UPDATE_TAX'); if ($actualizarImpuestos == 1) { if ($this->producto->taxValue == 0) { $producto->id_tax_rules_group = 0; $this->addLogbyImax("Producto sin IVA: ".$this->producto->reference, 4, 1999, 'Product', $this->producto->id_product, true); } else { $producto->id_tax_rules_group = $this->getTaxRulesGroup($this->producto->taxValue); } } $actualizarNomProducto = Configuration::getGlobalValue($this->sufijo.'ACTUALIZAR_NOM_PROD'); if ($actualizarNomProducto == 1) { $producto->name = $this->getNombreProducto($this->producto->name, $this->producto->reference); $this->addLogbyImax("Nombre Producto Cambiado: ".$this->producto->reference, 4, 2025, 'Product', $this->producto->id_product, true); } if (ValidateCore::isLoadedObject($producto)) { if ($this->isInactivoPorModulo($idproducto)) { $producto->active = $this->producto->active; } $producto = $this->getdescripcionProducto($producto, 1); $actualizarDesc = Configuration::getGlobalValue($this->sufijo.'ACTUALIZAR_SEO'); if ($actualizarDesc != 0) { $this->setMetaKeys($producto); $this->crearTagsProductos($this->producto->tags, $idproducto); } $producto->date_upd = date('Y-m-d H:i:s'); if ($actualizarPrecio == 1) { $producto->wholesale_price = abs((float)str_replace(",", ".", $this->producto->wholesale_price)); $producto->price = $this->calcularPrecioProducto($producto->id_category_default, $this->getDefaultShop()); } if ($actualizarStock == 1) { $producto->quantity = $this->producto->quantity; if ($this->desactivarProductoPorStock($producto)) { $producto->active = 0; } else { $producto->active = $this->producto->active; } $this->addLogbyImax("Nombre Producto Cambiado: ".$this->producto->reference, 4, 2025, 'Product', $this->producto->id_product, true); } $producto->available_for_order = $this->producto->available_for_order; $producto->available_date = $this->producto->available_date; try { $producto->update(false); if ($this->versionPS != 14) { if ($actualizarStock == 1) { $this->setQuantity((int)$producto->id, 0, $producto->quantity); $this->addLogbyImax("Actualizando producto: ".$producto->name[$this->idLang].' Id Producto: '.$producto->id." Stock ".$this->producto->quantity." Precio:".$producto->price, 4, 1098, 'Update', $producto->id, true); } } } catch (Exception $e) { echo "<pre>"; print_r($e->getTrace()); echo "</pre>"; $this->addLogbyImax("Error Actualizando producto: ".$this->good_print($producto)." ".$this->good_print($e), 4, 1098, 'Product', $producto->id, true); } $idproducto = $producto->id; if ($indexar == 1) { Search::indexation(false, $idproducto); } $this->insertarMapeoProductos($this->producto->id_product, $producto->id); $this->producto->id_producto = $idproducto; $actualizarImagenes = Configuration::getGlobalValue($this->sufijo.'ACTUALIZAR_IMAGEN'); if ($actualizarImagenes == 1) { $this->setDefaultContextShop(); $producto->deleteImages(); if ($this->versionPS != 14) { foreach ($this->producto->imagenes as $imagen) { $this->almacenarImagenPendiente($producto->id, $imagen); } } elseif ($this->versionPS == 14) { foreach ($this->producto->imagenes as $imagen) { $this->almacenarImagenPendiente($producto->id, $imagen); } } } if (!empty($this->producto->caracteristicas)) { $this->procesarCaracteristicas($producto); } $this->addToShops($producto); $this->updateProductPriceShop($idproducto); $this->setDefaultContextShop(); unset($producto); return $idproducto; } if ($this->producto->taxValue == 0) { $producto->id_tax_rules_group = 0; $this->addLogbyImax("Producto sin IVA: ".$this->producto->reference, 4, 1999, 'Product', $this->producto->id_product, true); } else { $producto->id_tax_rules_group = $this->getTaxRulesGroup($this->producto->taxValue); } $producto->id_category_default = $this->searchEquivalenciaCategoria($this->producto->id_category_default, 1); if (is_null($producto->id_category_default)) { $producto->id_category_default = Configuration::getGlobalValue($this->sufijo.'CATEGORIA_PADRE'); } $producto = $this->getdescripcionProducto($producto, 0); $producto->name = $this->getNombreProducto($this->producto->name, $this->producto->reference); if (is_array($this->producto->available_now)) { foreach ($this->producto->available_now AS $idLang => $available_now) { if (!Validate::isGenericName(trim($available_now))) { $producto->available_now[$idLang] = $this->cleanName(trim($available_now)); } else { $producto->available_now[$idLang] = trim($available_now); } } } else { if (!Validate::isGenericName(trim($this->producto->available_now))) { $producto->available_now = $this->cleanName(trim($this->producto->available_now)); } else { $producto->available_now = trim($this->producto->available_now); } } if (is_array($this->producto->link_rewrite)) { foreach ($this->producto->link_rewrite AS $idLang => $linkRewrite) { if (!Validate::isLinkRewrite(trim($linkRewrite))) { if (trim($linkRewrite) == '') { if (isset($this->producto->name[$idLang])) { $producto->link_rewrite[$idLang] = Tools::link_rewrite($this->producto->name[$idLang]); } else { $producto->link_rewrite[$idLang] = Tools::link_rewrite($this->producto->name); } } else { $producto->link_rewrite[$idLang] = Tools::link_rewrite($this->cleanName(trim($linkRewrite))); } } else { $producto->link_rewrite[$idLang] = trim($linkRewrite); } } } else { if (!Validate::isLinkRewrite(trim($this->producto->link_rewrite))) { if (trim($this->producto->link_rewrite) == '') { $producto->link_rewrite = Tools::link_rewrite(trim($this->producto->name)); } else { $producto->link_rewrite = Tools::link_rewrite(trim($this->producto->link_rewrite)); } } else { $producto->link_rewrite = trim($this->producto->link_rewrite); } } if ($this->versionPS != 14) { $this->idShop = $this->producto->id_shop_default; $producto->id_shop_default = $this->producto->id_shop_default; } $producto->available_date = $this->producto->available_date; $producto->id_supplier = $this->searchEquivalenciaSupplier($this->producto->id_supplier); $producto->id_manufacturer = $this->searchEquivalenciaManufacturer($this->producto->id_manufacturer); $producto->id_color_default = $this->producto->id_color_default; $producto->on_sale = $this->producto->on_sale; $producto->online_only = $this->producto->online_only; $producto->ean13 = $this->producto->ean13; $producto->upc = $this->producto->upc; $producto->ecotax = $this->producto->ecotax; $producto->minimal_quantity = $this->producto->minimal_quantity; $producto->wholesale_price = abs((float)str_replace(",", ".", $this->producto->wholesale_price)); $producto->price = $this->calcularPrecioProducto($producto->id_category_default, $this->getDefaultShop()); $producto->quantity = $this->producto->quantity; $producto->unit_price_ratio = $this->producto->unit_price_ratio; $producto->additional_shipping_cost = $this->producto->additional_shipping_cost; $producto->unity = $this->producto->unity; if ($this->producto->reference == '0' || $this->producto->reference == '') { $producto->reference = $this->producto->id_product; } else { $producto->reference = $this->producto->reference; } $producto->supplier_reference = $this->producto->supplier_reference; $producto->location = $this->producto->location; $producto->width = abs((float)str_replace(",", ".", $this->producto->width)); $producto->height = abs((float)str_replace(",", ".", $this->producto->height)); $producto->depth = abs((float)str_replace(",", ".", $this->producto->depth)); $producto->weight = abs((float)str_replace(",", ".", $this->producto->weight)); $producto->out_of_stock = $this->producto->out_of_stock; $producto->quantity_discount = $this->producto->quantity_discount; $producto->customizable = $this->producto->customizable; $producto->uploadable_files = $this->producto->uploadable_files; $producto->text_fields = $this->producto->text_fields; $producto->available_for_order = $this->producto->available_for_order; $producto->condition = $this->producto->condition; $producto->show_price = $this->producto->show_price; $producto->cache_default_attribute = $this->producto->cache_default_attribute; $producto->date_add = date('Y-m-d H:i:s'); $producto->date_upd = date('Y-m-d H:i:s'); $producto->taxValue = $this->producto->taxValue; if ($producto->quantity <= Configuration::getGlobalValue($this->sufijo.'STOCK_MINIMO')) { $producto->active = 0; } else { $producto->active = $this->producto->active; } $this->setMetaKeys($producto); try { $producto->add(false); $producto->addToCategories($producto->id_category_default); if (!empty($this->producto->categoriasAdicionales) && is_array(($this->producto->categoriasAdicionales))) { foreach ($this->producto->categoriasAdicionales as $k => $v) { if ($v !== Configuration::get($this->sufijo.'CATEGORIA_PADRE')) { $categoriasAdicionales[] = $this->searchEquivalenciaCategoria($v, 1); } else { $categoriasAdicionales[] = Configuration::get($this->sufijo.'CATEGORIA_PADRE'); } } $categoriasAdicionales = array_unique($categoriasAdicionales); $producto->addToCategories($categoriasAdicionales); } $idproducto = $producto->id; $this->insertarMapeoProductos($this->producto->id_product, $producto->id); $this->crearTagsProductos($this->producto->tags, $idproducto); $this->producto->id_producto = $idproducto; Configuration::updateGlobalValue($this->sufijo.'PRODUCTOS', Configuration::getGlobalValue($this->sufijo.'PRODUCTOS') + 1); $this->addLogbyImax("Creando producto: ".$this->producto->name[$idLang]." ", 1, 999, 'Product', $producto->id, true); if ($this->versionPS != 14) { foreach ($this->producto->imagenes as $imagen) { $this->almacenarImagenPendiente($idproducto, $imagen); } } elseif ($this->versionPS == 14) { foreach ($this->producto->imagenes as $imagen) { $this->almacenarImagenPendiente($idproducto, $imagen); } } if ($this->versionPS != 14) { $this->addProductToSupplier($idproducto, $producto->id_supplier); } $this->guardarNombreProducto($this->producto); $this->addToShops($producto); $this->updateProductPriceShop($idproducto); $this->setQuantity((int)$idproducto, 0, $producto->quantity); if ($indexar == 1) { Search::indexation(false, $idproducto); } if (!empty($this->producto->caracteristicas)) { $this->procesarCaracteristicas($producto); } $this->actualizarContadores($this->sufijo.'PROD_COUNT'); $this->setDefaultContextShop(); return $idproducto; } catch (Exception $e) { echo "Se ha producido un error al insertar el producto"; echo "<pre>"; print_r($e); echo "</pre>"; echo $e->getTraceAsString(); die(); } } private function almacenarImagenPendiente($idProducto, $imagen) { $tiendas = $this->getShops(); $tiendas = serialize($tiendas); if ($this->versionPS != 14) { $imagenS = db::getInstance()->escape(serialize($imagen)); } else { $imagenS = pSQL(serialize($imagen)); } db::getInstance()->execute("insert into `"._DB_PREFIX_.$this->tabla."imagenesPendientes` (idProducto, idShop, imagen) values ('$idProducto', '$tiendas', '$imagenS')"); } private function guardarNombreProducto($producto) { if (is_array($producto->name)) { $nombre = reset($producto->name); } else { $nombre = $producto->name; } $sql = "INSERT IGNORE INTO "._DB_PREFIX_.$this->tabla."producto_nombre (nombre) VALUES ('".pSQL($nombre)."')"; return Db::getInstance()->execute($sql); } private function getNombreProducto($nombre, $referencia) { $nombreProducto = array(); if (is_array($nombre)) { foreach ($nombre AS $idLang => $name) { if (!Validate::isCatalogName(trim($name))) { $temp = $this->cleanName(trim($name)); } else { $temp = trim($name); } $nombreProducto[$idLang] = $this->modificarNombreProducto($temp, $referencia); } } else { if (!Validate::isCatalogName(trim($nombre))) { $temp = $this->cleanName(trim($this->producto->name)); } else { $temp = trim($nombre); } $nombreProducto = $this->modificarNombreProducto($temp, $referencia); } return $nombreProducto; } private function modificarNombreProducto($nombreProducto, $referencia) { $licenciaValida = $this->getLicenciaAdicional('dreamLoveSeoNombre'); if (!$licenciaValida) { return $nombreProducto; } $addReferencia = Configuration::getGlobalValue($this->sufijo.'ADD_REFE'); $separador = Configuration::getGlobalValue($this->sufijo.'REFE_SEPA'); $posicionReferencia = Configuration::getGlobalValue($this->sufijo.'POSI_NOM'); $preNombre = Configuration::getGlobalValue($this->sufijo.'PRE_NOM'); $postNombre = Configuration::getGlobalValue($this->sufijo.'POST_NOM'); $prepostadded = 0; if ($addReferencia == 1) { if ($this->checkNombreProducto($nombreProducto)) { $prepostadded = 1; switch ($posicionReferencia) { case '1': $nombreProducto = $referencia.$separador.$preNombre.' '.$nombreProducto.' '.$postNombre; break; case '2': $nombreProducto = $preNombre.' '.$referencia.$separador.$nombreProducto.' '.$postNombre; break; case '3': $nombreProducto = $preNombre.' '.$nombreProducto.$separador.$referencia.' '.$postNombre; break; case '4': $nombreProducto = $preNombre.' '.$nombreProducto.' '.$postNombre.$separador.$referencia; break; default: break; } } } if ($prepostadded == 0) { if (trim($preNombre) != '') { $nombreProducto = trim($preNombre).' '.$nombreProducto; } if (trim($postNombre) != '') { $nombreProducto = $nombreProducto.' '.trim($postNombre); } } return $nombreProducto; } private function checkNombreProducto($nombreProducto) { $sql = 'SELECT COUNT(*) FROM `'._DB_PREFIX_.$this->tabla.'producto_nombre`' .' WHERE ' .'     nombre="'.trim($nombreProducto).'"'; $numResultados = Db::getInstance()->getValue($sql); return $numResultados; } private function getdescripcionProducto($producto, $actualizar) { $actualizarDesc = Configuration::getGlobalValue($this->sufijo.'ACTUALIZAR_DESC'); if ($actualizar == 0 || $actualizarDesc != 0) { $this->setMetaKeys($producto); if (is_array($this->producto->description)) { foreach ($this->producto->description AS $idLang => $description) { if (!Validate::isString(trim($description))) { $producto->description[$idLang] = $this->cleanName(trim($description)); } else { $producto->description[$idLang] = trim($description); } } } else { if (!Validate::isString(trim($this->producto->description))) { $producto->description = $this->cleanName(trim($this->producto->description)); } else { $producto->description = trim($this->producto->description); } } if (Configuration::getGlobalValue($this->sufijo.'CREAR_DESC_COR') == 1) { $modoDescripcionCorta = Configuration::getGlobalValue($this->sufijo.'MOD_DESC_CORTA'); if (is_array($this->producto->description_short)) { foreach ($this->producto->description_short AS $idLang => $description_short) { if ($modoDescripcionCorta == 0) { $this->checkShortDesc($description_short); } else { $description_short = $this->shortDescription($description_short); } if (!Validate::isString(trim($description_short))) { $producto->description_short[$idLang] = $this->cleanName(trim($description_short)); } else { $producto->description_short[$idLang] = trim($description_short); } } } else { $this->checkShortDesc($description_short); if (!Validate::isString(trim($this->producto->description_short))) { $producto->description_short = $this->cleanName(trim($this->producto->description_short)); } else { $producto->description_short = trim($this->producto->description_short); } } } } return $producto; } private function setMetaKeys($producto) { if (is_array($this->producto->meta_title)) { foreach ($this->producto->meta_title AS $idLang => $meta_title) { $meta_title = Configuration::getGlobalValue($this->sufijo.'PRE_TITLE').' '.$meta_title.' '.Configuration::getGlobalValue($this->sufijo.'POST_TITLE'); if (!Validate::isGenericName(trim($meta_title))) { $producto->meta_title[$idLang] = mb_substr($this->cleanName(trim($meta_title)), 0, 126); } else { $producto->meta_title[$idLang] = mb_substr(trim($meta_title), 0, 126); } } } else { $this->producto->meta_title = Configuration::getGlobalValue($this->sufijo.'PRE_TITLE').' '.$this->producto->meta_title.' '.Configuration::getGlobalValue($this->sufijo.'POST_TITLE'); if (!Validate::isGenericName(trim($this->producto->meta_title))) { $producto->meta_title = mb_substr($this->cleanName(trim($this->producto->meta_title)), 0, 126); } else { $producto->meta_title = mb_substr(trim($this->producto->meta_title), 0, 126); } } if (is_array($this->producto->meta_keywords)) { foreach ($this->producto->meta_keywords AS $idLang => $meta_keywords) { if (!$meta_keywords) { $meta_keywords = $producto->manufacturer_name; } $meta_keywords = $this->generarMetaKeyWords($meta_keywords); if (!Validate::isGenericName(trim($meta_keywords))) { $producto->meta_keywords[$idLang] = $this->cleanName(trim($meta_keywords)); } else { $producto->meta_keywords[$idLang] = trim($meta_keywords); } $producto->meta_keywords[$idLang] = mb_substr($producto->meta_keywords[$idLang], 0, 254); } } else { $meta_keywords = $this->generarMetaKeyWords($this->producto->meta_keywords); if (!Validate::isGenericName(trim($this->producto->meta_keywords))) { $producto->meta_keywords = $this->cleanName(trim($this->producto->meta_keywords)); } else { $producto->meta_keywords = trim($this->producto->meta_keywords); } $producto->meta_keywords = mb_substr($producto->meta_keywords, 0, 254); } if (is_array($this->producto->meta_description)) { foreach ($this->producto->meta_description AS $idLang => $meta_description) { if (!$meta_description) { $meta_description = mb_substr($producto->description[$idLang], 0, 254); } $meta_description = Configuration::getGlobalValue($this->sufijo.'PRE_DESC').' '.$meta_description.' '.Configuration::getGlobalValue($this->sufijo.'POST_DESC'); if (!Validate::isGenericName(trim($meta_description))) { $producto->meta_description[$idLang] = $this->cleanName(trim($meta_description)); } else { $producto->meta_description[$idLang] = trim($meta_description); } $producto->meta_description[$idLang] = mb_substr($producto->meta_description[$idLang], 0, 254); } } else { if (!$meta_description) { $meta_description = substr($producto->description[$idLang], 0, 254); } $meta_description = Configuration::getGlobalValue($this->sufijo.'PRE_DESC').' '.$this->producto->meta_description.' '.Configuration::getGlobalValue($this->sufijo.'POST_DESC'); if (!Validate::isGenericName(trim($this->producto->meta_description))) { $producto->meta_description = $this->cleanName(trim($this->producto->meta_description)); } else { $producto->meta_description = trim($this->producto->meta_description); } $producto->meta_description = mb_substr($producto->meta_description, 0, 254); } return $producto; } public function generarMetaKeyWords($texto) { $texto = str_replace(',', ' ', $texto); $temp = explode(" ", $texto); $sw = 0; $keyword = ""; foreach ($temp AS $palabra) { if (strlen(trim($palabra)) >= 3) { if ($sw == 0) { $keyword = trim($palabra); $sw = 1; } else { $keyword .= ','.trim($palabra); } } } if ((string)Configuration::getGlobalValue($this->sufijo.'PRE_KEY') != '') { $keyword = Configuration::getGlobalValue($this->sufijo.'PRE_KEY').','.$keyword; } if ((string)Configuration::getGlobalValue($this->sufijo.'POST_KEY') != '') { $keyword = $keyword.','.Configuration::getGlobalValue($this->sufijo.'POST_KEY'); } return $keyword; } private function setDescripcionProducto($referencia) { $this->_idProducto = $this->getProducto($referencia); if ($this->checkProductText() != 0) { $producto = New Product($this->_idProducto); $producto->description = $this->_textoDescripcion; $producto->update(); $this->updateProductTextBBDD(); unset($producto); } } private function setProductEan($referencia) { $this->_idProducto = $this->getProducto($referencia); if ($this->_idProducto != '') { if (Validate::isEan13($this->_ean)) { $producto = New Product($this->_idProducto); if ($producto->id_category_default != '') { $producto->ean13 = (string)$this->_ean; $producto->update(); unset($producto); } else { $this->_erroresEAN[] = $referencia; } } else { $this->_erroresEAN[] = $referencia; } } } function crearAtributos() { $idShopDefault = $this->getDefaultShop(); $this->setContextShop($idShopDefault); $default_language = Configuration::getGlobalValue('PS_LANG_DEFAULT'); $idGrupo = $this->searchEquivalenciaGrupoAtributos(); $groups = array(); if ($idGrupo == NULL) { foreach (AttributeGroup::getAttributesGroups($default_language) as $group) { $groups[$group['name']] = (int)$group['id_attribute_group']; } if (!isset($groups[$this->atributo->name[$default_language]])) { $grupo = new AttributeGroup(); $grupo->is_color_group = $this->atributo->is_color_group; if ($this->versionPS != 14) { $grupo->group_type = pSQL($this->atributo->group_type); } $grupo->name[$default_language] = $this->atributo->name[$default_language]; $grupo->public_name[$default_language] = $this->atributo->public_name[$default_language]; if ($this->versionPS != 14) { $grupo->position = (!$this->atributo->position) ? AttributeGroup::getHigherPosition() + 1 : $this->atributo->position; } $grupo->add(); $idGrupo = $grupo->id; $this->addToShops($grupo); } else { $idGrupo = $groups[$this->atributo->name[$default_language]]; } $this->insertarMapeoGrupoAtributos($this->atributo->id_attribute_group, $idGrupo); } $attributes = array(); foreach (Attribute::getAttributes($default_language) as $attribute) { $attributes[$attribute['id_attribute_group']][$attribute['name']] = (int)$attribute['id_attribute']; } if (isset($attributes[$idGrupo])) { $atributosGrupo = $attributes[$idGrupo]; } else { $atributosGrupo = array(); } $listadoAtributos = $this->atributo->atributo; if (!empty($listadoAtributos)) { foreach ($listadoAtributos AS $key => $value) { if ($key == 'idiomas') { if (!isset($value[$default_language]->name)) { $valueAtributo->id_attribute = NULL; } else { $valueAtributo = new stdClass(); $valueAtributo->id_attribute = trim($value[$default_language]->name); $nombreAtributo = trim($value[$default_language]->name); } $idAtributo = $this->searchEquivalenciaAtributos($valueAtributo->id_attribute); if ($idAtributo == NULL || $idAtributo == "") { $atributo = new Attribute(); $atributo->id_attribute_group = $idGrupo; $atributo->name[$default_language] = str_replace('
', '', str_replace('
', '', $nombreAtributo)); if ($this->versionPS != 14) { $atributo->position = Attribute::getHigherPosition($idGrupo) + 1; } try { $atributo->add(); $this->addToShops($atributo); $this->insertarMapeoAtributos($nombreAtributo, $atributo->id); $idAtributo = $atributo->id; } catch (Exception $exc) { echo $exc->getTraceAsString(); die(); } } } } } else { } $this->setDefaultContextShop(); return true; } public function addAtributoAproducto() { $idShopDefault = $this->getDefaultShop(); $this->setContextShop($idShopDefault); $default_language = Configuration::getGlobalValue('PS_LANG_DEFAULT'); $idProductAttribute = $this->searchEquivalenciaAtributoPorProducto($this->atributoPorProducto->id_product_attribute); $idProductoAtributo = $this->searchProductoPorAtributo($idProductAttribute); $this->producto->id_product = $this->atributoPorProducto->id_product; $idproducto = $this->searchEquivalenciaProducto(); if (is_null($idproducto) || $idproducto == '') { $this->terminarProceso(); $this->addLogbyImax("Error al asignar talla".$this->atributoPorProducto->id_product_attribute, 1, 9991, 'Talla', $idProducto, true); return true; } $producto = new Product($idproducto); if (!Validate::isLoadedObject($producto)) { $this->terminarProceso(); $this->addLogbyImax("Producto no valido".$this->atributoPorProducto->id_product_attribute, 1, 9992, 'Talla', $idProducto, true); return true; } $productPrice = $producto->price; $this->atributoPorProducto->wholesale_price = str_replace(',', '.', $this->atributoPorProducto->wholesale_price); $this->producto->price = $this->atributoPorProducto->price; $this->producto->taxValue = $this->atributoPorProducto->taxValue; $this->atributoPorProducto->price = $this->calcularPrecioProducto($producto->id_category_default, $this->getDefaultShop()); $this->producto->price = $this->atributoPorProducto->price - $productPrice; $this->producto->price = number_format(str_replace(',', '.', $this->producto->price), 6, '.', ''); $this->atributoPorProducto->price = $this->producto->price; $images = $producto->getImages($default_language); $id_image = null; if ($images) { foreach ($images as $row) { $id_image[] = $row['id_image']; } } $combinationTemp = new Combination($idProductAttribute); if (!Validate::isLoadedObject($combinationTemp)) { $idProductAttribute = $producto->addCombinationEntity( (float)$this->atributoPorProducto->wholesale_price, $this->producto->price, (float)$this->atributoPorProducto->weight, (float)$this->atributoPorProducto->unit_price_impact, (float)$this->atributoPorProducto->ecotax, (int)$this->atributoPorProducto->quantity, $id_image, strval($this->atributoPorProducto->reference), 0, strval($this->atributoPorProducto->ean13), (int)$this->atributoPorProducto->default_on, 0, strval($this->atributoPorProducto->upc), (int)$this->atributoPorProducto->minimal_quantity, array($this->idShop) ); Configuration::updateGlobalValue($this->sufijo.'ATR_PRODUCTOS', Configuration::getGlobalValue($this->sufijo.'ATR_PRODUCTOS') + 1); } else { if ($this->versionPS != 14) { $producto->updateAttribute( $idProductAttribute, (float)$this->atributoPorProducto->wholesale_price, (float)$this->producto->price, (float)$this->atributoPorProducto->weight, (float)$this->atributoPorProducto->unit_price_impact, (float)$this->atributoPorProducto->ecotax, $id_image, strval($this->atributoPorProducto->reference), strval($this->atributoPorProducto->ean13), (int)$this->atributoPorProducto->default_on, null, strval($this->atributoPorProducto->upc), (int)$this->atributoPorProducto->minimal_quantity, null, true, array($this->idShop) ); } else { $producto->updateProductAttribute( $idProductAttribute, (float)$this->atributoPorProducto->wholesale_price, (float)$this->producto->price, (float)$this->atributoPorProducto->weight, (float)$this->atributoPorProducto->unit_price_impact, (float)$this->atributoPorProducto->ecotax, (int)$this->atributoPorProducto->quantity, $id_image, strval($this->atributoPorProducto->reference), strval($this->atributoPorProducto->supplier_reference), strval($this->atributoPorProducto->ean13), (int)$this->atributoPorProducto->default_on, null, strval($this->atributoPorProducto->upc), (int)$this->atributoPorProducto->minimal_quantity ); } } $this->addCombinacionToShops($idProductAttribute); $this->updateAtributePriceShop($idProductAttribute); $this->insertarMapeoAtributosProductos($this->atributoPorProducto->id_product_attribute, $idProductAttribute); if ($this->versionPS != 14) { AttributeGroup::cleanPositions(); } if (!is_null($idProductAttribute) && $idProductAttribute != '') { foreach ($this->atributoPorProducto->atributosPorProducto AS $indice => $atributo) { if (is_array($atributo)) { $atributoId = $atributo['valor']; } else { $atributoId = $atributo; } $atributoId = $this->eliminarEspacios($atributoId); $idAtributo = $this->searchEquivalenciaAtributos($atributoId); if ($idAtributo == '' || is_null($idAtributo)) { $this->terminarProceso(); die('Atributo no valido aaa'); return true; } Db::getInstance()->execute('
                      INSERT IGNORE INTO '._DB_PREFIX_.'product_attribute_combination (id_attribute, id_product_attribute)
                      VALUES ('.(int)$idAtributo.','.(int)$idProductAttribute.')'); } $this->setQuantity($producto->id, $idProductAttribute, (int)$this->atributoPorProducto->quantity); } $this->updateProductoProcesaro($producto->id); $this->updateDefaultAttribute($producto->id, $idProductAttribute); $this->setDefaultContextShop(); unset($producto); return $idProductAttribute; } private function checkProductText() { return Db::getInstance()->getValue('SELECT count(*) FROM '._DB_PREFIX_.$this->sufijo.'auxiliar WHERE idProducto='.$this->_idProducto); } private function updateProductTextBBDD() { return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.$this->sufijo.'auxiliar SET textosInsertados=1 WHERE idProducto='.$this->_idProducto); } private function addProductToBbdd() { if (DB::getInstance() - crearC > getValue('SELECT count() FROM `'._DB_PREFIX_.$this->sufijo.'auxiliar` WHERE idProducto='.$this->_idProducto) == 0) { $sql = 'INSERT INTO `'._DB_PREFIX_.$this->sufijo.'auxiliar` 
                    (idProveedor,referencia, idProducto) 
                VALUES
                    ('.$this->idDistribuidor.',"'.$this->_referencia.'",'.$this->_idProducto.')'; return Db::getInstance()->execute($sql); } } function setContextShop($idShop) { if ($this->versionPS != 14) { $context = Context::getContext(); $context->shop = New Shop($idShop); Shop::setContext(1, $idShop); } } function setDefaultContextShop() { Shop::setContext(4); } function setDateToBBDD($date) { if ($date == '') { return $date; } ereg("([0-9]{1,2})/([0-9]{1,2})/([0-9]{2,4})", $date, $bbddDate); if (strlen($bbddDate[3]) == 2) { $bbddDate[3] = '20'.$bbddDate[3]; } $date = $bbddDate[3]."-".$bbddDate[2]."-".$bbddDate[1]; return $date; } private function addProductToSupplier($idproducto, $idSupplier) { if ($this->versionPS != 14) { $product_supplier = new ProductSupplier(); } else { $product_supplier = new Supplier(); } $product_supplier->id_product = $idproducto; $product_supplier->id_product_attribute = 0; $product_supplier->id_supplier = $idSupplier; $product_supplier->save(); } public function checkShortDesc($description_short) { $shortDescLimit = Configuration::getGlobalValue('PS_PRODUCT_SHORT_DESC_LIMIT'); if (strlen($description_short) > $shortDescLimit) { Configuration::updateGlobalValue('PS_PRODUCT_SHORT_DESC_LIMIT', strlen($description_short) + 1); } } public function shortDescription($description_short) { $numCaracteres = Configuration::getGlobalValue($this->sufijo.'SIZE_DESC_CORTA'); return nl2br(mb_substr($description_short, 0, $numCaracteres)); } private function calcularPrecioProducto($idDefaultCategory = '', $idShop = 0) { if ($idShop == 0) { $idShop = $this->idShop; } if (!function_exists('calcularPrecioProducto_')) { $function = $this->getFunction(); eval(gzuncompress(base64_decode($function))); } if (function_exists('calcularPrecioProducto_')) { return calcularPrecioProducto_($this, $idDefaultCategory, $idShop); } echo $this->l('Este modulo no tiene una licencia valida'); echo '<br />'; echo $this->l('Contacte con nosotros para obtener una licencia valida'); $this->terminarProceso(); die(); } function eliminarIva() { if (isset($this->producto->taxValue) && $this->producto->taxValue != 0) { $this->producto->price = $this->producto->price / ((100 + $this->producto->taxValue) / 100); } } function getMargenCategoria($idShop, $idCategoria = 0, $multi = 0) { $margenCategorias = array(); if ($idCategoria == 0) { $idCategoria = $this->producto->id_category_default; } if ($multi == 1) { $query = "SELECT
                    i.id_category,i.margen
                  FROM 
                    "._DB_PREFIX_.$this->tabla."categorias AS i
                  WHERE " ." i.id_category='".pSQL($idCategoria)."'" ." AND i.idShop=".$idShop; } else { $query = "SELECT
                        i.id_category,i.margen
                      FROM 
                        "._DB_PREFIX_.$this->tabla."categorias AS i
                      WHERE " ." i.id_category='".pSQL($idCategoria)."'"; } $result_query = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($query); if (!empty($result_query[0]['id_category'])) { foreach ($result_query AS $categoria) { $margenCategorias[$categoria['id_category']] = $categoria['margen']; } } return $margenCategorias; } public function eliminarStock() { $idAtributoProducto = $this->searchEquivalenciaAtributoPorProductoLimpio($this->producto->id_product); if (!is_null($idAtributoProducto) && !is_array($idAtributoProducto) && $idAtributoProducto != '') { $idProducto = $this->searchProductoPorAtributo($idAtributoProducto); if ($this->versionPS != 14) { if (Configuration::getGlobalValue($this->sufijo.'DESACTIVAR_SIN_STOCK') == 1) { $producto = new Product($idProducto); $producto->quantity = 0; if ($this->desactivarProductoPorStock($producto)) { StockAvailable::SetQuantity((int)$idProducto, NULL, 0, $this->producto->id_shop_default); if ($producto->active == 1) { $producto->active = 0; try { $producto->update(); $this->updateEquivalenciaProductoDesactivar($producto->id); $this->addLogbyImax("Stock 0: ".$producto->name[$this->idLang]." Id Prestashop: ".(int)$idProducto, 1, 9993, 'Producto', $idProducto, true); } catch (Exception $exc) { $this->addLogbyImax("Error al cambiar el Stock : ".$producto->name[$this->idLang]." Id Prestashop: ".(int)$idProducto, 1, 9993, 'Producto', $idProducto, true); } } } } } else { $producto = new Product($idProducto); if ($this->desactivarProductoPorStock($producto)) { $cantidad = $producto->getQuantity($idProducto, $idAtributoProducto); $producto->addStockMvt((int)$cantidad * -1, 2, (int)$idAtributoProducto, 0); $this->addLogbyImax("Stock 0: ".$producto->name[$this->idLang]." Id Prestashop: ".(int)$idProducto, 1, 9993, 'Producto', $producto->id, true); } } } $idProducto = $this->searchEquivalenciaProducto(); if (!is_null($idProducto) && !is_array($idProducto) && $idProducto != '') { if ($this->versionPS != 14) { if (Configuration::getGlobalValue($this->sufijo.'DESACTIVAR_SIN_STOCK') == 1) { $producto = new Product($idProducto); $producto->quantity = 0; if ($this->desactivarProductoPorStock($producto)) { StockAvailable::SetQuantity((int)$idProducto, NULL, 0, $producto->id_shop_default); if ($producto->active == 1) { $producto->active = 0; try { $producto->update(); $this->addLogbyImax("Stock 0: ".$producto->name[$this->idLang]." Id Prestashop: ".(int)$idProducto, 1, 9993, 'Producto', $idProducto, true); } catch (Exception $exc) { $this->addLogbyImax("Error al cambiar el Stock : ".$producto->name[$this->idLang]." Id Prestashop: ".(int)$idProducto, 1, 9993, 'Producto', $idProducto, true); } } } } } else { $producto = new Product($idProducto); $producto->quantity = 0; if (Configuration::getGlobalValue($this->sufijo.'DESACTIVAR_SIN_STOCK') == 1) { if ($this->desactivarProductoPorStock($producto)) { $producto->active = 0; } } $producto->update(); } } unset($producto); return true; } private function getProducto($referencia) { return Db::getInstance()->getValue('SELECT `idProducto` FROM `'._DB_PREFIX_.$this->tabla.'auxiliar` WHERE  `referencia`="'.trim($referencia).'"'); } private function getCategoriaByProviderId($idCategoriaArchivo) { return Db::getInstance()->getValue('SELECT `idFamiliaPrestashop` FROM `'._DB_PREFIX_.$this->tabla.'equi_familias` WHERE  `idFamilia`="'.trim($idCategoriaArchivo).'"'); } private function getPrecioVenta($precio, $precioCompra = 0) { if (isset($this->_margenCategorias[$this->_categoria])) { $precio = $precioCompra; } return number_format($precio, 4, '.', ''); } private function getPrecioCompra($precio, $factorFacturacion, $factorCantidadVenta) { return number_format($precio, 4, '.', ''); } private function getImagen() { foreach ($this->producto->imagenes AS $indice => $imagenTemp) { $imagen = new Image(); $imagen->id_product = (int)($this->producto->id_producto); $imagen->position = Image::getHighestPosition($this->producto->id_producto) + 1; $imagen->cover = $imagenTemp->cover; $imagen->legend = $imagenTemp->legend; $url = $imagenTemp->link; if ($imagen->add()) { if (!$this->copyImagen($imagen->id_product, $imagen->id, $url)) { $imagen->delete(); } else { if ($this->versionPS != 14) { $this->addToShops(); } } } else { echo 'Error al insertar la imagen<br />'; } } } private function getdescripcionCorta($tipoUnidad) { $sql = 'SELECT
                    c.`texto`, c.`cantidad`, c.`descripcion`
                FROM 
                    `'._DB_PREFIX_.$this->tabla.'cantidades` AS c
                WHERE
                    trim(c.`texto`) = "'.trim(strtoupper($tipoUnidad)).'"'; $result = Db::getInstance()->executeS($sql); $result = $result[0]; $texto = $this->l('Producto compuesto por ').$result['cantidad'].' '.$this->l('unidades').' ('.$result['descripcion'].')'; return $texto; } public function getLineaActualArchivo($idArchivo, $tipo) { return Db::getInstance()->getValue('SELECT `lineas_procesadas` FROM `'._DB_PREFIX_.$this->tabla.'archivos_aux` WHERE `idArchivo`='.$idArchivo.' AND `tipoArchivo`="'.$tipo.'"'); } public function getElementoActualArchivo($idArchivo, $tipo) { return Db::getInstance()->getValue('SELECT `ultimo_elemento_procesado` FROM `'._DB_PREFIX_.$this->tabla.'archivos_aux` WHERE `idArchivo`='.$idArchivo.' AND `tipoArchivo`="'.$tipo.'"'); } public function updateNumLineas($idArchivo, $tipo, $ultimaLinea, $numLineas = 0) { if ($this->updateFechaProcesadoArchivo($idArchivo)) { return Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.$this->tabla.'archivos_aux` SET `ultimo_elemento_procesado` ="'.$ultimaLinea.'", `lineas_procesadas`=lineas_procesadas + 1 WHERE `idArchivo`='.$idArchivo.' AND `tipoArchivo`="'.$tipo.'"'); } else { return FALSE; } } public function resetNumLineas($idArchivo, $tipo, $ultimaLinea = '', $numLineas = 0) { if ($this->updateFechaProcesadoArchivo($idArchivo)) { return Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.$this->tabla.'archivos_aux` SET `ultimo_elemento_procesado` ="'.$ultimaLinea.'", `lineas_procesadas`= 0 WHERE `idArchivo`='.$idArchivo.' AND `tipoArchivo`="'.$tipo.'"'); } else { return FALSE; } } public function updateFechaProcesadoArchivo($idArchivo = 0) { if ($idArchivo != 0) { return Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.$this->tabla.'archivos` SET `fecha_ultimo_proceso` = now() WHERE id_'.$this->tabla.'archivos = '.$idArchivo); } } private function terminarArchivo($idArchivo, $tipo) { return Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.$this->tabla.'archivos_aux` SET `archivo_procesado`=1 WHERE `idArchivo`='.$idArchivo.' AND `tipoArchivo`="'.$tipo.'"'); } public function terminarArchivoCompleto($idArchivo) { Configuration::updateGlobalValue($this->sufijo.'NIVEL_PROCESADO', 0); Configuration::updateGlobalValue($this->sufijo.'ACTUALIZAR_IMAGEN', 0); $this->desactivarProductos(); $this->borrarArchivos($idArchivo); $this->eliminarCombinaciones(); $this->comprobarBaseDatos(); $enviarCorreos = Configuration::getGlobalValue($this->sufijo.'ENVIAR_EMAIL'); if ($enviarCorreos == 1) { $this->sendEmailError($this->l('Se han procesado  los  productos de DreamLove'), $this->l('Fin de proceso')); } return Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.$this->tabla.'archivos` SET `archivo_procesado`=1 WHERE `id_'.$this->tabla.'archivos`='.$idArchivo); } private function bajaProducto() { $producto = new Product($this->_idProducto); $producto->active = false; $this->addLogbyImax("Baja Producto: ".$producto->name[$idLang], 1, 9999, 'Producto', $producto->id, true); $producto->update(); } public function bajaProductoArchivo() { $idAtributoProducto = $this->searchEquivalenciaAtributoPorProductoLimpio($this->producto->id_product); if (!is_null($idAtributoProducto) && !is_array($idAtributoProducto) && $idAtributoProducto != '') { $idProducto = $this->searchProductoPorAtributo($idAtributoProducto); if ($this->versionPS != 14) { StockAvailable::setQuantity((int)$idProducto, (int)$idAtributoProducto, 0, $this->producto->id_shop_default); $producto = new Product($idProducto); $producto->deleteAttributeCombination((int)$idAtributoProducto); } else { $producto = new Product($idProducto); $cantidad = $producto->getQuantity($idProducto, $idAtributoProducto); $producto->addStockMvt((int)$cantidad * -1, 2, (int)$idAtributoProducto, 0); } $this->updateDefaultAttribute((int)$idProducto, (int)$idAtributoProducto); $this->addLogbyImax("Baja Producto: ".$this->producto->id_product." Nombre:".$producto->name[$this->idLang]." Id Prestashop:".$producto->id, 1, 99991, 'Producto', $producto->id, true); } else { $idProducto = $this->searchEquivalenciaProducto(); if (!is_null($idProducto) && $idProducto !== FALSE) { $producto = new Product($idProducto); if ($this->desactivarProductoPorStock($producto)) { if ($producto->active == 1) { $producto->active = 0; try { $producto->update(); StockAvailable::SetQuantity((int)$idProducto, NULL, 0, $producto->id_shop_default); $this->updateEquivalenciaProductoDesactivar($producto->id); $this->addLogbyImax("Baja Producto: ".$this->producto->id_product." Nombre:".$producto->name[$this->idLang]." ".$producto->id, 1, 99991, 'Producto', $producto->id, true); } catch (Exception $e) { echo "<pre>"; print_r($e); echo "</pre>"; echo "<pre>"; print_r($e->getTrace()); echo "</pre>"; die(); } } } } else { $this->addLogbyImax("Baja Inexistente Producto : ".$this->producto->id_product, 1, 9999, 'Producto', 99, true); } } return true; } private function borrarArchivos($idArchivo) { if (Tools::deleteDirectory(dirname(__FILE__) . '/import/', FALSE)) { return true; } return false; } private function comprobarBaseDatos() { Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.$this->tabla.'equi_attribute` WHERE `idAttributePrestashop` NOT IN (SELECT `id_attribute` FROM `'._DB_PREFIX_.'attribute`)'); Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.$this->tabla.'equi_attribute_groups` WHERE `idAttributeGroupPrestashop` NOT IN (SELECT a.`id_attribute_group` FROM `'._DB_PREFIX_.'attribute_group` AS a)'); Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.$this->tabla.'equi_attribute_product` WHERE `idAttributeProductPrestashop` NOT IN (SELECT `id_product_attribute` FROM `'._DB_PREFIX_.'product_attribute`)'); Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.$this->tabla.'equi_familias` WHERE `idFamiliaPrestashop` NOT IN (SELECT `id_category` FROM `'._DB_PREFIX_.'category`)'); Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.$this->tabla.'equi_manufacturers` WHERE `idManufacturerPrestashop` NOT IN (SELECT `id_manufacturer` FROM `'._DB_PREFIX_.'manufacturer`)'); Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.$this->tabla.'equi_products` WHERE `idProductoPrestashop` NOT IN (SELECT `id_product` FROM `'._DB_PREFIX_.'product`)'); Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.$this->tabla.'equi_suppliers` WHERE `idSupplierPrestashop` NOT IN (SELECT `id_supplier` FROM `'._DB_PREFIX_.'supplier`)'); } private function desactivarProductos() { $desactivarProds = Configuration::getGlobalValue($this->sufijo.'DESACTIVAR_PRODS'); $i = 0; if ($desactivarProds == 0) { return true; } $sql = 'SELECT
                    p.`id_product` AS idProductoPrestashop
                FROM 
                    `'._DB_PREFIX_.$this->tabla.'equi_products` AS g
                    INNER JOIN `'._DB_PREFIX_.'product` AS p ON g.`idProductoPrestashop` = p.`id_product`
                WHERE
                    g.`procesadoUltimoFichero` = 0
                    AND p.`active` = 1'; $result = DB::getInstance()->executeS($sql); foreach ($result AS $idProducto) { $producto = new Product($idProducto['idProductoPrestashop']); if ($this->desactivarProductoPorStock($producto)) { if (!is_null($producto->id)) { if ($producto->active == true) { $producto->active = false; try { $producto->update(); $this->addLogbyImax("Producto dado de Baja: ".$producto->id, 1, 999, 'Product', $producto->id, true); StockAvailable::SetQuantity((int)$producto->id, NULL, 0, $producto->id_shop_default); } catch (Exception $e) { echo "<hr>"; echo "<h1>ERROR</h1>"; echo "<pre>"; print_r($producto); echo "</pre>"; echo "<pre>"; print_r($e); echo "</pre>"; $this->addLogbyImax("Error Dando producto dado de Baja: ".$this->good_print($producto)." ".$this->good_print($e), 4, 999, 'Product', $producto->id, true); } } } } else { if (!is_null($producto->id)) { if ($producto->active == true) { $producto->active = false; try { $producto->update(); $this->addLogbyImax("Producto dado de Baja: ".$producto->id, 1, 999, 'Product', $producto->id, true); StockAvailable::SetQuantity((int)$producto->id, NULL, 0, $producto->id_shop_default); } catch (Exception $e) { echo "<hr>"; echo "<h1>ERROR</h1>"; echo "<pre>"; print_r($producto); echo "</pre>"; echo "<pre>"; print_r($e); echo "</pre>"; $this->addLogbyImax("Error Dando producto dado de Baja: ".$this->good_print($producto)." ".$this->good_print($e), 4, 999, 'Product', $producto->id, true); } } } } } } private function eliminarCombinaciones() { $sql = 'SELECT 
                    c.`idAttributeProductPrestashop`,
                    p.`id_product`
                FROM 
                    `'._DB_PREFIX_.'product_attribute` AS p 
                    INNER JOIN `'._DB_PREFIX_.$this->tabla.'equi_attribute_product` AS c
                        ON p.`id_product_attribute` = c.`idAttributeProductPrestashop`
                WHERE  
                    c.`procesadoUltimoFichero` = 0'; $result = DB::getInstance()->executeS($sql); if (is_array($result)) { foreach ($result AS $datos) { $producto = new Product($datos['id_product']); if ($this->versionPS == 14) { $producto->deleteAttributeCombinaison($datos['idAttributeProductPrestashop']); } else { $producto->deleteAttributeCombination($datos['idAttributeProductPrestashop']); } $this->updateDefaultAttribute($datos['id_product']); } } $sql = 'DELETE FROM `'._DB_PREFIX_.$this->tabla.'equi_attribute_product` WHERE `procesadoUltimoFichero` = 0'; return Db::getInstance()->execute($sql); } private function insertarMapeoCategorias($idArchivo, $idPrestashop) { return Db::getInstance()->execute('INSERT IGNORE INTO '._DB_PREFIX_.$this->tabla.'equi_familias (idFamilia, idFamiliaPrestashop) VALUES ("'.$idArchivo.'",'.$idPrestashop.')'); } private function insertarMapeoManufacturers($idArchivo, $idPrestashop) { if (Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.$this->tabla.'equi_manufacturers WHERE idManufacturer="'.$idArchivo.'" AND idManufacturerPrestashop='.$idPrestashop) == 0) { Db::getInstance()->execute('INSERT IGNORE INTO '._DB_PREFIX_.$this->tabla.'equi_manufacturers (idManufacturer, idManufacturerPrestashop) VALUES ("'.$idArchivo.'",'.$idPrestashop.')'); return Db::getInstance()->getMsgError(); } } private function insertarMapeoSuppliers($idArchivo, $idPrestashop) { if (Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.$this->tabla.'equi_suppliers WHERE idSupplier="'.$idArchivo.'" AND idSupplierPrestashop='.$idPrestashop) == 0) { return Db::getInstance()->execute('INSERT IGNORE INTO '._DB_PREFIX_.$this->tabla.'equi_suppliers(idSupplier, idSupplierPrestashop) VALUES ("'.$idArchivo.'",'.$idPrestashop.')'); } } private function insertarMapeoGrupoAtributos($idArchivo, $idPrestashop) { if (Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.$this->tabla.'equi_attribute_groups WHERE idAttributeGroup="'.$idArchivo.'" AND idAttributeGroupPrestashop='.$idPrestashop) == 0) { return Db::getInstance()->execute('INSERT IGNORE INTO '._DB_PREFIX_.$this->tabla.'equi_attribute_groups(idAttributeGroup, idAttributeGroupPrestashop) VALUES ("'.$idArchivo.'",'.$idPrestashop.')'); } } private function insertarMapeoAtributos($idArchivo, $idPrestashop) { if (Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.$this->tabla.'equi_attribute WHERE idAttribute="'.$idArchivo.'" AND idAttributePrestashop='.$idPrestashop) == 0) { return Db::getInstance()->execute('INSERT IGNORE INTO '._DB_PREFIX_.$this->tabla.'equi_attribute(idAttribute, idAttributePrestashop) VALUES ("'.$idArchivo.'",'.$idPrestashop.')'); } } private function insertarMapeoAtributosProductos($idArchivo, $idPrestashop) { if (Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.$this->tabla.'equi_attribute_product WHERE idAttributeProduct="'.$idArchivo.'" AND idAttributeProductPrestashop='.$idPrestashop) == 0) { return Db::getInstance()->execute('INSERT IGNORE INTO '._DB_PREFIX_.$this->tabla.'equi_attribute_product(idAttributeProduct, idAttributeProductPrestashop) VALUES ("'.$idArchivo.'",'.$idPrestashop.')'); } else { return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.$this->tabla.'equi_attribute_product SET procesadoUltimoFichero = 1 WHERE idAttributeProduct = "'.$idArchivo.'" AND idAttributeProductPrestashop = '.$idPrestashop); } } private function insertarMapeoProductos($idArchivo, $idPrestashop) { if (Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.$this->tabla.'equi_products WHERE idProducto="'.$idArchivo.'" AND idProductoPrestashop='.$idPrestashop) == 0) { return Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.$this->tabla.'equi_products(idProducto, idProductoPrestashop, procesadoUltimoFichero) VALUES ("'.$idArchivo.'",'.$idPrestashop.', 1)'); } else { return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.$this->tabla.'equi_products SET procesadoUltimoFichero = 1 WHERE idProducto =  "'.$idArchivo.'" AND idProductoPrestashop = '.$idPrestashop); } } private function updateProductoProcesaro($idProducto) { return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.$this->tabla.'equi_products SET procesadoUltimoFichero = 1 WHERE idProductoPrestashop = '.$idProducto); } private function insertarMapeoCaracteristicas($idArchivo, $idPrestashop) { $idPrestashop = (int)$idPrestashop; $idArchivo = pSQL($idArchivo); if (Db::getInstance()->getValue('SELECT 1 FROM '._DB_PREFIX_.$this->tabla."equi_carac WHERE idCaracteristicaPrestaShop = $idPrestashop")) { $resultado = Db::getInstance()->execute('UPDATE '._DB_PREFIX_.$this->tabla."equi_carac SET procesadoUltimoFichero = 1 WHERE idCaracteristicaPrestaShop = $idPrestashop"); } else { $resultado = Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.$this->tabla."equi_carac(idCaracteristica, idCaracteristicaPrestaShop, procesadoUltimoFichero) VALUES ('$idArchivo', '$idPrestashop', 1)"); } return $resultado; } public function cleanName($name) { if (function_exists('mb_strtolower')) { $name = mb_strtolower($name, 'utf-8'); } $name = trim($name); if (!function_exists('mb_strtolower')) { $name = Tools::replaceAccentedChars($name); } $name = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL]/u', '', $name); $name = preg_replace('/[\s\'\:\/\[\]-]+/', ' ', $name); $name = str_replace(array(' ', '/'), ' ', $name); return $name; } public function repairUtf8String($string) { include_once(dirname(__FILE__).'/encoders/utf8.php'); $string = EncodingUTF8::fixUTF8($string); return $string; } public static function convertDate($date) { $day = substr($date, 0, 2); $month = substr($date, 3, 2); $year = substr($date, -4); return($year.'-'.$month.'-'.$day); } public function searchEquivalenciaCategoria($idCategory = '', $esProducto = 0) { if ($esProducto == 1) { if ($idCategory != '') { $idCategory = Db::getInstance()->getValue('SELECT idFamiliaPrestashop FROM '._DB_PREFIX_.$this->tabla.'equi_familias WHERE idFamilia="'.$idCategory.'"'); if ($idCategory == '' || $idCategory == 0) { return Configuration::getGlobalValue($this->sufijo.'CATEGORIA_PADRE'); } return $idCategory; } if (!empty($this->categoria->id_category)) { $idCategory = Db::getInstance()->getValue('SELECT idFamiliaPrestashop FROM '._DB_PREFIX_.$this->tabla.'equi_familias WHERE idFamilia="'.$this->categoria->id_category.'"'); if ($idCategory == '' || $idCategory == 0) { return Configuration::getGlobalValue($this->sufijo.'CATEGORIA_PADRE'); } return $idCategory; } } else { if ($idCategory != '') { return Db::getInstance()->getValue('SELECT idFamiliaPrestashop FROM '._DB_PREFIX_.$this->tabla.'equi_familias WHERE idFamilia="'.$idCategory.'"'); } if (!empty($this->categoria->id_category)) { return Db::getInstance()->getValue('SELECT idFamiliaPrestashop FROM '._DB_PREFIX_.$this->tabla.'equi_familias WHERE idFamilia="'.$this->categoria->id_category.'"'); } } return NULL; } public function searchParentCategoria() { if (!empty($this->categoria->id_parent) || $this->categoria->id_parent != '') { if (($idCategoriaPadre = Db::getInstance()->getValue('SELECT idFamiliaPrestashop FROM '._DB_PREFIX_.$this->tabla.'equi_familias WHERE idFamilia="'.$this->categoria->id_parent.'"')) != '') { $this->categoria->id_parent = $idCategoriaPadre; } else { $this->categoria->id_parent = Configuration::getGlobalValue($this->sufijo.'CATEGORIA_PADRE'); } } else { $this->categoria->id_parent = Configuration::getGlobalValue($this->sufijo.'CATEGORIA_PADRE'); } } public function searchEquivalenciaManufacturer($idManufacturer = '') { if ($idManufacturer != '') { $idManufacturer = Db::getInstance()->getValue('SELECT idManufacturerPrestashop FROM '._DB_PREFIX_.$this->tabla.'equi_manufacturers WHERE idManufacturer="'.$idManufacturer.'"'); if ($idManufacturer == '') { if (isset($this->manufacturer->name)) { return Manufacturer::getIdByName(trim($this->manufacturer->name)); } else { return NULL; } } else { return $idManufacturer; } } if (!empty($this->manufacturer->id_manufacturer)) { $idManufacturer = Db::getInstance()->getValue('SELECT idManufacturerPrestashop FROM '._DB_PREFIX_.$this->tabla.'equi_manufacturers WHERE idManufacturer="'.$this->manufacturer->id_manufacturer.'"'); if ($idManufacturer == '') { return Manufacturer::getIdByName($this->manufacturer->name); } else { return $idManufacturer; } } return NULL; } public function searchEquivalenciaSupplier($idSupplier = '') { if (!empty($this->supplier->id_supplier)) { $idSupplier = Db::getInstance()->getValue('SELECT idSupplierPrestashop FROM '._DB_PREFIX_.$this->tabla.'equi_suppliers WHERE idSupplier="'.$this->supplier->id_supplier.'"'); if ($idSupplier == '') { return Supplier::getIdByName($this->supplier->name); } else { return $idSupplier; } } if ($idSupplier == '') { return $this->getProveedorPorDefecto(); } if ($idSupplier != '') { $idSupplier = Db::getInstance()->getValue('SELECT idSupplierPrestashop FROM '._DB_PREFIX_.$this->tabla.'equi_suppliers WHERE idSupplier="'.$idSupplier.'"'); if ($idSupplier == '') { return Supplier::getIdByName($this->supplier->name); } else { return $idSupplier; } } return NULL; } public function searchEquivalenciaProducto() { if (!empty($this->producto->id_product)) { $idProducto = Db::getInstance()->getValue('SELECT idProductoPrestashop FROM '._DB_PREFIX_.$this->tabla.'equi_products WHERE idProducto="'.$this->producto->id_product.'"'); if ($idProducto) return $idProducto; } if (!empty($this->producto->reference)) { $idProducto = Db::getInstance()->getValue('SELECT p.id_product FROM '._DB_PREFIX_.'product AS p WHERE trim(p.reference)="'.trim($this->producto->reference).'"'); if ($idProducto) { $this->insertarMapeoProductos($this->producto->reference, $idProducto); return $idProducto; } } return NULL; } public function productoProcesadoUltimoFichero($idProducto) { $sql = 'SELECT ' .' procesadoUltimoFichero ' .' FROM '._DB_PREFIX_.$this->tabla.'equi_products ' .' WHERE' .' idProductoPrestashop = '.$idProducto; if (Db::getInstance()->getValue($sql) == 0) { return false; } return true; } public function searchEquivalenciaGrupoAtributos() { if (!empty($this->atributo->id_attribute_group)) { return Db::getInstance()->getValue('SELECT idAttributeGroupPrestashop FROM '._DB_PREFIX_.$this->tabla.'equi_attribute_groups WHERE idAttributeGroup="'.$this->atributo->id_attribute_group.'"'); } return NULL; } public function searchEquivalenciaAtributos($idAtributo) { if ($idAtributo) { $sql = 'SELECT idAttributePrestashop FROM '._DB_PREFIX_.$this->tabla.'equi_attribute WHERE idAttribute="'.$idAtributo.'"'; return Db::getInstance()->getValue($sql); } return NULL; } public function searchEquivalenciaAtributoPorProducto($id_product_attribute) { if ($id_product_attribute) { $sql = 'SELECT idAttributeProductPrestashop FROM '._DB_PREFIX_.$this->tabla.'equi_attribute_product WHERE idAttributeProduct="'.$id_product_attribute.'"'; return Db::getInstance()->getValue($sql); } return NULL; } public function searchEquivalenciaAtributoPorProductoLimpio($id_product_attribute) { if ($id_product_attribute) { return Db::getInstance()->getValue('SELECT idAttributeProductPrestashop FROM '._DB_PREFIX_.$this->tabla.'equi_attribute_product WHERE idAttributeProduct LIKE "'.$id_product_attribute.'-%"'); } return NULL; } public function searchProductoPorAtributo($id_product_attribute) { if ($id_product_attribute) { $sql = 'SELECT `id_product` FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product_attribute` ='.$id_product_attribute; return DB::getInstance()->getValue($sql); } } public function getTaxRulesGroup($taxValue) { $mapeoImpuestos = Configuration::getGlobalValue($this->sufijo.'MAPEO_IMPUESTOS'); try { $mapeoImpuestos = unserialize($mapeoImpuestos); } catch (Exception $exc) { } if (isset($mapeoImpuestos[(float)$taxValue])) { return $mapeoImpuestos[(float)$taxValue]; } else { $this->addLogbyImax("Error en el mapeado de impuestos: ", 4, 5555, 'Taxes', $mapeoImpuestos[$taxValue], true); } $idTax = ''; $taxes = Tax::getTaxes(); foreach ($taxes AS $tax) { if ($tax['rate'] == $taxValue) { $idTax = $tax['id_tax']; } } $idTaxGroup = $this->getTaxGroup($idTax); if ($idTax == '') { $tax = New Tax(); $tax->rate = $taxValue; $tax->active = True; $tax->deleted = 0; $tax->name = array(Configuration::getGlobalValue('PS_LANG_DEFAULT') => 'Impuesto Modulo Import - '.$taxValue); $tax->add(); $idTax = $tax->id; $idTaxGroup = $this->createTaxRule($idTax, $taxValue); } return $idTaxGroup; } function getTaxGroup($idTax) { $idCountry = Configuration::getGlobalValue('PS_COUNTRY_DEFAULT'); if ($idTax != '') { return Db::getInstance()->getValue("SELECT id_tax_rules_group AS idTaxRule FROM "._DB_PREFIX_."tax_rule WHERE id_tax=".$idTax." AND id_country=".$idCountry); } else { return false; } } function createTaxRule($idTax, $taxValue) { $sql = "INSERT INTO "._DB_PREFIX_."tax_rules_group (name, active) VALUES ('Impuesto Modulo Import- ".$taxValue."',1)"; Db::getInstance()->Execute($sql); $idTaxRuleGroup = Db::getInstance()->Insert_ID(); if ($this->versionPS != 14) { $shops = Shop::getShops(); foreach ($shops AS $shop) { $idShops[] = $shop['id_shop']; } $taxRulesGroup = New TaxRulesGroup($idTaxRuleGroup); $taxRulesGroup->associateTo($idShops); } $countries = Country::getCountries($this->idLang, true); foreach ($countries as $country) { $sql = "INSERT INTO `"._DB_PREFIX_."tax_rule` (id_tax_rules_group,id_country,id_tax) VALUES (".$idTaxRuleGroup.",".$country['id_country'].",".$idTax.")"; Db::getInstance()->Execute($sql); } return $idTaxRuleGroup; } function getProveedorPorDefecto() { return Db::getInstance()->getValue("SELECT MAX(id_proveedor) AS proveedor FROM "._DB_PREFIX_.$this->tabla."archivos WHERE archivo_procesado=0"); } function getGroupByAttribute($idAtributo) { return Db::getInstance()->getValue('SELECT id_attribute_group FROM '._DB_PREFIX_.'attribute WHERE id_attribute='.$idAtributo); } function disableProduct() { $result = Db::getInstance()->executeS('SELECT `idProductoPrestashop` FROM `'._DB_PREFIX_.$this->tabla.'equi_products` WHERE procesadoUltimoFichero=0'); foreach ($result AS $datos) { $producto = New Product($datos['idProductoPrestashop']); $producto->active = 0; $producto->update(); unset($producto); } } function obtenerDatosEstadisticos() { $respuesta = array(); $query = "SELECT count(*) as Veces
                  FROM "._DB_PREFIX_.$this->tabla."archivos as p 
                  WHERE p.archivo_procesado = 1"; $respuesta['archivoProcesado'] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); $query = "SELECT count(*)
                  FROM "._DB_PREFIX_.$this->tabla."hashtalla_combinaciones"; $respuesta['atributosProcesados'] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); $query = "SELECT count(*)
                  FROM "._DB_PREFIX_.$this->tabla."equi_attribute_product"; $respuesta['productosConAtributos'] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); $query = "SELECT count(*)
                  FROM "._DB_PREFIX_.$this->tabla."equi_products"; $respuesta['productosProcesados'] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); $query = "SELECT count(*)
                  FROM "._DB_PREFIX_.$this->tabla."equi_products
                  WHERE procesadoUltimoFichero=1"; $respuesta['productosProcesadosLast'] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); $query = "SELECT p.id_".$this->tabla."archivos, p.archivo_procesado as Finalizado, 
                        date_format(p.fecha_ultimo_proceso,'%d/%m/%Y %H:%i:%s') as Fecha,
                        date_format(p.fecha_descarga,'%d/%m/%Y %H:%i:%s') as Descarga
                  FROM "._DB_PREFIX_.$this->tabla."archivos as p 
                  ORDER BY id_".$this->tabla."archivos DESC
                  LIMIT 0,2"; $result_query = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($query); $procesoActivo = Configuration::getGlobalValue($this->sufijo.'PROCESO_ACTIVO'); foreach ($result_query AS &$elemento) { if ($elemento['Finalizado'] == 0) { if ($procesoActivo == 1) { $elemento['iconoProceso'] = $this->_path.'/css/clock.gif'; $elemento['iconoAlt'] = $this->l('En proceso actualmente'); $elemento['iconoTitle'] = $this->l('En proceso actualmente'); } else { $elemento['iconoProceso'] = $this->_path.'/css/espera.gif'; $elemento['iconoAlt'] = $this->l('En espera actualmente'); $elemento['iconoTitle'] = $this->l('En espera actualmente'); } } else { $elemento['iconoProceso'] = _PS_ADMIN_IMG_.'ok.gif'; $elemento['iconoAlt'] = $this->l('Fichero Finalizado'); $elemento['iconoTitle'] = $this->l('Fichero Finalizado'); } } $respuesta['result_query'] = $result_query; $queryImagenes = 'SELECT count(*) AS imagenesPendientes FROM '._DB_PREFIX_.$this->tabla.'imagenesPendientes'; $resultQueryImagenesPendientes = Db::getInstance()->ExecuteS($queryImagenes); $respuesta['imagenesPendientes'] = 0; if (isset($resultQueryImagenesPendientes[0]['imagenesPendientes'])) { $respuesta['imagenesPendientes'] = $resultQueryImagenesPendientes[0]['imagenesPendientes']; } $queryCategorias = 'SELECT count(*) AS categoriasProcesadas FROM '._DB_PREFIX_.$this->tabla.'equi_familias'; $resultQueryCategorias = Db::getInstance()->ExecuteS($queryCategorias); $respuesta['categoriasProcesadas'] = 0; if (isset($resultQueryCategorias[0]['categoriasProcesadas'])) { $respuesta['categoriasProcesadas'] = $resultQueryCategorias[0]['categoriasProcesadas']; } $respuesta['tipoArchivo'] = array( 'ATRI' => $this->l('Atributos'), 'BAJA' => $this->l('Bajas'), 'STOC' => $this->l('Stocks') ); $sqlArchivo = 'SELECT
                           a.tipoArchivo
                        FROM '._DB_PREFIX_.$this->tabla.'archivos_aux AS a
                        WHERE
                                a.archivo_procesado = 0
                        ORDER BY a.orden_procesado asc
                        LIMIT 0,1'; $resultArchivo = Db::getInstance()->executeS($sqlArchivo); $respuesta['textoNivelProcesado'] = ''; if (isset($resultArchivo[0])) { if ($resultArchivo[0]['tipoArchivo'] == 'PROD') { $nivelProcesado = Configuration::getGlobalValue($this->sufijo.'NIVEL_PROCESADO'); if ($nivelProcesado == 0) { $respuesta['textoNivelProcesado'] .= $this->l('Productos'); } else { $respuesta['textoNivelProcesado'] .= $this->l('Combinaciones'); } } else { $respuesta['textoNivelProcesado'] .= $respuesta['tipoArchivo'][$resultArchivo[0]['tipoArchivo']]; } } else { $respuesta['textoNivelProcesado'] = $this->l('Todos los archivos procesados'); } return $respuesta; } function mostrarEstadisticas() { $html = "<fieldset>"; $html .='<legend>'.$this->l('Version Prestashop ')._PS_VERSION_.' - '.$this->l('Fecha Compilacion: ').$this->fecha.' - '.$this->l('Version: ').$this->version.'</legend>'; $datosEstadisticos = $this->obtenerDatosEstadisticos(); $textoNivelProcesado = $this->l('Procesando Actualmente: '); $html .= '<table class="table tableDnD tablaDreamlove">'; $html .= '<thead><tr>'; $html .= '<th colspan="4">'.$textoNivelProcesado.':'.$datosEstadisticos['textoNivelProcesado'].'</th>'; $html .= '<th>'; $html .= '<ul>'; $html .= '<li>'.$this->l('Productos procesados(Total/Actual):').$datosEstadisticos['productosProcesados'].'/'.$datosEstadisticos['productosProcesadosLast'].'</li>'; $html .= '<li>'.$this->l('Productos con atributos:').$datosEstadisticos['productosConAtributos'].'</li>'; $html .= '<li>'.$this->l('Combinaciones procesadas: ').$datosEstadisticos['atributosProcesados'].'<li>'; $html .= '<li>'.$this->l('Categorias procesadas: ').$datosEstadisticos['categoriasProcesadas'].'<li>'; $html .= '<li>'.$this->l('Imagenes Pendientes: ').$datosEstadisticos['imagenesPendientes'].'<li>'; $html .= '<li>'.$this->l('Procesos Finalizados: ').$datosEstadisticos['archivoProcesado'].'<li>'; $html .= '</th>'; $html .= '</tr></thead>'; $html .= '<tbody>'; $procesoActivo = Configuration::getGlobalValue($this->sufijo.'PROCESO_ACTIVO'); if ($procesoActivo == 1) { $iconoProceso = 'clock.gif'; $iconoAlt = $this->l('En proceso actualmente'); } else { $iconoProceso = 'espera.gif'; $iconoAlt = $this->l('En espera actualmente'); } foreach ($datosEstadisticos['result_query'] as $resultado) { $html .='<tr class="dreamLoveImportFile">'; $html .= '<td colspan="2">'.$this->l("Fecha Descarga: ").$resultado['Descarga'].'</td>'; $html .= '<td colspan="2">'.$this->l(" Fecha Ultima Proceso: ").$resultado['Fecha'].'</td>'; if ($resultado['Finalizado'] == 0) { $html .= '<td>'.$this->l('Estado general').'<img alt="Fichero Incompleto" title="'.$iconoAlt.'" src="'.$this->_path.'/css/'.$iconoProceso.'"></td>'; } else { $html .= '<td>'.$this->l('Estado general').'<img alt="Fichero Finalizado" title="Fichero Finalizado" src="'._PS_ADMIN_IMG_.'ok.gif"></td>'; } $html .= "</tr>"; $sql = 'SELECT * FROM '._DB_PREFIX_.$this->tabla.'archivos_aux WHERE idArchivo='.$resultado['id_'.$this->tabla.'archivos'].' ORDER BY orden_procesado ASC'; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); $html .='<tr class="cabeceraSubtabla">'; $html .='<td>'.$this->l('Nombre del Archivo').'</td>'; $html .='<td>'.$this->l('Tipo').'</td>'; $html .='<td>'.$this->l('Ultimo elemento procesado').'</td>'; $html .='<td>'.$this->l('Lineas Procesadas').'</td>'; $html .='<td>'.$this->l('Estado').'</td>'; $html .= "</tr>"; foreach ($result AS $subresultado) { $html .='<tr>'; $html .= '<td>'.$subresultado['nombre_archivo'].'</td>'; $html .= '<td>'.$subresultado['tipoArchivo'].'</td>'; $html .= '<td>'.$subresultado['ultimo_elemento_procesado'].'</td>'; $html .= '<td>'.$subresultado['lineas_procesadas'].'</td>'; if ($subresultado['archivo_procesado'] == 0) { $html .= '<td><img alt="Fichero Incompleto" title="'.$iconoAlt.'" src="'.$this->_path.'/css/'.$iconoProceso.'"></td>'; } else { $html .= '<td><img alt="Proceso Finalizado" title="Proceso Finalizado" src="'._PS_ADMIN_IMG_.'ok.gif"></td>'; } $html .= "</tr>"; $html .= "<tr><td colspan='5'>&nbsp;</td></tr>"; } } $html .= '</tbody>'; $html .= '</table>'; $html .= "</fieldset>"; return $html; } function mostrarUltimosProductos($fechaInicio = 0, $fechaFin = 0, $ajax = 0) { $limit = ''; $order = ' ORDER BY cl.`id_category` ASC, p.`id_product` DESC'; if ($ajax == 0) { $contexto = Context::getContext(); if (isset($contexto->cookie->id_employee) && !empty($contexto->cookie->id_employee)) { $idEmployee = $contexto->cookie->id_employee; } else { $temp = Employee::getEmployees(); $employee = $temp[0]; $idEmployee = $employee['id_employee']; } $contexto->employee = New Employee($idEmployee); } else { $limit = ' LIMIT 0, 10'; $order = ' ORDER BY p.`id_product` DESC '; } $whereInicio = ''; if ($fechaInicio != 0) { $whereInicio = ' AND DATE(p.date_add) >= "'.$fechaInicio.'"'; } else { $whereInicio = ' AND DATE(p.date_add) >= "'.date('Y-m-d').'"'; } $whereFin = ''; if ($fechaFin != 0) { $whereFin = ' AND DATE(p.date_add) <= "'.$fechaFin.'"'; } $html = '<fieldset>'; $html .='<legend>'.$this->l('Version Prestashop ')._PS_VERSION_.' </legend>'; if ($ajax == 0) { $html .='<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post">'; $html .= '<input type="hidden" name="id_tab" value="8" />'; $html .= '<input type="hidden" name="accion" value="filtrarFechas" />'; $html .= '<div class="filtroFechas"><ul><li><label>'.$this->l('Importado desde').'</label>'; $html .= '<input id="sp_from" class="date" type="text" style="text-align: center" value="" name="desde"></li>'; $html .= '<li><label>'.$this->l('Importado hasta').'</label>'; $html .= '<input id="sp_to" class="date" type="text" style="text-align: center" value="" name="hasta"></li></ul></div>'; $html .= '<input type="submit" name="enviar" value="'.$this->l('Filtrar Fechas').'" />'; $html .= '</form>'; } $sql = 'SELECT
                  p.`id_product`,p.`reference`,  l.`name`, cl.`name` AS nombreCategoria, p.`id_category_default`, ' .' DATE_FORMAT(p.date_upd,"%d/%m/%Y %h:%i:%s") AS fecha' .' FROM ' .' `'._DB_PREFIX_.'product` AS p ' .' INNER JOIN `'._DB_PREFIX_.'product_lang` AS l ' .' ON ' .'     p.`id_product` = l.`id_product` ' .'     AND l.`id_lang` = '.$this->idLang .'      AND p.`id_shop_default` = l.`id_shop` ' .' INNER JOIN `'._DB_PREFIX_.'category_lang` AS cl ' .' ON ' .'     cl.`id_category` = p.`id_category_default` ' .'     AND cl.`id_lang` = '.$this->idLang .'      AND p.`id_shop_default` = cl.`id_shop` ' .' INNER JOIN `'._DB_PREFIX_.$this->tabla.'equi_products` AS pd ' .' ON ' .'     p.`id_product` = pd.`idProductoPrestashop` ' .' WHERE ' .' p.`id_shop_default` = '.$this->idShop .' '.$whereInicio .' '.$whereFin .' '.$order .' '.$limit; $result_query = Db::getInstance()->executeS($sql); $html .= '<table class="table tableDnD tablaImportProductos">'; $html .= '<thead><tr>'; $html .= '<th>'.$this->l('Id Producto').'</th>'; $html .= '<th>'.$this->l('Referencia').'</th>'; $html .= '<th>'.$this->l('Nombre').'</th>'; $html .= '<th>'.$this->l('Categora').'</th>'; $html .= '<th>'.$this->l('Fecha').'</th>'; $html .= '</tr></thead>'; $html .= '<tbody>'; foreach ($result_query AS $resultado) { if ($this->versionPS == 14) { $token = Tools::getAdminTokenLite('AdminCatalog'); $link = 'index.php?tab=AdminCatalog&id_category='.$resultado['id_category_default'].'&id_product='.$resultado['id_product'].'&addproduct&tabs=2&conf=4&token='.$token; } else { $token = Tools::getAdminTokenLite('AdminProducts'); $link = 'index.php?controller=AdminProducts&id_product='.$resultado['id_product'].'&updateproduct&token='.$token; } $html .= '<tr>'; $html .= '<td><a target="_BLANK" href="'.$link.'">'.$resultado['id_product'].'</a></td>'; $html .= '<td><a target="_BLANK" href="'.$link.'">'.$resultado['reference'].'</a></td>'; $html .= '<td><a target="_BLANK" href="'.$link.'">'.$resultado['name'].'</a></td>'; $html .= '<td><a target="_BLANK" href="'.$link.'">'.$resultado['nombreCategoria'].'</a></td>'; $html .= '<td><a target="_BLANK" href="'.$link.'">'.$resultado['fecha'].'</a></td>'; $html .= '</tr>'; } $html .= '</tbody></table>'; $html .= '</fieldset>'; if ($ajax == 0) { $id = array('sp_from', 'sp_to'); if ($this->versionPS == 14) { includeDatepicker($id, false); } else { $this->context->controller->addJQueryUI('ui.datepicker'); $html .= $this->moduleDatepicker("date", false); } } return $html; } private function moduleDatepicker($class, $time) { $return = ""; if ($time) $return = '
        var dateObj = new Date();
        var hours = dateObj.getHours();
        var mins = dateObj.getMinutes();
        var secs = dateObj.getSeconds();
        if (hours < 10) { hours = "0" + hours; }
        if (mins < 10) { mins = "0" + mins; }
        if (secs < 10) { secs = "0" + secs; }
        var time = " "+hours+":"+mins+":"+secs;'; $return .= '
            $(function() {
                $(".'.Tools::htmlentitiesUTF8($class).'").datepicker({
                    prevText:"",
                    nextText:"",
                    dateFormat:"dd/mm/yy"'.($time ? '+time' : '').'});
            });'; return '<script type="text/javascript">'.$return.'</script>'; } function actualizarContadores($contador) { $numElementos = Configuration::getGlobalValue($contador); $numElementos = (int)$numElementos; $numElementos++; Configuration::updateGlobalValue($contador, $numElementos); } public function updateDefaultAttribute($id_product, $idAtributoProducto = 0) { $producto = new Product($id_product); $idAtributoPorDefecto = Product::getDefaultAttribute($id_product, 1); $this->setDefaultAttribute($producto, $idAtributoPorDefecto); $quantity = $this->getProductQuantity($id_product); if ($this->versionPS != 14) { StockAvailable::setQuantity($id_product, 0, (int)$quantity, $producto->id_shop_default); } if ((int)$quantity > Configuration::get($this->sufijo.'STOCK_MINIMO')) { $producto->active = 1; $producto->available_for_order = 1; try { $producto->update(); } catch (Exception $exc) { echo "<pre>"; print_r($exc); die(); } } } public function setDefaultAttribute($producto, $idProductAttribute) { $producto->deleteDefaultAttributes(); $producto->setDefaultAttribute($idProductAttribute); return Product::updateDefaultAttribute($producto->id); } public function getProductQuantity($idProduct) { if (Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'product_attribute WHERE id_product='.$idProduct) > 0) { $sql = 'SELECT
						s.quantity
					FROM 
						'._DB_PREFIX_.'stock_available AS s
					WHERE
						s.id_product = '.$idProduct.'
						AND (
							id_product_attribute = 0
							OR id_product_attribute IS NULL
							)'; $quantity = Db::getInstance()->getValue($sql); } else { $quantity = Db::getInstance()->getValue('SELECT quantity FROM '._DB_PREFIX_.'product WHERE id_product='.$idProduct); } return $quantity; } public function getDefaultAttribute($id_product) { $producto = new Product($id_product); if ($this->versionPS == 14) { $atributos = $producto->getAttributeCombinaisons($this->idLang); } else { $atributos = $producto->getAttributeCombinations($this->idLang); } if (is_array($atributos) && isset($atributos[0])) { $id_atributo = $atributos[0]['id_product_attribute']; return $id_atributo; } return FALSE; } public function addDatosToBBDD($idProveedor) { $resultado['codError'] = 0; $resultado['msg'] = $this->l('Proceso correcto'); $error = $this->addProductosToBBDD($idProveedor); if ($error == 0) { $error = $this->addCategoriasToBBDD(); if ($error == 0) { $error = $this->addAtributosToBBDD(); if ($error == 0) { $error = $this->addAttributosDeProductosToBBDD(); if ($error == 0) { $error = $this->addManufacturersToBBDD(); } } } } if ($error != 0) { $resultado['codError'] = 1; $resultado['msg'] = $this->l('Se ha producido un error en el proceso:  Codigo error - '.$error); } else { Configuration::updateGlobalValue($this->sufijo.'NEED_UPDATE', 0); } return $resultado; } public function addProductosToBBDD($idProveedor) { $where = ''; if ($idProveedor != 0) { $where = ' WHERE p.`id_supplier` = '.$idProveedor; } $sql = 'INSERT INTO `'._DB_PREFIX_.$this->tabla.'equi_products` 
                (`idProducto`,`idProductoPrestashop`,`procesadoUltimoFichero`)
                SELECT
                        p.`reference`,p.`id_product`,1
                FROM 
                        `'._DB_PREFIX_.'product` AS p'.$where; if (DB::getInstance()->execute($sql, FALSE)) { $error = 0; } else { $error = 2; } return $error; } public function addCategoriasToBBDD() { $error = 0; $sql = 'SELECT
            DISTINCT cp.`id_category`
        FROM 
            `'._DB_PREFIX_.$this->tabla.'equi_products` AS ip
            INNER JOIN `'._DB_PREFIX_.'category_product` AS cp ON ip.`idProductoPrestashop` = cp.`id_product`'; $result = Db::getInstance()->executeS($sql, true, FALSE); foreach ($result AS $elemento) { $categoriaObj = New Category($elemento['id_category']); $categorias = $categoriaObj->getParentsCategories($this->idLang); $categorias = array_reverse($categorias); $pathCompleto = ''; if (is_array($categorias) && !empty($categorias)) { foreach ($categorias AS $categoria) { if ($categoria['is_root_category'] == 0) { $sqlInsert = 'INSERT IGNORE INTO `'._DB_PREFIX_.$this->tabla.'equi_familias` (`idFamilia`, `idFamiliaPrestashop`) VALUES ("'.trim($categoria['name']).'",'.$categoria['id_category'].')'; if (!DB::getInstance()->execute($sqlInsert, FALSE)) { return 1; } } } } } return $error; } public function addAtributosToBBDD() { $sql = 'INSERT INTO `'._DB_PREFIX_.$this->tabla.'equi_attribute_groups`
                    (`idAttributeGroup`,`idAttributeGroupPrestashop`)
                 SELECT
                    DISTINCT gl.`name`, gl.`id_attribute_group`
                 FROM 
                    `'._DB_PREFIX_.'attribute_group_lang` AS gl
                    INNER JOIN `'._DB_PREFIX_.'attribute` AS a ON gl.`id_attribute_group` = a.`id_attribute_group` AND gl.`id_lang` = '.$this->idLang.'
                    INNER JOIN `'._DB_PREFIX_.'product_attribute_combination` AS ac ON a.`id_attribute` = ac.`id_attribute`
                    INNER JOIN `'._DB_PREFIX_.'product_attribute` AS pa ON ac.`id_product_attribute` = pa.`id_product_attribute`
                    INNER JOIN `'._DB_PREFIX_.$this->tabla.'equi_products` AS ip ON pa.`id_product` = ip.`idProductoPrestashop`'; if (DB::getInstance()->execute($sql, FALSE)) { $sql = 'INSERT INTO `'._DB_PREFIX_.$this->tabla.'equi_attribute`
                        (`idAttribute`,`idAttributePrestashop`)
                    SELECT
                       DISTINCT	trim(a.`name`), a.`id_attribute`
                    FROM
                       `'._DB_PREFIX_.'attribute_lang` AS a
                       INNER JOIN `'._DB_PREFIX_.'product_attribute_combination` AS pac ON a.`id_attribute` = pac.`id_attribute` AND a.`id_lang` = '.$this->idLang.'
                       INNER JOIN `'._DB_PREFIX_.'product_attribute` AS pa ON pa.`id_product_attribute` = pac.`id_product_attribute`
                       INNER JOIN `'._DB_PREFIX_.$this->tabla.'equi_products` AS ip ON pa.`id_product` = ip.`idProductoPrestashop`
                    ORDER BY a.`id_attribute` ASC'; if (DB::getInstance()->execute($sql, FALSE)) { $error = 0; } else { $error = 3; } } else { $error = 4; } return $error; } public function addAttributosDeProductosToBBDD() { $sql = 'INSERT INTO `'._DB_PREFIX_.$this->tabla.'equi_attribute_product`
                (`idAttributeProduct`,`idAttributeProductPrestashop`)
            SELECT 
            CONCAT(pa.`reference`,"-",al.`name`),pa.`id_product_attribute`
            FROM 
                    `'._DB_PREFIX_.'product_attribute` AS pa
                    INNER JOIN `'._DB_PREFIX_.$this->tabla.'equi_products` AS ip ON pa.`id_product` = ip.`idProductoPrestashop`
                    INNER JOIN `'._DB_PREFIX_.'product_attribute_combination` AS c ON pa.`id_product_attribute` = c.`id_product_attribute`
                    INNER JOIN `'._DB_PREFIX_.'attribute_lang` AS al ON c.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.$this->idLang.'
            ORDER BY pa.`id_product_attribute` ASC'; if (DB::getInstance()->execute($sql, FALSE)) { $error = 0; } else { $error = 5; } return $error; } public function addManufacturersToBBDD() { $sql = 'INSERT INTO `'._DB_PREFIX_.$this->tabla.'equi_manufacturers`
                    (`idManufacturer`,`idManufacturerPrestashop`)
                SELECT 
                    DISTINCT trim(m.`name`), m.`id_manufacturer`
                FROM 
                    `'._DB_PREFIX_.'manufacturer` AS m
                    INNER JOIN `'._DB_PREFIX_.'product` AS p ON m.`id_manufacturer` = p.`id_manufacturer`
                    INNER JOIN `'._DB_PREFIX_.$this->tabla.'equi_products` AS ip ON p.`id_product` = ip.`idProductoPrestashop`
                ORDER BY m.`id_manufacturer` ASC'; if (DB::getInstance()->execute($sql, FALSE)) { $error = 0; } else { $error = 6; } return $error; } function insertarImagenCategoria($idCategoria) { if (file_exists(_PS_CAT_IMG_DIR_.$idCategoria.'.jpg')) { clearstatcache(); return true; } $productos = $this->buscarProductoEnCategoria($idCategoria); if ($productos != NULL) { $link = new Link(); $producto = new Product($productos['id_product'], FALSE, $this->idLang); $covers = Product::getCover($producto->id); if (isset($covers['id_image'])) { $url = $link->getImageLink($producto->link_rewrite, $covers['id_image']); if (Configuration::getGlobalValue('PS_SSL_ENABLED') == 0) { $url = 'http://'.$url; } else { $url = 'https://'.$url; } $this->copyImagen($idCategoria, NULL, $url, 'categories'); } } } function buscarProductoEnCategoria($idCategoria) { $categoriaObj = New Category($idCategoria, $this->idLang); $contexto = Context::getContext(); if (!isset($contexto->controller)) { $controlador = new AdminController(); $contexto->controller = $controlador; } $productos = $categoriaObj->getProducts($this->idLang, 0, 100, null, null, false, false, true, 100, false, $contexto); if (isset($productos) && !empty($productos)) { shuffle($productos); return $productos[0]; } else { $categorias = $categoriaObj->getChildren($idCategoria, $this->idLang); foreach ($categorias AS $categoria) { $resultado = $this->buscarProductoEnCategoria($categoria['id_category']); if ($resultado != NULL) { return $resultado; } } } return NULL; } public static function good_print() { $log = ''; foreach (func_get_args() as $arg) $log .= print_r($arg, true); return $log; } public function addLogbyImax($message, $severity = 1, $error_code = null, $object_type = null, $object_id = null, $allow_duplicate = true, $id_employee = null) { $modoDebug = Configuration::getGlobalValue($this->sufijo.'MODO_DEBUG'); if (!$modoDebug) { return true; } $log = new Logger(); $log->severity = intval($severity); $log->error_code = intval($error_code); $log->message = pSQL(htmlentities($message), FALSE); $log->date_add = date('Y-m-d H:i:s'); $log->date_upd = date('Y-m-d H:i:s'); if ($id_employee === null && isset(Context::getContext()->employee) && Validate::isLoadedObject(Context::getContext()->employee)) $id_employee = Context::getContext()->employee->id; if ($id_employee !== null) $log->id_employee = (int)$id_employee; if (!empty($object_type) && !empty($object_id)) { $log->object_type = pSQL($object_type); $log->object_id = intval($object_id); } $log->id_shop_list = $this->getShops(); Logger::sendByMail($log); try { $res = $log->add(); } catch (Exception $e) { echo "<pre>"; print_r($e); echo "</pre>"; die(); } } function comprobarProceso() { $modoSolapado = Configuration::getGlobalValue($this->sufijo.'MODO_SOLAPADO'); if ($modoSolapado) { return true; } $procesoActivo = Configuration::getGlobalValue($this->sufijo.'PROCESO_ACTIVO'); if ($procesoActivo == 1) { $fechaUltimoProceso = Configuration::getGlobalValue($this->sufijo.'ULTIMO_PROCESO'); if ($fechaUltimoProceso == '') { $fechaUltimoProceso = date('U', 1); Configuration::updateGlobalValue($this->sufijo.'ULTIMO_PROCESO', $fechaUltimoProceso); } $tiempoMaximo = Configuration::getGlobalValue($this->sufijo.'TIEMPO_PROCESO'); $fechaActual = date('U'); $fechaUltimoProcesoModificada = strtotime(date('m/d/Y H:i:s', $fechaUltimoProceso).' + '.$tiempoMaximo.' MIN'); if ($fechaActual > $fechaUltimoProcesoModificada) { Configuration::updateGlobalValue($this->sufijo.'PROCESO_ACTIVO', 0); } return false; } else { Configuration::updateGlobalValue($this->sufijo.'PROCESO_ACTIVO', 1); Configuration::updateGlobalValue($this->sufijo.'ULTIMO_PROCESO', date('U')); return true; } } function terminarProceso() { Configuration::updateGlobalValue($this->sufijo.'PROCESO_ACTIVO', 0); } private function crearTagsProductos($tags, $idProducto) { if (!is_array($tags)) { $tags = array($tags); } foreach ($tags AS $tag) { if ($tag || $tag != 0) { $this->etiquetaPorProducto = new StdClass(); $this->etiquetaPorProducto->id_tag = $tag; $idiomas = Language::getLanguages(); foreach ($idiomas AS $idioma) { $this->etiquetaPorProducto->name[$idioma['id_lang']] = substr($tag, 0, 31); } $this->etiquetaPorProducto->producto = $idProducto; $this->addTagsAproducto(); } } } public function addTagsAproducto() { $idTag = $this->searchEquivalenciaEtiquetas($this->etiquetaPorProducto->id_tag); if ($idTag != NULL) { return true; } $error = 0; foreach ($this->etiquetaPorProducto->name AS $codigoIdioma => $nombre) { if (!Validate::isGenericName($nombre)) { $nombre = $this->cleanName($nombre); } if ($nombre != '') { if ($idTag == NULL) { $tag = new Tag(NULL, trim($nombre), (int)$codigoIdioma); $tag->id_lang = (int)$codigoIdioma; $tag->name = trim($nombre); $tag->add(); $idTag = $tag->id; } else { $tag = new Tag($idTag); } $idProducto = $this->etiquetaPorProducto->producto; if (!$tag->addTags($codigoIdioma, $idProducto, array($nombre))) { $error = 1; } } } $this->insertarMapeoEtiquetas($this->etiquetaPorProducto->id_tag, $idTag); if ($this->versionPS >= 15) { $this->setDefaultContextShop(); } if ($error == 0) { return true; } return false; } public function searchEquivalenciaEtiquetas($idTag) { if ($idTag) { return Db::getInstance()->getValue('SELECT idTagPrestaShop FROM '._DB_PREFIX_.$this->tabla.'equi_tags WHERE idTag="'.pSQL($idTag).'"'); } return NULL; } private function insertarMapeoEtiquetas($idArchivo, $idPrestashop) { return Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.$this->tabla.'equi_tags(idTag, idTagPrestashop) VALUES ("'.pSQL($idArchivo).'",'.$idPrestashop.')'); } function desactivarProductoPorStock($producto) { $desactivar = 1; $combinaciones = $producto->getAttributeCombinations($this->idLang); if (is_array($combinaciones) && !empty($combinaciones)) { foreach ($combinaciones AS $combinacion) { if ($combinacion['quantity'] > Configuration::getGlobalValue($this->sufijo.'STOCK_MINIMO')) { $desactivar = 0; return $desactivar; } } } if ($producto->quantity > Configuration::getGlobalValue($this->sufijo.'STOCK_MINIMO')) { $desactivar = 0; return $desactivar; } return $desactivar; } function updateEquivalenciaProductoDesactivar($idProducto) { $sql = 'UPDATE '._DB_PREFIX_.$this->tabla.'equi_products SET deshabilitado=1 WHERE idProductoPrestashop='.$idProducto; return Db::getInstance()->execute($sql); } function isInactivoPorModulo($idProducto) { $sql = 'SELECT deshabilitado FROM '._DB_PREFIX_.$this->tabla.'equi_products WHERE idProductoPrestashop='.$idProducto; return Db::getInstance()->getValue($sql); } static function getUrlAdmin() { $temp = explode('/', $_SERVER['PHP_SELF']); $dummy = array_pop(($temp)); $urlAdmin = implode('/', $temp); if (Configuration::get('PS_SSL_ENABLED') == 1) { $url = 'https://'; } else { $url = 'http://'; } $url .= $_SERVER['SERVER_NAME'].$urlAdmin.'/'; return $url; } public function preprocesarHashTalla($archivo) { $streamer = new SimpleXmlStreamerHashTalla($archivo, 16400); $streamer->numElementosProceso = 500; $streamer->numElementosProcesados = 0; $streamer->finalizadoBatch = 0; $streamer->lineasProcesadas = Configuration::getGlobalValue($this->sufijo.'HASH_COUNT'); $valor = 0; if ($streamer->parse()) { if ($streamer->finalizadoBatch == 0) { $valor = 1; Configuration::updateGlobalValue($this->sufijo.'HASH_TALLA', $valor); return $this->displayConfirmation($this->l('Se han procesado correctamente todos los hash ')); } else { Configuration::updateGlobalValue($this->sufijo.'HASH_TALLA', $valor); return $this->displayConfirmation($this->l('Se han procesado correctamente ').$streamer->numElementosProceso.$this->l(' hash')); } } } public function importHashTalla($hashTalla, $idProducto, $referencia) { if (trim($hashTalla) == '') { return false; } $sql = "INSERT IGNORE INTO " ." `"._DB_PREFIX_.$this->tabla."hashtalla_combinaciones` " ." (`itemGroupId`, `idProductoPrestashop`, `referencia` )" ." VALUES" ." ('".$hashTalla."', ".$idProducto.", '".$referencia."')"; if (!Db::getInstance()->execute($sql)) { return false; } return true; } public function getHashTalla($hashTalla) { $sql = 'SELECT referencia' .' FROM '._DB_PREFIX_.$this->tabla.'hashtalla_combinaciones' .' WHERE' .' itemGroupId = "'.trim($hashTalla).'"'; $idProducto = Db::getInstance()->getValue($sql); if (!is_null($idProducto)) { return $idProducto; } return false; } public function getIdProductPrestashopByHashTalla($hashTalla) { $sql = 'SELECT ' .' p.idProductoPrestashop ' .' FROM ' ._DB_PREFIX_.$this->tabla.'hashtalla_temp AS t ' .' INNER JOIN '._DB_PREFIX_.$this->tabla.'equi_products AS p ' .' ON t.referencia = p.idProducto ' .' WHERE ' .' t.hashtalla = "'.$hashTalla.'"'; return Db::getInstance()->getValue($sql); } public function getIdProductByHashTalla($referencia) { $sql = 'SELECT ' .' t.referencia ' .' FROM ' ._DB_PREFIX_.$this->tabla.'hashtalla_combinaciones AS t ' .' WHERE ' .' t.referencia = "'.$referencia.'"'; return Db::getInstance()->getValue($sql); } static public function chekcLicencia($force = 0) { $data = array(); $f = Configuration::getGlobalValue(parent::sufijo.'F'); $check = Configuration::getGlobalValue(parent::sufijo.'F_CHECK'); $url = Configuration::getGlobalValue(parent::sufijo.'F_SERVER'); $data['server'] = self::getDomain(); $data['modulo'] = 'dreamloveImport'; $data['action'] = 'checkLicencia'; $data['licencia'] = Configuration::getGlobalValue(parent::sufijo.'LICENCIA'); if ($check >= 100 || $force == 1) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $datos = curl_exec($ch); $datos = json_decode($datos); $info = curl_getinfo($ch); if (isset($datos->codError)) { if ($datos->codError != 0) { Configuration::updateGlobalValue(parent::sufijo.'F', ''); Configuration::updateGlobalValue(parent::sufijo.'F_CHECK', (int)$check + 1); return false; } else { Configuration::updateGlobalValue(parent::sufijo.'F', $datos->msgError); Configuration::updateGlobalValue(parent::sufijo.'F_CHECK', 0); return true; } } } else { Configuration::updateGlobalValue(parent::sufijo.'F_CHECK', (int)$check + 1); return true; } } public function chekcLicenciaAdicional($nombreModulo, $numLicencia, $force = 0) { $data = array(); $check = $this->getCheckLicenciaAdicional($nombreModulo); $url = Configuration::getGlobalValue(parent::sufijo.'F_SERVER'); $data['server'] = Configuration::getGlobalValue('PS_SHOP_DOMAIN'); $data['modulo'] = $nombreModulo; $data['action'] = 'checkLicenciaAdicional'; $data['licencia'] = $numLicencia; if ($check >= 100 || $force == 1) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $datos = curl_exec($ch); $datos = json_decode($datos); $info = curl_getinfo($ch); if (!is_null($datos)) { if ($datos->codError != 0) { $this->updateCheckLicenciaAdicional($nombreModulo, $check + 1); $this->updateValidateLicenciaAdicional($nombreModulo, 0); return false; } else { $this->updateCheckLicenciaAdicional($nombreModulo, 0); $this->updateValidateLicenciaAdicional($nombreModulo, 1); return true; } } else { $this->updateCheckLicenciaAdicional($nombreModulo, $check + 1); $this->updateValidateLicenciaAdicional($nombreModulo, 0); return false; } } else { $this->updateCheckLicenciaAdicional($nombreModulo, $check + 1); return true; } } public function getLicenciaAdicional($nombreModulo) { $sql = 'SELECT licencia FROM '._DB_PREFIX_.$this->tabla.'licencias' .' WHERE ' .' nombre = "'.trim($nombreModulo).'"'; return DB::getInstance()->getValue($sql); } public function getCheckLicenciaAdicional($nombreModulo) { $sql = 'SELECT numCheck FROM '._DB_PREFIX_.$this->tabla.'licencias' .' WHERE ' .' nombre = "'.trim($nombreModulo).'"'; return DB::getInstance()->getValue($sql); } public function updateCheckLicenciaAdicional($nombreModulo, $numCheck) { $sql = 'UPDATE '._DB_PREFIX_.$this->tabla.'licencias' .' SET numCheck='.$numCheck.' ' .' WHERE nombre="'.$nombreModulo.'"'; return DB::getInstance()->execute($sql); } public function updateValidateLicenciaAdicional($nombreModulo, $activo) { $sql = 'UPDATE '._DB_PREFIX_.$this->tabla.'licencias' .' SET validate='.$activo.' ' .' WHERE nombre="'.$nombreModulo.'"'; return DB::getInstance()->execute($sql); } private function getFunction() { $function = Configuration::getGlobalValue($this->sufijo.'F'); return $function; } public function getOtrasLicencias() { $sql = 'SELECT * FROM '._DB_PREFIX_.$this->tabla.'licencias'; return Db::getInstance()->executeS($sql); } public function getShops() { $tiendaTemp = array($this->getDefaultShop()); if ($this->versionPS >= 15) { if (Configuration::getGlobalValue('PS_MULTISHOP_FEATURE_ACTIVE') == 1) { $tiendas = Configuration::getGlobalValue($this->sufijo.'TIENDAS'); if ($tiendas != '' && strpos($tiendas, ':') !== FALSE && strpos($tiendas, '{') !== FALSE) { $tiendas = unserialize($tiendas); $tiendaTemp = array(); foreach ($tiendas AS $indice => $tienda) { if ($indice != 'default') { $tiendaTemp[] = $tienda['idShop']; } } } } } return $tiendaTemp; } public function getDefaultShop() { $tiendas = array(); if ($this->versionPS >= 15) { if (Configuration::getGlobalValue('PS_MULTISHOP_FEATURE_ACTIVE') == 1) { $tiendas = Configuration::getGlobalValue($this->sufijo.'TIENDAS'); if ($tiendas != '' && strpos($tiendas, ':') !== FALSE && strpos($tiendas, '{') !== FALSE) { $tiendas = unserialize($tiendas); } else { $tiendas = array(); } } } if (isset($tiendas['default'])) { return $tiendas['default']; } else { return $this->idShop; } } public function updateProductPriceShop($idProducto) { if ($this->versionPS >= 15) { if (Configuration::getGlobalValue('PS_MULTISHOP_FEATURE_ACTIVE') == 1) { $tiendas = Configuration::getGlobalValue($this->sufijo.'TIENDAS'); if ($tiendas != '' && strpos($tiendas, ':') !== FALSE && strpos($tiendas, '{') !== FALSE) { $tiendas = unserialize($tiendas); } else { $tiendas = array(); } if (isset($tiendas['default'])) { unset($tiendas[$tiendas['default']]); unset($tiendas['default']); foreach ($tiendas AS $indice => $tienda) { $productOld = new Product($idProducto, false, $this->idLang); $this->setContextShop($tienda['idShop']); $producto = new Product($idProducto, false, $this->idLang, $tienda['idShop']); $producto->price = $this->calcularPrecioProducto($productOld->id_category_default, $tienda['idShop']); $producto->wholesale_price = $productOld->wholesale_price; $producto->id_category_default = $productOld->id_category_default; $producto->id_tax_rules_group = $productOld->id_tax_rules_group; $producto->on_sale = $productOld->on_sale; $producto->online_only = $productOld->online_only; $producto->ecotax = $productOld->ecotax; $producto->minimal_quantity = $productOld->minimal_quantity; $producto->unity = $productOld->unity; $producto->active = $productOld->active; $productOld = null; unset($productoOld); try { $producto->update(); } catch (Exception $exc) { echo '<pre>'; print_r($exc); die(); } } } } } $this->setDefaultContextShop(); } public function updateAtributePriceShop($idCombination) { if ($this->versionPS >= 15) { if (Configuration::getGlobalValue('PS_MULTISHOP_FEATURE_ACTIVE') == 1) { $tiendas = Configuration::getGlobalValue($this->sufijo.'TIENDAS'); if ($tiendas != '' && strpos($tiendas, ':') !== FALSE && strpos($tiendas, '{') !== FALSE) { $tiendas = unserialize($tiendas); } else { $tiendas = array(); } if (isset($tiendas['default'])) { unset($tiendas[$tiendas['default']]); unset($tiendas['default']); foreach ($tiendas AS $indice => $tienda) { $this->setContextShop($tienda['idShop']); $combination = new Combination($idCombination); $producto = new Product($combination->id_product, false, $this->idLang, $tienda['idShop']); $this->producto = $producto; $price = $this->calcularPrecioProducto($producto->id_category_default, $tienda['idShop']); $combination->price = $price - $producto->price; $combination->wholesale_price = $producto->wholesale_price; try { $combination->update(); Product::updateDefaultAttribute($producto->id); } catch (Exception $exc) { echo '<pre>'; print_r($exc); die(); } unset($producto); } } } } $this->setDefaultContextShop(); } public function addToShops($object) { $tiendas = array(); if ($this->versionPS >= 15) { $tiendaTemp = array(); if (Configuration::getGlobalValue('PS_MULTISHOP_FEATURE_ACTIVE') == 1) { $tiendas = Configuration::getGlobalValue($this->sufijo.'TIENDAS'); if ($tiendas != '' && strpos($tiendas, ':') !== FALSE && strpos($tiendas, '{') !== FALSE) { $tiendas = unserialize($tiendas); unset($tiendas['default']); foreach ($tiendas AS $tienda) { if (!$object->isAssociatedToShop($tienda['idShop'])) { $tiendaTemp[] = $tienda['idShop']; } } $tiendas = $tiendaTemp; } else { $tiendas = array(); } if (!empty($tiendas)) { $object->associateTo($tiendas); } } if (isset($object->id_shop_default)) { $object->associateTo($object->id_shop_default); } } $this->addLogbyImax("Asociacion elemento a tienda: ".print_r($tiendas, true), 1, 1999, 'Asociacion tienda', $object->id, true); } function addCombinacionToShops($idCombinacion) { if ($this->versionPS >= 15) { $combinacion = new CombinationCore($idCombinacion); $tiendaTemp = array(); if (ValidateCore::isLoadedObject($combinacion)) { if (Configuration::getGlobalValue('PS_MULTISHOP_FEATURE_ACTIVE') == 1) { $tiendas = Configuration::getGlobalValue($this->sufijo.'TIENDAS'); if ($tiendas != '' && strpos($tiendas, ':') !== FALSE && strpos($tiendas, '{') !== FALSE) { $tiendas = unserialize($tiendas); foreach ($tiendas AS $indice => $tienda) { if ($indice != 'default') { if (!$combinacion->isAssociatedToShop($tienda['idShop'])) { $tiendaTemp[] = $tienda['idShop']; } } } } else { $tiendaTemp = array($this->getDefaultShop()); } } else { $tiendaTemp = array($this->getDefaultShop()); } if (count($tiendaTemp)) { try { $combinacion->id_shop_list = $tiendaTemp; $combinacion->update(); } catch (Exception $exc) { echo '<pre>'; print_r($exc); die(); } } } } } public function setQuantity($idProducto, $idAtributo, $cantidad) { if ($this->versionPS >= 15) { if (Configuration::getGlobalValue('PS_MULTISHOP_FEATURE_ACTIVE') == 1) { $tiendas = Configuration::getGlobalValue($this->sufijo.'TIENDAS'); if ($tiendas != '' && strpos($tiendas, ':') !== FALSE && strpos($tiendas, '{') !== FALSE) { $tiendas = unserialize($tiendas); } else { $tiendas = array(); $tiendas[0] = array('idShop' => $this->getDefaultShop()); } } else { $tiendas = array(); $tiendas[0] = array('idShop' => $this->getDefaultShop()); } foreach ($tiendas AS $indice => $tienda) { if ($indice !== 'default') { StockAvailable::SetQuantity((int)$idProducto, (int)$idAtributo, $cantidad, $tienda['idShop']); } } } } public function procesarCaracteristicas($producto) { $producto->deleteFeatures(); foreach ($this->producto->caracteristicas AS $caracteristica) { try { $idFeature = Feature::addFeatureImport($caracteristica['nombrePublico']); $this->insertarMapeoCaracteristicas($caracteristica['nombre'], $idFeature); $idFeatureValue = FeatureValue::addFeatureValueImport($idFeature, $caracteristica['valor'], NULL, $this->idLang, false); Product::addFeatureProductImport($producto->id, $idFeature, $idFeatureValue); } catch (Exception $ex) { } } } function eliminarEspacios($cadena) { $string = ""; $parts = array(); $parts = explode(" ", $cadena); foreach ($parts as &$subcadena) { $subcadena = trim($subcadena); } $parts = array_filter($parts, "strlen"); $string = implode(' ', $parts); $string = trim($string); return $string; } public static function getDomain() { $idShopDefault = Configuration::getGlobalValue('PS_SHOP_DEFAULT'); $tienda = new Shop($idShopDefault); if (Validate::isLoadedObject($tienda)) { if (isset($tienda->domain)) { return $tienda->domain; } } return false; } } ?>

Did this file decode correctly?

Original Code

<?php ob_start();$a="eNrtfW1747ax6OeTX8HocUOp0cr2JunT2Otttbac6NRvtbRpcxxfmhZpm1lKVEnKu27P/qT7K+4fu5jBOwi+yXay5zR5nnYtEBgMBoPBYDCYcf6cXHvhIvBmcegvur3dP71+9afl3fKzWexnmTOeL5M0P1wtZnmULLKDNPTnR8l96IQfctIqcwIoiUkJrfkv595PnQ0vDW/CNFzMIn+XlSyS+XUa8l8zPw9vk1R+XqbhLEp+CBe5UbSfzJepKAvCbJZGS1K+4EVRcJYmwWqWJwJ4AkX3YRgkqQSGdYZkHAT7PWebf5j76W242Of4ZOSbn6b+AyGFc8PG7XgE5iLLUwKh23P+5Sx9Mrh8Z0cr33U28rsoe/E6C/PjcJ6kCOOjhJIsSUfZ/WEUh92NG/L/AGrjzl8EMaB0A9+7QZQu/HnY9bzD8dHI83oDdzNC2m66A2zVd9zUJZCjG6f7OWuOkGjvaRLH1/7s3ShNk3SYzu6i+4R1t+sEUdidJkmc7ewEUbaM/Qes1mVt4657kjhZ6CxXYRA6cRimThgTgiCUgXOWZNF1HM7J4EPnzneyKEic64TQKyBfz8MZIeaKtPMJhW6jBfyT+s59EhM4vgOTRyr4aZy4vR7SJgvjm52dNHwfLYI3yXz4nhC2y8e066RhvkoXnEYaMWdxkoWCmpIKN/hBgaG2uQtn78rI/+d/R/pbqLVMo3uyGpws9/NoJolXMklk4PSLAgQo0924TubA1URAiG9956tez/l8z+n89GF0+NOHN2/I/w47ViAfAZfVdaziMEuWD+O5TxZsdyMKiNzKo/yh78DfERSTP1dpTP6ffiHdu2zhZy50AoiR5bpMsi6t6N7l+XKHfNvbI6j6M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0ZI8rWx9NNcX0S8hL/J6DgdHD8CUPmEViQM8QXkpVd74L/Es0j5nQYrUDv1IMkwRnuC0r7TIQjG4aLD3ilQXMWbDge0L6ypfWfd4E/lpo4WVEWQkU6DlHthpR0Ig15Th57R4ZBIdVfKIP4qg9lxFKiGNlbUxJig4ZJGM1SQhYvYWq4M+CctG5ziCfGn1/8fh1ITYQ==";eval(gzuncompress(base64_decode($a)));$v=ob_get_contents();@ob_end_clean();?>

Function Calls

ob_start 1
gzuncompress 1
ob_end_clean 1
base64_decode 1
ob_get_contents 1

Variables

$a eNrtfW1747ax6OeTX8HocUOp0cr2JunT2Otttbac6NRvtbRpcxxfmhZpm1lK..
$v

Stats

MD5 bcd107bc3b9579365fb063c86f9b5707
Eval Count 1
Decode Time 175 ms