[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/includes/modules/pages/discount_coupon/ -> header_php.php (source)

   1  <?php
   2  /**

   3   * discount coupon info

   4   *

   5   * @package page

   6   * @copyright Copyright 2003-2006 Zen Cart Development Team

   7   * @copyright Portions Copyright 2003 osCommerce

   8   * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

   9   * @version $Id: header_php.php 4591 2006-09-23 04:25:15Z ajeh $

  10   */
  11  
  12    require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
  13    $text_coupon_help = '';
  14    if (isset($_POST['lookup_discount_coupon']) and $_POST['lookup_discount_coupon'] != '') {
  15  // lookup requested discount coupon

  16  
  17      $coupon = $db->Execute("select * from " . TABLE_COUPONS . " where coupon_code = '" . zen_db_input($_POST['lookup_discount_coupon']) . "' and  coupon_type != 'G'");
  18  
  19      if ($coupon->RecordCount() < 1) {
  20  // invalid discount coupon code

  21        $text_coupon_help = sprintf(TEXT_COUPON_FAILED, $_POST['lookup_discount_coupon']);
  22      } else {
  23  // valid discount coupon code

  24        $lookup_coupon_id = $coupon->fields['coupon_id'];
  25  
  26        $coupon_desc = $db->Execute("select * from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . (int)$lookup_coupon_id . "' and language_id = '" . (int)$_SESSION['languages_id'] . "'");
  27        $text_coupon_help = TEXT_COUPON_HELP_HEADER;
  28        $text_coupon_help .= sprintf(TEXT_COUPON_HELP_NAME, $coupon_desc->fields['coupon_name']);
  29        if (zen_not_null($coupon_desc->fields['coupon_description'])) $text_coupon_help .= sprintf(TEXT_COUPON_HELP_DESC, $coupon_desc->fields['coupon_description']);
  30        $coupon_amount = $coupon->fields['coupon_amount'];
  31        switch ($coupon->fields['coupon_type']) {
  32          case 'F':
  33          $text_coupon_help .= sprintf(TEXT_COUPON_HELP_FIXED, $currencies->format($coupon->fields['coupon_amount']));
  34          break;
  35          case 'P':
  36          $text_coupon_help .= sprintf(TEXT_COUPON_HELP_FIXED, number_format($coupon->fields['coupon_amount'],2). '%');
  37          break;
  38          case 'S':
  39          $text_coupon_help .= TEXT_COUPON_HELP_FREESHIP;
  40          break;
  41          default:
  42        }
  43        if ($coupon->fields['coupon_minimum_order'] > 0 ) $text_coupon_help .= sprintf(TEXT_COUPON_HELP_MINORDER, $currencies->format($coupon->fields['coupon_minimum_order']));
  44        $text_coupon_help .= sprintf(TEXT_COUPON_HELP_DATE, zen_date_short($coupon->fields['coupon_start_date']),zen_date_short($coupon->fields['coupon_expire_date']));
  45        $text_coupon_help .= TEXT_COUPON_HELP_RESTRICT;
  46  
  47        if ($coupon->fields['coupon_zone_restriction'] > 0) {
  48          $text_coupon_help .= TEXT_COUPON_GV_RESTRICTION_ZONES;
  49        }
  50  
  51        $text_coupon_help .= TEXT_COUPON_HELP_CATEGORIES;
  52        $get_result=$db->Execute("select * from " . TABLE_COUPON_RESTRICT . "  where coupon_id='" . (int)$lookup_coupon_id . "' and category_id !='0'");
  53        $cats = '';
  54        while (!$get_result->EOF) {
  55          if ($get_result->fields['coupon_restrict'] == 'N') {
  56            $restrict = TEXT_CAT_ALLOWED;
  57          } else {
  58            $restrict = TEXT_CAT_DENIED;
  59          }
  60          $result = $db->Execute("SELECT * FROM " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd WHERE c.categories_id = cd.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' and c.categories_id='" . $get_result->fields['category_id'] . "'");
  61          $cats .= '<br />' . $result->fields["categories_name"] . $restrict;
  62          $get_result->MoveNext();
  63        }
  64        if ($cats=='') $cats = TEXT_NO_CAT_RESTRICTIONS;
  65        $text_coupon_help .= $cats;
  66        $text_coupon_help .= TEXT_COUPON_HELP_PRODUCTS;
  67        $get_result=$db->Execute("select * from " . TABLE_COUPON_RESTRICT . "  where coupon_id='" . (int)$lookup_coupon_id . "' and product_id !='0'");
  68  
  69        while (!$get_result->EOF) {
  70          if ($get_result->fields['coupon_restrict'] == 'N') {
  71            $restrict = TEXT_PROD_ALLOWED;
  72          } else {
  73            $restrict = TEXT_PROD_DENIED;
  74          }
  75          $result = $db->Execute("SELECT * FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd WHERE p.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'and p.products_id = '" . $get_result->fields['product_id'] . "'");
  76          $prods .= '<br />' . $result->fields['products_name'] . $restrict;
  77          $get_result->MoveNext();
  78        }
  79        if ($prods=='') $prods = TEXT_NO_PROD_RESTRICTIONS;
  80        $text_coupon_help .= $prods . TEXT_COUPON_GV_RESTRICTION;
  81      }
  82    }
  83  
  84  // include template specific file name defines

  85  $define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_DISCOUNT_COUPON, 'false');
  86  $breadcrumb->add(NAVBAR_TITLE);
  87  ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics