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


PHP zen_create_coupon_code函数代码示例

本文整理汇总了PHP中zen_create_coupon_code函数的典型用法代码示例。如果您正苦于以下问题:PHP zen_create_coupon_code函数的具体用法?PHP zen_create_coupon_code怎么用?PHP zen_create_coupon_code使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: values

     $coupon_id = NEW_SIGNUP_DISCOUNT_COUPON;
     $coupon = $db->Execute("select * from " . TABLE_COUPONS . " where coupon_id = '" . $coupon_id . "'");
     $coupon_desc = $db->Execute("select coupon_description from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $coupon_id . "' and language_id = '" . $_SESSION['languages_id'] . "'");
     $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $coupon_id . "', '0', 'Admin', '" . $email_address . "', now() )");
     $text_coupon_help = sprintf(TEXT_COUPON_HELP_DATE, zen_date_short($coupon->fields['coupon_start_date']), zen_date_short($coupon->fields['coupon_expire_date']));
     // if on, add in Discount Coupon explanation
     //        $email_text .= EMAIL_COUPON_INCENTIVE_HEADER .
     $email_text .= "\n" . EMAIL_COUPON_INCENTIVE_HEADER . (!empty($coupon_desc->fields['coupon_description']) ? $coupon_desc->fields['coupon_description'] . "\n\n" : '') . $text_coupon_help . "\n\n" . strip_tags(sprintf(EMAIL_COUPON_REDEEM, ' ' . $coupon->fields['coupon_code'])) . EMAIL_SEPARATOR;
     $html_msg['COUPON_TEXT_VOUCHER_IS'] = EMAIL_COUPON_INCENTIVE_HEADER;
     $html_msg['COUPON_DESCRIPTION'] = !empty($coupon_desc->fields['coupon_description']) ? '<strong>' . $coupon_desc->fields['coupon_description'] . '</strong>' : '';
     $html_msg['COUPON_TEXT_TO_REDEEM'] = str_replace("\n", '', sprintf(EMAIL_COUPON_REDEEM, ''));
     $html_msg['COUPON_CODE'] = $coupon->fields['coupon_code'] . $text_coupon_help;
 }
 //endif coupon
 if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) {
     $coupon_code = zen_create_coupon_code();
     $insert_query = $db->Execute("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $coupon_code . "', 'G', '" . NEW_SIGNUP_GIFT_VOUCHER_AMOUNT . "', now())");
     $insert_id = $db->Insert_ID();
     $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id . "', '0', 'Admin', '" . $email_address . "', now() )");
     // if on, add in GV explanation
     $email_text .= "\n\n" . sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) . sprintf(EMAIL_GV_REDEEM, $coupon_code) . EMAIL_GV_LINK . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false) . "\n\n" . EMAIL_GV_LINK_OTHER . EMAIL_SEPARATOR;
     $html_msg['GV_WORTH'] = str_replace('\\n', '', sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)));
     $html_msg['GV_REDEEM'] = str_replace('\\n', '', str_replace('\\n\\n', '<br />', sprintf(EMAIL_GV_REDEEM, '<strong>' . $coupon_code . '</strong>')));
     $html_msg['GV_CODE_NUM'] = $coupon_code;
     $html_msg['GV_CODE_URL'] = str_replace('\\n', '', EMAIL_GV_LINK . '<a href="' . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false) . '">' . TEXT_GV_NAME . ': ' . $coupon_code . '</a>');
     $html_msg['GV_LINK_OTHER'] = EMAIL_GV_LINK_OTHER;
 }
 // endif voucher
 // add in regular email welcome text
 $email_text .= "\n\n" . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_GV_CLOSURE;
 $html_msg['EMAIL_MESSAGE_HTML'] = str_replace('\\n', '', EMAIL_TEXT);
开发者ID:Southern-Exposure-Seed-Exchange,项目名称:Zencart-Bootstrap-Theme,代码行数:31,代码来源:create_account.php

示例2: send_gift_certificate_email

 public static function send_gift_certificate_email()
 {
     global $db, $error, $messageStack, $mail, $gv_current_balance, $gv_amount;
     require_once 'includes/classes/http_client.php';
     require 'includes/languages/english/gv_send.php';
     // verify no timeout has occurred on the send or process
     if (!$_SESSION['customer_id']) {
         zen_redirect(zen_href_link(FILENAME_TIME_OUT));
     }
     // if the customer is not logged on, redirect them to the login page (for
     // cowoa customers, just a check the session is good)
     if (!$_SESSION['customer_id']) {
         $_SESSION['navigation']->set_snapshot();
         zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
     }
     require DIR_WS_MODULES . zen_get_module_directory('require_languages.php');
     // extract sender's name+email from database, since logged-in customer is the one who is sending this GV email
     $account_query = "SELECT customers_firstname, customers_lastname, customers_email_address\n                      FROM " . TABLE_CUSTOMERS . "\n                      WHERE customers_id = :customersID";
     $account_query = $db->bindVars($account_query, ':customersID', $_SESSION['customer_id'], 'integer');
     $account = $db->Execute($account_query);
     $send_firstname = $account->fields['customers_firstname'];
     $send_name = $send_firstname . ' ' . $account->fields['customers_lastname'];
     $send_email_address = $account->fields['customers_email_address'];
     $gv_query = "SELECT amount\n                FROM " . TABLE_COUPON_GV_CUSTOMER . "\n                WHERE customer_id = :customersID";
     $gv_query = $db->bindVars($gv_query, ':customersID', $_SESSION['customer_id'], 'integer');
     $gv_result = $db->Execute($gv_query);
     $gv_amount = $gv_result->fields['amount'];
     if ($currencies->value($gv_amount, true, DEFAULT_CURRENCY) > $gv_amount || $gv_amount == 0) {
         $error = true;
         $messageStack->add('gv_send', ERROR_ENTRY_AMOUNT_CHECK, 'error');
     }
     $id1 = zen_create_coupon_code($mail['customers_email_address']);
     $new_amount = 0;
     $new_db_amount = 0;
     $gv_query = "UPDATE " . TABLE_COUPON_GV_CUSTOMER . "\n    SET amount = '" . $new_amount . "'\n    WHERE customer_id = :customersID";
     $gv_query = $db->bindVars($gv_query, ':customersID', $_SESSION['customer_id'], 'integer');
     $db->Execute($gv_query);
     $gv_query = "INSERT INTO " . TABLE_COUPONS . " (coupon_type, coupon_code, date_created, coupon_amount)\n    VALUES ('G', :couponCode, NOW(), :amount)";
     $gv_query = $db->bindVars($gv_query, ':couponCode', $id1, 'string');
     $gv_query = $db->bindVars($gv_query, ':amount', $currencies->value($gv_amount, true, DEFAULT_CURRENCY), 'currency');
     $gv = $db->Execute($gv_query);
     $insert_id = $db->Insert_ID();
     $gv_query = "INSERT INTO " . TABLE_COUPON_EMAIL_TRACK . "\n           (coupon_id, customer_id_sent, sent_firstname, sent_lastname, emailed_to, date_sent)\n    VALUES (:insertID, :customersID, :firstname, :lastname, :email, now())";
     $gv_query = $db->bindVars($gv_query, ':insertID', $insert_id, 'integer');
     $gv_query = $db->bindVars($gv_query, ':customersID', $_SESSION['customer_id'], 'integer');
     $gv_query = $db->bindVars($gv_query, ':firstname', $send_firstname, 'string');
     $gv_query = $db->bindVars($gv_query, ':lastname', $account->fields['customers_lastname'], 'string');
     $gv_query = $db->bindVars($gv_query, ':email', $account->fields['customers_email_address'], 'string');
     $db->Execute($gv_query);
     // build email content:
     $gv_email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . sprintf(EMAIL_GV_AUTO_AMOUNT, $currencies->format($gv_amount, false)) . "\n" . EMAIL_SEPARATOR . "\n\n";
     $gv_email .= sprintf(EMAIL_GV_AUTO_CODE, '<strong>' . $id1 . '</strong>');
     $gv_email .= "\n\n";
     $gv_email .= EMAIL_GV_SHOP_FOOTER;
     $gv_email_subject = EMAIL_GV_AUTO_SUBJECT;
     $html_msg['EMAIL_GV_SHOP_FOOTER'] = EMAIL_GV_SHOP_FOOTER;
     // send the email
     zen_mail($send_name, $send_email_address, $gv_email_subject, nl2br($gv_email), STORE_NAME, EMAIL_FROM, $html_msg, 'gv_send');
     // send additional emails
     if (SEND_EXTRA_GV_CUSTOMER_EMAILS_TO_STATUS == '1' and SEND_EXTRA_GV_CUSTOMER_EMAILS_TO != '') {
         $extra_info = email_collect_extra_info(ENTRY_NAME . $_POST['to_name'], ENTRY_EMAIL . $_POST['email'], $send_name, $account->fields['customers_email_address']);
         $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
         zen_mail('', SEND_EXTRA_GV_CUSTOMER_EMAILS_TO, SEND_EXTRA_GV_CUSTOMER_EMAILS_TO_SUBJECT . ' ' . $gv_email_subject, $gv_email . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'gv_send_extra');
     }
     // do a fresh calculation after sending an email
     $gv_query = "SELECT amount\n      FROM " . TABLE_COUPON_GV_CUSTOMER . "\n      WHERE customer_id = :customersID";
     $gv_query = $db->bindVars($gv_query, ':customersID', $_SESSION['customer_id'], 'integer');
     $gv_result = $db->Execute($gv_query);
     $gv_current_balance = $currencies->format($gv_result->fields['amount']);
     // validate entries
     $gv_amount = (double) $gv_amount;
 }
开发者ID:Southern-Exposure-Seed-Exchange,项目名称:Zencart-Bootstrap-Theme,代码行数:72,代码来源:tpl_checkout_success_default.php

示例3: str_replace

    $_POST['amount'] = str_replace('$', '', $_POST['amount']);
    $gv_amount = trim($_POST['amount']);
    if (preg_match('/[^0-9\\.]/', $gv_amount)) {
        $error = true;
        $messageStack->add('gv_send', ERROR_ENTRY_AMOUNT_CHECK, 'error');
    }
    if ($currencies->value($gv_amount, true, DEFAULT_CURRENCY) > $customer_amount || $gv_amount == 0) {
        //echo $currencies->value($customer_amount, true,DEFAULT_CURRENCY);
        $error = true;
        $messageStack->add('gv_send', ERROR_ENTRY_AMOUNT_CHECK, 'error');
    }
}
if ($_GET['action'] == 'process') {
    if (!isset($_POST['back'])) {
        // customer didn't click the back button
        $id1 = zen_create_coupon_code($mail['customers_email_address']);
        // sanitize and remove non-numeric characters
        $_POST['amount'] = preg_replace('/[^0-9.,%]/', '', $_POST['amount']);
        $new_amount = $gv_result->fields['amount'] - $currencies->value($_POST['amount'], true, DEFAULT_CURRENCY);
        //die($currencies->value($_POST['amount'], true, $_SESSION['currency']));
        $new_db_amount = $gv_result->fields['amount'] - $currencies->value($_POST['amount'], true, DEFAULT_CURRENCY);
        if ($new_amount < 0) {
            $error = true;
            $messageStack->add('gv_send', ERROR_ENTRY_AMOUNT_CHECK, 'error');
            $_GET['action'] = 'send';
        } else {
            $_GET['action'] = 'complete';
            $gv_query = "UPDATE " . TABLE_COUPON_GV_CUSTOMER . "\n                 SET amount = '" . $new_amount . "'\n                 WHERE customer_id = :customersID";
            $gv_query = $db->bindVars($gv_query, ':customersID', $_SESSION['customer_id'], 'integer');
            $db->Execute($gv_query);
            $gv_query = "INSERT INTO " . TABLE_COUPONS . " (coupon_type, coupon_code, date_created, coupon_amount)\n                 VALUES ('G', :couponCode, NOW(), :amount)";
开发者ID:R-Future,项目名称:zencart,代码行数:31,代码来源:header_php.php

示例4: module_visitor_to_account


//.........这里部分代码省略.........
                     $sql_data_array['entry_state'] = $state;
                 }
             }
             zen_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int) $_SESSION['customer_id'] . "' and address_book_id = '" . (int) $_SESSION['customer_default_address_id'] . "'");
             $sql = "UPDATE " . TABLE_CUSTOMERS_INFO . "\r\n                  SET    customers_info_date_account_last_modified = now()\r\n                  WHERE  customers_info_id = :customersID";
             $sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer');
             // phpBB create account
             if ($phpBB->phpBB['installed'] == true) {
                 $phpBB->phpbb_create_account($nick, $password, $email_address);
             }
             // End phppBB create account
             $_SESSION['customer_first_name'] = $firstname;
             $_SESSION['customer_last_name'] = $lastname;
             // ->furikana
             if (FURIKANA_NESESSARY) {
                 $_SESSION['customer_first_name_kana'] = $firstname_kana;
                 $_SESSION['customer_last_name_kana'] = $lastname_kana;
             }
             // <-furikana
             $_SESSION['customer_country_id'] = $country;
             $_SESSION['customer_zone_id'] = $zone_id;
             // restore cart contents
             $_SESSION['cart']->restore_contents();
             // hook notifier class
             $zco_notifier->notify('NOTIFY_LOGIN_SUCCESS_VIA_VISITOR_TO_ACCOUNT');
             // build the message content
             $name = $firstname . ' ' . $lastname;
             if (ACCOUNT_GENDER == 'true') {
                 if ($gender == 'm') {
                     $email_text = sprintf(EMAIL_GREET_MR, $name);
                 } else {
                     $email_text = sprintf(EMAIL_GREET_MS, $name);
                 }
             } else {
                 $email_text = sprintf(EMAIL_GREET_NONE, $name);
             }
             $html_msg['EMAIL_GREETING'] = str_replace('\\n', '', $email_text);
             $html_msg['EMAIL_FIRST_NAME'] = $firstname;
             $html_msg['EMAIL_LAST_NAME'] = $lastname;
             // initial welcome
             $email_text .= EMAIL_WELCOME;
             $html_msg['EMAIL_WELCOME'] = str_replace('\\n', '', EMAIL_WELCOME);
             if (NEW_SIGNUP_DISCOUNT_COUPON != '' and NEW_SIGNUP_DISCOUNT_COUPON != '0') {
                 $coupon_id = NEW_SIGNUP_DISCOUNT_COUPON;
                 $coupon = $db->Execute("select * from " . TABLE_COUPONS . " where coupon_id = '" . $coupon_id . "'");
                 $coupon_desc = $db->Execute("select coupon_description from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $coupon_id . "' and language_id = '" . $_SESSION['languages_id'] . "'");
                 $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $coupon_id . "', '0', 'Admin', '" . $email_address . "', now() )");
                 // if on, add in Discount Coupon explanation
                 //        $email_text .= EMAIL_COUPON_INCENTIVE_HEADER .
                 $email_text .= "\n" . EMAIL_COUPON_INCENTIVE_HEADER . (!empty($coupon_desc->fields['coupon_description']) ? $coupon_desc->fields['coupon_description'] . "\n\n" : '') . strip_tags(sprintf(EMAIL_COUPON_REDEEM, ' ' . $coupon->fields['coupon_code'])) . EMAIL_SEPARATOR;
                 $html_msg['COUPON_TEXT_VOUCHER_IS'] = EMAIL_COUPON_INCENTIVE_HEADER;
                 $html_msg['COUPON_DESCRIPTION'] = !empty($coupon_desc->fields['coupon_description']) ? '<strong>' . $coupon_desc->fields['coupon_description'] . '</strong>' : '';
                 $html_msg['COUPON_TEXT_TO_REDEEM'] = str_replace("\n", '', sprintf(EMAIL_COUPON_REDEEM, ''));
                 $html_msg['COUPON_CODE'] = $coupon->fields['coupon_code'];
             }
             //endif coupon
             if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) {
                 $coupon_code = zen_create_coupon_code();
                 $insert_query = $db->Execute("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $coupon_code . "', 'G', '" . NEW_SIGNUP_GIFT_VOUCHER_AMOUNT . "', now())");
                 $insert_id = $db->Insert_ID();
                 $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id . "', '0', 'Admin', '" . $email_address . "', now() )");
                 // if on, add in GV explanation
                 $email_text .= "\n\n" . sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) . sprintf(EMAIL_GV_REDEEM, $coupon_code) . EMAIL_GV_LINK . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false) . "\n\n" . EMAIL_GV_LINK_OTHER . EMAIL_SEPARATOR;
                 $html_msg['GV_WORTH'] = str_replace('\\n', '', sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)));
                 $html_msg['GV_REDEEM'] = str_replace('\\n', '', str_replace('\\n\\n', '<br />', sprintf(EMAIL_GV_REDEEM, '<strong>' . $coupon_code . '</strong>')));
                 $html_msg['GV_CODE_NUM'] = $coupon_code;
                 $html_msg['GV_CODE_URL'] = str_replace('\\n', '', EMAIL_GV_LINK . '<a href="' . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false) . '">' . TEXT_GV_NAME . ': ' . $coupon_code . '</a>');
                 $html_msg['GV_LINK_OTHER'] = EMAIL_GV_LINK_OTHER;
             }
             // endif voucher
             // add in regular email welcome text
             $email_text .= "\n\n" . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_GV_CLOSURE;
             $html_msg['EMAIL_MESSAGE_HTML'] = str_replace('\\n', '', EMAIL_TEXT);
             $html_msg['EMAIL_CONTACT_OWNER'] = str_replace('\\n', '', EMAIL_CONTACT);
             $html_msg['EMAIL_CLOSURE'] = nl2br(EMAIL_GV_CLOSURE);
             // include create-account-specific disclaimer
             $email_text .= "\n\n" . sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
             $html_msg['EMAIL_DISCLAIMER'] = sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . ' </a>');
             // send welcome email
             zen_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, $html_msg, 'welcome');
             // send additional emails
             if (SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_STATUS == '1' and SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO != '') {
                 if ($_SESSION['customer_id']) {
                     $account_query = "select customers_firstname, customers_lastname, customers_email_address\r\n                                from " . TABLE_CUSTOMERS . "\r\n                                where customers_id = '" . (int) $_SESSION['customer_id'] . "'";
                     $account = $db->Execute($account_query);
                 }
                 $extra_info = email_collect_extra_info($name, $email_address, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address']);
                 $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
                 zen_mail('', SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO, SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT . ' ' . EMAIL_SUBJECT, $email_text . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'welcome_extra');
             }
             //endif send extra emails
             $_SESSION['navigation']->clear_snapshot();
             zen_redirect(zen_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
         }
         //endif !error
     } else {
         $return = $this->getFormDefault($return);
     }
     return $return;
 }
开发者ID:homework-bazaar,项目名称:zencart-sugu,代码行数:101,代码来源:module.php


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