<?PHP
function ___print_product($id, $___view = '', $___view_small = 'price')
{
if( $id != '' ){
echo ' <form method="post" id="form_card_'.$id.'">
<div style="display:none;">
<span class="addtocart-button">
<input class="addtocart-button" title="Add to Cart" type="submit" name="addtocart" value="Add to Cart" />
</span>
<input type="hidden" name="quantity[]" value="1" />
<input class="pname" type="hidden" value="Hand Shovel" />
<input type="hidden" name="option" value="com_" />
<input type="hidden" name="view" value="cart" />
<input type="hidden" name="task" value="add" />
<input type="hidden" name="_product_id[]" value="'.$id.'" />
<input type="hidden" name="_manufacturer_id" value="1" />
<input type="hidden" name="_category_id[]" value="1" />
</div>
';
#=============================================================
#Цена
WHERE `idproduct` = '".$id."' LIMIT 1;"));
WHERE `_product_id` = '".$id."' LIMIT 1;"));
if( $___view_small == 'price' ) { $___style_price = "top25";}else{ $___style_price = "top20";}
$___price_product['product_price'] = round($___price_product['product_price']); if( $___price_product_sale['cena'] == '' || $___price_product_sale['cena'] == 0 )
{
$___print_price = '<div class="oldprice">'.$___price_product['product_price'].',00 <img src="/templates/img/rub.png" alt=""> </div>';
}else{
$___print_price = '<div class="discprice">'.$___price_product['product_price'].',00 <img src="/templates/img/rub.png" alt=""></div>
<div class="oldprice '.$___style_price.'">'.$___price_product_sale['cena'].',00 <img src="/templates/img/rub.png" alt=""> </div>';
}
#=============================================================
#=============================================================
#Название
WHERE `_product_id` = '".$id."' LIMIT 1;"));
#=============================================================
#=============================================================
#Ссылка на товар
// Получаем основную категорию
WHERE `idproduct` = '".$id."' LIMIT 1;"));
#=============================================================
#Картинка $___img['file_url']
WHERE `_product_id` = '".$id."'
ORDER BY `ordering` ASC LIMIT 1;"));
WHERE `_media_id` = '".$___img_id['_media_id']."' LIMIT 1;"));
if( $___view_small == 'pricesmall' ) {
$___print_img = '<div class="fotomm223135"><img src="timthumb.php?src='.$___img_product['file_url'].'&w=190&h=135" alt=""></div>';
}else{
$___print_img = '<div class="fotomm300182"><img src="timthumb.php?src='.$___img_product['file_url'].'&w=260&h=182" alt=""></div>';
}
if( $___view == '1' ) { $___print_img = '<img src="timthumb.php?src='.$___img_product['file_url'].'&w=300&h=474" alt="">'; }
else{ $___view = 0; }
$___print_modal_windows = '<a class="view chaintoggler" href="'.$___link.'" title="Быстрый просмотр"></a>';
if( $___view == '1' ) { $___print_modal_windows = '<a class="view chaintoggler" href="#fastviewjacket" '
. 'onclick="return load_modal_tovar('.$id.','.$___view.');" dependency="fastview" title="Быстрый просмотр"></a> '; }
if( $___view_small == 'price' ) { $___style_name = '';}else{ $___style_name = 'style="overflow:hidden;height:42px;"';}
#################################################################
# АДМИН - управлени датами
// 7413-admin2
if( $___user_id == 7413){
WHERE `_product_id` = '".$id."' LIMIT 1;"));
?>
<div style="border:1px #000 solid;padding:2px;border-color:#b2b2b2;"><input type="text" id="datecreate<?PHP echo $id ?>" value="<?PHP echo $___data_create['created_on'] ?>" style="color:#000;font-size:14px;width:14px;width:150px;padding:0;margin:0;"><span id="datecreateinfo<?PHP echo $id ?>"></span>
<a href="#" onclick="SaveDateCreate('<?PHP echo $id ?>');return false;">Сохранить</a></div>
<?PHP
}
#################################################################
echo '
<div class="recommenditem">
<a href="'.$___link.'">'.$___print_img.'</a>
<div class="recommendtitle" '.$___style_name.'>
<h6 '.$___style_name.'>'.$___name_product['product_name'].'</h6>
</div>
<div class="'.$___view_small.'">
'.$___print_price.'
</div>
<div class="hovermenu">
'.$___print_modal_windows.'
<a class="fav" href="#" onclick="add_favorities_js('."'".$id."'".');return false;" title="Добавить в избранное"></a>
<a class="inbasket" href="#" onclick="jQuery('."'#form_card_".$id."'".').submit();return false;" title="Добавить в корзину"></a>
</div>
<div style="clear: both"></div>
</div></form>';
}
}
include('./templates/functions.php');
include('index-sidebar.php');
function ___be_razmer($id){
$___return_data = 0;
if( $_SESSION['filter_type_array_razm'] == '' )
{
return 1;
}else{
$___filter_cheked = $_SESSION['filter_type_array_razm'];
$___filter_cheked = explode(':',$___filter_cheked);
for($i=0;$i<=sizeof($___filter_cheked);$i++){ if( $___filter_cheked[$i] != '' ){
WHERE `idtovara` = ".$id." AND `razmer` LIKE '%".$___filter_cheked[$i]."%' AND `cols` > 0 LIMIT 1;"));
//echo "SELECT * FROM `__razmeri`
// WHERE `idtovara` = ".$id." AND `razmer` LIKE '%".$___filter_cheked[$i]."%' LIMIT 1;".'<BR>';
//$pos = strpos($data['razmer'] , $___filter_cheked[$i]);
//if ($pos === true) {
// if( $data['idtovara'] != '' ) $___return_data = 1;
//}
//echo $data['idtovara'].' - '.$data['razmer'].'<BR>';
if( $data['idtovara'] != '' ) $___return_data = 1;
if( $___return_data != 0 ) break;
}
}
return $___return_data;
}
}
function ___be_main_category($id,$catid){
$___return_data = 0;
#Запрос проверяет, находится ли продукт в корневой категории
WHERE `_product_id` = ".$id." AND `_category_id` = ".$catid." LIMIT 1;"));
$___tmp_type_count = 0;
if( $data['_product_id'] != '' ){
$___filter_cheked = $_SESSION['filter_type_array'];
$___filter_cheked = explode(':',$___filter_cheked);
for($i=0;$i<sizeof($___filter_cheked);$i++){
if( $catid != $___filter_cheked[$i] && $___filter_cheked[$i] != ''){
if( $___filter_cheked[$i] != 125 && $___filter_cheked[$i] != 126 && $___filter_cheked[$i] != 112 && $___filter_cheked[$i] != 118 && $___filter_cheked[$i] != 140
&& $___filter_cheked[$i] != 139 && $___filter_cheked[$i] != 143 && $___filter_cheked[$i] != 120 && $___filter_cheked[$i] != 110 && $___filter_cheked[$i] != 107
&& $___filter_cheked[$i] != 123 && $___filter_cheked[$i] != 121 && $___filter_cheked[$i] != 109 && $___filter_cheked[$i] != 111 && $___filter_cheked[$i] != 122
&& $___filter_cheked[$i] != 119 && $___filter_cheked[$i] != 145 && $___filter_cheked[$i] != 137 && $___filter_cheked[$i] != 148 && $___filter_cheked[$i] != 142
&& $___filter_cheked[$i] != 108 && $___filter_cheked[$i] != 141)
{
$___tmp_type_count++;
WHERE `_product_id` = ".$id." AND `_category_id` = ".$___filter_cheked[$i]." LIMIT 1;"));
if( $data['_product_id'] != '' ) $___return_data = 1;
if( $___return_data != 0 ) break;
}
}
}
}
if( $___tmp_type_count == 0 ) $___return_data = 1;
return $___return_data;
}
function ___be_brand($id,$__cats_id){
$___return_data = 0;
if( $__cats_id == '' )
{
return 1;
}else{
#Запрос оставляет только выбранные бренды
$__cats_id = explode(',',$__cats_id);
$__cats_id_count = sizeof($__cats_id );
$___tmp_brands_count = 0;
for($i=0; $i<=$__cats_id_count; $i++){
if( $__cats_id[$i] == 125 || $__cats_id[$i] == 126 || $__cats_id[$i] == 112 || $__cats_id[$i] == 118 || $__cats_id[$i] == 140
|| $__cats_id[$i] == 139 || $__cats_id[$i] == 143 || $__cats_id[$i] == 120 || $__cats_id[$i] == 110 || $__cats_id[$i] == 107
|| $__cats_id[$i] == 123 || $__cats_id[$i] == 121 || $__cats_id[$i] == 109 || $__cats_id[$i] == 111 || $__cats_id[$i] == 122
|| $__cats_id[$i] == 119 || $__cats_id[$i] == 145 || $__cats_id[$i] == 137 || $__cats_id[$i] == 148 || $__cats_id[$i] == 142
|| $__cats_id[$i] == 108 || $__cats_id[$i] == 141)
{
$___tmp_brands_count++;
WHERE `_product_id` = ".$id." AND `_category_id` = ".$__cats_id[$i]." LIMIT 1;"));
if( $data['_product_id'] != '' ) $___return_data = 1;
}
if( $___return_data != 0 ) break;
}
if( $___tmp_brands_count == 0 )$___return_data = 1;
return $___return_data;
}
}
$___mysql_filter_1 = " `__product_categories`.`_category_id` = ".$this->category->_category_id." ";
if( $_SESSION['filter_type'] != '' ){
$___mysql_filter_1 = $_SESSION['filter_type'];
//$___mysql_filter_1 = str_replace('IN (','IN ('.$this->category->_category_id.', ',$___mysql_filter_1);
}
$__cats_id = explode('(',$___mysql_filter_1); $__cats_id = explode(')',$__cats_id[1
]); $__cats_id = $__cats_id[0];
if($res_temp = mysql_query(" SELECT * FROM `__products` INNER JOIN `__product_categories`
ON `__product_categories`.`_product_id` = `__products`.`_product_id`
WHERE ".$___mysql_filter_1." AND
`__products`.`published` = 1
ORDER BY `__products`.`created_on` DESC;"))
{
$___arr_obyv = NULL;
$___arr_odejda = NULL;
{
WHERE `idproduct` = '".$data_temp['_product_id']."' LIMIT 1;"));
#Проверка на выделенный бренд
if(___be_brand($data_temp['_product_id'],$__cats_id) == 1 ){
#Проверка на категорию товара
if( ___be_main_category($data_temp['_product_id'],$this->category->_category_id) == 1 ){
#Проверка на размер
if( ___be_razmer($data_temp['_product_id']) == 1 ){
if( $___type_product_view['view'] == 'clothing1' )
{
$___arr_odejda[] = $data_temp['_product_id'];
}else{
$___arr_obyv[] = $data_temp['_product_id'];
}
}
}
}
}
}
//print_r($___arr_obyv);
#####################################
if( $___current_page < 0 ) $___current_page = 0;
$___obyv_page = 12; //Количество обуви на страницу 6, 24
$___odejda_page = 6; //Количество одежды на страницу 6, 9
$___obyv_page_all = 18; //Количество обуви на страницу 6, 24
$___odejda_page_all = 9; //Количество одежды на страницу 6, 9
$___view_main = 'default';
#Вычисляем на сколько страниц у нас хватит одежды и обуви
$___pages_with_odejda = ceil(sizeof($___arr_odejda)/$___odejda_page); $___pages_with_obyv = ceil(sizeof($___arr_obyv)/$___obyv_page);
if( $___pages_with_obyv >= $___pages_with_odejda){
$___pages_ONE_VIEW_ = $___pages_with_obyv-$___pages_with_odejda;
$num_pages_obyv = ceil((sizeof($___arr_obyv) - $___pages_with_odejda*$___obyv_page)/$___obyv_page_all); $num_pages = $___pages_with_odejda+$num_pages_obyv;
}else{
$___pages_ONE_VIEW_ = $___pages_with_odejda-$___pages_with_obyv;
$num_pages_odejda = ceil((sizeof($___arr_odejda) - $___pages_with_obyv*$___odejda_page)/$___odejda_page_all); $num_pages = $___pages_with_obyv+$num_pages_odejda;
}
#####################################
$___shet_obyv = $___current_page*$___obyv_page;
$___shet_odejda = $___current_page*$___odejda_page ;
#Если недостаточно одежды для вывода на страницу
if( sizeof($___arr_odejda)< $___current_page*$___odejda_page OR
sizeof($___arr_odejda) == 0
) { $___view_main = 'only_boots';
$___shet_obyv = ($___current_page-$___pages_with_odejda)*$___obyv_page_all+$___pages_with_odejda*$___obyv_page;
}
#Если недостаточно обуви для вывода на страницу
if( sizeof($___arr_obyv)< $___current_page*$___obyv_page OR
sizeof($___arr_obyv) == 0
) { $___view_main = 'only_odejda';
$___shet_odejda = ($___current_page-$___pages_with_obyv)*$___odejda_page_all+$___pages_with_obyv*$___odejda_page;
}
#####################################
#####################################
?>
<?PHP
//echo '<BR>Количество обуви - '.sizeof($___arr_obyv).'; количество одежды - '.sizeof($___arr_odejda).'<BR>';
//echo '<BR>Страниц обуви - '.$___pages_with_obyv.'; страниц одежды - '.$___pages_with_odejda.'; всего - '.$num_pages.'<BR>';
//echo '<BR>Вид - '.$___view_main.'<BR>';
if( $___view_main == 'default' ){
?>
<div class="maincatalog span9">
<div class="span3">
<?PHP
//Одежда 0
$___id_prd = $___arr_odejda[0+$___shet_odejda];
if( $___id_prd == '' ) { $___id_prd = $___arr_odejda[rand(0
,sizeof($___arr_odejda)-1
)];} ___print_product($___id_prd,'1','pricesmall');
//Обувь 3
$___id_prd = $___arr_obyv[3+$___shet_obyv];
if( $___id_prd == '' ) { $___id_prd = $___arr_obyv[rand(0
,sizeof($___arr_obyv)-1
)];} ___print_product($___id_prd,'','pricesmall');
//Обувь 4
$___id_prd = $___arr_obyv[4+$___shet_obyv];
if( $___id_prd == '' ) { $___id_prd = $___arr_obyv[rand(0
,sizeof($___arr_obyv)-1
)];} ___print_product($___id_prd,'','pricesmall');
//Одежда 3
$___id_prd = $___arr_odejda[3+$___shet_odejda];
if( $___id_prd == '' ) { $___id_prd = $___arr_odejda[rand(0
,sizeof($___arr_odejda)-1
)];} ___print_product($___id_prd,'1','pricesmall');
//Обувь 9
$___id_prd = $___arr_obyv[9+$___shet_obyv];
if( $___id_prd == '' ) { $___id_prd = $___arr_obyv[rand(0
,sizeof($___arr_obyv)-1
)];} ___print_product($___id_prd,'','pricesmall');
//Обувь 10
$___id_prd = $___arr_obyv[10+$___shet_obyv];
if( $___id_prd == '' ) { $___id_prd = $___arr_obyv[rand(0
,sizeof($___arr_obyv)-1
)];} ___print_product($___id_prd,'','pricesmall');
?>
</div>
<div class="span3">
<?PHP
//Обувь 0
$___id_prd = $___arr_obyv[0+$___shet_obyv];
if( $___id_prd == '' ) { $___id_prd = $___arr_obyv[rand(0
,sizeof($___arr_obyv)-1
)];} ___print_product($___id_prd ,'','pricesmall');
//Обувь 2
$___id_prd = $___arr_obyv[2+$___shet_obyv];
if( $___id_prd == '' ) { $___id_prd = $___arr_obyv[rand(0
,sizeof($___arr_obyv)-1
)];} ___print_product($___id_prd ,'','pricesmall');
//Одежда 2
$___id_prd = $___arr_odejda[2+$___shet_odejda];
if( $___id_prd == '' ) { $___id_prd = $___arr_odejda[rand(0
,sizeof($___arr_odejda)-1
)];} ___print_product($___id_prd,'1','pricesmall');
//Обувь 6
$___id_prd = $___arr_obyv[6+$___shet_obyv];
if( $___id_prd == '' ) { $___id_prd = $___arr_obyv[rand(0
,sizeof($___arr_obyv)-1
)];} ___print_product($___id_prd,'','pricesmall');
//Обувь 8
$___id_prd = $___arr_obyv[8+$___shet_obyv];
if( $___id_prd == '' ) { $___id_prd = $___arr_obyv[rand(0
,sizeof($___arr_obyv)-1
)];} ___print_product($___id_prd,'','pricesmall');
//Одежда 5
$___id_prd = $___arr_odejda[5+$___shet_odejda];
if( $___id_prd == '' ) { $___id_prd = $___arr_odejda[rand(0
,sizeof($___arr_odejda)-1
)];} ___print_product($___id_prd,'1','pricesmall');
?>
</div>
<div class="span3">
<?PHP
//Обувь 1
$___id_prd = $___arr_obyv[1+$___shet_obyv];
if( $___id_prd == '' ) { $___id_prd = $___arr_obyv[rand(0
,sizeof($___arr_obyv)-1
)];} ___print_product($___id_prd,'','pricesmall');
//Одежда 1
$___id_prd = $___arr_odejda[1+$___shet_odejda];
if( $___id_prd == '' ) { $___id_prd = $___arr_odejda[rand(0
,sizeof($___arr_odejda)-1
)];} ___print_product($___id_prd,'1','pricesmall');
//Обувь 5
$___id_prd = $___arr_obyv[5+$___shet_obyv];
if( $___id_prd == '' ) { $___id_prd = $___arr_obyv[rand(0
,sizeof($___arr_obyv)-1
)];} ___print_product($___id_prd,'','pricesmall');
//Обувь 7
$___id_prd = $___arr_obyv[7+$___shet_obyv];
if( $___id_prd == '' ) { $___id_prd = $___arr_obyv[rand(0
,sizeof($___arr_obyv)-1
)];} ___print_product($___id_prd,'','pricesmall');
//Одежда 4
$___id_prd = $___arr_odejda[4+$___shet_odejda];
if( $___id_prd == '' ) { $___id_prd = $___arr_odejda[rand(0
,sizeof($___arr_odejda)-1
)];} ___print_product($___id_prd,'1','pricesmall');
//Обувь 11
$___id_prd = $___arr_obyv[11+$___shet_obyv];
if( $___id_prd == '' ) { $___id_prd = $___arr_obyv[rand(0
,sizeof($___arr_obyv)-1
)];} ___print_product($___id_prd,'','pricesmall');
?>
</div>
</div>
<div class="clear"></div>
<?PHP
}
if( $___view_main == 'only_boots'){
?>
<div class="maincatalog span9">
<div class="span3">
<?PHP
___print_product($___arr_obyv[0+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[3+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[6+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[9+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[12+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[15+$___shet_obyv],'','pricesmall');
?>
</div>
<div class="span3">
<?PHP
___print_product($___arr_obyv[1+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[4+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[7+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[10+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[13+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[16+$___shet_obyv],'','pricesmall');
?>
</div>
<div class="span3">
<?PHP
___print_product($___arr_obyv[2+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[5+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[8+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[11+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[14+$___shet_obyv],'','pricesmall');
___print_product($___arr_obyv[17+$___shet_obyv],'','pricesmall');
?>
</div>
</div>
<div class="clear"></div>
<?PHP
}
if( $___view_main == 'only_odejda'){
?>
<div class="span3">
<?PHP
___print_product($___arr_odejda[0+$___shet_odejda],'1','pricesmall');
___print_product($___arr_odejda[3+$___shet_odejda],'1','pricesmall');
___print_product($___arr_odejda[6+$___shet_odejda],'1','pricesmall');
?>
</div>
<div class="span3">
<?PHP
___print_product($___arr_odejda[1+$___shet_odejda],'1','pricesmall');
___print_product($___arr_odejda[4+$___shet_odejda],'1','pricesmall');
___print_product($___arr_odejda[7+$___shet_odejda],'1','pricesmall');
?>
</div>
<div class="span3">
<?PHP
___print_product($___arr_odejda[2+$___shet_odejda],'1','pricesmall');
___print_product($___arr_odejda[5+$___shet_odejda],'1','pricesmall');
___print_product($___arr_odejda[8+$___shet_odejda],'1','pricesmall');
?>
</div>
<?PHP
}
?>
<!--END main row-->
</div>
<?PHP
if( $num_pages > 1){
?>
<div class="pagination"><ul>
<?PHP
$___url_page = explode('?',$_SERVER['REQUEST_URI']);
$___page_min = $___page - 1;
$___page_plus = $___page + 1;
if( $___page_min < 1 ) $___page_min = 1;
if( $___page_plus > $num_pages ) $___page_plus = $num_pages;
?>
<li><a href="<?PHP echo $___url_page[0].'?page='.($i+1)?>"><img src="/templates/img/prev.png" alt=""></a></li>
<li><a href="<?PHP echo $___url_page[0].'?page='.($___page_min)?>">Назад</a></li>
<?PHP
if( $___page == '' ) $___page = 1;
for($i=0;$i<$num_pages;$i++){
if( ($i >= ($___page - 4)) && ($i < ($___page + 6))){
if( $___page-1 == $i ){
echo ' <li class="active"><a href="#" onclick="return false;">'.($i+1).'</a></li>';
}else{
echo ' <li><a href="'.$___url_page[0].'?page='.($i+1).'">'.($i+1).'</a></li>';
}
}
}
?><li><a href="<?PHP echo $___url_page[0].'?page='.($___page_plus)?>">Вперед</a></li>
<li><a href="<?PHP echo $___url_page[0].'?page='.($num_pages)?>"><img src="/templates/img/next.png" alt=""></a></li></ul></div>
<?PHP }else{ echo '<BR>';} ?>
<?PHP
?>
<?PHP include('./templates/__footer_socials.php') ?>
<div>