Location: PHPKode > projects > Katyshop > katyshop_ro_0.3.2.1/web/includes/products_list.php
<?php
/**
 * Product: Katyshop
 * @version 0.3.2.1
 * @author Catalin Hulea - hide@address.com
 * @copyright Copyright (C) 2007 Catalin Hulea
 * @license GNU General Public License version 3
 * 			You can find a copy of GNU GPL v3 at this path: /docs/LICENSE
 * @link https://sourceforge.net/projects/katyshop
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

if(empty($_GET["order_by"]["products"]))
	$_GET["order_by"]["products"] = "pos";
if(empty($_GET["order_direction"]["products"]))
	$_GET["order_direction"]["products"] = "asc";


$category = Application::getCurrentCategory();
if(isset($searchPage) && $searchPage === true)
{
	$id_category = 0;
	$arr = Compat::array_clone($_GET);
	$arr["active"] = 1;
	$arr["min_price"] = readPrice(@$_GET["min_price"]);
	$arr["max_price"] = readPrice(@$_GET["max_price"]);
	$pageTitle = "Rezultatele cautarii";
	$page = "search.php";
	$productsCount = $db->tbProduct->advancedGetCount($arr, @$_GET["start"], @$_GET["rowsPerPage"], @$_GET["order_by"]["products"], @$_GET["order_direction"]["products"]);
	$list = $db->tbProduct->advancedSearch($arr, @$_GET["start"], @$_GET["rowsPerPage"], @$_GET["order_by"]["products"], @$_GET["order_direction"]["products"]);
}
else
{
	$id_category = $category->id;
	$arr = array("id_category" => intval($id_category), "active" => 1, "only_current_category" => 1);
	$pageTitle = "Produsele din " . Escape::html($category->title);
	$page = "category.php";
	$searchPage = false;
}

$productsCount = $db->tbProduct->advancedGetCount($arr, @$_GET["start"], @$_GET["rowsPerPage"], @$_GET["order_by"]["products"], @$_GET["order_direction"]["products"]);
$list = $db->tbProduct->advancedSearch($arr, @$_GET["start"], @$_GET["rowsPerPage"], @$_GET["order_by"]["products"], @$_GET["order_direction"]["products"]);

if($productsCount > 0)
{
	?>
	<a name="products"></a>
	<dl>
	<dt></dt>
	<dd>
	<h3><?php echo $pageTitle; ?></h3>
	<table width="470" cellspacing="0">
	<tr>
	<td></td>
	<td width="300">
		<?php
		displayOrderBy($id_category, "title", "asc", $page, "products");
		displayOrderBy($id_category, "title", "desc", $page, "products");
		?>
	</td>
	<td width="100">
		<?php
		displayOrderBy($id_category, "price", "asc", $page, "products");
		displayOrderBy($id_category, "price", "desc", $page, "products");
		?>
	</td>
	</tr>
	<?php
	for($i = 0; $i < count($list); $i++)
	{
		$p = $list[$i];
		if($searchPage && !$p->canBeDisplayed())
			continue;
		?>
		<tr valign="top" class="border_top">
		<td align="center">
		<?php
		if(!empty($p->picture) && is_file(WEB_DIR . "/img/products/small/{$p->picture}"))
		{
			?>
			<a href="product.php?id_product=<?php echo intval($p->id); ?>">
			<img src="img/products/small/<?php echo Escape::htmlValue($p->picture); ?>">
			</a>
			<?php
		}
		?>
		</td>
		<td>
		<a href="product.php?id_product=<?php echo intval($p->id); ?>"><?php echo Escape::html($p->title); ?></a>
		<br>
		<?php echo nl2br(Escape::html($p->description)); ?>
		<?php
		if(!empty($p->manufacturer))
		{
			?>
			<p style="margin: 0px; color: #333333; font-weight: bold; ">Producator: <?php echo Escape::htmlValue($p->manufacturer); ?></p>
			<?php
		}
		?>
		</td>
		<td style="font-size: 12pt; font-weight: bold; color: red; ">
		<?php echo displayPrice($p->price); ?> <?php echo Escape::html(Application::getConfigValue("default_currency")); ?>
		<br>

		<form action="formparser/order.php?action=add_to_cart" method="post">
		<input type="hidden" name="id_product" value="<?php echo Escape::htmlValue(@$p->id); ?>">
		<input type="submit" value="Adauga in cos" class="button">
		</form>
		</td>
		</tr>
		<?php
	}
	?>
	</table>
	<?php
	echo getListPages($productsCount);
	?>
	</dd>
	</dl>
	<?php
}
elseif ($searchPage)
{
	?>
	<a name="products"></a>
	<dl>
	<dt></dt>
	<dd>
	<h3><?php echo $pageTitle; ?></h3>
	Nu au putut fi gasite produse care sa corespunda criteriilor de cautare.
	</dd>
	</dl>
	<?php
}
?>
Return current item: Katyshop