add menus lk

This commit is contained in:
Your Name
2021-05-16 14:15:10 +03:00
parent 96a1540ef7
commit 2f2c1489a2
16 changed files with 154 additions and 58 deletions

View File

@@ -3,10 +3,9 @@
*
*/
function bookid_kuri($hash) {
$query = "SELECT `price_id`, `pricename`, `BeginDate`, `priceanons`, `priceimg`, `pricehash` FROM `price` WHERE `pricehash` = '$hash' LIMIT 1";
$query = "SELECT `price_id`, `pricename`, `BeginDate`, `priceanons`, `priceimg`, `pricehash`, `price` FROM `price` WHERE `pricehash` = '$hash' LIMIT 1";
$book = dbl_get($query);
@@ -21,6 +20,47 @@ function bookid_kuri($hash) {
}
}
/**
* вернуть товары магазина (все или по фильтру)
*/
function api_books_kuri($category = 'all', $page = 1){
$limit = 25;
if ($page > 1){
$offset = $limit * ($page - 1);
$offset_str = ", $offset";
}
else {
$offset_str = '';
}
if ($category == 'all'){
$where = '';
}
else {
$category_sql = "SELECT `category_id` FROM `pricecategory` WHERE `categoryslug` = '$category' LIMIT 1";
$category = db_get($category_sql);
if (isset($category['category_id'])) {
$category_id = $category['category_id'];
$where = "WHERE `category_id` = $category_id";
}
}
$sql_books = "SELECT * FROM `price` $where ORDER BY `price_id` DESC LIMIT $limit $offset_str";
return db_get($sql_books);
}