free_sql($sql);
$smarty->assign('menu_internet_magazin', $mnu_categories);
/* ----------------------------------------------------------------------
18.09.2022
Фикс описаний товаров, чтоб не ебаться с json без особой нужды
---------------------------------------------------------------------- */
$sql = 'SELECT `json`, `id` FROM `pages` WHERE `tip` = "tovar" AND `opisanie` ISNULL AND `json`<> "" LIMIT 1';
//echo $sql . '
';
unset( $json_m );
unset( $json );
$json_m = $db -> free_sql( $sql );
$json = $db -> from_j ( $db -> json_fix( $json_m[0]['json'] ) );
unset( $a );
$opis = $json['opisanie'];
if ( !@$opis ) $opis= ' ';
$sql = 'UPDATE `pages` SET `opisanie` = "' . $db->json_prepare($opis) . '", `json`="" WHERE `id` = ' . $json_m[0]['id'];
//echo $sql;
if ($json_m[0]['id'])$db->free_sql($sql);
unset($id);
$sql = 'SELECT `id` FROM `pages` WHERE `tip` = "tovar" AND `txt` LIKE "%Полотенца бума%" AND `public`= "0" LIMIT 1';
//echo $sql . '
';
$id_m = $db -> free_sql( $sql );
$id=$id_m[0]['id'];
$sql = 'UPDATE `pages` SET `public` = "1", `parent`="10542" WHERE `id` = ' . $id;
//echo $sql;
if ($id)$db->free_sql($sql);
unset($id);
unset($id_m);
$sql = 'SELECT `id` FROM `pages` WHERE `tip` = "tovar" AND `txt` LIKE "%Бумага туалет%" AND `parent`<>"10543" LIMIT 1';
//echo $sql . '
';
$id_m = $db -> free_sql( $sql );
$id=$id_m[0]['id'];
$sql = 'UPDATE `pages` SET `public` = "1", `parent`="10543", "zakazEnable"=1 WHERE `id` = ' . $id;
//echo $sql;
if ($id)$db->free_sql($sql);
}
#if ( BD_TYPE == 'SQLITE3' ) $sql = 'CREATE TABLE IF NOT EXISTS `cart` (`id` INTEGER PRIMARY KEY NOT NULL, `pages_id` INTEGER, `user_id` TEXT,`kolvo` INTEGER, `t` INTEGER, FOREIGN KEY (pages_id) REFERENCES pages(id))';
#if ( BD_TYPE == 'MYSQL' ) $sql = 'CREATE TABLE IF NOT EXISTS `cart` (`id` int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, `pages_id` int(10) NOT NULL, `user_id` varchar(30) NOT NULL, `kolvo` int(4) NOT NULL, `t` varchar(13) NOT NULL, FOREIGN KEY (`pages_id`) REFERENCES `pages` (`id`) ) ENGINE="InnoDB" COLLATE "utf8_general_ci"';
#$db->free_sql($sql);
unset($a);
//получаем даннные корзины:
if ($_SESSION['user_id'])
$a['user_id']=$_SESSION['user_id'];
else
$a['user_id']=session_id();
$cart=$db->get_massiv('cart', $a, 'id');
$count=count($cart);
for($i=0;$i<$count;$i++){
$page_id=$cart[$i]['pages_id'];
$sql='SELECT pages.id, pages.txt, pages.cena, img.fileName FROM pages, img WHERE pages.id=' . $cart[$i]['pages_id'] . ' AND img.page_id=' . $cart[$i]['pages_id'] . ' LIMIT 1';
$res=$db->free_sql($sql);
$cart[$i]['txt'] = $res[0]['txt'];
$cart[$i]['cena'] = $res[0]['cena'];
$cart[$i]['fileName'] = $res[0]['fileName'];
}
$smarty->assign('cart', $cart);
$smarty->assign('cart_count', $count);
if (file_exists('skin/inc/mod/' . MOD . '/index.html'))
$smarty->display('skin/inc/mod/' . MOD . '/index.html', ID);
else
$smarty->display('api/modules/' . MOD . '/index.html', ID);
#if (MOD=='main' || MOD=='page' || MOD=='page_all')ob_end_flush();
/*if (MOD!='ajax'){
$finish = microtime(true);
$delta = $finish - $start;
echo '' . memory_get_usage() - $mem_start . ' b. | ' . $delta . ' сек. ';
}*/
@exec('php ' . MYDIR . '/php/getHtml.php &');
?>