add category
This commit is contained in:
@@ -23,13 +23,19 @@ function bookid_kuri($slug) {
|
|||||||
`sub`,
|
`sub`,
|
||||||
`authorslug`,
|
`authorslug`,
|
||||||
`author`,
|
`author`,
|
||||||
`priceauthor_id`
|
`priceauthor_id`,
|
||||||
|
`price`.`pricepart_id` as `pricepart_id`,
|
||||||
|
`partname`,
|
||||||
|
`partalias`
|
||||||
FROM
|
FROM
|
||||||
`price`
|
`price`
|
||||||
LEFT JOIN `pricecategory`
|
LEFT JOIN `pricecategory`
|
||||||
ON price.category_id = pricecategory.category_id
|
ON price.category_id = pricecategory.category_id
|
||||||
LEFT JOIN `price_authors`
|
LEFT JOIN `price_authors`
|
||||||
ON `price`.`priceauthor_id` = `price_authors`.`author_id`
|
ON `price`.`priceauthor_id` = `price_authors`.`author_id`
|
||||||
|
LEFT JOIN
|
||||||
|
`priceparts`
|
||||||
|
ON `price`.`pricepart_id` = `priceparts`.`pricepart_id`
|
||||||
|
|
||||||
WHERE
|
WHERE
|
||||||
`priceslug` = '$slug'
|
`priceslug` = '$slug'
|
||||||
@@ -114,14 +120,37 @@ function api_books_kuri($filter = 'all', $page = 1){
|
|||||||
|
|
||||||
$sql_books = "
|
$sql_books = "
|
||||||
SELECT
|
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`
|
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
|
WHERE $where
|
||||||
ORDER BY `price_id` DESC
|
ORDER BY `price_id` DESC
|
||||||
LIMIT $limit OFFSET $offset_str";
|
LIMIT $limit OFFSET $offset_str";
|
||||||
//echo $sql_books.'<br>';
|
//echo $sql_books.'<br>';
|
||||||
$books = db_get($sql_books);
|
$books = db_get($sql_books);
|
||||||
|
|
||||||
|
|
||||||
if (!isset($books['error'])) {
|
if (!isset($books['error'])) {
|
||||||
|
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,12 @@
|
|||||||
<p class="pricename">
|
<p class="pricename">
|
||||||
<a href="<?=SITE?>author/<?=$book['authorslug']?>"><?=$book['author']?></a>
|
<a href="<?=SITE?>author/<?=$book['authorslug']?>"><?=$book['author']?></a>
|
||||||
</p>
|
</p>
|
||||||
<?endif?>
|
<?endif?>
|
||||||
|
<?if ($book['pricepart_id'] > 0):?>
|
||||||
|
<p style="text-align: right;">
|
||||||
|
<a href="<?=SITE?>knigi/<?=$book['partalias']?>"><?=$book['partname']?></a>
|
||||||
|
</p>
|
||||||
|
<?endif?>
|
||||||
<p class="pricename"><?=$book['pricename']?></p>
|
<p class="pricename"><?=$book['pricename']?></p>
|
||||||
<?=$book['priceanons']?>
|
<?=$book['priceanons']?>
|
||||||
<?if ($buy_status):?>
|
<?if ($buy_status):?>
|
||||||
|
|||||||
@@ -6,11 +6,12 @@
|
|||||||
<a href="<?=$link?>" target="_blank">
|
<a href="<?=$link?>" target="_blank">
|
||||||
<img src="<?=picbook($book, 180, 280)?>" alt="<?=$book['pricename']?>">
|
<img src="<?=picbook($book, 180, 280)?>" alt="<?=$book['pricename']?>">
|
||||||
</a>
|
</a>
|
||||||
<?if ($book['priceauthor_id'] > 1):?>
|
<?if ($book['priceauthor_id'] > 0):?>
|
||||||
<p class="book_mini_title">
|
<p class="book_mini_title">
|
||||||
<a href="<?=SITE?>author/<?=$book['authorslug']?>"><?=$book['author']?></a>
|
<a href="<?=SITE?>author/<?=$book['authorslug']?>"><?=$book['author']?></a>
|
||||||
</p>
|
</p>
|
||||||
<?endif?>
|
<?endif?>
|
||||||
|
|
||||||
<p class="book_mini_title">
|
<p class="book_mini_title">
|
||||||
<a href="<?=$link?>"><?=$book['pricename']?></a>
|
<a href="<?=$link?>"><?=$book['pricename']?></a>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user