当前位置: 首页>>代码示例>>PHP>>正文


PHP Tax::getInstance方法代码示例

本文整理汇总了PHP中Tax::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Tax::getInstance方法的具体用法?PHP Tax::getInstance怎么用?PHP Tax::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tax的用法示例。


在下文中一共展示了Tax::getInstance方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _sendCoupon

 /**
  * Send gift certificate va email
  *
  * @param int $coupon_id
  * @param array $data
  * @return bool
  */
 private function _sendCoupon($coupon_id, $data)
 {
     if (!empty($coupon_id)) {
         if (($coupon = $GLOBALS['db']->select('CubeCart_coupons', false, array('coupon_id' => (int) $coupon_id, 'email_sent' => 0))) !== false) {
             $mailer = new Mailer();
             if (isset($coupon[0]['value'])) {
                 $coupon[0]['value'] = Tax::getInstance()->priceFormat($coupon[0]['value']);
             }
             $data['storeURL'] = $GLOBALS['storeURL'];
             if (($content = $mailer->loadContent('cart.gift_certificate', $this->_order_summary['lang'], array_merge($this->_order_summary, $data, $coupon[0]))) !== false) {
                 $GLOBALS['db']->update('CubeCart_coupons', array('email_sent' => 1), array('coupon_id' => (int) $coupon_id));
                 return $mailer->sendEmail($data['email'], $content);
             }
         }
     }
     return false;
 }
开发者ID:briansandall,项目名称:v6,代码行数:24,代码来源:order.class.php

示例2: unset

    $GLOBALS['smarty']->assign('PAGINATION_SEARCH', $GLOBALS['db']->pagination($numrows, $per_page, $page, 5, 'page_search', 'stats_search', ' ', false));
    unset($results, $result, $divider);
}
// Best Customers
$per_page = 15;
$page = isset($_GET['page_customers']) && is_numeric($_GET['page_customers']) ? $_GET['page_customers'] : 1;
$query = "SELECT sum(`total`) as `customer_expenditure`, C.first_name, C.last_name, C.customer_id FROM `" . $glob['dbprefix'] . "CubeCart_order_summary` as O INNER JOIN  `" . $glob['dbprefix'] . "CubeCart_customer` as C on O.customer_id = C.customer_id WHERE O.status = 3 GROUP BY O.customer_id ORDER BY `customer_expenditure` DESC";
if (($results = $GLOBALS['db']->query($query, $per_page, $page)) !== false) {
    $GLOBALS['main']->addTabControl($lang['statistics']['title_customers_best'], 'stats_best_customers');
    $numrows = $GLOBALS['db']->numrows($query);
    $divider = $GLOBALS['db']->query("SELECT sum(`total`) as `total_sales` FROM `" . $glob['dbprefix'] . "CubeCart_order_summary` WHERE `status` = 3");
    $g_graph_data[8]['data'] = "['" . $lang['statistics']['percentage_of_views'] . "','" . sprintf($lang['statistics']['sales_volume'], $GLOBALS['config']->get('config', 'default_currency')) . "'],";
    $smarty_data[8] = array();
    foreach ($results as $key => $result) {
        $result['key'] = ($page - 1) * $per_page + ($key + 1);
        $result['expenditure'] = Tax::getInstance()->priceFormat($result['customer_expenditure']);
        $result['percent'] = $divider[0]['total_sales'] ? number_format(100 * ($result['customer_expenditure'] / $divider[0]['total_sales']), 2) : 0;
        $tmp_col_data[] = "['" . $result['key'] . ". " . addslashes($result['last_name'] . ", " . $result['first_name']) . "'," . $result['customer_expenditure'] . "]";
        // Create a customer legend
        $smarty_data[8][] = $result;
    }
    $g_graph_data[8]['data'] .= isset($tmp_col_data) ? implode(',', $tmp_col_data) : '';
    unset($tmp_col_data);
    $g_graph_data[8]['title'] = '';
    $g_graph_data[8]['hAxis'] = $lang['dashboard']['inv_customers'];
    $g_graph_data[8]['vAxis'] = $lang['statistics']['total_expenditure'];
    $GLOBALS['smarty']->assign('BEST_CUSTOMERS', $smarty_data[8]);
    $GLOBALS['smarty']->assign('PAGINATION_BEST', $GLOBALS['db']->pagination($numrows, $per_page, $page, 5, 'page_customers', 'stats_best_customers', ' ', false));
    unset($results, $result, $divider);
}
// Customers Online
开发者ID:Geotex,项目名称:v6,代码行数:31,代码来源:statistics.index.inc.php

示例3: array

    }
    if (!isset($_GET['sort']) || !is_array($_GET['sort'])) {
        $_GET['sort'] = array('time' => 'DESC');
    }
    $current_page = currentPage(array('sort'));
    $thead_sort = array('cart_order_id' => $GLOBALS['db']->column_sort('cart_order_id', $GLOBALS['language']->orders['order_number'], 'sort', $current_page, $_GET['sort']), 'amount' => $GLOBALS['db']->column_sort('amount', $GLOBALS['language']->basket['total'], 'sort', $current_page, $_GET['sort']), 'gateway' => $GLOBALS['db']->column_sort('gateway', $GLOBALS['language']->orders['gateway_name'], 'sort', $current_page, $_GET['sort']), 'date' => $GLOBALS['db']->column_sort('time', $GLOBALS['language']->common['date'], 'sort', $current_page, $_GET['sort']));
    foreach ($GLOBALS['hooks']->load('admin.product.table_head_sort') as $hook) {
        include $hook;
    }
    $GLOBALS['smarty']->assign('THEAD', $thead_sort);
    if (($transactions = $GLOBALS['db']->select('CubeCart_transactions', array('DISTINCT' => 'order_id', 'time', 'amount', 'gateway', 'trans_id'), $where, $_GET['sort'], $per_page, $page)) !== false) {
        if (isset($_GET['search']) && !empty($_GET['search'])) {
            $GLOBALS['main']->setACPNotify(sprintf($GLOBALS['language']->orders['notify_search_logs'], $_GET['search']));
        }
        foreach ($transactions as $transaction) {
            if (!empty($transaction['order_id'])) {
                $transaction['time'] = formatTime($transaction['time']);
                $transaction['amount'] = Tax::getInstance()->priceFormat($transaction['amount']);
                $transaction['link'] = currentPage(array('page', 'sort'), array('order_id' => $transaction['order_id']));
                $smarty_data['transactions'][] = $transaction;
            }
        }
        $GLOBALS['smarty']->assign('ALL_TRANSACTIONS', $smarty_data['transactions']);
    } else {
        if (isset($_GET['search']) && !empty($_GET['search']) && !$transactions) {
            $GLOBALS['gui']->setError(sprintf($GLOBALS['language']->orders['error_search_logs'], $_GET['search']));
        }
    }
    $GLOBALS['smarty']->assign('DISPLAY_ALL_TRANSACTIONS', true);
}
$page_content = $GLOBALS['smarty']->fetch('templates/orders.transactions.php');
开发者ID:briansandall,项目名称:v6,代码行数:31,代码来源:orders.transactions.inc.php

示例4: foreach

             $GLOBALS['main']->setACPNotify(sprintf($lang['orders']['notify_orders_by'], $orders[0]['first_name'], $orders[0]['last_name']));
         }
         if (isset($_GET['search'])) {
             $GLOBALS['main']->setACPNotify($lang['orders']['notify_search_result']);
         }
         foreach ($orders as $order) {
             $order['name'] = isset($order['name']) && !empty($order['name']) ? $order['name'] : sprintf('%s %s %s', $order['title'], $order['first_name'], $order['last_name']);
             $order['icon'] = $order['type'] == 2 || empty($order['customer_id']) ? 'user_ghost' : 'user_registered';
             $order['link_edit'] = currentPage(array('print_hash'), array('action' => 'edit', 'order_id' => $order['cart_order_id']));
             $order['link_customer'] = $order['customer_id'] ? "?_g=customers&action=edit&customer_id=" . $order['customer_id'] : "#";
             $order['link_delete'] = currentPage(array('print_hash'), array('delete' => $order['cart_order_id']));
             // Link needs to be an array with one key
             $order['link_print'] = currentPage(array('print_hash'), array('print[0]' => $order['cart_order_id']));
             $order['status'] = $lang['order_state']['name_' . $order['status']];
             $order['date'] = formatTime($order['order_date']);
             $order['prod_total'] = Tax::getInstance()->priceFormat($order['total']);
             $smarty_data['list_orders'][] = $order;
         }
         $GLOBALS['smarty']->assign('ORDER_LIST', $smarty_data['list_orders']);
     } else {
         if (isset($_GET['search'])) {
             # No orders found
             $GLOBALS['main']->setACPWarning($lang['orders']['error_search_result']);
         }
     }
     $GLOBALS['smarty']->assign('DISPLAY_ORDER_LIST', true);
     // Hook
     foreach ($GLOBALS['hooks']->load('admin.order.index.list') as $hook) {
         include $hook;
     }
 }
开发者ID:Geotex,项目名称:v6,代码行数:31,代码来源:orders.index.inc.php

示例5: getProductPrice

 /**
  * Get product price
  *
  * @param array $product_data
  * @return array/false
  */
 public function getProductPrice(&$product_data, $quantity = 1)
 {
     if (isset($product_data['product_id']) && is_numeric($product_data['product_id'])) {
         $product_id = (int) $product_data['product_id'];
         $group_id = 0;
         // Check for group pricing
         if (isset($GLOBALS['user']) && $GLOBALS['user']->is() && ($memberships = $GLOBALS['user']->getMemberships()) !== false) {
             $group_id = array();
             foreach ($memberships as $membership) {
                 $group_id[] = $membership['group_id'];
             }
             if (($pricing_group = $GLOBALS['db']->select('CubeCart_pricing_group', false, array('product_id' => $product_id, 'group_id' => $group_id), array('price' => 'ASC'), 1)) !== false) {
                 $product_data['price'] = $pricing_group[0]['price'];
                 $product_data['sale_price'] = $pricing_group[0]['sale_price'];
                 $product_data['tax_inclusive'] = $pricing_group[0]['tax_inclusive'];
                 # do not rely on retail price setting!
                 $product_data['tax_type'] = $pricing_group[0]['tax_type'];
             }
         }
         //Are we in sale mode?
         $sale = false;
         $product_data['ctrl_sale'] = false;
         $product_data['price_to_pay'] = $product_data['price'];
         $product_data['full_base_price'] = $product_data['price'];
         switch ((int) $GLOBALS['config']->get('config', 'catalogue_sale_mode')) {
             case 0:
                 break;
             case 1:
                 if ($product_data['sale_price'] && ($product_data['sale_price'] > 0 && $product_data['sale_price'] != Tax::getInstance()->priceFormatHidden())) {
                     $product_data['price_to_pay'] = $product_data['sale_price'];
                     $product_data['ctrl_sale'] = true;
                 }
                 $sale = true;
                 break;
             case 2:
                 if (!$GLOBALS['config']->isEmpty('config', 'catalogue_sale_percentage')) {
                     $product_price = $product_data['price'];
                     //Make sure the first character is a digit
                     $product_price = preg_replace('/[^0-9.]*/', '', $product_price);
                     $product_data['sale_price'] = $product_price - $product_price / 100 * $GLOBALS['config']->get('config', 'catalogue_sale_percentage');
                     $product_data['ctrl_sale'] = $product_data['sale_price'] > 0 && $product_data['sale_price'] != Tax::getInstance()->priceFormatHidden() ? true : false;
                     $product_data['price_to_pay'] = $product_data['sale_price'];
                     $sale = true;
                 }
                 break;
         }
         $search = array('product_id' => $product_id, 'group_id' => $group_id);
         if (($pricing = $GLOBALS['db']->select('CubeCart_pricing_quantity', array('quantity', 'price'), $search, array('quantity' => 'ASC', 'price' => 'ASC'))) !== false) {
             foreach ($pricing as $price) {
                 $prices[$price['quantity']] = $GLOBALS['config']->get('config', 'catalogue_sale_mode') == 2 ? $price['price'] - $price['price'] / 100 * $GLOBALS['config']->get('config', 'catalogue_sale_percentage') : $price['price'];
             }
             krsort($prices);
             // Ok so we need to get quantity for other items with same product ID for quantity discounts.
             // e.g. 1 x Blue Widget + 2 x Red Widget
             $original_quantity = $quantity;
             if (is_array($GLOBALS['cart']->basket['contents'])) {
                 $quantity = 0;
                 foreach ($GLOBALS['cart']->basket['contents'] as $hash => $item) {
                     if ($item['id'] == $product_id) {
                         $quantity += $item['quantity'];
                     }
                 }
             }
             $quantity = $quantity == 0 ? $original_quantity : $quantity;
             foreach ($prices as $quant => $price) {
                 if ($quant > $quantity) {
                     continue;
                 } else {
                     //If the sale price is still better than the quantity price use the sale price
                     if (!$sale || (double) $product_data['sale_price'] == 0 || $sale && $product_data['sale_price'] > $price) {
                         $product_data['price'] = $price;
                         $product_data['sale_price'] = $price;
                     }
                     break;
                 }
             }
         }
         foreach ($GLOBALS['hooks']->load('class.cubecart.product_price') as $hook) {
             include $hook;
         }
         if ($sale && $product_data['sale_price'] >= $product_data['price']) {
             $product_data['ctrl_sale'] = false;
         }
         return $product_data;
     }
     return false;
 }
开发者ID:briansandall,项目名称:v6,代码行数:93,代码来源:catalogue.class.php

示例6: preg_replace

$GLOBALS['language'] = Language::getInstance();
//Initialize hooks
$GLOBALS['hooks'] = HookLoader::getInstance();
//Initialize SEO
$GLOBALS['seo'] = SEO::getInstance();
if (isset($_GET['seo_path']) && !empty($_GET['seo_path'])) {
    $_GET['seo_path'] = preg_replace('/(\\/\\~[a-z0-9]{1,}\\/)/', '', $_GET['seo_path']);
    // Remove /~username/ from seo_path
    $GLOBALS['seo']->getItem($_GET['seo_path']);
}
//Initialize SSL
$GLOBALS['ssl'] = SSL::getInstance();
//Initialize GUI
$GLOBALS['gui'] = GUI::getInstance();
//Initialize Taxes
$GLOBALS['tax'] = Tax::getInstance();
//Initialize catalogue
$GLOBALS['catalogue'] = Catalogue::getInstance();
//Initialize cubecart
$GLOBALS['cubecart'] = Cubecart::getInstance();
//Initialize user
$GLOBALS['user'] = User::getInstance();
//Initialize cart
$GLOBALS['cart'] = Cart::getInstance();
// Set store timezone - default to UTC
date_default_timezone_set($GLOBALS['config']->get('config', 'time_zone') ? $GLOBALS['config']->get('config', 'time_zone') : 'UTC');
if ($GLOBALS['config']->get('config', 'recaptcha') && !$GLOBALS['session']->get('confirmed', 'recaptcha')) {
    $recaptcha['error'] = null;
    $recaptcha['confirmed'] = false;
    if ($GLOBALS['config']->get('config', 'recaptcha') == 2 && isset($_POST['g-recaptcha-response'])) {
        if (empty($_POST['g-recaptcha-response'])) {
开发者ID:Dirty-Butter,项目名称:v6,代码行数:31,代码来源:controller.index.inc.php

示例7: displaySideBasket

 /**
  * Display / Generate Side Basket
  *
  * @return string/bool
  */
 public function displaySideBasket()
 {
     // Display the basket sidebar
     $basket_total = 0;
     $basket_items = 0;
     if (($contents = $GLOBALS['cart']->get()) !== false) {
         $gc = $GLOBALS['config']->get('gift_certs');
         $vars = array();
         foreach ($contents as $hash => $product) {
             $product['name_abbrev'] = strlen($product['name']) >= 15 ? substr($product['name'], 0, 15) . '…' : $product['name'];
             $product['total'] = $GLOBALS['tax']->priceFormat($product['price_display']);
             if (isset($gc['product_code']) && $product['product_code'] == $gc['product_code']) {
                 $product['link'] = $GLOBALS['seo']->buildURL('certificates');
             } else {
                 $product['link'] = $GLOBALS['seo']->buildURL('prod', $product['product_id']);
             }
             $product['image'] = $this->getProductImage($product['product_id']);
             $vars['contents'][$hash] = $product;
             $basket_total += $product['price_display'];
             $basket_items += $product['quantity'];
         }
         $GLOBALS['smarty']->assign('CONTENTS', array_reverse($vars['contents'], true));
         $GLOBALS['smarty']->assign('CART_ITEMS', $basket_items);
     }
     $GLOBALS['smarty']->assign('CART_TOTAL', isset($this->_total) ? Tax::getInstance()->priceFormat($this->_total) : $GLOBALS['tax']->priceFormat($basket_total));
     $button = array('link' => $GLOBALS['storeURL'] . '/index.php?_a=basket', 'text' => $GLOBALS['language']->basket['view_basket']);
     $GLOBALS['smarty']->assign('BUTTON', $button);
     foreach ($GLOBALS['hooks']->load('class.gui.display_side_basket') as $hook) {
         include $hook;
     }
     $content = $GLOBALS['smarty']->fetch('templates/box.basket.php');
     $GLOBALS['smarty']->assign('SHOPPING_CART', $content);
     if (isset($_GET['_g']) && $_GET['_g'] == 'ajaxadd') {
         return $content;
     } else {
         return true;
     }
 }
开发者ID:briansandall,项目名称:v6,代码行数:43,代码来源:gui.class.php

示例8: search

 /**
  * Admin search function
  *
  * @param string $type
  * @param string $search_string
  * @return data/false
  */
 public static function search($type, $search_string)
 {
     $data = false;
     if (!empty($type) && !empty($search_string)) {
         switch (strtolower($type)) {
             case 'user':
                 if (($results = $GLOBALS['db']->select('CubeCart_customer', false, array('~' . $search_string => array('last_name', 'first_name', 'email')), false, false, false, false)) !== false) {
                     foreach ($results as $result) {
                         $data[] = array('value' => $result['customer_id'], 'display' => $result['first_name'] . ' ' . $result['last_name'], 'info' => $result['email'], 'data' => $result);
                     }
                 }
                 break;
             case 'address':
                 if (($results = $GLOBALS['db']->select('CubeCart_addressbook', false, array('customer_id' => (int) $search_string), false, false, false, false)) !== false) {
                     foreach ($results as $result) {
                         $result['state'] = getStateFormat($result['state']);
                         $result['country'] = getCountryFormat($result['country']);
                         $data[] = $result;
                     }
                 }
                 break;
             case 'product':
                 // Limited to a maximum of 15 results, in order to prevent it going mental
                 if (($results = $GLOBALS['db']->select('CubeCart_inventory', false, array('~' . $search_string => array('name', 'product_code')), false, 15, false, false)) !== false) {
                     foreach ($results as $result) {
                         $lower_price = Tax::getInstance()->salePrice($result['price'], $result['sale_price'], false);
                         if ($lower_price && $lower_price < $result['price']) {
                             $result['price'] = $lower_price;
                         }
                         $data[] = array('value' => $result['product_id'], 'display' => $result['name'], 'info' => Tax::getInstance()->priceFormat($result['price']), 'data' => $result);
                     }
                 }
                 break;
             case 'newsletter':
                 $newsletter = Newsletter::getInstance();
                 $status = $newsletter->sendNewsletter($_GET['q'], $_GET['page']);
                 if (is_array($status)) {
                     $data = $status;
                 } else {
                     $data = $status ? array('complete' => 'true', 'percent' => 100) : array('error' => 'true');
                 }
                 break;
             case 'files':
                 if ($_GET['dir'] == '/') {
                     $dir = false;
                 } elseif ($_GET['dir'] == '/') {
                     $dir = false;
                 } else {
                     $dir = $_GET['dir'];
                 }
                 $filemanager = new FileManager($_GET['group'], $dir);
                 // Directories
                 if (($dirs = $filemanager->findDirectories()) !== false) {
                     foreach ($dirs[$filemanager->formatPath($dir)] as $parent => $folder) {
                         $path = !empty($dir) ? '/' : '';
                         $json[] = array('type' => 'directory', 'path' => urldecode($dir . basename($folder) . '/'), 'name' => basename($folder));
                     }
                 }
                 if (($files = $filemanager->listFiles()) !== false) {
                     $catalogue = new Catalogue();
                     foreach ($files as $result) {
                         if ($filemanager->getMode() == FileManager::FM_FILETYPE_IMG) {
                             $fetch = $catalogue->imagePath($result['file_id'], 'medium');
                             $path = $name = $fetch;
                         } else {
                             $path = $result['filepath'];
                             $name = $result['filename'];
                         }
                         $json[] = array('type' => 'file', 'path' => dirname($path) . '/', 'file' => basename($result['filename']), 'name' => basename($name), 'id' => $result['file_id'], 'description' => $result['description'], 'mime' => $result['mimetype']);
                     }
                 }
                 $data = isset($json) && is_array($json) ? $json : false;
                 break;
             default:
                 return false;
                 break;
         }
         if (!$data) {
             $data = array();
         }
         return json_encode($data);
     }
     return false;
 }
开发者ID:kblok,项目名称:v6,代码行数:91,代码来源:ajax.class.php

示例9: empty

 if (isset($result['mpn']) && empty($result['mpn']) && isset($result['gtin']) && empty($result['gtin'])) {
     $result['identifier_exists'] = 'FALSE';
 } else {
     $result['identifier_exists'] = 'TRUE';
 }
 $result['condition'] = empty($result['condition']) ? 'new' : $result['condition'];
 # Manufacturer
 if (!empty($result['manufacturer'])) {
     $result['manufacturer'] = ($manuf = $GLOBALS['db']->select('CubeCart_manufacturers', array('name'), array('id' => (int) $result['manufacturer']))) ? $manuf[0]['name'] : '';
 } else {
     $result['manufacturer'] = '';
 }
 # Price
 $sale = Tax::getInstance()->salePrice($result['price'], $result['sale_price'], false);
 $result['price'] = $sale > 0 && strtolower($_GET['format']) != 'cubecart' ? $sale : $result['price'];
 $result['price_formatted'] = Tax::getInstance()->priceFormat($result['price'], true);
 ## Generate Product URL
 $url = $seo->generatePath($result['product_id'], 'product', 'product_id', true, true);
 $result['url'] = $seo->fullURL($url, true);
 ## Generate Image URL
 if (($images = $GLOBALS['db']->select('CubeCart_image_index', array('file_id'), array('main_img' => 1, 'product_id' => $result['product_id']))) !== false) {
     $result['image'] = $catalogue->imagePath($images[0]['file_id'], $image_mode, $image_path, false);
 } else {
     $result['image'] = '';
 }
 $result['currency'] = $GLOBALS['config']->get('config', 'default_currency');
 //CSV must have double quotes around strings. This is the standard and most spreasheets will behave best this way
 foreach ($fields as $field) {
     // format specialist fields e.g. 'price currency' to '9.99 USD'
     if (stristr($field, " ")) {
         $exploded_fields = explode(' ', $field);
开发者ID:Geotex,项目名称:v6,代码行数:31,代码来源:products.export.inc.php

示例10: array

    }
    if (!isset($_GET[$coupon_sort_key]) || !is_array($_GET[$coupon_sort_key])) {
        $_GET[$coupon_sort_key] = array('expires' => 'DESC');
    }
    $current_page = currentPage(array($coupon_sort_key, $certificate_sort_key));
    $thead_sort = array('status' => $GLOBALS['db']->column_sort('status', $lang['common']['status'], $coupon_sort_key, $current_page, $_GET[$coupon_sort_key], 'coupons'), 'code' => $GLOBALS['db']->column_sort('code', $lang['catalogue']['title_coupon_code'], $coupon_sort_key, $current_page, $_GET[$coupon_sort_key], 'coupons'), 'value' => $GLOBALS['db']->column_sort('discount_price', $lang['catalogue']['discount_value'], $coupon_sort_key, $current_page, $_GET[$coupon_sort_key], 'coupons'), 'expires' => $GLOBALS['db']->column_sort('expires', $lang['catalogue']['title_coupon_expires'], $coupon_sort_key, $current_page, $_GET[$coupon_sort_key], 'coupons'), 'time_used' => $GLOBALS['db']->column_sort('count', $lang['catalogue']['title_coupon_count'], $coupon_sort_key, $current_page, $_GET[$coupon_sort_key], 'coupons'));
    $GLOBALS['smarty']->assign('THEAD_COUPON', $thead_sort);
    $per_page = 20;
    $page_var = 'c_page';
    $page = isset($_GET[$page_var]) ? $_GET[$page_var] : 1;
    $coupons = $GLOBALS['db']->select('CubeCart_coupons', false, '`cart_order_id` IS NULL', $_GET[$coupon_sort_key], $per_page, $page);
    $pagination = $GLOBALS['db']->pagination(false, $per_page, $page, 5, $page_var, 'coupons');
    if ($coupons) {
        foreach ($coupons as $coupon) {
            $coupon['expires'] = $coupon['expires'] > 0 ? formatTime(strtotime($coupon['expires'])) : $GLOBALS['lang']['common']['never'];
            if ($coupon['allowed_uses'] == 0) {
                $coupon['allowed_uses'] = '&infin;';
            } else {
                $coupon['allowed_uses'] = $coupon['allowed_uses'];
            }
            $coupon['value'] = $coupon['discount_percent'] > 0 ? $coupon['discount_percent'] . '%' : Tax::getInstance()->priceFormat($coupon['discount_price']);
            $coupon['link_edit'] = currentPage(null, array('action' => 'edit', 'coupon_id' => $coupon['coupon_id']));
            $coupon['link_delete'] = currentPage(null, array('delete' => $coupon['coupon_id']));
            $smarty_data['list_coupon'][] = $coupon;
        }
        $GLOBALS['smarty']->assign('COUPONS', $smarty_data['list_coupon']);
        $GLOBALS['smarty']->assign('PAGINATION_COUPONS', $pagination);
    }
    $GLOBALS['smarty']->assign('DISPLAY_COUPONS', true);
}
$page_content = $GLOBALS['smarty']->fetch('templates/products.coupons.php');
开发者ID:briansandall,项目名称:v6,代码行数:31,代码来源:products.coupons.inc.php


注:本文中的Tax::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。