require_once BASE_PATH . '/assets/includes/cart.inc.php'; require_once BASE_PATH . '/assets/includes/affiliate.inc.php'; //define('META_TITLE',''); // Override page title, description, keywords and page encoding here //define('META_DESCRIPTION',''); //define('META_KEYWORDS',''); //define('PAGE_ENCODING',''); define('META_TITLE', $lang['promotions'] . ' – ' . $config['settings']['site_title']); // Assign proper meta titles require_once BASE_PATH . '/assets/includes/header.inc.php'; require_once BASE_PATH . '/assets/includes/errors.php'; try { if ($promoID) { $smarty->assign('promoID', $promoID); } $promotionsResult = mysqli_query($db, "\r\n\t\t\tSELECT *\r\n\t\t\tFROM {$dbinfo[pre]}promotions \r\n\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\tON ({$dbinfo[pre]}promotions.promo_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'promotions') \r\n\t\t\tWHERE {$dbinfo[pre]}promotions.active = 1 \r\n\t\t\tAND {$dbinfo[pre]}promotions.promopage = 1 \r\n\t\t\tAND {$dbinfo[pre]}promotions.deleted = 0\r\n\t\t\tAND ({$dbinfo[pre]}promotions.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\tAND ({$dbinfo[pre]}promotions.quantity = '' OR {$dbinfo[pre]}promotions.quantity > '0')\r\n\t\t\tORDER BY {$dbinfo[pre]}promotions.sortorder\r\n\t\t\t"); if ($returnRows = mysqli_num_rows($promotionsResult)) { while ($promotions = mysqli_fetch_assoc($promotionsResult)) { $promotionsArray[] = promotionsList($promotions); } $smarty->assign('promotionsRows', $returnRows); $smarty->assign('promotions', $promotionsArray); } $smarty->display('promotions.tpl'); } catch (Exception $e) { echo $e->getMessage(); } include BASE_PATH . '/assets/includes/debug.php'; if ($db) { mysqli_close($db); } // Close any database connections
$cartTotals['taxInPrices'] = 0; $cartTotals['taxablePrice'] = 0; $cartTotals['taxableDigitalPrice'] = 0; /* * Get cart items */ $cartItemsSQL = "\r\n\t\t\tSELECT SQL_CALC_FOUND_ROWS * FROM {$dbinfo[pre]}invoice_items \r\n\t\t\tWHERE invoice_id = '{$invoiceID}' \r\n\t\t\tAND deleted = 0 \r\n\t\t\tAND pack_invoice_id = 0 \r\n\t\t\tORDER BY item_added DESC\r\n\t\t\t"; $cartItemsResult = mysqli_query($db, $cartItemsSQL); if ($cartItemRows = getRows()) { /* * Get promotions */ $promotionsResult = mysqli_query($db, "\r\n\t\t\t\tSELECT SQL_CALC_FOUND_ROWS *\r\n\t\t\t\tFROM {$dbinfo[pre]}promotions \r\n\t\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\t\tON ({$dbinfo[pre]}promotions.promo_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'promotions')\r\n\t\t\t\tWHERE {$dbinfo[pre]}promotions.active = 1 \r\n\t\t\t\tAND {$dbinfo[pre]}promotions.deleted = 0\r\n\t\t\t\tAND ({$dbinfo[pre]}promotions.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\t\tAND ({$dbinfo[pre]}promotions.quantity = '' OR {$dbinfo[pre]}promotions.quantity > '0')\r\n\t\t\t\tORDER BY {$dbinfo[pre]}promotions.sortorder \r\n\t\t\t\t"); if ($returnRows = getRows()) { while ($promotions = mysqli_fetch_assoc($promotionsResult)) { $promotionDetails = promotionsList($promotions); if ($promotions['cartpage']) { // Add this coupon to the array for promotions that will display in the cart $promotionsArray[] = $promotionDetails; } if ($promotions['autoapply'] and !$_SESSION['cartCouponsArray'][$promotions['promo_id']]) { // If one use per member then do not apply until member is logged in if ($promotions['oneuse'] and !$_SESSION['loggedIn']) { // need to login } else { $memberCouponUsageRows = 0; // No usage if ($promotions['oneuse']) { // Check to make sure member did not already use this coupon $memberCouponUsageResult = mysqli_query($db, "SELECT * FROM {$dbinfo[pre]}usedcoupons WHERE mem_id = '{$_SESSION[member][mem_id]}' AND promo_id = '{$promotions[promo_id]}'"); $memberCouponUsageRows = mysqli_num_rows($memberCouponUsageResult);
require_once BASE_PATH . '/assets/includes/header.inc.php'; require_once BASE_PATH . '/assets/includes/errors.php'; try { if ($config['EncryptIDs']) { // Decrypt IDs $id = k_decrypt($id); } if (!is_numeric($id)) { $id = k_decrypt($id); } idCheck($id); // Make sure ID is numeric $promoResult = mysqli_query($db, "\r\n\t\t\tSELECT *\r\n\t\t\tFROM {$dbinfo[pre]}promotions \r\n\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\tON ({$dbinfo[pre]}promotions.promo_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'promotions') \r\n\t\t\tWHERE {$dbinfo[pre]}promotions.promo_id = {$id}\r\n\t\t\tAND ({$dbinfo[pre]}promotions.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\t"); if ($returnRows = mysqli_num_rows($promoResult)) { $promo = mysqli_fetch_assoc($promoResult); $promoArray = promotionsList($promo); if ($promo['active'] == 1 and $promo['deleted'] == 0) { $smarty->assign('promo', $promoArray); $smarty->assign('promoRows', $returnRows); } else { $smarty->assign('noAccess', 1); } } else { $smarty->assign('noAccess', 1); } $smarty->display('promo.tpl'); // Smarty template } catch (Exception $e) { echo $e->getMessage(); } if ($db) {
// Assign to smarty } } catch (Exception $e) { die(exceptionError($e)); } } //print_r($featuredMediaDetailsArray); //$thumbMediaDetailsArray = array_merge($featuredMediaDetailsArray,$newestMediaDetailsArray,$randomMediaDetailsArray,$popularMediaDetailsArray); /* * Get featured homepage promotions */ if ($config['settings']['hppromos']) { try { $featuredPromotionsResult = mysqli_query($db, "\r\n\t\t\t\tSELECT *\r\n\t\t\t\tFROM {$dbinfo[pre]}promotions \r\n\t\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\t\tON ({$dbinfo[pre]}promotions.promo_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'promotions') \r\n\t\t\t\tWHERE {$dbinfo[pre]}promotions.active = 1 \r\n\t\t\t\tAND {$dbinfo[pre]}promotions.homepage = 1 \r\n\t\t\t\tAND {$dbinfo[pre]}promotions.deleted = 0\r\n\t\t\t\tAND ({$dbinfo[pre]}promotions.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\t\tAND ({$dbinfo[pre]}promotions.quantity = '' OR {$dbinfo[pre]}promotions.quantity > '0')\r\n\t\t\t\tORDER BY {$dbinfo[pre]}promotions.sortorder\r\n\t\t\t\t"); while ($featuredPromotions = mysqli_fetch_assoc($featuredPromotionsResult)) { $featuredPromotionsArray[] = promotionsList($featuredPromotions); } $smarty->assign('featuredPromotionsRows', count($featuredPromotionsArray)); $smarty->assign('featuredPromotions', $featuredPromotionsArray); /* if($returnRows = mysqli_num_rows($featuredPromotionsResult)) { while($featuredPromotions = mysqli_fetch_assoc($featuredPromotionsResult)) $featuredPromotionsArray[] = promotionsList($featuredPromotions); $smarty->assign('featuredPromotionsRows',$returnRows); $smarty->assign('featuredPromotions',$featuredPromotionsArray); } */ } catch (Exception $e) { die(exceptionError($e));