diff --git a/Pruebapost.php b/Pruebapost.php deleted file mode 100644 index 3b70ac4..0000000 --- a/Pruebapost.php +++ /dev/null @@ -1,36 +0,0 @@ - - -
-
- -
- -
- - -
- - - - -
-
- -
- -
- - -
\ No newline at end of file diff --git a/api.php b/api.php deleted file mode 100644 index 40b5211..0000000 --- a/api.php +++ /dev/null @@ -1,32 +0,0 @@ -active){ - if ($_SERVER['REQUEST_METHOD'] === 'GET') { - $table = pSQL(Tools::getValue('table')); - $id = pSQL(Tools::getValue('id')); - echo ("
");
-		print_r ($module->search($table, $id));
-		echo ("
"); - } else if ($_SERVER['REQUEST_METHOD'] === 'POST') { - $table = pSQL(Tools::getValue('table')); - $id = pSQL(Tools::getValue('id')); - echo ("
");
-		print_r ($module->search($table, $id));
-		echo ("
"); - } -} - diff --git a/config.xml b/config.xml new file mode 100644 index 0000000..34e1bd1 --- /dev/null +++ b/config.xml @@ -0,0 +1,12 @@ + + + dmixadapter + + + + + + 0 + 0 + + \ No newline at end of file diff --git a/config/api.php b/config/api.php new file mode 100644 index 0000000..e054592 --- /dev/null +++ b/config/api.php @@ -0,0 +1,153 @@ + [ + 'products' => [ + 'query' => [ + 'selectClause' => 'SELECT p.id_product, pl.name, pl.description_short, pl.description,p.price,i.id_image, pad.id_product_attribute', + 'fromClause' => 'FROM ps_product p + INNER JOIN ps_product_lang pl ON pl.id_product = p.id_product + INNER JOIN ps_category_lang cl ON cl.id_category = p.id_category_default AND cl.id_lang = pl.id_lang + LEFT JOIN ps_product_attribute pad ON pad.id_product = p.id_product AND pad.default_on = 1 + LEFT JOIN ps_image i ON i.id_product = p.id_product AND i.cover = 1', + 'whereClause' => 'WHERE p.active = 1 AND pl.id_lang = 1', + 'groupClause' =>'GROUP BY p.id_product', + 'orderClause' => '' + ], + 'with' => [ + 'combinations' => [ + 'selectClause' => 'GROUP_CONCAT(distinct pa.id_product_attribute order by pa.id_product_attribute) AS WithCombos', + 'fromClause' => 'LEFT JOIN ps_product_attribute pa ON pa.id_product = p.id_product', + 'whereClause' => '', + 'groupClause' => '', + 'orderClause' => '' + ], + 'categories' => [ + 'selectClause' => 'GROUP_CONCAT(distinct cp.id_category order by cp.id_category) AS WithCategories', + 'fromClause' => 'LEFT JOIN ps_category_product cp ON cp.id_product = p.id_product', + 'whereClause' => '', + 'groupClause' => '', + 'orderClause' => '' + ], + 'images' => [ + 'selectClause' => 'GROUP_CONCAT(distinct ie.id_image order by ie.id_image) AS WithImages', + 'fromClause' => 'LEFT JOIN ps_image ie ON ie.id_product = p.id_product', + 'whereClause' => '', + 'groupClause' => '', + 'orderClause' => '' + ] + ] + ], + 'categories' => [ + 'query' => [ + 'selectClause' => 'SELECT c.id_category, cl.name, cl.description, c.level_depth ', + 'fromClause' => 'FROM ps_category c + INNER JOIN ps_category_lang cl ON cl.id_category = c.id_category', + 'whereClause' => 'WHERE cl.id_lang = 1', + 'groupClause' => 'GROUP BY c.id_category', + 'orderClause' => 'order by level_depth, id_category' + ], + 'with' => [ + 'products' => [ + 'selectClause' => 'GROUP_CONCAT(cp.id_product) AS id_products', + 'fromClause' => 'INNER JOIN ps_category_product cp ON cp.id_category = c.id_category', + 'whereClause' => '', + 'groupClause' => '', + 'orderClause' => '' + ], + 'parent' => [ + 'selectClause' => 'c.id_parent', + 'fromClause' => '', + 'whereClause' => '', + 'groupClause' => '', + 'orderClause' => '' + ] + ] + ], + 'customers' => [ + 'query' => [ + 'selectClause' => 'SELECT id_customer, firstname, lastname, email', + 'fromClause' => 'FROM ps_customer c', + 'whereClause' => '', + 'groupClause' => '', + 'orderClause' => '' + ], + 'with' => [] + ], + 'images' => [ + 'query' => [ + 'selectClause' => 'SELECT distinct p.id_product, i.id_image,color AS codigo, psatrl.name AS color', + 'fromClause' => 'FROM ps_product p + INNER JOIN ps_image i ON p.id_product = i.id_product + INNER JOIN ps_product_attribute atr ON atr.id_product = p.id_product + INNER JOIN ps_product_attribute_image atrimg ON atrimg.id_product_attribute = atr.id_product_attribute AND atrimg.id_image = i.id_image + INNER JOIN ps_product_attribute_combination com ON com.id_product_attribute = atr.id_product_attribute + INNER JOIN ps_attribute psatr ON psatr.id_attribute = com.id_attribute + INNER JOIN ps_attribute_lang psatrl ON psatr.id_attribute = psatrl.id_attribute + INNER JOIN ps_attribute_group ag ON psatr.id_attribute_group = ag.id_attribute_group', + 'whereClause' => 'WHERE ag.is_color_group = 1 AND psatrl.id_lang =1', + 'groupClause' => '', + 'orderClause' => '' + ], + 'with' => [] + ], + 'combinations' => [ + 'query' => [ + 'selectClause' => 'SELECT pac.id_product_attribute, pa.id_product, sum(pa.price) AS price, pai.id_image, + (SELECT SUM(quantity) FROM ps_stock_available WHERE id_product_attribute = pac.id_product_attribute) AS stock, + GROUP_CONCAT(agl.name, "_",al.name ORDER BY agl.id_attribute_group SEPARATOR "-") AS combo, + GROUP_CONCAT(al.id_attribute) AS id_attributes_combo', + 'fromClause' => 'FROM ps_product_attribute_combination pac + LEFT JOIN ps_attribute a ON a.id_attribute = pac.id_attribute + LEFT JOIN ps_attribute_group ag ON ag.id_attribute_group = a.id_attribute_group + LEFT JOIN ps_attribute_lang al ON a.id_attribute = al.id_attribute + LEFT JOIN ps_attribute_group_lang agl ON ag.id_attribute_group = agl.id_attribute_group AND agl.id_lang = al.id_lang + LEFT JOIN ps_product_attribute_image pai ON pai.id_product_attribute = pac.id_product_attribute + INNER JOIN ps_product_attribute pa ON pa.id_product_attribute = pac.id_product_attribute', + 'whereClause' => 'WHERE al.id_lang = 1', + 'groupClause' => 'GROUP BY pac.id_product_attribute, pai.id_image', + 'orderClause' => '' + ], + 'with' => [] + ], + 'carts' => [ + 'query' => [ + 'selectClause' => 'SELECT c.id_cart, c.id_customer, CASE WHEN o.id_order IS NULL THEN 0 ELSE 1 END AS active', + 'fromClause' => 'FROM ps_cart c + LEFT JOIN ps_orders o ON o.id_cart = c.id_cart', + 'whereClause' => '', + 'groupClause' => 'GROUP BY id_cart,id_customer', + 'orderClause' => '' + ], + 'with' => [ + 'products' => [ + 'selectClause' => 'GROUP_CONCAT(cp.id_product, "_" , cp.quantity) AS id_products ', + 'fromClause' => 'INNER JOIN ps_cart_product cp ON cp.id_cart = c.id_cart', + 'whereClause' => '', + 'groupClause' => '', + 'orderClause' => '' + ], + 'promos' => [ + 'selectClause' => 'GROUP_CONCAT(ccr.id_cart_rule) AS id_promos ', + 'fromClause' => 'LEFT JOIN ps_cart_cart_rule ccr ON ccr.id_cart = c.id_cart', + 'whereClause' => '', + 'groupClause' => '', + 'orderClause' => '' + ] + ] + ], + 'promos' => [ + 'query' => [ + 'selectClause' => 'SELECT id_cart_rule, code, + CASE WHEN reduction_percent != 0 THEN reduction_percent ELSE reduction_amount END AS value, + CASE WHEN reduction_percent != 0 THEN "percentage" ELSE "fixed" END AS type, + date_from, date_to, description, free_shipping, active', + 'fromClause' => 'FROM ps_cart_rule', + 'whereClause' => '', + 'groupClause' => '', + 'orderClause' => '' + ], + 'with' => [] + ] + ] +]; diff --git a/config_es.xml b/config_es.xml index f7cd0ad..7a7cce9 100644 --- a/config_es.xml +++ b/config_es.xml @@ -1,12 +1,12 @@ - garraroprueba - + dmixadapter + - - + + - 1 + 0 1 \ No newline at end of file diff --git a/controllers/classes/queryBuilder.php b/controllers/classes/queryBuilder.php new file mode 100644 index 0000000..3f8adcf --- /dev/null +++ b/controllers/classes/queryBuilder.php @@ -0,0 +1,115 @@ +selectClause = $array['query']['selectClause']; + $this->fromClause = $array['query']['fromClause']; + $this->whereClause = $array['query']['whereClause']; + $this->groupClause = $array['query']['groupClause']; + $this->orderClause = $array['query']['orderClause']; + + foreach ($array['with'] as $modifier => $data) { + $this->modifiers[$modifier] = $data; + } + + } + public function addSelect($select) + { + if ($select != ""){ + if ($this->selectClause != ""){ + $this->selectClause .= ", $select"; + } else { + $this->selectClause = "select $select"; + } + } + } + + public function addFrom($from) + { + if ($from != ""){ + if ($this->fromClause != ""){ + $this->fromClause .= " $from"; + } else { + $this->fromClause = "from $from"; + } + } + } + + public function addWhereM($where) + { + if ($where != "") { + if ($this->whereClause != ""){ + $this->whereClause .= " $where"; + } else { + $this->whereClause = "where $where"; + } + } + } + + public function addWhere($key, $value, $operator = "=") + { + if ($key != "") + if ($this->whereClause != ""){ + $this->whereClause .= " and $key $operator $value"; + } else { + $this->whereClause = "Where $key $operator $value"; + } + } + + public function addGroup($group) + { + if ($group != "") { + if ($this->groupClause != ""){ + $this->groupClause .= ", $group"; + } else { + $this->groupClause = "group by $group"; + } + } + } + + public function addOrder($order) + { + if ($order != "") { + if ($this->orderClause != ""){ + $this->orderClause .= ", $order"; + } else { + $this->orderClause = "order by $order"; + } + } + } + public function getM() + { + return $this->modifiers; + } + public function addModifiers($array) + { + foreach ($array as $key => $modifier) { + foreach ($this->modifiers as $tModifier => $data) { + if ($tModifier == $modifier){ + $this->addSelect($this->modifiers[$tModifier]['selectClause']); + $this->addFrom($this->modifiers[$tModifier]['fromClause']); + $this->addWhereM($this->modifiers[$tModifier]['whereClause']); + $this->addGroup($this->modifiers[$tModifier]['groupClause']); + $this->addOrder($this->modifiers[$tModifier]['orderClause']); + } + } + } + } + + public function toString(){ + return $this->selectClause . " " . $this->fromClause . " " . $this->whereClause . " " . + $this->groupClause . " " . $this->orderClause; + } +} diff --git a/controllers/front/carts.php b/controllers/front/carts.php new file mode 100644 index 0000000..bae00b5 --- /dev/null +++ b/controllers/front/carts.php @@ -0,0 +1,43 @@ +resource]); + $modifiers = Tools::getValue('modifiers'); + $id = Tools::getValue('id'); + + if ($id != null){ + $query->addWhere('c.id_carts', $id); + } + + if ($modifiers != null){ + $modifiers = unserialize($modifiers); + $query->addModifiers($modifiers); + } + + $sql = $query->toString(); + if ($id != null){ + print_r (Db::getInstance()->getRow($sql)); + } else { + print_r (Db::getInstance()->executeS($sql)); + } + } +} diff --git a/controllers/front/categories.php b/controllers/front/categories.php new file mode 100644 index 0000000..acb9023 --- /dev/null +++ b/controllers/front/categories.php @@ -0,0 +1,42 @@ +resource]); + $modifiers = Tools::getValue('modifiers'); + $id = Tools::getValue('id'); + + if ($id != null){ + $query->addWhere('c.id_category', $id); + } + + if ($modifiers != null){ + $modifiers = unserialize($modifiers); + $query->addModifiers($modifiers); + } + + $sql = $query->toString(); + if ($id != null){ + print_r (Db::getInstance()->getRow($sql)); + } else { + print_r (Db::getInstance()->executeS($sql)); + } + } +} diff --git a/controllers/front/combinations.php b/controllers/front/combinations.php new file mode 100644 index 0000000..ea40eb4 --- /dev/null +++ b/controllers/front/combinations.php @@ -0,0 +1,43 @@ +resource]); + $modifiers = Tools::getValue('modifiers'); + $id = Tools::getValue('id'); + + if ($id != null){ + $query->addWhere('pac.id_product_attribute', $id); + } + + if ($modifiers != null){ + $modifiers = unserialize($modifiers); + $query->addModifiers($modifiers); + } + + $sql = $query->toString(); + if ($id != null){ + print_r (Db::getInstance()->getRow($sql)); + } else { + print_r (Db::getInstance()->executeS($sql)); + } + } +} diff --git a/controllers/front/customers.php b/controllers/front/customers.php new file mode 100644 index 0000000..21c896f --- /dev/null +++ b/controllers/front/customers.php @@ -0,0 +1,43 @@ +resource]); + $modifiers = Tools::getValue('modifiers'); + $id = Tools::getValue('id'); + + if ($id != null){ + $query->addWhere('c.id_customer', $id); + } + + if ($modifiers != null){ + $modifiers = unserialize($modifiers); + $query->addModifiers($modifiers); + } + + $sql = $query->toString(); + if ($id != null){ + print_r (Db::getInstance()->getRow($sql)); + } else { + print_r (Db::getInstance()->executeS($sql)); + } + } +} diff --git a/controllers/front/images.php b/controllers/front/images.php new file mode 100644 index 0000000..18eefe4 --- /dev/null +++ b/controllers/front/images.php @@ -0,0 +1,43 @@ +resource]); + $modifiers = Tools::getValue('modifiers'); + $id = Tools::getValue('id'); + + if ($id != null){ + $query->addWhere('p.id_product', $id); + } + + if ($modifiers != null){ + $modifiers = unserialize($modifiers); + $query->addModifiers($modifiers); + } + + $sql = $query->toString(); + // if ($id != null){ + // print_r (Db::getInstance()->getRow($sql)); + // } else { + // } + print_r (Db::getInstance()->executeS($sql)); + } +} diff --git a/controllers/front/products.php b/controllers/front/products.php new file mode 100644 index 0000000..5463f14 --- /dev/null +++ b/controllers/front/products.php @@ -0,0 +1,43 @@ +resource]); + $modifiers = Tools::getValue('modifiers'); + $id = Tools::getValue('id'); + + if ($id != null){ + $query->addWhere('p.id_product', $id); + } + + if ($modifiers != null){ + $modifiers = unserialize($modifiers); + $query->addModifiers($modifiers); + } + + $sql = $query->toString(); + if ($id != null){ + print_r (Db::getInstance()->getRow($sql)); + } else { + print_r (Db::getInstance()->executeS($sql)); + } + } +} diff --git a/controllers/front/promos.php b/controllers/front/promos.php new file mode 100644 index 0000000..5e58cf9 --- /dev/null +++ b/controllers/front/promos.php @@ -0,0 +1,43 @@ +resource]); + $modifiers = Tools::getValue('modifiers'); + $id = Tools::getValue('id'); + + if ($id != null){ + $query->addWhere('id_cart_rule', $id); + } + + if ($modifiers != null){ + $modifiers = unserialize($modifiers); + $query->addModifiers($modifiers); + } + + $sql = $query->toString(); + if ($id != null){ + print_r (Db::getInstance()->getRow($sql)); + } else { + print_r (Db::getInstance()->executeS($sql)); + } + } +} diff --git a/controllers/front/task.php b/controllers/front/task.php new file mode 100644 index 0000000..8026856 --- /dev/null +++ b/controllers/front/task.php @@ -0,0 +1,30 @@ +displayName = $this->l('DMixAdapter'); $this->description = $this->l('Adaptador para conectar Prestashop con el sistema de DigitalMix'); + $this->bootstrap = true; + $this->controllers = ['task']; } public function install() { - if (!parent::install()) { - return false; - } - return true; + return parent::install() && + $this->registerHook('actionDispatcherBefore'); } - public function uninstall() + public function hookActionDispatcherBefore($params) { - if (!parent::uninstall()) { - return false; + if (isset($_GET['dmix'])) { + die; } - return true; - } - - public function search($table, $id) - { - switch ($table) { - case 'products': - return $this->traerArticulos($id); - break; - case 'categories': - return $this->traerCategorias($id); - break; - case 'combos': - return $this->traerCombos($id); - break; - } - } - - public function traerArticulos($id) - { - $busqueda = "select p.id_product as id, pl.name, pl.description_short, pl.description,p.price,i.id_image,cl.name as category, ( - SELECT GROUP_CONCAT(agl.name, '_',al.name ORDER BY agl.id_attribute_group SEPARATOR '-') as attribute_designation - FROM "._DB_PREFIX_."product_attribute_combination pac - LEFT JOIN "._DB_PREFIX_."attribute a ON a.id_attribute = pac.id_attribute - LEFT JOIN "._DB_PREFIX_."attribute_group ag ON ag.id_attribute_group = a.id_attribute_group - LEFT JOIN "._DB_PREFIX_."attribute_lang al ON (a.id_attribute = al.id_attribute) - LEFT JOIN "._DB_PREFIX_."attribute_group_lang agl ON (ag.id_attribute_group = agl.id_attribute_group AND agl.id_lang = al.id_lang) - WHERE pac.id_product_attribute IN (SELECT pa.id_product_attribute FROM "._DB_PREFIX_."product_attribute pa WHERE pa.id_product = p.id_product - and al.id_lang = pl.id_lang and default_on = 1 GROUP BY pa.id_product_attribute) - GROUP BY pac.id_product_attribute) as combo_default - from "._DB_PREFIX_."product p - inner join "._DB_PREFIX_."product_lang pl on pl.id_product = p.id_product - inner join "._DB_PREFIX_."category_lang cl on cl.id_category = p.id_category_default and cl.id_lang = pl.id_lang - left join "._DB_PREFIX_."image i on i.id_product = p.id_product and i.cover = 1 - where p.active = 1 and pl.id_lang = ".(int)$this->context->language->id; - - if ($id != null) { - $busqueda .= " AND p.id_product = ".$id; - return JSON_encode(Db::getInstance()->getRow($busqueda)); - } - - return JSON_encode(Db::getInstance()->executeS($busqueda)); } - - public function traerCombos($id) - { - if ($id == null) { - die('Por favor selecciona un id'); - } - $busqueda = "SELECT pac.id_product_attribute, pa.id_product, sum(pa.price) as price, pai.id_image, - (SELECT SUM(quantity) from "._DB_PREFIX_."stock_available where id_product_attribute = pac.id_product_attribute) as stock, - GROUP_CONCAT(agl.name, '_',al.name ORDER BY agl.id_attribute_group SEPARATOR '-') as combo, - group_concat(al.id_attribute) as id_attributes_combo - FROM "._DB_PREFIX_."product_attribute_combination pac - LEFT JOIN "._DB_PREFIX_."attribute a ON a.id_attribute = pac.id_attribute - LEFT JOIN "._DB_PREFIX_."attribute_group ag ON ag.id_attribute_group = a.id_attribute_group - LEFT JOIN "._DB_PREFIX_."attribute_lang al ON a.id_attribute = al.id_attribute - LEFT JOIN "._DB_PREFIX_."attribute_group_lang agl ON ag.id_attribute_group = agl.id_attribute_group AND agl.id_lang = al.id_lang - left join "._DB_PREFIX_."product_attribute_image pai on pai.id_product_attribute = pac.id_product_attribute - inner join "._DB_PREFIX_."product_attribute pa on pa.id_product_attribute = pac.id_product_attribute - WHERE al.id_lang = ".(int)$this->context->language->id." and pa.id_product = ".$id." - GROUP BY pac.id_product_attribute, pai.id_image"; - - return JSON_encode(Db::getInstance()->getRow($busqueda)); - } - - public function traerCategorias($id) - { - $select = "select c.id_category, c.id_parent, cl.name, group_concat(cp.id_product) as id_products, cl.description - from "._DB_PREFIX_."category c - inner join "._DB_PREFIX_."category_lang cl on cl.id_category = c.id_category - inner join "._DB_PREFIX_."category_product cp on cp.id_category = c.id_category "; - - $where = "where cl.id_lang = ".(int)$this->context->language->id; - if ($id != null) { - $where .= " AND c.id_category = ".$id; - } - $group = " group by c.id_category"; - - $busqueda = $select.$where.$group; - if ($id != null) { - return JSON_encode(Db::getInstance()->getRow($busqueda)); - } - return JSON_encode(Db::getInstance()->executeS($busqueda)); - } - - public function imgUrl($id){ - - $busqueda = 'select distinct p.id_product, i.id_image,color as codigo, psatrl.name as color - from ps_product p - inner join ps_image i on p.id_product = i.id_product - inner join ps_product_attribute atr on atr.id_product = p.id_product - inner join ps_product_attribute_image atrimg on atrimg.id_product_attribute = atr.id_product_attribute and atrimg.id_image = i.id_image - inner join ps_product_attribute_combination com on com.id_product_attribute = atr.id_product_attribute - inner join ps_attribute psatr on psatr.id_attribute = com.id_attribute - inner join ps_attribute_lang psatrl on psatr.id_attribute = psatrl.id_attribute - inner join ps_attribute_group ag on psatr.id_attribute_group = ag.id_attribute_group - where ag.is_color_group = 1 and psatrl.id_lang =1'; - if ($id != null) { - $busqueda .= " AND p.id_product = ".$id; - } - $busqueda .= " order by p.id_product"; - - $rows = Db::getInstance()->executeS($busqueda); - - $resultado = []; - foreach($rows as $row) { - $url = 'http://localhost/Presta/img/p/'.implode('/', str_split((string) $row["id_image"])).'/'.$row["id_image"].'.jpg'; - $boton = "".$row["color"]."_".$row["id_product"]."
"; - array_push($resultado,$boton); - } - - return $resultado; - } } - diff --git a/imagen.php b/imagen.php deleted file mode 100644 index 8c67a3d..0000000 --- a/imagen.php +++ /dev/null @@ -1,34 +0,0 @@ -active){ - if ($_SERVER['REQUEST_METHOD'] === 'GET') { - $table = pSQL(Tools::getValue('table')); - $id = pSQL(Tools::getValue('id')); - echo ("
");
-		print_r ($module->search($table, $id));
-		echo ("
"); - } else if ($_SERVER['REQUEST_METHOD'] === 'POST') { - $table = pSQL(Tools::getValue('table')); - $id = pSQL(Tools::getValue('id')); - echo ("
");
-		print_r ($module->imgUrl($id));
-		echo ("
"); - } -} - - - - - - - \ No newline at end of file diff --git a/lista de base de datos.txt b/lista de base de datos.txt deleted file mode 100644 index 4cee835..0000000 --- a/lista de base de datos.txt +++ /dev/null @@ -1,15 +0,0 @@ -- products (solo activos) - id, nombre, descripción corta, descripcion, precio, default_image_id, default_combination_id, default_category_id - extras: combinations, images, categories -- combinations - id, product_id, precio, default_image_id -- categories - id, nombre, parent_category_id, descripcion - extras: parent_categories, products -- carritos - id, customer_id, (boolean) activo - extras: products, id codigos de promocion aplicados -- customers - id, nombre, email -- códigos de promoción - id, código, cantidad del descuento, tipo (porcentaje o monto) diff --git a/sql/products.sql b/sql/products.sql new file mode 100644 index 0000000..1f967e7 --- /dev/null +++ b/sql/products.sql @@ -0,0 +1,54 @@ +select + p.id_product as id, + pl.name, + pl.description_short, + pl.description, + p.price, + i.id_image as default_image_id, + c.id_category as default_category_id, + ( + SELECT + GROUP_CONCAT( + agl.name, + '_', + al.name + ORDER BY + agl.id_attribute_group SEPARATOR '-' + ) as attribute_designation + FROM + ps_product_attribute_combination pac + LEFT JOIN ps_attribute a ON a.id_attribute = pac.id_attribute + LEFT JOIN ps_attribute_group ag ON ag.id_attribute_group = a.id_attribute_group + LEFT JOIN ps_attribute_lang al ON ( + a.id_attribute = al.id_attribute + AND al.id_lang = 1 + ) + LEFT JOIN ps_attribute_group_lang agl ON ( + ag.id_attribute_group = agl.id_attribute_group + AND agl.id_lang = 1 + ) + WHERE + pac.id_product_attribute IN ( + SELECT + pa.id_product_attribute + FROM + ps_product_attribute pa + WHERE + pa.id_product = p.id_product + and default_on = 1 + GROUP BY + pa.id_product_attribute + ) + GROUP BY + pac.id_product_attribute + ) as combo_default +from + ps_product p + inner join ps_product_lang pl on pl.id_product = p.id_product + and pl.id_lang = 1 + inner join ps_category c on c.id_category = p.id_category_default + left join ps_image i on i.id_product = p.id_product + and i.cover = 1 +where + p.active = 1 + and p.id_product = 1; \ No newline at end of file diff --git a/views/index.php b/views/index.php deleted file mode 100644 index a3e1e76..0000000 --- a/views/index.php +++ /dev/null @@ -1,22 +0,0 @@ - 0) { $.ajax({ type: "GET", url: url_ajax, data: {'search' : buscar}, dataType: "json", success: function(response){ $.each(response, function(i, v) { res += ''+v.id_product+''+v.name+''; }) $('#result').html(res); }, }); } else { $('#result').html(''); } } \ No newline at end of file diff --git a/views/js/index.php b/views/js/index.php deleted file mode 100644 index a3e1e76..0000000 --- a/views/js/index.php +++ /dev/null @@ -1,22 +0,0 @@ -
{l s='Busca un producto' mod='garraroprueba'}

{l s='Aprende a programar con Prestashop en' mod='garraroprueba'} garraro.com

{l s='ID Producto' mod='garraroprueba'} {l s='Nombre' mod='garraroprueba'}
\ No newline at end of file diff --git a/views/templates/admin/index.php b/views/templates/admin/index.php deleted file mode 100644 index a3e1e76..0000000 --- a/views/templates/admin/index.php +++ /dev/null @@ -1,22 +0,0 @@ -