add authors page
This commit is contained in:
@@ -7,11 +7,30 @@ function bookid_kuri($slug) {
|
||||
|
||||
$query = "
|
||||
SELECT
|
||||
`price_id`, `pricename`, `categoryname`, `priceslug`, `categoryslug`, price.category_id AS category_id, `BeginDate`, `priceanons`, `priceimg`, `pricehash`, `pieces`, `price`, `offline_price`, `sub`
|
||||
`price_id`,
|
||||
`pricename`,
|
||||
`categoryname`,
|
||||
`priceslug`,
|
||||
`categoryslug`,
|
||||
price.category_id AS category_id,
|
||||
`BeginDate`,
|
||||
`priceanons`,
|
||||
`priceimg`,
|
||||
`pricehash`,
|
||||
`pieces`,
|
||||
`price`,
|
||||
`offline_price`,
|
||||
`sub`,
|
||||
`authorslug`,
|
||||
`author`,
|
||||
`priceauthor_id`
|
||||
FROM
|
||||
`price`
|
||||
LEFT JOIN `pricecategory`
|
||||
ON price.category_id = pricecategory.category_id
|
||||
ON price.category_id = pricecategory.category_id
|
||||
LEFT JOIN `price_authors`
|
||||
ON `price`.`priceauthor_id` = `price_authors`.`author_id`
|
||||
|
||||
WHERE
|
||||
`priceslug` = '$slug'
|
||||
LIMIT 1
|
||||
@@ -43,8 +62,9 @@ function bookid_kuri($slug) {
|
||||
|
||||
/**
|
||||
* вернуть товары магазина (все или по фильтру)
|
||||
*
|
||||
*/
|
||||
function api_books_kuri($category = 'knigi', $filter = 'all', $page = 1){
|
||||
function api_books_kuri($filter = 'all', $page = 1){
|
||||
|
||||
$limit = 24;
|
||||
|
||||
@@ -55,13 +75,20 @@ function api_books_kuri($category = 'knigi', $filter = 'all', $page = 1){
|
||||
else {
|
||||
$offset_str = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($category == 'all'){
|
||||
if ($filter == 'all'){
|
||||
$where = '';
|
||||
}
|
||||
else {
|
||||
else {
|
||||
$where = "$filter ";
|
||||
}
|
||||
|
||||
$category_sql = "SELECT `category_id` FROM `pricecategory` WHERE `categoryslug` = '$category' LIMIT 1";
|
||||
|
||||
//`categoryslug` = '$category'
|
||||
|
||||
/* $category_sql = "SELECT `category_id` FROM `pricecategory` WHERE $filter LIMIT 1";
|
||||
|
||||
$category = db_get($category_sql);
|
||||
|
||||
@@ -70,9 +97,14 @@ function api_books_kuri($category = 'knigi', $filter = 'all', $page = 1){
|
||||
$where = "WHERE `category_id` = $category_id";
|
||||
}
|
||||
|
||||
}
|
||||
} */
|
||||
|
||||
if ($where !== '')
|
||||
$where .= "AND `active` = 1 ";
|
||||
else
|
||||
$where .= "`active` = 1 ";
|
||||
|
||||
$db_count = db_get("SELECT COUNT(price_id) AS count FROM `price` $where LIMIT 1;");
|
||||
$db_count = db_get("SELECT COUNT(price_id) AS count FROM `price` WHERE $where LIMIT 1;");
|
||||
|
||||
if (isset($db_count['error']))
|
||||
return False;
|
||||
@@ -80,8 +112,15 @@ function api_books_kuri($category = 'knigi', $filter = 'all', $page = 1){
|
||||
if (isset($db_count['count']))
|
||||
$count = $db_count['count'];
|
||||
|
||||
$sql_books = "SELECT * FROM `price` $where AND `active` = 1 ORDER BY `price_id` DESC LIMIT $limit OFFSET $offset_str";
|
||||
|
||||
$sql_books = "
|
||||
SELECT
|
||||
*
|
||||
FROM `price`
|
||||
LEFT JOIN `price_authors` ON `price`.`priceauthor_id` = `price_authors`.`author_id`
|
||||
WHERE $where
|
||||
ORDER BY `price_id` DESC
|
||||
LIMIT $limit OFFSET $offset_str";
|
||||
//echo $sql_books.'<br>';
|
||||
$books = db_get($sql_books);
|
||||
|
||||
if (!isset($books['error'])) {
|
||||
|
||||
Reference in New Issue
Block a user