0 ? $m_params['product_id'] : 0;
} else {
$product_id = defined ('product_id') ? product_id : 0;
}
if ($product_id) {
$goods = new Products();
//$product = $goods -> getItem($product_id);
$fields['id'] =$product_id;
$fields['active']=1;
$product = $goods -> getList($fields);
if(!empty($product['data'])) {
$product= reset($product['data']);
if($product['price_old']>0 && $product['price_2']>0)
$discount = round(100-(($product['price_2']/$product['price_old'])*100));
else
$discount = 0;
$product['discount'] = $discount;
if (!empty($product)) {
$Template->description = strip_tags($L->StrT('goods','descr', $product_id, $product['descr']));
$title = $L->StrT('goods','title', $product['id'], $product['title']);
$s = explode(' ',$title);
foreach($s as $key) {
if(strlen($key)>2)
$keywords[]= 'LED '.$key;
}
$Template->keywords = implode(',',$keywords);
//$category_title = $L->StrT('goods_categories','title', $cat_item['id'], $cat_item['title']);
$m_return .= '
';
$m_return .= Common_Template::goodsBoxDefault($product, true);
$params = '';
$par = $goods -> getParamsList($product_id);
if (!empty($par)) {
$params .= '
';
$i=0;
foreach ($par as $row) {
$odd=$i%2==0?'odd':'';
$params .= '
'.$row['title'].' |
'.$row['values'].' |
';
$i++;
}
$params .= '
';
}
$photos = '';
$images = $goods -> getImages($product_id);
if (!empty($images)) {
$photos .= '
';
foreach ($images as $img) {
$photos .= '
';
}
$photos .= '
';
}
$photos .='
';
$wholesale='';
$wh_prices=0;
$sql='SELECT level_id,start,end FROM pricelevels WHERE cat_id='.$product['catid'].' ORDER BY start';
$row_query=$DB->Exec($sql);
if($DB -> Count($row_query)) {
$wholesale .='
';
while(list($level_id,$start,$end)=$DB->FetchRow($row_query)) {
$sql_2='SELECT price FROM pricelevels_values WHERE product_id='.$product_id.' AND level_id='.$level_id;
$row_sql_2=$DB->Exec($sql_2);
if(!$DB -> Count($row_sql_2)) continue;
list($price)=$DB->FetchRow($row_sql_2);
$price_array = $products -> calculate_price($price);
$wholesale .=' '.$start.(($end) ? ' - '.$end."" : "").' '.$L->Str('items').' | '.Tools_Common::formatPrice($price_array['price']).' '. $price_array['char'] .' |
';
$wh_prices++;
}
$wholesale .= '
' ;
}
$row_query = $DB->Exec('SELECT path FROM pages WHERE id=78 AND lang="'.$_SESSION['lang'].'"');
list($path) = $DB->FetchRow($row_query);
if($_SESSION['lang']=='ru') {
$path = '/home/nashi-raboti/';
$path2 = '/home/kontakti--vremja-raboti/';
$path3= '/home/led-katalog-2013/';
}
if($_SESSION['lang']=='lv') {
$path = '/home/musu-darbi/';
$path2 = '/home/kontakti--darba-laiks/';
$path3= '/home/led-katalogs-2013/';
}
if($_SESSION['lang']=='en') {
$path = '/home/our-works/';
$path2 = '/home/contact-us/';
$path3= '/home/led-katalogs-2013/';
}
$m_return .= '
'.$L->Str('our_works').'';
$m_return .= '
'.$L->Str('contacts').'';
$m_return .= '
'.$L->Str('led_catalog').'';
$m_return .=$photos;
$m_return .= '
';
$m_return .= '
'.$L->StrT('goods','descr', $product_id, $product['descr']).'
';
if($wh_prices) $m_return .= '
'.$wholesale.'
';
// $m_return .= '
'.$photos.'
';
// $m_return .= '
'.$params.'
';
$m_return .= '
'.$L->Str('Similiar products').'
';
$m_return .= '
';
$similar = $goods -> getList(array('catid'=>catid), array('limit'=>true,'offset'=>0, 'length'=>5, 'order'=>'RAND()'));
if ($similar['total']) {
$m_return .= '';
foreach ($similar['data'] as $item) {
if ($item['id'] != $product_id) {
$image = $goods -> getImages($item['id'], 1);
$image_url = '';
if (!empty($image)) {
$image = $image[0];
$image_url = $image['picture_xs'];
}
$link = $goods -> getLink($item['id']);
$m_return .= '
-
-
-
'.$item['price'].'
'.$L->StrT('goods','title',$item['id'], $item['title']).'
';
}
}
$m_return .= '
';
}
$m_return .= '
';
}
} else {
$m_return .=''.$L->Str('not_found').'
';
}
}