<commit_before><?php
/**
 * @package Abricos
 * @subpackage EShop
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @author <NAME> <<EMAIL>>
 */

$brick = Brick::$builder->brick;
$p = &$brick->param->param;
$v = &$brick->param->var;

$man = EShopModule::$instance->GetManager()->cManager;
$cCat = $man->CatalogByAdress();

$imgWidth = bkint($p['imgw']);
$imgHeight = bkint($p['imgh']);

Abricos::GetModule('filemanager')->EnableThumbSize(array(array(
	"w" => $imgWidth,
	"h" => $imgHeight
)));

$cfg = new CatalogElementListConfig();

if ($p['forcontent'] == 'true'){

	$cat = $man->CatalogByAdress();
	array_push($cfg->catids, $cat->id); 
	
	$cfg->limit = EShopConfig::$instance->productPageCount;
}else{
	
	return;
}

$elList = $man->ProductList($cfg);
if (empty($elList)){ $brick->content = ""; return; }

$lst = "";
for ($i=0;$i<$elList->Count();$i++){
	$el = $elList->GetByIndex($i);
	
	$pTitle = addslashes(htmlspecialchars($el->title));
	
	$pr_spec = !empty($el->ext['akc']) ? $v['pr_akc'] : "";
	$pr_spec = !empty($el->ext['new']) ? $v['pr_new'] : "";
	$pr_spec = !empty($el->ext['hit']) ? $v['hit'] : "";
	
	$pr_special = "";
	if (!empty($pr_spec)){
		$pr_special = Brick::ReplaceVar($v["special"], "pr_spec", $pr_spec);
	}
	
	if (empty($el->foto)){
		$image = $v["imgempty"];
	}else{
		$image = Brick::ReplaceVarByData($v["img"], array(
			"src" => $el->FotoSrc($imgWidth, $imgHeight)
		));
	}
	$image = Brick::ReplaceVarByData($image, array(
		"w" => $imgWidth,
		"h" => $imgHeight
	));

	$replace = array(
		"special" => $pr_special,
		"tpl_btn" => $v[$el->ext['sklad']==0 ? 'btnnotorder' : 'btnorder'],
		"image" => $image,
		"title" => $pTitle,
		"price" => $el->ext['price'],
		"link" => $el->URI(),
		"productid" => $el->id
	);
	
	$lst .=  Brick::ReplaceVarByData($v['row'], $replace);
}

$brick->content = Brick::ReplaceVarByData($brick->content, array(
	"display" => $p['display'],
	"result" => Brick::ReplaceVarByData($v['table'], array(
		"rows" => $lst<commit_msg>Сортировка товара без цен<commit_after><?php
/**
 * @package Abricos
 * @subpackage EShop
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @author <NAME> <<EMAIL>>
 */

$brick = Brick::$builder->brick;
$p = &$brick->param->param;
$v = &$brick->param->var;

$man = EShopModule::$instance->GetManager()->cManager;
$cCat = $man->CatalogByAdress();

$imgWidth = bkint($p['imgw']);
$imgHeight = bkint($p['imgh']);

Abricos::GetModule('filemanager')->EnableThumbSize(array(array(
	"w" => $imgWidth,
	"h" => $imgHeight
)));

$cfg = new CatalogElementListConfig();

if ($p['forcontent'] == 'true'){

	$cat = $man->CatalogByAdress();
	array_push($cfg->catids, $cat->id); 
	
	$cfg->limit = EShopConfig::$instance->productPageCount;
}else{
	
	return;
}

$elList = $man->ProductList($cfg);
if (empty($elList)){ $brick->content = ""; return; }

$lst = ""; $lstz = "";
for ($i=0;$i<$elList->Count();$i++){
	$el = $elList->GetByIndex($i);
	
	$pTitle = addslashes(htmlspecialchars($el->title));
	
	$pr_spec = !empty($el->ext['akc']) ? $v['pr_akc'] : "";
	$pr_spec = !empty($el->ext['new']) ? $v['pr_new'] : "";
	$pr_spec = !empty($el->ext['hit']) ? $v['hit'] : "";
	
	$pr_special = "";
	if (!empty($pr_spec)){
		$pr_special = Brick::ReplaceVar($v["special"], "pr_spec", $pr_spec);
	}
	
	if (empty($el->foto)){
		$image = $v["imgempty"];
	}else{
		$image = Brick::ReplaceVarByData($v["img"], array(
			"src" => $el->FotoSrc($imgWidth, $imgHeight)
		));
	}
	$image = Brick::ReplaceVarByData($image, array(
		"w" => $imgWidth,
		"h" => $imgHeight
	));

	$replace = array(
		"special" => $pr_special,
		"tpl_btn" => $v[$el->ext['sklad']==0 ? 'btnnotorder' : 'btnorder'],
		"image" => $image,
		"title" => $pTitle,
		"price" => $el->ext['price'],
		"link" => $el->URI(),
		"productid" => $el->id
	);
	
	if ($el->ext['price'] > 0){
		$lst .=  Brick::ReplaceVarByData($v['row'], $replace);
	}else{
		$lstz .=  Brick::ReplaceVarByData($v['row'], $replace);
	}
}

$brick->content = Brick::ReplaceVarByData($brick->content, array(
	"display" => $p['display'],
	"result" => Brick::ReplaceVarByData($v['table'], array(
		"rows" => $lst.$lstz
{'fraction_non_alphanumeric': 0.2672766674692993, 'fraction_numerical': 0.0012039489525644113, 'mean_word_length': 5.172362555720654, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 101, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3286811', 'n_tokens_mistral': 1744, 'n_tokens_neox': 1686, 'n_words': 258}