|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<ss:logic:if test="\Components\Website\Pages::currentPageQuery() !== null">
<ss:logic:variable value="\Components\Commerce\Products\Categories::getFromPageURI(\Framework\HTTP\Request::getCurrentURIPath())" as="product_category" parsenow="value" />
<ss:logic:variable value="$product_category['product_category_id']" as="product_category_id" parsenow="value" />
<h1>Products <ss:logic:if test="$product_category">- [? $product_category['product_category_title'] ?]</ss:logic:if></h1>
<ss:logic:if test="$product_category['product_category_content']">
<p>[? $product_category['product_category_content'] ?]</p>
</ss:logic:if>
<ss:data:repeater as="category" datasource="\Components\Commerce\Products\Categories::getChildren($product_category_id)">
<table border="0" cellspacing="0" cellpadding="10" width="100%">
<tr valign="top">
<ss:logic:if test="$category['product_category_icon']">
<td width="100">
<a href="[? $category['product_category_uri'] ?]"><ss:standard:image alt="$category['product_category_title']" src="'/media/commerce_products_categories/' + $category['product_category_id'] + '/' + $category['product_category_icon']" parsenow="alt,src" width="160" /></a>
</td>
</ss:logic:if>
<td>
<strong><a href="[? $category['product_category_uri'] ?]">[? $category['product_category_title'] ?]</a></strong>
<ss:logic:if test="$category['product_category_is_offline']"><img alt="Invisible" src="/admin/invisible.gif" /></ss:logic:if> <br />
[? $category['product_category_description'] ?]
</td>
</tr>
</table>
</ss:data:repeater>
<ss:data:repeater as="brand" datasource="\Components\Commerce\Products\Brands::getAll()">
<ss:logic:variable value="$brand['product_brand_id']" as="product_brand_id" parsenow="value" />
<ss:logic:variable value="\Components\Commerce\Products::getAllForCategoryAndBrand($product_category_id, $product_brand_id)" as="product_list" parsenow="value" />
<ss:logic:if test="count($product_list)">
<h2>[? $brand['product_brand_title'] ?] <ss:logic:if test="$brand['product_brand_is_offline']"><img alt="Invisible" src="/admin/invisible.gif" /></ss:logic:if></h2>
<ss:data:table as="product" paging="true" datasource="$product_list">
<ss:data:column width="50">
<ss:logic:if test="$product['product_icon']"><a href="[? $product['product_uri'] ?]"><ss:standard:image alt="$product['product_title']" src="'/media/commerce_products/' + $product['product_id'] + '/' + $product['product_icon']" parsenow="alt,src" width="160" /></a></ss:logic:if>
</ss:data:column>
<ss:data:column heading="Product">
<a href="[? $product['product_uri'] ?]">[? $product['product_title'] ?]</a>
<ss:logic:if test="$product['product_is_offline']"><img alt="Invisible" src="/admin/invisible.gif" /></ss:logic:if>
<ss:logic:if test="$product['product_price_has_discounts']">
<br />[? \Components\Commerce\Products::renderDiscountPrice($product) ?]
</ss:logic:if>
</ss:data:column>
<ss:data:repeater as="customfield" datasource="\Components\Commerce\Products::fieldsCustomGetAllExt(true, true)">
<ss:data:column parsenow="heading" width="60" heading="$customfield['field_label']">
<ss:logic:variable value="$customfield['field_id']" as="fieldkey" parsenow="value" /><span title="[? $customfield['field_label'] ?]">[? $product[$fieldkey] ?]</span>
</ss:data:column>
</ss:data:repeater>
<ss:data:column width="100" align="right" heading="Price" nowrap="nowrap">
[? \Components\Commerce\Products::renderPrice($product['product_price']) ?]
</ss:data:column>
<ss:data:column width="60" align="middle">
<ss:logic:if test="!($product['product_is_unorderable'])">
<ss:logic:if test="$product['product_inventory_level'] === null || !$product['product_inventory_is_unorderable_sold_out'] || $product['product_inventory_level']">
<ss:forms:form id="'form_' + ($product['product_id'])" parsenow="id">
<ss:forms:submitbutton id="'order_' + ($product['product_id'])" value="Order" parsenow="id" onclickserver="orderProduct($product['product_id'])" style="font-size: 8pt;" />
</ss:forms:form>
</ss:logic:if>
<ss:logic:else>
SOLD OUT!
</ss:logic:else>
</ss:logic:if>
</ss:data:column>
</ss:data:table>
</ss:logic:if>
</ss:data:repeater>
</ss:logic:if>
<ss:logic:else>
<h1>Products</h1>
<ss:data:repeater as="category" datasource="\Components\Commerce\Products\Categories::getChildren(null)">
<table border="0" cellspacing="0" cellpadding="10" width="100%">
<tr>
<ss:logic:if test="$category['product_category_icon']">
<td valign="top" width="100"><a href="[? $category['product_category_uri'] ?]"><ss:standard:image alt="$category['product_category_title']" src="'/media/commerce_products_categories/' + $category['product_category_id'] + '/' + $category['product_category_icon']" parsenow="alt,src" width="160" /> </a></td>
</ss:logic:if>
<td valign="top"><strong><a href="[? $category['product_category_uri'] ?]">[? $category['product_category_title'] ?]</a></strong> <ss:logic:if test="$category['product_category_is_offline']"><img alt="Invisible" src="/admin/invisible.gif" /></ss:logic:if> <br />
[? $category['product_category_description'] ?]</td>
</tr>
</table>
</ss:data:repeater>
</ss:logic:else>
|
|
<?php
// Redirect access through numerical ids to textual version
$strQuery = \Components\Website\Pages::currentPageQuery();
if($strQuery && is_numeric($strQuery))
{
$arrCategory = \Components\Commerce\Products\Categories::get($strQuery);
if($arrCategory && $arrCategory['product_category_uri'] && \Framework\HTTP\Request::getCurrentURIPath() != $arrCategory['product_category_uri'])
{
\Framework\HTTP\Redirection::redirect($arrCategory['product_category_uri']);
}
}
function orderProduct($iProductId)
{
\Components\Commerce\Carts\Current::orderProduct($iProductId);
// TODO: If statement - config
\Framework\HTTP\Redirection::redirect('/commerce/order/');
}
?>
|
|
|