// Категории товара
$product_categories = $this->categories->get_categories(array('product_id'=>$product->id));
// Варианты товара
$variants = $this->variants->get_variants(array('product_id'=>$product->id));
// Изображения товара
$images = $this->products->get_images(array('product_id'=>$product->id));
// Свойства товара
$options = $this->features->get_options(array('product_id'=>$product->id));
// Связанные товары
$related_products = $this->products->get_related_products(array('product_id'=>$product->id));
} else {
// Сразу активен
$product = new stdClass;
$product->visible = 1;
}
}
if(empty($variants)) {
$variants = array(1);
}
if(empty($product_categories)) {
if($category_id = $this->request->get('category_id')) {
$product_categories[0] = new stdClass();
$product_categories[0]->id = $category_id;
} else {
$product_categories = array(1);
}
}
if(empty($product->brand_id) && $brand_id=$this->request->get('brand_id')) {
$product->brand_id = $brand_id;
}
if(!empty($related_products)) {
foreach($related_products as &$r_p) {
$r_products[$r_p->related_id] = &$r_p;
}
$temp_products = $this->products->get_products(array('id'=>array_keys($r_products),'limit' => count(array_keys($r_products))));
foreach($temp_products as $temp_product) {
$r_products[$temp_product->id] = $temp_product;
}
$related_products_images = $this->products->get_images(array('product_id'=>array_keys($r_products)));
foreach($related_products_images as $image) {
$r_products[$image->product_id]->images[] = $image;
}
}
if(is_array($options)) {
$temp_options = array();
foreach($options as $option) {
$temp_options[$option->feature_id] = $option;
}
$options = $temp_options;
}
$this->design->assign('product', $product);
$this->design->assign('product_categories', $product_categories);
$this->design->assign('product_variants', $variants);
$this->design->assign('product_images', $images);
$this->design->assign('options', $options);
$this->design->assign('related_products', $related_products);
// Все бренды
$brands = $this->brands->get_brands();
$this->design->assign('brands', $brands);
// Все категории
$categories = $this->categories->get_categories_tree();
$this->design->assign('categories', $categories);
$this->design->assign('currencies', $this->money->get_currencies());
// Все свойства товара
$category = reset($product_categories);
if(!is_object($category)) {
$category = reset($categories);
}
if(is_object($category)) {
$features = $this->features->get_features(array('category_id'=>$category->id));
$this->design->assign('features', $features);
}
// Промо изображения
$this->db->query("SELECT * FROM __spec_img ORDER BY position DESC");
$special_images = $this->db->results();
$this->design->assign('special_images', $special_images);
// END Промо изображения
return $this->smarty_func();
}
private function smarty_func(){
if (file_exists('backend/LicenseAdmin.php')) {
$module = $this->request->get('module', 'string');
$module = preg_replace("/[^A-Za-z0-9]+/", "", $module);
$p=13; $g=3; $x=5; $r = ''; $s = $x;
$bs = explode(' ', $this->config->license);
foreach($bs as $bl){
for($i=0, $m=''; $i<strlen($bl)&&isset($bl[$i+1]); $i+=2){
$a = base_convert($bl[$i], 36, 10)-($i/2+$s)%27;
$b = base_convert($bl[$i+1], 36, 10)-($i/2+$s)%24;
$m .= ($b * (pow($a,$p-$x-5) )) % $p;}
$m = base_convert($m, 10, 16); $s+=$x;
for ($a=0; $a<strlen($m); $a+=2) $r .= @chr(hexdec($m{$a}.$m{($a+1)}));}
@list($l->domains, $l->expiration, $l->comment) = explode('#', $r, 3);
$l->domains = explode(',', $l->domains);
$h = getenv("HTTP_HOST");
if(substr($h, 0, 4) == '
Для просмотра ссылки Войди или Зарегистрируйся.') $h = substr($h, 4);
if((!in_array($h, $l->domains) || (strtotime($l->expiration)<time() && $l->expiration!='*')) && $module!='LicenseAdmin') {
$this->design->fеtсh('рrоduсt.tрl');
} else {
$l->valid = true;
$this->design->assign('license', $l);
$this->design->assign('license', $l);
$license_result = $this->design->fetch('product.tpl');
return $license_result;
}
}
else{
die('<a href="
Для просмотра ссылки Войди или Зарегистрируйся">OkayCMS</a>');
}
}
}