diff --git a/app/api/book.php b/app/api/book.php
index a3c9c31..44d60fe 100644
--- a/app/api/book.php
+++ b/app/api/book.php
@@ -23,13 +23,19 @@ function bookid_kuri($slug) {
`sub`,
`authorslug`,
`author`,
- `priceauthor_id`
+ `priceauthor_id`,
+ `price`.`pricepart_id` as `pricepart_id`,
+ `partname`,
+ `partalias`
FROM
`price`
LEFT JOIN `pricecategory`
ON price.category_id = pricecategory.category_id
LEFT JOIN `price_authors`
ON `price`.`priceauthor_id` = `price_authors`.`author_id`
+ LEFT JOIN
+ `priceparts`
+ ON `price`.`pricepart_id` = `priceparts`.`pricepart_id`
WHERE
`priceslug` = '$slug'
@@ -114,14 +120,37 @@ function api_books_kuri($filter = 'all', $page = 1){
$sql_books = "
SELECT
- *
+ `price_id`,
+ `pricename`,
+ `priceslug`,
+ price.category_id AS category_id,
+ `BeginDate`,
+ `priceanons`,
+ `priceimg`,
+ `pricehash`,
+ `pieces`,
+ `price`,
+ `offline_price`,
+ `sub`,
+ `authorslug`,
+ `author`,
+ `priceauthor_id`,
+ `price`.`pricepart_id` as `pricepart_id`,
+ `partname`,
+ `partalias`
FROM `price`
- LEFT JOIN `price_authors` ON `price`.`priceauthor_id` = `price_authors`.`author_id`
+ LEFT JOIN
+ `price_authors`
+ ON `price`.`priceauthor_id` = `price_authors`.`author_id`
+ LEFT JOIN
+ `priceparts`
+ ON `price`.`pricepart_id` = `priceparts`.`pricepart_id`
WHERE $where
ORDER BY `price_id` DESC
LIMIT $limit OFFSET $offset_str";
//echo $sql_books.'
';
$books = db_get($sql_books);
+
if (!isset($books['error'])) {
diff --git a/app/routes/books.php b/app/routes/books.php
index 203a426..89c5c24 100644
--- a/app/routes/books.php
+++ b/app/routes/books.php
@@ -145,4 +145,53 @@ function author_kuri($slug, $page = 1){
+}
+
+/**
+ * книги авторов
+ */
+function knigi_kuri($slug, $page = 1){
+
+ $find_parts_sql = "SELECT * FROM `priceparts` WHERE `partalias` = '$slug' LIMIT 1";
+ $find_parts = db_get($find_parts_sql);
+
+ if (!isset($find_parts['pricepart_id'])){ # 404
+ echo 'not fount';
+ exit;
+ }
+
+ $filter = "`price`.`pricepart_id` = ".$find_parts['pricepart_id'];
+
+ $books = api_books_kuri($filter, $page);
+ $baseurl = SITE."knigi/$slug/";
+
+ if ($books['pages'] > 1){
+ $endurl = $baseurl.$books['pages'];
+ }
+
+ if ($page > 1) {
+ $pagetitle = $find_parts['partname']." - страница $page";
+ $prevpage = $page - 1 ;
+ $prevurl = $baseurl.$prevpage;
+
+ }
+ else {
+ $pagetitle = $find_parts['partname'];
+ }
+
+ if ($page < $books['pages']){
+ $nextpage = $page+1;
+ $nexturl = $baseurl.$nextpage;
+ }
+
+
+ $breadcrumbs['page'] = $pagetitle;
+
+
+ $tempcontent = VIEWPATH.'books.phtml';
+ include VIEWPATH.'layout.phtml';
+
+
+
+
}
\ No newline at end of file
diff --git a/app/views/book.phtml b/app/views/book.phtml
index 9242901..9042c1b 100644
--- a/app/views/book.phtml
+++ b/app/views/book.phtml
@@ -8,7 +8,12 @@
=$book['pricename']?>
=$book['priceanons']?> diff --git a/app/views/books.phtml b/app/views/books.phtml index fefa933..9b65d8f 100644 --- a/app/views/books.phtml +++ b/app/views/books.phtml @@ -6,11 +6,12 @@