Skip to content

Commit

Permalink
correciones probando pedir datos de la web
Browse files Browse the repository at this point in the history
  • Loading branch information
Garrarop committed Nov 12, 2020
1 parent 37fb306 commit e9e3de8
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 15 deletions.
11 changes: 9 additions & 2 deletions config/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
'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',
'fromClause' => 'LEFT JOIN ps_category_product cp ON cp.id_category = c.id_category',
'whereClause' => '',
'groupClause' => '',
'orderClause' => ''
Expand All @@ -61,7 +61,14 @@
'whereClause' => '',
'groupClause' => '',
'orderClause' => ''
]
],
'childs' => [
'selectClause' => ' GROUP_CONCAT(distinct ch.id_category) AS id_child',
'fromClause' => 'left join ps_category ch on ch.id_parent = c.id_category',
'whereClause' => '',
'groupClause' => '',
'orderClause' => ''
]
]
],
'customers' => [
Expand Down
4 changes: 2 additions & 2 deletions controllers/front/carts.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public function initContent()

$sql = $query->toString();
if ($id != null){
print_r (Db::getInstance()->getRow($sql));
echo (json_encode(Db::getInstance()->getRow($sql)));
} else {
print_r (Db::getInstance()->executeS($sql));
echo (json_encode(Db::getInstance()->executeS($sql)));
}
}
}
4 changes: 2 additions & 2 deletions controllers/front/categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public function initContent()

$sql = $query->toString();
if ($id != null){
print_r (Db::getInstance()->getRow($sql));
echo (json_encode(Db::getInstance()->getRow($sql)));
} else {
print_r (Db::getInstance()->executeS($sql));
echo (json_encode(Db::getInstance()->executeS($sql)));
}
}
}
4 changes: 2 additions & 2 deletions controllers/front/combinations.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public function initContent()

$sql = $query->toString();
if ($id != null){
print_r (Db::getInstance()->getRow($sql));
echo (json_encode(Db::getInstance()->getRow($sql)));
} else {
print_r (Db::getInstance()->executeS($sql));
echo (json_encode(Db::getInstance()->executeS($sql)));
}
}
}
4 changes: 2 additions & 2 deletions controllers/front/customers.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public function initContent()

$sql = $query->toString();
if ($id != null){
print_r (Db::getInstance()->getRow($sql));
echo (json_encode(Db::getInstance()->getRow($sql)));
} else {
print_r (Db::getInstance()->executeS($sql));
echo (json_encode(Db::getInstance()->executeS($sql)));
}
}
}
2 changes: 1 addition & 1 deletion controllers/front/images.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ public function initContent()
// print_r (Db::getInstance()->getRow($sql));
// } else {
// }
print_r (Db::getInstance()->executeS($sql));
echo (json_encode(Db::getInstance()->executeS($sql)));
}
}
4 changes: 2 additions & 2 deletions controllers/front/products.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public function initContent()

$sql = $query->toString();
if ($id != null){
print_r (Db::getInstance()->getRow($sql));
echo (json_encode(Db::getInstance()->getRow($sql)));
} else {
print_r (Db::getInstance()->executeS($sql));
echo (json_encode(Db::getInstance()->executeS($sql)));
}
}
}
4 changes: 2 additions & 2 deletions controllers/front/promos.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public function initContent()

$sql = $query->toString();
if ($id != null){
print_r (Db::getInstance()->getRow($sql));
echo (json_encode(Db::getInstance()->getRow($sql)));
} else {
print_r (Db::getInstance()->executeS($sql));
echo (json_encode(Db::getInstance()->executeS($sql)));
}
}
}

0 comments on commit e9e3de8

Please sign in to comment.