Files
bobsleighphotos.com/production/includes/boxes/saleItems.inc.php
2017-03-02 20:30:40 -06:00

64 lines
2.3 KiB
PHP

<?php
/*
+--------------------------------------------------------------------------
| CubeCart 4
| ========================================
| CubeCart is a registered trade mark of Devellion Limited
| Copyright Devellion Limited 2006. All rights reserved.
| Devellion Limited,
| 5 Bridge Street,
| Bishops Stortford,
| HERTFORDSHIRE.
| CM23 2JU
| UNITED KINGDOM
| http://www.devellion.com
| UK Private Limited Company No. 5323904
| ========================================
| Web: http://www.cubecart.com
| Email: info (at) cubecart (dot) com
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
| Licence Info: http://www.cubecart.com/site/faq/license.php
+--------------------------------------------------------------------------
| saleItems.inc.php
| ========================================
| Sales Items Box
+--------------------------------------------------------------------------
*/
if (!defined('CC_INI_SET')) die("Access Denied");
## include lang file
$lang = getLang("includes".CC_DS."boxes".CC_DS."saleItems.inc.php");
## query database
$cache = new cache('boxes.saleItems');
$saleItems = $cache->readCache();
if (!$cache->cacheStatus) {
$saleItems = $db->select("SELECT name, productId, price, sale_price, price - sale_price AS saving FROM ".$glob['dbprefix']."CubeCart_inventory WHERE disabled != '1' AND price > sale_price AND sale_price > 0 AND cat_id > 0 ORDER BY saving DESC",$config['noSaleBoxItems']);
$cache->writeCache($saleItems);
}
if ($saleItems && $config['saleMode']>0) {
$salePrice = 0;
$box_content=new XTemplate ("boxes".CC_DS."saleItems.tpl");
$box_content->assign("LANG_SALE_ITEMS_TITLE",$lang['saleItems']['sale_items']);
for ($i=0; $i<count($saleItems); $i++){
if (($val = prodAltLang($saleItems[$i]['productId'])) == true) {
$saleItems[$i]['name'] = $val['name'];
}
$salePrice = salePrice($saleItems[$i]['price'], $saleItems[$i]['sale_price']);
$saleItems[$i]['name'] = validHTML($saleItems[$i]['name']);
$box_content->assign("DATA",$saleItems[$i]);
$box_content->assign("SAVING",priceFormat($saleItems[$i]['price'] - $salePrice,true));
$box_content->assign("LANG_SAVE",$lang['saleItems']['save']);
$box_content->parse("sale_items.li");
}
$box_content->parse("sale_items");
$box_content = $box_content->text("sale_items");
} else {
$box_content = '';
}
?>