0 ) { $id = $gData->FindGoodsPSU(addslashes($psu_code)); if ( $id == 0 ) { header("Location: ./"); exit; } } // Request Goods $goods = $gData->GetGoods($id); if ( ($goods['id']*1 == 0) || ($goods['active'] == 0)) { header("Location: ./"); exit; } $gGoodsID = $goods['id']; // Redirect to psevdo-static url if ( strlen($psu_code) == 0 && strlen($goods['seo_psu']) > 0 && !isset($_POST['action']) ) { header("Location: ./goods_".urlencode($goods['seo_psu']).'.htm'); exit; } // Get base shop options $gOptions = $gData->GetShopValues('goods'); if ($_SESSION['payment']['multiplex'] > 0) { $gOptions['main_base_curr'] = $_SESSION['payment']['curr_name']; $gOptions['main_prec'] = $_SESSION['payment']['curr_prec']; } $goods_name_max = $gOptions['main_goods_name']; $goods_descr_max = $gOptions['main_goods_descr']; // Define client if ( !isset($_SESSION['client']) ) { new_client(); } // Test for reload database if ( test_basket_reload() ) exit; // Save shop statistic save_shop_stat('goods', $id); // Make path for back make_back_path(); // Init templates $gTpl = new FastTemplate('./'.TEMPLATES.'/_goods'); $gTpl->DefineTemplate(array('main' => 'main.htm', 'descr_full' => 'descr_full.htm', 'descr_simple' => 'descr_simple.htm', 'descr_icon' => 'descr_icon.htm', 'order_form' => 'order_form.htm', 'no_order' => 'no_order.htm', 'price_client' => 'price_client.htm', 'price_new' => 'price_new.htm', 'price_simple' => 'price_simple.htm', 'apendix_name' => 'apendix_name.htm', 'new' => 'new.htm', 'hit' => 'hit.htm', 'status0' => 'status0.htm', 'status1' => 'status1.htm', 'status2' => 'status2.htm', 'status3' => 'status3.htm', 'status4' => 'status4.htm' )); // Default vars $client_category = $_SESSION['client']['category_id']*1; $ic_value = $_SESSION['payment']['multiplex']*1; // Parse cross sections $tpl_sub = new FastTemplate('./'.TEMPLATES.'/_goods/sections'); $tpl_sub->DefineTemplate(array('between_row' => 'between_row.htm', 'unit' => 'unit.htm' )); $goods_section = $gData->GetGoodsSection($goods['id']); $rows = $gData->GetNumRows($goods_section); $hidden_topic = ( $rows == 0 ); $col_cnt = 1; for ( $i = 1; $i <= $rows; $i++ ) { $hash = $gData->FetchRow($goods_section); if ( ($col_cnt == $gOptions['goods_sec_col']) && ($i <> $rows) ) { $tpl_sub->Parse('BETWEENROW', 'between_row'); $col_cnt = 1; } else { $tpl_sub->Assign('BETWEENROW', ''); $col_cnt += 1; } if ( is_file('./files/topic'.$hash[0].'.jpg') ) { $img_file = 'files/topic'.$hash[0].'.jpg'; } else { $img_file = 'files/topic_default.jpg'; } if ($hash[5] == 2) { $link = $hash[6]; } else { if ( strlen($hash[8]) == 0 ) { $link = 'dir.php?id='.$hash[0]; } else { $link = './dir_'.urlencode($hash[8]).'.htm'; } } $tpl_sub->Assign(array('LINK' => $link, 'NAME' => htmlspecialchars($hash[1]), 'DESCR' => $hash[4], 'ICON' => $img_file, 'TITLE' => ( strlen($hash[7]) > 0) ? htmlspecialchars($hash[7]) : htmlspecialchars($hash[1]) )); $tpl_sub->Parse('UNIT', '.unit'); if ( $i == 1 ) $current_sec_id = $hash[0]; } $gTpl->Assign('SECUNIT', $tpl_sub->Fetch('UNIT')); // Save voice if need $verify_code_pass = true; if ( $gOptions['main_no_spam'] == 'True' ) $verify_code_pass = right_verify_code(); if ( $_POST['action'] == 'save_voice' && $verify_code_pass && strlen($_POST['name']) > 0 && strlen($_POST['mess_text']) > 0 ) { $gData->AddComment($gGoodsID, get_now(), addslashes($_POST['name']), addslashes($_POST['email']), addslashes($_POST['mess_text']), $_POST['set_voice']*1, ip2long(user_ip()) ); } // Parse comments if need $gTpl->Assign(array('COMMENT' => '', 'VOICEIMG' => '' )); if ( $gOptions['goods_comm_allow'] == 'True' ) { $tpl_sub = new FastTemplate('./'.TEMPLATES.'/_goods/comment'); $tpl_sub->DefineTemplate(array('main' => 'main.htm', 'unit' => 'unit.htm', 'comments' => 'comments.htm', 'verify_code' => 'verify_code.htm', 'between_row' => 'between_row.htm', 'empty' => 'empty.htm', 'voice0' => 'voice0.htm', 'voice1' => 'voice1.htm', 'voice2' => 'voice2.htm', 'voice3' => 'voice3.htm', 'voice4' => 'voice4.htm', 'voice5' => 'voice5.htm', 'voiceimg0' => 'voiceimg0.htm', 'voiceimg1' => 'voiceimg1.htm', 'voiceimg2' => 'voiceimg2.htm', 'voiceimg3' => 'voiceimg3.htm', 'voiceimg4' => 'voiceimg4.htm', 'voiceimg5' => 'voiceimg5.htm' )); $comment = $gData->GetGoodsComment($gGoodsID); $rows = $gData->GetNumRows($comment); if ( $rows > 0 ) { $voice_sum = 0; $voice_cnt = 0; for ( $i = 1; $i <= $rows; $i++ ) { $hash = $gData->FetchRow($comment); if ( $rows == $i ) $tpl_sub->Assign('BETWEENROW', ''); $tpl_sub->Assign(array('NAME' => htmlspecialchars($hash[3]), 'EMAIL' => htmlspecialchars($hash[4]), 'DATETIME' => date($gOptions['main_fmt_date_time'], strtotime($hash[2])), 'MESSTEXT' => emo2img(nl2br(htmlspecialchars($hash[5]))) )); $tpl_sub->Parse('VOICE', 'voice'.$hash[6]); $tpl_sub->Parse('UNIT', '.unit'); if ( $hash[6] != 0 ) { $voice_sum += $hash[6]; $voice_cnt++; } } $tpl_sub->Parse('BETWEENROW', 'between_row'); $tpl_sub->Parse('COMMENTS', 'comments'); } else { $tpl_sub->Parse('COMMENTS', 'empty'); } if ( strlen($goods['name']) <= $goods_name_max && $goods_name_max > 0 ) { $goods_name = $goods['name']; } else { $goods_name = substr($goods['name'], 0, $goods_name_max).'...'; } $tpl_sub->Assign('GOODSNAME', htmlspecialchars($goods_name)); // Anti spam verify code if ( $gOptions['main_no_spam'] == 'True' ) { create_verify_code(); $tpl_sub->Parse('VERIFYCODE', 'verify_code'); } else { $tpl_sub->Assign('VERIFYCODE', ''); } $tpl_sub->Parse('COMMENT', 'main'); $gTpl->Assign('COMMENT', $tpl_sub->Fetch('COMMENT')); // Voice image if ( $voice_cnt > 0 ) { $voice_avg = round($voice_sum/$voice_cnt, 1); $voice_img = round($voice_sum/$voice_cnt, 0); } else { $voice_avg = 0; $voice_img = 0; } $tpl_sub->Assign(array('VALUE' => number_format($voice_avg, 1, "," ,""), 'COUNT' => $voice_cnt )); $tpl_sub->Parse('VOICEIMG', 'voiceimg'.$voice_img); $gTpl->Assign('VOICEIMG', $tpl_sub->Fetch('VOICEIMG')); } // Parse sections list $gTpl->Assign(sections($current_sec_id, false, $hidden_topic)); // Parse nil info keynames $info_key = $gData->GetInfoAllKeyName('in_preview'); $info_key_rows = $gData->GetNumRows($info_key); for ( $n = 1; $n <= $info_key_rows; $n++ ) { $hash = $gData->FetchRow($info_key); $gTpl->Assign($hash[0], ''); } // Parse info tree $info = $gData->GetInfoGoods($id, 'in_preview'); $info_rows = $gData->GetNumRows($info); if ( $info_rows > 0 ) { $tpl_sub = new FastTemplate('./'.TEMPLATES.'/_goods/info'); $tpl_sub->DefineTemplate(array('main' => 'main.htm', 'unit' => 'unit.htm', 'icon' => 'icon.htm', 'elem_file' => 'elem_file.htm', 'elem_folder'=> 'elem_folder.htm' )); $allow = array(); for ( $n = 1; $n <= $info_rows; $n++ ) { $hash = $gData->FetchRow($info); if ( (strlen($hash[5]) > 0) || ($allow[$hash[0]] == 1) ) { if ( $hash[4] == 1) { $tpl_sub->Assign(array('NAME' => htmlspecialchars($hash[1]), 'LEVEL' => $hash[2] )); $tpl_sub->Parse('ELEMENT', 'elem_folder'); } else { $icon_exists = is_file('./files/info_value'.$hash[7].'.jpg'); $value = htmlspecialchars($hash[5]); if ( strpos($hash[5], 'ftp://') !== false || strpos($hash[5], 'http://') !== false ) { if ( strlen($value) > 30 ) $value = substr($value, 0, 30).'...'; $value = ''.$value.''; } $tpl_sub->Assign(array('NAME' => htmlspecialchars($hash[1]), 'VALUE' => $value, 'LEVEL' => $hash[2], 'URL' => './files/info_value'.$hash[7].'.jpg' )); if ( $icon_exists ) $tpl_sub->Parse('VALUE', ',icon'); $tpl_sub->Parse('ELEMENT', 'elem_file'); } if ( strlen($hash[3]) > 0 ) { if ( strlen($hash[3]) > 0 ) $gTpl->Assign($hash[3], $tpl_sub->Fetch('VALUE')); } else { $allow[$hash[6]] = 1; $tpl_sub->Parse('UNIT', ',unit'); } } } if ( count($allow) > 0 ) { $tpl_sub->Parse('MAIN', 'main'); $info_content = $tpl_sub->Fetch('MAIN'); } else { $info_content = ''; } } else { $info_content = ''; } // Parse family $fam_goods = $gData->GetFamilyGoods($goods['family']); $fam_goods_rows = $gData->GetNumRows($fam_goods); if ( $fam_goods_rows > 1 ) { $tpl_sub = new FastTemplate('./'.TEMPLATES.'/_goods/family'); $tpl_sub->DefineTemplate(array('main' => 'main.htm', 'price' => 'price.htm', 'name' => 'name.htm', 'icon' => 'icon.htm', 'descr' => 'descr.htm', 'unit' => 'unit.htm', 'values' => 'values.htm', 'status0' => 'status0.htm', 'status1' => 'status1.htm', 'status2' => 'status2.htm', 'status3' => 'status3.htm', 'apendix_name' => 'apendix_name.htm' )); // Parse goods base for ( $g = 1; $g <= $fam_goods_rows; $g++ ) { $hash = $gData->FetchHash($fam_goods); // Make icon if ( is_file('./files/store'.$hash['id'].'.jpg') ) { $img_file = 'files/store'.$hash['id'].'.jpg'; } else { $img_file = 'files/store_default.jpg'; } $link = ( strlen($hash['seo_psu']) > 0 ) ? 'goods_'.urlencode($hash['seo_psu']).'.htm' : 'goods.php?id='.$hash['id']; // Make Apendix link $tpl_sub->Assign('GOODSNAME', htmlspecialchars($hash['name'])); if ( is_file('./files/apendix'.$hash['id'].'.htm') ) { if ( $hash['apendix_type'] == 0) { $link_app = ( strlen($hash['seo_psu']) > 0 ) ? 'descr_'.urlencode($hash['seo_psu']).'.htm' : 'descr.php?id='.$hash['id']; $apendix_link = ' href="'.$link_app.'" '; $apendix_link .= ' onclick="ShowApendix('."$hash[id], $hash[xpos], $hash[ypos], $hash[w], $hash[h]".'); return false;" '; $tpl_sub->Assign('APENDIXLINK', $apendix_link); $tpl_sub->Parse('APENDIXNAME', 'apendix_name'); } else { $tpl_sub->Assign('APENDIXLINK', "href=\"$link\""); $tpl_sub->Parse('APENDIXNAME', 'apendix_name'); } } else { $tpl_sub->Assign(array('APENDIXLINK' => "href=\"$link\"", 'APENDIXNAME' => '')); } // Make price offer list($new_price, $disc_proc, $disc_suma, $price_offer, $can_buy) = calc_goods_price($hash['id'], $hash['price'], $hash['disc_price']); // Info currency if ( $ic_value > 0 ) { $new_price = round($new_price*$ic_value, 2); } // Select $sel = ( $goods['id'] == $hash['id'] ) ? '1' : '0'; // Goods name and descr $goods_name = $hash['name']; if ( strlen($goods_name) > $goods_name_max && $goods_name_max > 0 ) $goods_name = substr($goods_name, 0, $goods_name_max).'...'; $goods_descr = html2text($hash['descr']); if ( strlen($goods_descr) > $goods_descr_max && $goods_descr_max > 0 ) $goods_descr = substr($goods_descr, 0, $goods_descr_max).'...'; // Assign vars $tpl_sub->Assign(array('VALUE' => htmlspecialchars($goods_name), 'LINK' => $link, 'BUY' => ( $can_buy && $hash['status'] != 1) ? 'SimpleBuy('.$hash['id'].')' : 'ToGoods('.$hash['id'].')', 'SEL' => $sel, 'ALT' => htmlspecialchars(str_replace('{NAME}', $hash['name'], $hash['seo_alt'])), 'LINKTITLE' => htmlspecialchars(str_replace('{NAME}', $hash['name'], $hash['seo_link'])) )); $tpl_sub->Parse('NAMES', '.name'); $tpl_sub->Assign('VALUE', htmlspecialchars($goods_descr)); $tpl_sub->Parse('DESCRS', '.descr'); $tpl_sub->Assign('ICON', $img_file); $tpl_sub->Parse('ICONS', '.icon'); $tpl_sub->Assign('VALUE', number_format($new_price, $gOptions['main_prec'], "," ,"'")); $tpl_sub->Parse('PRICES', '.price'); $tpl_sub->Parse('STATUSES', '.status'.$hash['status']); } // Parse goods information $family = $gData->GetInfoFamilyGoods($goods['family']); $family_rows = $gData->GetNumRows($family); $allow = array(); $tpl_sub->Assign('UNIT', ''); for ( $n = 1; $n <= $family_rows; $n++ ) { $hash = $gData->FetchHash($family); if ( ($hash['info_id']*1 > 0) || ($allow[$hash['id']] == 1) ) { $allow[$hash['tindex']] = 1; $tpl_sub->Assign(array('NAME' => htmlspecialchars($hash['name']), 'LEVEL' => $hash['tlevel'] )); $info_values = $gData->GetFamilyInfoValues($goods['family'], $hash['id']); $tpl_sub->Clear('VALUES'); for ( $g = 1; $g <= $fam_goods_rows; $g++ ) { $hash_value = $gData->FetchRow($info_values); $sel = ( $goods['id'] == $hash_value[1] ) ? '1' : '0'; $value = htmlspecialchars($hash_value[0]); if ( strpos($hash_value[0], 'ftp://') !== false || strpos($hash_value[0], 'http://') !== false ) { if ( strlen($value) > 15 ) $value = substr($value, 0, 15).'...'; $value = ''.$value.''; } $tpl_sub->Assign(array('VALUE' => $value, 'SEL' => $sel )); $tpl_sub->Parse('VALUES', '.values'); } $tpl_sub->Parse('UNIT', ',unit'); } } $tpl_sub->Parse('MAIN', 'main'); $gTpl->Assign('FAMILY', $tpl_sub->Fetch('MAIN')); } else { $gTpl->Assign('FAMILY', ''); } // Parse discount tree $disc = $gData->GetGoodsDiscounts($id); $rows = $gData->GetNumRows($disc); if ( $rows > 0 ) { $tpl_sub = new FastTemplate('./'.TEMPLATES.'/_goods/discount'); $tpl_sub->DefineTemplate(array('main' => 'main.htm', 'unit' => 'unit.htm', 'elem_file' => 'elem_file.htm', 'elem_folder' => 'elem_folder.htm', 'cat_ok' => 'cat_ok.htm', 'cat_default' => 'cat_default.htm' )); $allow = array(); for ( $n = 1; $n <= $rows; $n++ ) { $hash = $gData->FetchRow($disc); if ( (strlen($hash[11]) > 0) || ($allow[$hash[0]] == 1) ) { $allow[$hash[4]] = 1; if ( $ic_value > 0 ) { $hash[9] = round($hash[9]*$ic_value, 2); } $tpl_sub->Assign(array('NAME' => htmlspecialchars($hash[1]), 'DESCR' => $hash[2], 'LEVEL' => $hash[3] )); if ( strlen($hash[11]) > 0) { $tpl_sub->Assign(array('PROC' => number_format($hash[8], 2, "," ,"'"), 'SUMA' => number_format($hash[9], $gOptions['main_prec'], "," ,"'"), 'FROM' => number_format($hash[6], 0, "" ,"'"), 'CATOK' => '' )); ( $hash[7] == 0 ) ? $tpl_sub->Parse('CATEGORY', 'cat_default') : $tpl_sub->Assign('CATEGORY', htmlspecialchars($hash[12])); if ( ($hash[7] == $client_category) && ($client_category > 0) ) $tpl_sub->Parse('CATOK', 'cat_ok'); $tpl_sub->Parse('ELEMENT', 'elem_file'); } else { $tpl_sub->Parse('ELEMENT', 'elem_folder'); } $tpl_sub->Parse('UNIT', ',unit'); } } if ( count($allow) > 0 ) { $tpl_sub->Parse('MAIN', 'main'); $gTpl->Assign('DISCOUNT', $tpl_sub->Fetch('MAIN')); } else { $gTpl->Assign('DISCOUNT', ''); } } else { $gTpl->Assign('DISCOUNT', ''); } // Parse complectation if ( $goods['kind'] == 2 ) { $comp = $gData->GetCompGoods($id); $rows = $gData->GetNumRows($comp); if ( $rows > 0 ) { $tpl_sub = new FastTemplate('./'.TEMPLATES.'/_goods/comp'); $tpl_sub->DefineTemplate(array('main' => 'main.htm', 'unit' => 'unit.htm', 'unit_empty' => 'unit_empty.htm', 'between_row' => 'between_row.htm', 'footer' => 'footer.htm', 'footer_end' => 'footer_end.htm', 'kind' => 'kind.htm', 'config' => 'config.htm', 'title' => 'title.htm' )); $suma = 0; $col_cnt = 1; for ( $n = 1; $n <= $rows; $n++ ) { $hash = $gData->FetchRow($comp); if ( ($col_cnt == $gOptions['goods_comp_col']) && $rows != $n ) { $tpl_sub->Parse('BETWEENROW', 'between_row'); $col_cnt = 1; } else { $tpl_sub->Assign('BETWEENROW', ''); $col_cnt+=1; } // cut name if need if ( strlen($hash[2]) > $gOptions['goods_comp_name_lim'] ) { $name = substr($hash[2], 0, $gOptions['goods_comp_name_lim']).'...'; } else { $name = $hash[2]; } // make icon if ( is_file('./files/store'.$hash[0].'.jpg') ) { $img_file = 'files/store'.$hash[0].'.jpg'; } else { $img_file = 'files/store_default.jpg'; } // make price list($new_price, $disc_proc, $disc_suma, $price_offer, $can_buy) = calc_goods_price($hash[0], $hash[3], $hash[4]); // Info currency if ( $ic_value > 0 ) { $new_price = round($new_price*$ic_value, 2); } // special kind if ( $hash[5] == 1 ) { $link = ''; $tpl_sub->Parse('KIND', 'kind'); } else { $link = ( strlen($hash[9]) > 0 ) ? 'href="goods_'.urlencode($hash[9]).'.htm"' : 'href="goods.php?id='.$hash[0].'"'; $tpl_sub->Assign('KIND', ''); } // Assign vars $tpl_sub->Assign(array('NAME' => htmlspecialchars($name), 'CODE' => htmlspecialchars($hash[1]), 'ICON' => $img_file, 'PRICE' => number_format($new_price, $gOptions['main_prec'], "," ,"'"), 'LINK' => $link, 'HOW' => $hash[6], 'ALT' => htmlspecialchars(str_replace('{NAME}', $hash[2], $hash[8])), 'LINKTITLE' => htmlspecialchars(str_replace('{NAME}', $hash[2], $hash[7])) )); $tpl_sub->Parse('UNIT', '.unit'); $suma += $new_price*$hash[6]; } // Parse footers & empty cell's $how_col = ( $rows < $gOptions['goods_comp_col'] ) ? $rows : $gOptions['goods_comp_col']; for ( $n = $col_cnt; $n <= $how_col; $n++ ) { $tpl_sub->Parse('UNIT', '.unit_empty'); } // Parse footers for ( $n = 1; $n <= $how_col; $n++ ) { $tpl_sub->Parse('TITLE', '.title'); if ( $n != $how_col ) { $tpl_sub->parse('FOOTER', '.footer'); } else { $tpl_sub->parse('FOOTER', '.footer_end'); } } $tpl_sub->Assign(array('COLSPAN' => $how_col, 'HOW' => $rows, 'SUMM' => number_format($suma, $gOptions['main_prec'], "," ,"'"), 'CONFID' => $goods['conf_id'], 'STOREID' => $goods['id'], 'CONFIG' => '' )); if ( $goods['conf_id'] != 0 ) { $tpl_sub->Parse('CONFIG', 'config'); } $tpl_sub->Parse('MAIN', 'main'); $gTpl->Assign('COMP', $tpl_sub->Fetch('MAIN')); } else { $gTpl->Assign('COMP', ''); } } else { $gTpl->Assign('COMP', ''); } // Calc prices list($new_price, $disc_proc, $disc_suma, $price_offer, $can_buy) = calc_goods_price($goods['id'], $goods['price'], $goods['disc_price']); $price = $goods['price']; $left_sum = $price - $new_price; // Parsing parameters $param = $gData->GetParamGoods($id); $param_rows = $gData->GetNumRows($param); $param_base_exists = false; $param_code = ''; if ( $param_rows > 0 ) { $tpl_sub = new FastTemplate('./'.TEMPLATES.'/_goods/param'); $tpl_sub->DefineTemplate(array('main' => 'main.htm')); for ( $n = 1; $n <= $param_rows; $n++ ) { $hash_param = $gData->FetchRow($param); if ( $hash_param[2] == 0) { $file = 'form'; $options = ''; $values_how = ''; } else { $file = 'list'; $values = $gData->GetParamGoodsValues($id, $hash_param[0], $goods['how']-$goods['how_ordered']); $val_rows = $gData->GetNumRows($values); $options = ''; $values_how = ''; for ( $m = 1; $m <= $val_rows; $m++ ) { $hash_value = $gData->FetchRow($values); if ( strlen($hash_value[5]) > 0 ) { // Check status if ( $hash_value[7] == 1 ) continue; // Special fixed price for "real goods" or add price for "modification" if ( $hash_param[9] == 0 ) { // Phis type of param is "real goods" $add_price = round($hash_value[5]*(1-$disc_proc/100), 2) - ($disc_suma+$new_price); } else { // Phis type of param is "modification" $add_price = $hash_value[5]; $add_price = round($add_price*(1-$disc_proc/100), 2); } } else { // Price calc with proc and sum if ( $hash_param[9] == 0 ) { // Phis type of param is "real goods" $param_price = round($price*(1+$hash_value[3]/100), 2)+$hash_value[4]; $add_price = round($param_price*(1-$disc_proc/100), 2) - ($disc_suma+$new_price); } else { // Phis type of param is "modification" $add_price = round($price*$hash_value[3]/100, 2)+$hash_value[4]; $add_price = round($add_price*(1-$disc_proc/100), 2); } } $sum_price = $add_price + $new_price; $sign = ''; if ( $add_price >= 0 ) { $sign = '+'; } if ( $ic_value > 0 ) { $add_price = round($add_price*$ic_value, 2); $sum_price = round($sum_price*$ic_value, 2); } $options .= ''; $values_how .= ''; $values_how .= ''; } } $tpl_sub->ClearTpl('unit'); $tpl_sub->DefineTemplate(array('unit' => $file.'.htm')); $tpl_sub->Assign(array('NAME' => htmlspecialchars($hash_param[1]), 'STOREID' => $id, 'ID' => $hash_param[0], 'GRPID' => $hash_param[9], 'GRPTYPE' => ( $hash_param[9] == 0 ) ? 'radio' : 'checkbox', 'OPTIONS' => $options, 'VALUESHOW' => $values_how, 'WINSIZE' => $hash_param[5].','.$hash_param[6].','.$hash_param[7].','.$hash_param[8] )); $param_code .= $hash_param[0].'I'; if ( $hash_param[9] == 0 ) $param_base_exists = true; $tpl_sub->Parse('UNIT', '.unit'); } $tpl_sub->Assign('PARAMCODE', $param_code); $tpl_sub->Parse('MAIN', 'main'); $gTpl->Assign('PARAM', $tpl_sub->Fetch('MAIN')); } else { $gTpl->Assign('PARAM', ''); } // Parse icon if ( is_file('./files/store'.$id.'.jpg') ) { $img_file = 'files/store'.$id.'.jpg'; } else { $img_file = 'files/store_default.jpg'; } $link = ( strlen($goods['seo_psu']) > 0 ) ? 'goods_'.urlencode($goods['seo_psu']).'.htm' : 'goods.php?id='.$id; // Parse apendix if ( is_file('./files/apendix'.$id.'.htm') ) { if ( $goods['apendix_type'] == 0 ) { $link_app = ( strlen($goods['seo_psu']) > 0 ) ? 'descr_'.urlencode($goods['seo_psu']).'.htm' : 'descr.php?id='.$id; $apendix_link = ' href="'.$link_app.'" '; $apendix_link .= ' onclick="ShowApendix('."$id, $goods[xpos], $goods[ypos], $goods[w], $goods[h]".'); return false;" '; $gTpl->Assign(array('APENDIXLINK' => $apendix_link, 'ICON' => $img_file, 'ALT' => htmlspecialchars(str_replace('{NAME}', $goods['name'], $goods['seo_alt'])) )); $gTpl->Parse('APENDIXNAME', 'apendix_name'); $gTpl->Parse('APENDIX', 'descr_simple'); if ( $gOptions['main_descr_info'] == 'True' ) { $gTpl->Assign('INFO', ''); } else { $gTpl->Assign('INFO', $info_content); } } else { $content = iconv('UTF-8', SHOP_CHARSET, implode("", (@file('./files/apendix'.$id.'.htm')))); $content = eregi_replace("src=\"([^\"<>[:space:]]+)\"([<>[:space:]])", 'src="files/\\1"\\2', $content); $content = eregi_replace('ShowBigFoto\(\'', 'ShowBigFoto(\'files/', $content); if ( $gOptions['main_descr_info'] == 'True' ) { $gTpl->Assign('INFO', ''); $content = str_replace('{INFO}', $info_content, $content); } else { $gTpl->Assign('INFO', $info_content); $content = str_replace('{INFO}', '', $content); } $url = rtrim($gOptions['attr_base_url'].'/','/'); $gTpl->Assign(array('CONTENT' => $content, 'CONTENTURL' => $url.'/files/apendix'.$id.'.htm' )); $gTpl->Parse('APENDIX', 'descr_full'); } } else { $gTpl->Assign(array('APENDIXLINK' => '', 'ICON' => $img_file, 'ALT' => htmlspecialchars(str_replace('{NAME}', $goods['name'], $goods['seo_alt'])) )); $gTpl->Parse('APENDIX', 'descr_icon'); $gTpl->Assign('INFO', $info_content); } // Info currency if ( $ic_value > 0 ) { $price = round($price*$ic_value, 2); $new_price = round($new_price*$ic_value, 2); $left_sum = round($left_sum*$ic_value, 2); } // Price offer $gTpl->Assign(array('PRICE' => number_format($price, $gOptions['main_prec'], "," ,"'"), 'NEWPRICE' => number_format($new_price, $gOptions['main_prec'], "," ,"'"), 'LEFTSUM' => number_format($left_sum, $gOptions['main_prec'], "," ,"'"), 'CALCPRICE' => number_format($new_price, $gOptions['main_prec'], "." ,""), 'STOREID' => $id )); $gTpl->Parse('PRICEOFFER', $price_offer); // Order form if ( $goods['status'] == 1 ) { $gTpl->Parse('ORDER', 'no_order'); } else { // max order goods $max_order = ( $param_base_exists > 0 ) ? '?' : $goods['max_order']; $gTpl->Assign(array('CALCPRICE' => number_format($new_price, $gOptions['main_prec'], "." ,""), 'SUMA' => number_format($new_price*$goods['min_order'], $gOptions['main_prec'], "." ,""), 'STEPORDER' => $goods['step_order'], 'MINORDER' => $goods['min_order'], 'MAXORDER' => $max_order )); $gTpl->Parse('ORDER', 'order_form'); } // Parse status if ( $param_base_exists ) { $gTpl->Parse('STATUS', 'status4'); } else { $gTpl->Parse('STATUS', 'status'.$goods['status']); } // Echo unit $gTpl->Assign(array('CODE' => htmlspecialchars($goods['code']), 'NAME' => htmlspecialchars($goods['name']), 'NOTE' => $goods['descr'], 'LINK' => $link, 'MEAS' => htmlspecialchars($goods['meas']), 'LABEL' => '' )); if ( $goods['is_new']*1 > 0 ) $gTpl->Parse('LABEL', 'new'); if ( $goods['is_hit']*1 > 0 ) $gTpl->Parse('LABEL', 'hit'); // Parsing page properties $gTpl->Assign(array('TITLE' => htmlspecialchars(str_replace('{NAME}', $goods['name'], $goods['seo_title'])), 'DESCRIPTION' => htmlspecialchars(str_replace('{NAME}', $goods['name'], str_replace('{DESCR}', html2text($goods['descr']), $goods['seo_descr']))), 'KEYWORDS' => htmlspecialchars(str_replace('{NAME}', $goods['name'], str_replace('{DESCR}', html2text($goods['descr']), $goods['seo_keywords']))), 'LINKTITLE' => htmlspecialchars(str_replace('{NAME}', $goods['name'], $goods['seo_link'])) )); // Parse advert goods $gTpl->Assign(advert_goods($current_sec_id, $gGoodsID)); // Parse hit goods $gTpl->Assign('HITGOODS', hit_goods($gOptions['goods_hit_col'], $gOptions['goods_hit_how'])); // Echo shop variables echo_shop_variables('in_preview'); // Additional modules use_php_mod('goods'); // Parse main page $gTpl->Parse('MAIN', 'main'); $gEndPoint = run_time($gStartPoint); $gTpl->FastPrint('MAIN'); // Echo page compilate time echo_page_time($gEndPoint); } ?>