public static function ToToken($intPromoCodeTypeId) { switch ($intPromoCodeTypeId) { case 0: $locale = localeconv(); return $locale['currency_symbol']; case 1: return 'Percent'; default: throw new QCallerException(sprintf(_sp('Invalid intPromoCodeTypeId') . ': %s', $intPromoCodeTypeId)); } }
/** * Валидация длины строки * * @param array $option * * @return bool */ protected function lenght(array $option) { if (isset($option['empty']) && $option['empty'] && empty($option['value'])) { return true; } if (isset($option['min']) && mb_strlen($option['value']) < $option['min']) { $this->error[] = sprintf(_sp('Min. %d symbol', 'Min. %d symbols', $option['min']), $option['min']); return false; } elseif (isset($option['max']) && mb_strlen($option['value']) > $option['max']) { $this->error[] = sprintf(_sp('Max. %d symbol', 'Max. %d symbols', $option['max']), $option['max']); return false; } return true; }
public function run() { //Load some information we'll use within the loops $intStockHandling = _xls_get_conf('INVENTORY_OUT_ALLOW_ADD', 0); $strQueryAddl = $intStockHandling == 0 ? " AND inventory_avail > 0" : ""; header("Content-Type: text/xml;charset=UTF-8"); $ret = ""; $strSiteDir = _xls_site_dir(); $canonicalUrl = Yii::app()->createCanonicalUrl("site/index"); $strSiteDir = $canonicalUrl; echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> '; // index page echo $this->sitemapXml($strSiteDir); // sitemap page echo $this->sitemapXml($strSiteDir . "sitemap.xml"); $categories = Category::model()->findAll(); foreach ($categories as $category) { $ret .= _sp("Generating URL for category ") . $category->label . "\n"; echo $this->sitemapXml($category->canonicalUrl, date("c", strtotime($category->modified)), 'weekly'); } $arrProducts = Yii::app()->db->createCommand('SELECT * FROM ' . Product::model()->tableName() . ' WHERE current=1 AND web=1 AND parent IS NULL ' . $strQueryAddl . ' ORDER BY id')->query(); while (($arrItem = $arrProducts->read()) !== false) { $objProduct = Product::model()->findByPk($arrItem['id']); echo $this->sitemapXml($objProduct->canonicalUrl, date("c", strtotime($objProduct->modified)), 'daily', $objProduct->featured ? '0.8' : '0.5'); } $criteria = new CDbCriteria(); $criteria->condition = 'tab_position > 0'; $criteria->order = 'tab_position'; $pages = CustomPage::model()->findAll($criteria); foreach ($pages as $page) { $ret .= _sp("Generating url for page ") . $page->title . "\n"; echo $this->sitemapXml($page->canonicalUrl, date("c", strtotime($page->modified)), 'weekly'); } echo '</urlset>' . "\n"; }
/** * Функция пересчета на дни, или часы * * @param int $var Время в Unix формате * * @return string */ public static function timeCount($var) { $var = $var > 0 ? $var : 0; $day = ceil($var / 86400); if ($var >= 86400) { return sprintf(_sp('%d day', '%d days', $day), $day); } return date("G:i:s", mktime(0, 0, $var)); }
* For copyright and license information, please see the LICENSE.md * Installing the system or redistributions of files must retain the above copyright notice. * * @link http://mobicms.net mobiCMS Project * @copyright Copyright (C) mobiCMS Community * @license LICENSE.md (see attached file) */ defined('MOBICMS') or die('Error: restricted access'); use Config\System as Config; $app = App::getInstance(); $user = $app->user()->get(); $form = new Mobicms\Form\Form(['action' => $app->request()->getUri()]); if ($user->rights >= 7 || $user->nickChanged < time() - Config::$usrChangeNicknamePeriod * 86400) { $form->title(_m('Change Nickname'))->element('text', 'nickname', ['label' => _m('New Nickname'), 'maxlength' => 20, 'required' => true])->element('text', 'repeat', ['label' => _m('Repeat Nickname'), 'maxlength' => 20, 'description' => _s('Min. 2, Max. 20 Characters.<br>Allowed letters are Cyrillic and Latin alphabet, numbers, spaces and punctuation - = @ ! ? ~ . _ ( ) [ ] *') . '<br/>' . _m('Please note that while changing the nickname is changing your Login on the site.<br>The next change of nickname is allowed through') . ' ' . Config::$usrChangeNicknamePeriod . ' ' . _sp('Day', 'Days', Config::$usrChangeNicknamePeriod) . '.', 'required' => true])->element('password', 'password', ['label' => _m('Your Password'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>')->validate('nickname', 'lenght', ['min' => 2, 'max' => 20])->validate('repeat', 'compare', ['compare_field' => 'nickname']); } else { $form->html('<div class="alert alert-danger">' . '<strong>' . _m('Nickname can not change more than once a') . ' ' . Config::$usrChangeNicknamePeriod . ' ' . _sp('Day', 'Days', Config::$usrChangeNicknamePeriod) . '</strong><br/><br/>' . _m('You have already changed their nickname:') . ' ' . Includes\Functions::displayDate($user->nickChanged) . '<br/>' . _m('Next time will be able to change:') . ' ' . Includes\Functions::displayDate($user->nickChanged + Config::$usrChangeNicknamePeriod * 86400) . '</div>')->html('<a class="btn btn-primary" href="../">' . _s('Back') . '</a>'); } if ($form->process() === true) { $valid = $app->user()->validate(); // Проверяем Ник if (!$valid->checkNicknameChars($form->output['nickname'])) { // Обнаружены запрещенные символы $form->setError('nickname', _s('Invalid characters')); } elseif (!$valid->checkNicknameCharsets($form->output['nickname'])) { // Обнаружены символы из разных языков $form->setError('nickname', _s('It is forbidden to use characters of different languages')); } elseif (ctype_digit($form->output['nickname']) && !Config::$usrNicknameDigitsOnly) { // Ник состоит только из цифр $form->setError('nickname', _s('Nicknames consisting only of numbers are prohibited')); } elseif (!$valid->checkNicknameRepeatedChars($form->output['nickname'])) { // Обнаружены повторяющиеся символыь (более 3-х подряд)
/** * The description of this module * @return string */ public function info() { return _sp("This module provides a simple cash on delivery payment method."); }
public function __get($strName) { switch ($strName) { case 'Name': return $this->Title; case 'IsMaster': return $this->IsMaster(); case 'IsChild': return $this->IsChild(); case 'IsIndependent': return $this->IsIndependent(); case 'Slug': return $this->GetSlug(); case 'Code': if ($this->IsChild()) { if ($prod = $this->GetMaster()) { return $prod->code; } } return $this->code; case 'FkProductMaster': return $this->GetMaster(); case 'InventoryDisplay': return $this->InventoryDisplay(); case 'Family': if (isset($this->family)) { return $this->family->family; } else { return ''; } case 'Class': if (isset($this->class)) { return $this->class->class_name; } else { return ''; } case 'Url': case 'Link': return $this->getUrl(); case 'SEOName': return $this->GetSEOName(); case 'AbsoluteUrl': return $this->GetAbsoluteUrl(); case 'AddToCartImage': return $this->GetImageLink(ImagesType::addtocartmodal); case 'ListingImage': return $this->GetImageLink(ImagesType::listing); case 'ListingImageAbsolute': return $this->GetImageLink(ImagesType::listing, true); case 'MiniImage': return $this->GetImageLink(ImagesType::mini); case 'MiniImageAbsolute': return $this->GetImageLink(ImagesType::mini, true); case 'MiniImageTag': return CHtml::image(Images::GetLink($this->image_id, ImagesType::mini)); case 'PreviewImage': return $this->GetImageLink(ImagesType::preview); case 'PreviewImageAbsolute': return $this->GetImageLink(ImagesType::preview, true); case 'PreviewImageTag': return CHtml::image(Images::GetLink($this->image_id, ImagesType::preview)); case 'SliderImage': return $this->GetImageLink(ImagesType::slider); case 'SliderImageAbsolute': return $this->GetImageLink(ImagesType::slider, true); case 'SliderImageTag': return CHtml::image(Images::GetLink($this->image_id, ImagesType::slider)); case 'CategoryImage': return $this->GetImageLink(ImagesType::category); case 'CategoryImageAbsolute': return $this->GetImageLink(ImagesType::category, true); case 'CategoryImageTag': return CHtml::image(Images::GetLink($this->image_id, ImagesType::category)); case 'PDetailImage': return $this->GetImageLink(ImagesType::pdetail); case 'PDetailImageAbsolute': return $this->GetImageLink(ImagesType::pdetail, true); case 'PDetailImageTag': return CHtml::image(Images::GetLink($this->image_id, ImagesType::pdetail)); case 'SmallImage': return $this->GetImageLink(ImagesType::small); case 'SmallImageAbsolute': return $this->GetImageLink(ImagesType::small, true); case 'SmallImageTag': return CHtml::image(Images::GetLink($this->image_id, ImagesType::small)); case 'Image': return $this->GetImageLink(ImagesType::normal); case 'ImageAbsolute': return $this->GetImageLink(ImagesType::normal, true); case 'ImageTag': return CHtml::image(Images::GetLink($this->image_id, ImagesType::normal)); case 'OriginalCode': return $this->code; case 'SizeLabel': return _xls_get_conf('PRODUCT_SIZE_LABEL', _sp('Size')); case 'ColorLabel': return _xls_get_conf('PRODUCT_COLOR_LABEL', _sp('Color')); case 'PageTitle': return _xls_truncate($this->GetPageMeta('SEO_PRODUCT_TITLE'), 70); case 'PageDescription': return _xls_truncate($this->GetPageMeta('SEO_PRODUCT_DESCRIPTION'), 255); default: return parent::__get($strName); } }
?> "/> </div> <?php } ?> <h1><?php echo $this->pageHeader; ?> </h1> <div class="subcategories"> <?php if (isset($this->subcategories) && count($this->subcategories) > 0) { echo _sp("Subcategories") . ':'; foreach ($this->subcategories as $item) { echo CHtml::link(trim($item['label']), $item['link']); } } ?> </div> <?php if (isset($this->custom_page_content)) { ?> <div id="custom_content"> <?php echo $this->custom_page_content; ?> </div>
/** * Short Description. * * @param $strId * @return array */ public static function getAdminDropdownOptions($strId) { switch ($strId) { case 'VIEWSET': $arr = array(); $d = dir(YiiBase::getPathOfAlias('application')); while (false !== ($filename = $d->read())) { if (substr($filename, 0, 6) == "views-") { $strView = substr($filename, 6, 100); $arr[$strView] = ucfirst($strView); } } $d->close(); return $arr; case 'THEME': $arr = array(); $d = dir(YiiBase::getPathOfAlias('webroot') . "/themes"); while (false !== ($filename = $d->read())) { if ($filename[0] != ".") { $fnOptions = YiiBase::getPathOfAlias('webroot') . "/themes/" . $filename . "/config.xml"; if (file_exists($fnOptions)) { $strXml = file_get_contents($fnOptions); $oXML = new SimpleXMLElement($strXml); if ($oXML->viewset) { $arr[$filename] = $oXML->name; } } } } $d->close(); return $arr; case 'CHILD_THEME': $fnOptions = YiiBase::getPathOfAlias('webroot') . '/themes/' . _xls_get_conf('THEME') . '/config.xml'; $arr = array(); if (file_exists($fnOptions)) { $strXml = file_get_contents($fnOptions); // Parse xml for response values $oXML = new SimpleXMLElement($strXml); if ($oXML->themes) { foreach ($oXML->themes->theme as $item) { $arr[(string) $item->valuestring] = (string) $item->keystring; } } else { $arr['webstore'] = 'n/a'; } } else { $arr['webstore'] = 'config.xml missing'; } return $arr; break; case 'COUNTRY': return CHtml::listData(Country::model()->findAllByAttributes(array('active' => 1), array('order' => 'sort_order,country')), 'id', 'country'); case 'STATE': return array(0 => '') + CHtml::listData(State::model()->findAllByAttributes(array('active' => 1), array('order' => 'sort_order, state')), 'id', 'state'); case 'WEIGHT': return array('lb' => 'Pound', 'kg' => 'Kilogram'); case 'DIMENSION': return array('in' => 'Inch', 'cm' => 'Centimeter'); case 'ENCODING': return array('ISO-8859-1' => 'ISO-8859-1', 'ISO-8859-15' => 'ISO-8859-15', 'UTF-8' => 'UTF-8', 'cp1251' => 'cp1251', 'cp1252' => 'cp1252', 'KOI8-R' => 'KOI8-R', 'BIG5' => 'BIG5', 'GB2312' => 'GB2312', 'BIG5-HKSCS' => 'BIG5-HKSCS', 'Shift_JIS' => 'Shift_JIS', 'EUC-JP' => 'EUC-JP'); case 'TIMEZONE': $arr = _xls_timezones(); $arr = _xls_values_as_keys($arr); return $arr; case 'PRODUCT_SORT': return array("title" => _sp("Product Name"), "-id" => _sp("Most Recently Created"), "-modified" => _sp("Most Recently Updated"), "code" => _sp("Product Code"), "sell_web" => _sp("Price"), "-inventory_avail" => _sp("Most Inventory"), "description_short" => _sp("Short Description")); case 'ENABLE_FAMILIES': return array(0 => _sp("Off"), 1 => _sp("Bottom of Products Menu"), 2 => _sp("Top of Products Menu"), 3 => _sp("Blended into Products Menu")); case 'EMAIL_SMTP_SECURITY_MODE': return array(0 => _sp("Autodetect"), 1 => _sp("Force No Security"), 2 => _sp("Force SSL"), 3 => _sp("Force TLS")); case 'STORE_IMAGE_LOCATION': return array('DB' => 'Database', 'FS' => 'File System'); case 'CAPTCHA_REGISTRATION': return array(1 => _sp("ON for Everyone"), 0 => _sp("OFF for Everyone")); case 'CAPTCHA_CONTACTUS': return array(2 => _sp("ON for Everyone"), 1 => _sp("OFF for Logged-in Users"), 0 => _sp("OFF for Everyone")); case 'CAPTCHA_CHECKOUT': return array(2 => _sp("ON for Everyone"), 1 => _sp("OFF for Logged-in Users"), 0 => _sp("OFF for Everyone")); case 'CAPTCHA_STYLE': return array(0 => _sp("Google ReCAPTCHA"), 1 => _sp("Integrated Captcha (DEPRECATED)")); case 'CAPTCHA_THEME': return array('red' => _sp("Red"), 'white' => _sp("White"), 'blackglass' => _sp("Blackglass"), 'clean' => _sp("Clean")); case 'ENABLE_SLASHED_PRICES': return array(0 => _sp("Off"), 1 => _sp("Only on Details Page"), 2 => _sp("On Grid and Details Pages")); case 'IMAGE_FORMAT': return array('jpg' => "JPG", 'png' => "PNG"); case 'LOGGING': return array('error' => 'Error Logging', 'info' => 'Troubleshooting Logging', 'trace' => 'Ludicrous Logging'); case 'INVENTORY_OUT_ALLOW_ADD': return array(Product::InventoryAllowBackorders => _sp('Display and Allow backorders'), Product::InventoryDisplayNotOrder => _sp('Display but Do Not Allow ordering'), Product::InventoryMakeDisappear => _sp('Make product disappear')); case 'MATRIX_PRICE': return array(Product::HIGHEST_PRICE => _sp('Show Highest Price'), Product::PRICE_RANGE => _sp('Show Price Range'), Product::CLICK_FOR_PRICING => _sp('Show "Click for Pricing"'), Product::LOWEST_PRICE => _sp('Show Lowest Price'), Product::MASTER_PRICE => _sp('Show Master Item Price')); case 'SSL_NO_NEED_FORWARD': return array(1 => _sp('Only when going to Checkout'), 0 => _sp('At all times including browsing product pages')); case 'REQUIRE_ACCOUNT': return array(1 => _sp('without registering (default)'), 0 => _sp('only after creating an account')); case 'AFTER_ADD_CART': return array(0 => _sp('Stay on page'), 1 => _sp('Redirect to Edit Cart page')); case 'PRODUCTS_PER_ROW': return array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 6 => 6); case 'HOME_PAGE': $arr = array('*products' => _sp('Product grid')); if (Yii::app()->params['LIGHTSPEED_MT'] == '1') { if (Yii::app()->theme->info->showCustomIndexOption) { $arr['*index'] = _sp(Yii::app()->theme->info->name . ' home page'); } } else { if (Yii::app()->theme->info->showCustomIndexOption) { $arr['*index'] = _sp(Yii::app()->theme->info->name . ' home page'); } else { $arr['*index'] = _sp('site/index.php'); } } foreach (CustomPage::model()->findAll(array('order' => 'title')) as $item) { $arr[$item->page_key] = $item->title; } return $arr; //processors //processors case 'CEventPhoto': return CHtml::listData(Modules::model()->findAllByAttributes(array('category' => 'CEventPhoto'), array('order' => 'name')), 'module', 'name'); case 'PROCESSOR_RECOMMEND': return array('wsrecommend' => 'Default'); case 'PROCESSOR_MENU': return array('wsmenu' => 'Dropdown Menu'); case 'PROCESSOR_LANGMENU': return array('wslanglinks' => 'Language options as links', 'wslangdropdown' => 'Language options as dropdown', 'wslangflags' => 'Language options as flags'); case 'EMAIL_TEST': return array(1 => 'On', 0 => 'Off'); case 'AUTO_UPDATE_TRACK': return array(0 => 'Release Versions', 1 => 'Beta and Release Versions'); case 'IMAGE_ZOOM': return array('flyout' => 'Flyout', 'inside' => 'Inside'); default: return array(1 => 'On', 0 => 'Off'); } }
<?php } ?> <h1><?php echo $this->pageHeader; ?> </h1> <div class="subcategories"> <?php if (isset($this->subcategories) && count($this->subcategories) > 0) { ?> <?php echo _sp("Subcategories"); ?> : <?php foreach ($this->subcategories as $item) { echo CHtml::link(trim($item['label']), $item['link']); } ?> <?php } ?> </div> <?php if (isset($this->custom_page_content)) { ?>
/** * The run() function is called from Web Store to run the process. * The return array should have two elements: the first is true/false if the transaction was successful. The second * string is either the successful Transaction ID, or the failure Error String to display to the user. * @return array */ public function run() { $strCardType = $this->CheckoutForm->cardType; if ($strCardType == "AMERICAN_EXPRESS" || $strCardType == "American Express") { $strCardType = "Amex"; } $str = "&PAYMENTACTION=" . 'Sale'; $str .= "&ITEMAMT=" . $this->objCart->subtotal; $str .= "&SHIPPINGAMT=" . $this->objCart->shippingCharge; $str .= "&AMT=" . round($this->objCart->total, 2); $str .= "&TAXAMT=" . $this->objCart->TaxTotal; $str .= "&INVNUM=" . $this->objCart->id_str . date('YmdHis'); // append the datetime to prevent duplicate id error if payment must be re-tried $str .= "&CREDITCARDTYPE=" . $strCardType; $str .= "&ACCT=" . _xls_number_only($this->CheckoutForm->cardNumber); //AAAABBBBCCCCDDDD $str .= "&EXPDATE=" . _xls_number_only($this->CheckoutForm->cardExpiryMonth . $this->CheckoutForm->cardExpiryYear); //MMYYYY $str .= "&CVV2=" . $this->CheckoutForm->cardCVV; $str .= "&FIRSTNAME=" . urlencode($this->CheckoutForm->contactFirstName); $str .= "&LASTNAME=" . urlencode($this->CheckoutForm->contactLastName); $str .= "&STREET=" . urlencode($this->CheckoutForm->billingAddress2 != '' ? $this->CheckoutForm->billingAddress1 . " " . $this->CheckoutForm->billingAddress2 : $this->CheckoutForm->billingAddress1); $str .= "&CITY=" . urlencode($this->CheckoutForm->billingCity); $str .= "&STATE=" . strtoupper($this->CheckoutForm->billingStateCode); $str .= "&ZIP=" . str_replace(" ", "", $this->CheckoutForm->billingPostal); $str .= "&COUNTRYCODE=" . strtoupper($this->CheckoutForm->billingCountryCode); $str .= "&EMAIL=" . $this->CheckoutForm->contactEmail; $str .= "&CURRENCYCODE=" . strtoupper(_xls_get_conf('CURRENCY_DEFAULT', 'USD')); //CAD or USD $str .= "&IPADDRESS=" . $_SERVER['REMOTE_ADDR']; if ($this->config['live'] == 'test') { $API_Endpoint = 'https://api-3t.sandbox.paypal.com/nvp'; $API_UserName = $this->config['api_username_sb']; $API_Password = $this->config['api_password_sb']; $API_Signature = $this->config['api_signature_sb']; } else { $API_Endpoint = 'https://api-3t.paypal.com/nvp'; $API_UserName = $this->config['api_username']; $API_Password = $this->config['api_password']; $API_Signature = $this->config['api_signature']; } $version = '57.0'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $API_Endpoint); curl_setopt($ch, CURLOPT_VERBOSE, 1); // Force the use of TLS instead of SSLv3. // https://ppmts.custhelp.com/app/answers/detail/a_id/1182/session/L3RpbWUvMTQxNjg0NzY2Mi9zaWQvb0t6Y3llOG0%3D curl_setopt($ch, CURLOPT_SSLVERSION, 1); // TODO - Verify if this is still the recommended way to connect to paypal (WS-3516) // Turn off the server and peer verification (TrustManager Concept). curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); // Return response data instead of true(1). curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Do a regular HTTP POST curl_setopt($ch, CURLOPT_POST, 1); // Set the API operation, version, and API signature in the request. $strPaypalPost = "METHOD=doDirectPayment&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER="******"&SIGNATURE=" . urlencode($API_Signature) . $str; if (isset($this->CheckoutForm->debug) && $this->CheckoutForm->debug) { return $strPaypalPost; } // Set the request as a POST FIELD for curl. curl_setopt($ch, CURLOPT_POSTFIELDS, $strPaypalPost); $resp = curl_exec($ch); //converting NVPResponse to an Associative Array $nvpResArray = $this->deformatNVP($resp); $strPaypalPost = $this->obfuscateStr($strPaypalPost); Yii::log(sprintf("%s sending %s for amt %s\nString %s", __CLASS__, $this->objCart->id_str, $this->objCart->total, $strPaypalPost), $this->logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__); Yii::log(sprintf('%s receiving %s', __CLASS__, print_r($nvpResArray, true)), $this->logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__); if (curl_errno($ch)) { // moving to display page to display curl errors Yii::log("curl_error " . curl_errno($ch), 'error', 'application.' . __CLASS__ . '.' . __FUNCTION__); Yii::log("curl_error_msg " . curl_error($ch), 'error', 'application.' . __CLASS__ . '.' . __FUNCTION__); $errortext = _sp("There was a PayPal system error. Check error logs."); curl_close($ch); return FALSE; } else { //closing the curl curl_close($ch); $nvpResArray['ACK'] = strtoupper($nvpResArray['ACK']); } /* Sample returned [TIMESTAMP] => 2009-06-09T22:23:58Z [CORRELATIONID] => aa77bb77aa77 [ACK] => SUCCESS [VERSION] => 57.0 [BUILD] => 921486 [AMT] => 52.49 [CURRENCYCODE] => USD [AVSCODE] => X [CVV2MATCH] => M [TRANSACTIONID] => 2SK51234GE217235G [TIMESTAMP] => 2009-06-09T22:24:03Z [CORRELATIONID] => aa77bb77aa77 [ACK] => Failure [VERSION] => 57.0 [BUILD] => 921486 [L_ERRORCODE0] => 10508 [L_SHORTMESSAGE0] => Invalid Data [L_LONGMESSAGE0] => This transaction cannot be processed. Please enter a valid credit card expiration date. [L_SEVERITYCODE0] => Error [AMT] => 52.49 [CURRENCYCODE] => USD */ $arrReturn['jump_url'] = false; $arrReturn['api'] = $this->apiVersion; $arrReturn['jump_form'] = null; if ($nvpResArray['ACK'] != 'SUCCESS') { $arrReturn['success'] = false; $arrReturn['amount_paid'] = 0; $errortext = _sp($nvpResArray['L_SHORTMESSAGE0'] . ": " . $nvpResArray['L_LONGMESSAGE0']); $arrReturn['result'] = $errortext; Yii::log($errortext, 'error', 'application.' . __CLASS__ . '.' . __FUNCTION__); } else { //We have success $arrReturn['success'] = true; $arrReturn['amount_paid'] = $nvpResArray['AMT']; $arrReturn['result'] = $nvpResArray['TRANSACTIONID']; $arrReturn['payment_date'] = $nvpResArray['TIMESTAMP']; } return $arrReturn; }
/** * During the Cart completion process, update (decrement) the usage quantity remaining * and add the promo code information to the order notes. * * @return void */ public function completeUpdatePromoCode() { $objPromo = null; if ($this->fk_promo_id > 0) { $objPromo = PromoCode::model()->findByPk($this->fk_promo_id); $this->printed_notes = implode("\n\n", array($this->printed_notes, sprintf("%s: %s", _sp('Promo Code'), $objPromo->code))); foreach ($this->cartItems as $objItem) { if ($objItem->discount > 0) { $this->printed_notes = implode("\n", array($this->printed_notes, sprintf("%s discount: %.2f", $objItem->code, $objItem->discount))); } } if ($objPromo->qty_remaining > 0) { $objPromo->qty_remaining--; $objPromo->save(); } } $this->save(); }
function _xls_mail_body_from_template($templatefile, $vars) { if (!file_exists($templatefile)) { _xls_log(_sp("FATAL ERROR : e-mail template file not found") . $templatefile); return ""; } try { extract($vars); } catch (Exception $exc) { _xls_log(_sp("FATAL ERROR : problem extracting e-mail" . " variables in") . " " . print_r($vars, true)); return ""; } ob_start(); include templateNamed('email_header.tpl.php'); include $templatefile; include templateNamed('email_footer.tpl.php'); $content = ob_get_contents(); ob_end_clean(); return $content; }