$strthemelen = strlen($strtheme); $chars = preg_split('//', $strtheme, -1, PREG_SPLIT_NO_EMPTY); for ($k = 0; $k < $strthemelen; $k++) { if ($chars[$k] == 1) { $shopcoinstheme[] = $ThemeArray[($strthemelen - 1 - $k)]; if (!in_array(($strthemelen - 1 - $k), $ShopcoinsThemeArray)) $ShopcoinsThemeArray[] = ($strthemelen - 1 - $k); } } $tpl['show']['shopcoinstheme'] = $shopcoinstheme; //серия if ($rows_main["series"]) { $rows_main["series_title"] = $shopcoins_class->getSeries($rows_main["series"]); } $rows_main['year'] = contentHelper::setYearText($rows_main['year'], $materialtype); } else $tpl['show']['error']['no_coins'] = true; if ($rows_main&&$rows_main['check'] == 0) { require_once("show-search.ctl.php"); $tpl['task'] = 'showa'; } elseif ($rows_main) { $tpl['show']['rowscicle'] = $shopcoins_class->getCoinsrecicle($catalog); $resultcicle = $shopcoins_class->getPopular(4, array('materialtype' => $materialtype, 'shopcoins.group' => $rows_main["group"])); $i=0; foreach ($resultcicle as $rows){ $row = $shopcoins_class->getItem($rows["shopcoins"],true); $tpl['show']['resultcicle'][$i] = array_merge($row,$rows); $i++;
$ShopcoinsThemeArray = Array(); $ShopcoinsGroupArray = Array(); $data = array(); //var_dump($tpl['shop']['MyShowArray']); foreach ($tpl['shop']['MyShowArray'] as &$row){ $item = $shopcoins_class->getItem($row['shopcoins']); $row = array_merge($row,$item); $row['metal'] = $tpl['metalls'][$row['metal_id']]; $rehref = ""; if ($row['gname']) $rehref .= $row['gname']." "; $rehref .= $row['name']; if($row['year']) $rehref .= " ".contentHelper::setYearText($row['year'],$row['materialtype']); if ($row['metal']) $rehref .= " ".$row['metal']; if($row['price']) $rehref .= " <font color=red>".ceil($row['price'])." руб.</font>"; $image = contentHelper::showImage("smallimages/".$row["image_small"],'');; $currval = array(); $currval['label'] = TRIM($rehref)?trim($rehref):$row['name']; $currval['image'] = $image?$image:''; $currval['id'] = $row['shopcoins']; $data_href = contentHelper::getRegHref($row); $currval['href'] = $cfg['site_dir'].'shopcoins/'.$data_href['rehref']; array_push($data, $currval); } $currval = array();
static function getRegHref($rows, $materialtype = 0, $parent = 0) { $mtype = $rows['materialtype'] > 0 ? $rows['materialtype'] : $materialtype; $rows['year'] = contentHelper::setYearText($rows['year'], $rows['materialtype']); $rehref = ""; if ($materialtype == 5 || $materialtype == 3) { if ($mtype == 1) { $rehref = "Монета-"; } if ($mtype == 8) { $rehref = "Монета-"; } if ($mtype == 7) { $rehref = "Набор-монет-"; } if ($mtype == 2) { $rehref = "Банкнота-"; } if ($mtype == 4) { $rehref = "Набор-монет-"; } if ($mtype == 5) { $rehref = "книга-"; } if ($mtype == 9) { $rehref = "Лот монет "; } if ($rows['gname']) { $rehref .= $rows['gname'] . "-"; } $rehref .= $rows['name']; if ($rows['metal']) { $rehref .= "-" . $rows['metal']; } if ($rows['year']) { $rehref .= "-" . $rows['year']; } $namecoins = $rehref; $rehrefdubdle = contentHelper::strtolower_ru($rehref) . "_c" . ($mtype == 1 ? $rows['parent'] : $rows['shopcoins']) . "_pc" . ($parent > 0 ? $parent : (($mtype == 7 || $mtype == 8 || $mtype == 6 || $mtype == 4 || $mtype == 2) && $rows["amount"] > 1 ? $rows['shopcoins'] : ($mtype == 1 ? $rows['parent'] : 0))) . "_m" . $rows['materialtype'] . "_pp1.html"; $rehref = contentHelper::strtolower_ru($rehref) . "_c" . $rows['shopcoins'] . "_m" . $rows['materialtype'] . ".html"; } else { if ($mtype == 1) { $rehref = "Монета "; } if ($mtype == 8) { $rehref = "Монета "; } if ($mtype == 7) { $rehref = "Набор монет "; } if ($mtype == 2) { $rehref = "Банкнота "; } if ($mtype == 4) { $rehref = "Набор монет "; } if ($mtype == 5) { $rehref = "Книга "; } if ($mtype == 9) { $rehref = "Лот монет "; } if ($mtype == 10) { $rehref = "Нотгельд "; } if ($mtype == 11) { $rehref = "Монета "; } if (in_array($rows["materialtype"], array(2, 4, 7, 8, 6)) && $rows['amount'] > 10) { $rows['amount'] = 10; } if ($rows['gname']) { $rehref .= $rows['gname'] . " "; } $rehref .= $rows['name']; if ($rows['metal']) { $rehref .= " " . $rows['metal']; } if ($rows['year']) { $rehref .= " " . $rows['year']; } $namecoins = $rehref; $rehrefdubdle = contentHelper::strtolower_ru($rehref) . "_c" . ($mtype == 1 || $mtype == 10 || $mtype == 12 ? $rows['parent'] : $rows['shopcoins']) . "_pc" . ($parent > 0 ? $parent : (($mtype == 7 || $mtype == 8 || $mtype == 6 || $mtype == 4 || $mtype == 2) && $rows["amount"] > 1 ? $rows['shopcoins'] : ($mtype == 1 || $mtype == 10 ? $rows['parent'] : 0))) . "_m" . $rows['materialtype'] . "_pp1.html"; $rehref = contentHelper::strtolower_ru($rehref) . "_c" . $rows['shopcoins'] . "_m" . $rows['materialtype'] . ".html"; } return array('namecoins' => $namecoins, 'rehrefdubdle' => $rehrefdubdle, 'rehref' => $rehref); }