function update(&$class, $eventID, $paramsArray) { $store_credit = new storeCredit(); $store_credit->after_checkout($_SESSION['credits_applied']); unset($_SESSION['credits_applied']); unset($_SESSION['credit_covers']); }
// +----------------------------------------------------------------------+ // | This source file is subject to version 2.0 of the GPL license, | // | that is bundled with this package in the file LICENSE, and is | // | available through the world-wide-web at the following url: | // | http://www.zen-cart.com/license/2_0.txt. | // | If you did not receive a copy of the zen-cart license and are unable | // | to obtain it through the world-wide-web, please send a note to | // | license@zen-cart.com so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // $Id: store_credit.php 4 2008-10-25 23:24:35Z numinix $ // require 'includes/application_top.php'; require DIR_WS_CLASSES . 'currencies.php'; $currencies = new currencies(); require_once DIR_FS_CATALOG . 'includes/classes/store_credit.php'; $store_credit = new storeCredit(); $store_credit->store_pending_rewards(); $action = isset($_GET['action']) ? $_GET['action'] : ''; $error = false; $processed = false; if (zen_not_null($action)) { switch ($action) { case 'update': $customers_id = zen_db_prepare_input($_GET['cID']); $amount = zen_db_prepare_input($_POST['customers_balance']); $sql_data_array = array('customers_id' => $customers_id, 'amount' => $amount); $check = $db->execute('select count(*) as count from ' . TABLE_STORE_CREDIT . ' WHERE customers_id=' . (int) $customers_id); if ($check->fields['count'] == 0) { zen_db_perform(TABLE_STORE_CREDIT, $sql_data_array, 'insert', ''); } else { zen_db_perform(TABLE_STORE_CREDIT, $sql_data_array, 'update', "customers_id = '" . (int) $customers_id . "'");
<?php /** * store_credit_cron.php * * @package Store Credit and Rewards Points Advanced * @copyright Copyright 2007-2008 Numinix Technology http://www.numinix.com * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: store_credit_cron.php 2 2008-09-14 02:51:10Z numinix $ * @author Numinix */ require 'includes/application_top.php'; //include(DIR_WS_CLASSES . 'store_credit.php'); $store_credit = new storeCredit(); $stimer = microtime_float(); $today = time(); $approval_time = MODULE_ORDER_TOTAL_SC_ORDER_REWARD_APPROVAL * 86400; //multiply days by seconds in a day $orders_array = array(); $order_counter = 0; $product_counter = 0; $rewards_log_pending = $db->Execute("SELECT * \n \t FROM " . TABLE_SC_REWARD_POINT_LOGS . "\n \t\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t WHERE status = " . SC_CREDIT_PENDING . "\n \t\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t ORDER BY orders_id DESC"); $rewards_log_approved = $db->Execute("SELECT * \n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . TABLE_SC_REWARD_POINT_LOGS . "\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE status = " . SC_CREDIT_APPROVED . "\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY orders_id DESC"); // BEGIN ORDER CANCELLATIONS while (!$rewards_log_approved->EOF) { // only searching for orders in approved status $orders_id = $rewards_log_approved->fields['orders_id']; $amount = $rewards_log_approved->fields['amount']; $customers_id = $rewards_log_approved->fields['customers_id']; $products_id = $rewards_log_approved->fields['products_id']; $orders_table_query = $db->Execute("SELECT orders_id, orders_status \n\t \t FROM " . TABLE_ORDERS . "\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE orders_id = " . (int) $orders_id . "\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1");
<?php /** * Side Box Template * */ require_once DIR_WS_CLASSES . 'store_credit.php'; $store_credit = new storeCredit(); $content = ""; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">'; if (isset($_SESSION['customer_id'])) { $check = $db->execute('select sum(amount) as amount from ' . TABLE_STORE_CREDIT . ' where customers_id=' . (int) $_SESSION['customer_id']); $amount = $check->fields['amount']; } else { $amount = 0; } $content .= BOX_DESC_STORE_CREDIT . $currencies->format($amount); if (MODULE_ORDER_TOTAL_SC_ORDER_BOX_PENDING == 'true') { $pending_rewards = $store_credit->get_pending_rewards((int) $_SESSION['customer_id']); if ((double) $pending_rewards > 0) { $content .= '<center><hr width="50%"/></center>'; $content .= sprintf(BOX_DESC_STORE_CREDIT_PENDING, $currencies->format($pending_rewards)); } } $content .= '</div>';