<?php
//get shop page's title
$t = $site->pageTitle($s['shop_page']);
$seo_pageTitle = seo_str($t);
//add meta tags to the page if showing a sub category
$products = array();
$array['page_title'] = 'All products';
$array['keywords'] .= ',all,products,item,selling';
$size = $site->shop_settings('catimage_height,catimage_width');
$query = $mysql->query("ID,cat,name,price,sale_price,thumb_image,url_key" ,"fs_shop_products", "hide = 'n' AND cat > 0 ORDER BY cat ASC, `order` ASC");
while($data = $mysql->get_array($query))
{
$price = $site->currency_symbol($data['price']);
$shortName = (strlen($data['name']) > 42) ? substr($data['name'], 0, 42).'...' : $data['name'];
if($data['sale_price'] > 0){$price = 'WAS <span class="sale">'.$site->currency_symbol($data['price']).'</span><br /><strong>NOW '.$site->currency_symbol($data['sale_price']).'</strong>';}
$outOfStock = (!$site->in_stock($data['ID'])) ? '<br /><strong>Out of stock</strong>' : '';
$products[$data['cat']] .= '<table border="0" cellspacing="0" cellpadding="0" width="'.$size['catimage_width'].'">
<tr>
<th><a href="/'.$s['shop_page'].'/'.$seo_pageTitle.'/'.$data['url_key'].'"><img src="/inc/shop/images/clear.gif" alt="'.$data['name'].'" width="'.$size['catimage_width'].'" height="'.$size['catimage_height'].'" border="0" title="'.$data['name'].'" style="background-image: url(/inc/shop/images/'.$data['thumb_image'].');" /></a></th>
</tr>
<tr>
<td><a href="/'.$s['shop_page'].'/'.$seo_pageTitle.'/'.$data['url_key'].'" title="'.$data['name'].'">'.$shortName.'</a> '.$price.$outOfStock.'</td>
</tr>
</table>';
}
$html = '<h1>'.$t.'</h1>';
$html .= '<p id="shopCrumbs"><a href="/'.$s['shop_page'].'/'.$seo_pageTitle.'">'.$t.'</a> &gt; <strong>All products</strong></p><div id="prodlist">';
foreach($products as $cat => $producthtml)
{
$crumbs = '';
$c = explode("\n", $site->cat_levels($cat));
if(is_array($c))
{
for($x = 0; $x < sizeof($c); $x++)
{
list($key, $name) = explode("#", $c[$x]);
$crumbs .= (!empty($name)) ? '<a href="/'.$s['shop_page'].'/'.$seo_pageTitle.'/'.$key.'">'.$name.'</a> &gt; ' : '';
}
$crumbs = substr($crumbs, 0, -6);
}
$html .= '<div class="cat-divider"><h2>'.$crumbs.'</h2>';
$html .= $producthtml;
$html .= '</div><hr />';
}
$html .= '</div>';
$mainhtml .= stripslashes($html);
//include this add-ons's overwrite css file from the template being used, if there is one
$t = settings('template');
if(file_exists('templates/'.$t['template'].'/addons/shop.css'))
{
$mainhtml = str_replace("</head>", '<link rel="stylesheet" type="text/css" href="/templates/'.$t['template'].'/addons/shop.css" /></head>', $mainhtml);
}
else
{
$mainhtml = str_replace("</head>", '<link rel="stylesheet" type="text/css" href="//www.freesites.com.au/addons/shop.css" /></head>', $mainhtml);
}
//end
?>