Beispiel #1
0
 public static function GetSize($intImageTypeId)
 {
     list($intDefWidth, $intDefHeight) = ImagesType::$SizeArray[$intImageTypeId];
     $strCfg = ImagesType::GetConfigKey($intImageTypeId);
     $strCfgWidth = $strCfg . '_WIDTH';
     $strCfgHeight = $strCfg . '_HEIGHT';
     $intWidth = Yii::app()->theme->info->{$strCfgWidth};
     $intHeight = Yii::app()->theme->info->{$strCfgHeight};
     //If our theme doesn't have the config there, see if we have a 3.0 style config.xml
     if (empty($intWidth) || empty($intHeight)) {
         $fnOptions = YiiBase::getPathOfAlias('webroot') . "/themes/" . Yii::app()->theme->name . "/config.xml";
         if (file_exists($fnOptions)) {
             $strXml = file_get_contents($fnOptions);
             // Parse xml for response values
             $oXML = new SimpleXMLElement($strXml);
             if (isset($oXML->defaults->configuration)) {
                 foreach ($oXML->defaults->configuration as $item) {
                     if ((string) $item->key_name == $strCfgWidth) {
                         $intWidth = (string) $item->key_value;
                     }
                     if ((string) $item->key_name == $strCfgHeight) {
                         $intHeight = (string) $item->key_value;
                     }
                 }
             }
         }
     }
     //if all else STILL fails, go old school and get them from the config (And even more so, use defaults)
     if (empty($intWidth) || empty($intHeight)) {
         $intWidth = _xls_get_conf($strCfgWidth, $intDefWidth);
         $intHeight = _xls_get_conf($strCfgHeight, $intDefHeight);
     }
     return array($intWidth, $intHeight);
 }
 public function beforeAction($action)
 {
     $this->scanModules('payment');
     $arrModules = Modules::model()->findAllByAttributes(array('category' => 'payment'), array('order' => 'module'));
     $this->_allowAdvancedPayments = CPropertyValue::ensureBoolean(Yii::app()->params['ALLOW_ADVANCED_PAY_METHODS']);
     $menuSidebar = array();
     foreach ($arrModules as $module) {
         $currentModule = Yii::app()->getComponent($module->module);
         if (is_null($currentModule)) {
             continue;
         }
         if ($currentModule->cloudCompatible === false && _xls_get_conf('LIGHTSPEED_CLOUD') > 0) {
             continue;
         }
         if ($currentModule->isDisplayable() === false) {
             continue;
         }
         $menuSidebar[] = array('label' => $currentModule->AdminName, 'url' => array('payments/module', 'id' => $module->module), 'advancedPayment' => $currentModule->advancedMode);
     }
     $advancedPaymentMethods = where($menuSidebar, array('advancedPayment' => true));
     $simplePaymentMethods = where($menuSidebar, array('advancedPayment' => false));
     $this->menuItems = array_merge(array(array('label' => 'Simple Integration Modules', 'linkOptions' => array('class' => 'nav-header'))), $simplePaymentMethods, array(array('label' => 'Advanced Integration Modules', 'linkOptions' => array('class' => 'nav-header'), 'visible' => count($advancedPaymentMethods) > 0)), $advancedPaymentMethods, $this->getPaymentSetupLinks());
     $objModules = Modules::model()->findAllByAttributes(array('category' => 'payment', 'active' => 1));
     if (count($objModules) === 0 && $action->id == "index") {
         $this->noneActive = 1;
         Yii::app()->user->setFlash('error', Yii::t('admin', 'WARNING: You have no payment modules activated. No one can checkout.'));
     }
     return parent::beforeAction($action);
 }
 public function getAdminForm()
 {
     if (empty($this->origincountry)) {
         $this->origincountry = (int) _xls_get_conf('DEFAULT_COUNTRY', 224);
     }
     return array('title' => 'Note: You can ' . CHtml::link('Set Product Restrictions', '#', array('class' => 'basic', 'id' => get_class($this))) . ' for this module.', 'elements' => array('label' => array('type' => 'text', 'maxlength' => 64), 'accnumber' => array('type' => 'text', 'maxlength' => 64), 'meternumber' => array('type' => 'text', 'maxlength' => 64), 'securitycode' => array('type' => 'text', 'maxlength' => 64), 'authkey' => array('type' => 'text', 'maxlength' => 64), 'originadde' => array('type' => 'text', 'maxlength' => 64), 'origincity' => array('type' => 'text', 'maxlength' => 64), 'originpostcode' => array('type' => 'text', 'maxlength' => 64), 'origincountry' => array('type' => 'dropdownlist', 'items' => CHtml::listData(Country::model()->findAllByAttributes(array('active' => 1), array('order' => 'sort_order,country')), 'id', 'country'), 'ajax' => array('type' => 'POST', 'url' => Yii::app()->controller->createUrl('ajax/getstates'), 'data' => 'js:{"' . 'country_id' . '": $("#' . CHtml::activeId($this, 'origincountry') . ' option:selected").val()}', 'update' => '#' . CHtml::activeId($this, 'originstate'))), 'originstate' => array('type' => 'dropdownlist', 'items' => CHtml::listData(State::model()->findAllByAttributes(array('country_id' => $this->origincountry, 'active' => 1), array('order' => 'sort_order,state')), 'id', 'code')), 'offerservices' => array('type' => 'checkboxlist', 'items' => fedex::$service_types, 'separator' => '', 'template' => '<div class="offerservices">{input} {label}</div>', 'label' => 'Offer these services<br><a onclick="selectall()">Select All</a><br><a onclick="selectnone()">Select None</a><br>'), 'packaging' => array('type' => 'dropdownlist', 'items' => array('YOUR_PACKAGING' => 'Your packaging', 'FEDEX_BOX' => 'FedEx Box', 'FEDEX_PAK' => 'FedEx Pak', 'FEDEX_TUBE' => 'FedEx Tube')), 'ratetype' => array('type' => 'dropdownlist', 'items' => array('RATED_LIST' => 'List Rates', 'RATED_ACCOUNT' => 'Negotiated rates')), 'customs' => array('type' => 'dropdownlist', 'items' => array('CLEARANCEFEE' => 'FedEx Handles Customs Clearance', 'NOCHARGE' => 'My store handles Customs Clearance')), 'restrictcountry' => array('type' => 'dropdownlist', 'items' => Country::getAdminRestrictionList(true)), 'markup' => array('type' => 'text', 'maxlength' => 4), 'product' => array('type' => 'text', 'maxlength' => 64)));
 }
 /**
  * Ensure that a password meets our requirements
  * Return an error message detailing the failure if applicable.
  *
  * @param CModel $model
  * @param string $attribute
  * @return string | false
  */
 public function validateAttribute($model, $attribute)
 {
     $minLength = _xls_get_conf('MIN_PASSWORD_LEN', 0);
     if (strlen($model->{$attribute}) < $minLength) {
         $this->addError($model, $attribute, Yii::t('customer', '{attribute} too short. Must be a minimum of {length} characters.', array('{attribute}' => $model->getAttributeLabel($attribute), '{length}' => $minLength)));
     }
 }
Beispiel #5
0
 /**
  * The run() function is called from Web Store to run the process.
  * @return array
  */
 public function run()
 {
     $ewayCvnAusValues = array("ewayCardNumber" => _xls_number_only($this->CheckoutForm->cardNumber), "ewayCardHoldersName" => $this->CheckoutForm->cardNameOnCard, "ewayCardExpiryMonth" => $this->CheckoutForm->cardExpiryMonth, "ewayCardExpiryYear" => $this->CheckoutForm->cardExpiryYear, "ewayCVN" => $this->CheckoutForm->cardCVV, "ewayCustomerInvoiceRef" => $this->objCart->id_str, "ewayTotalAmount" => round($this->objCart->total * 100), "ewayCustomerFirstName" => $this->CheckoutForm->contactFirstName, "ewayCustomerLastName" => $this->CheckoutForm->contactLastName, "ewayCustomerAddress" => ($this->CheckoutForm->billingAddress2 != '' ? $this->CheckoutForm->billingAddress1 . " " . $this->CheckoutForm->billingAddress2 : $this->CheckoutForm->billingAddress1) . ", " . $this->CheckoutForm->billingCity . " " . $this->CheckoutForm->billingStateCode, "ewayCustomerPostcode" => $this->CheckoutForm->billingPostal, "ewayCustomerEmail" => $this->CheckoutForm->contactEmail, "ewayCustomerInvoiceDescription" => _xls_get_conf('STORE_NAME', "Online") . " Order", "ewayTrxnNumber" => '', "ewayOption1" => '', "ewayOption2" => '', "ewayOption3" => '');
     $xmlRequest = "<ewaygateway><ewayCustomerID>" . $this->config['login'] . "</ewayCustomerID>";
     foreach ($ewayCvnAusValues as $key => $value) {
         $xmlRequest .= "<{$key}>{$value}</{$key}>";
     }
     $xmlRequest .= "</ewaygateway>";
     Yii::log(sprintf("%s sending %s for amt %s\nRequest: %s", __CLASS__, $this->objCart->id_str, $this->objCart->total, print_r($this->obfuscateRequestArray($ewayCvnAusValues), true)), $this->logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__);
     $xmlResponse = $this->sendTransactionToEway($xmlRequest);
     if ($xmlResponse !== '') {
         $oXML = new SimpleXMLElement($xmlResponse);
         if ((string) $oXML->ewayTrxnStatus != "True") {
             // unsuccessful
             $arrReturn['success'] = false;
             $arrReturn['amount_paid'] = 0;
             $arrReturn['result'] = Yii::t('global', (string) $oXML->ewayTrxnError);
             Yii::log("Declined: " . (string) $oXML->ewayTrxnError, 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         } else {
             //We have success
             $arrReturn['success'] = true;
             $arrReturn['amount_paid'] = stripos((string) $oXML->ewayTrxnError, "Tests CVN Gateway") > 0 ? 0.0 : (string) $oXML->ewayReturnAmount / 100;
             $arrReturn['result'] = (string) $oXML->ewayAuthCode;
         }
     } else {
         // Curl call failed.
         $arrReturn['success'] = false;
         $arrReturn['amount_paid'] = 0;
         $arrReturn['result'] = Yii::t('global', "There was an error processing your payment, please try again later.");
         Yii::log("Curl Error: curl call failed.", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
     }
     return $arrReturn;
 }
 /**
  * Run the payment process
  * @return mixed
  */
 public function run()
 {
     if ($this->config['live'] == 'live') {
         $worldpay_url = "https://secure.wp3.rbsworldpay.com/wcc/purchase";
     } else {
         $worldpay_url = "https://select-test.wp3.rbsworldpay.com/wcc/purchase";
     }
     $str = sprintf('<FORM name="worldpayform" action="%s" method="POST">', $worldpay_url);
     if ($this->config['live'] == 'test') {
         $str .= _xls_make_hidden('testMode', '100');
     }
     $str .= _xls_make_hidden('address1', $this->CheckoutForm->billingAddress1);
     $str .= _xls_make_hidden('address2', $this->CheckoutForm->billingAddress2);
     $str .= _xls_make_hidden('town', $this->CheckoutForm->billingCity);
     $str .= _xls_make_hidden('region', $this->CheckoutForm->billingStateCode);
     $str .= _xls_make_hidden('postcode', $this->CheckoutForm->billingPostal);
     $str .= _xls_make_hidden('country', $this->CheckoutForm->billingCountryCode);
     $str .= _xls_make_hidden('email', $this->CheckoutForm->contactEmail);
     $str .= _xls_make_hidden('name', $this->CheckoutForm->contactFirstName . " " . $this->CheckoutForm->contactLastName);
     $str .= _xls_make_hidden('tel', $this->CheckoutForm->contactPhone);
     $str .= _xls_make_hidden('instId', $this->config['login']);
     $str .= _xls_make_hidden('currency', _xls_get_conf('CURRENCY_DEFAULT', 'USD'));
     $str .= _xls_make_hidden('cartId', $this->objCart->id_str);
     $str .= _xls_make_hidden('desc', _xls_get_conf('STORE_NAME', "Online") . " Order");
     $str .= _xls_make_hidden('M_cartlink', Yii::app()->controller->createAbsoluteUrl('cart/restore', array('getuid' => $this->objCart->linkid)));
     $str .= _xls_make_hidden('MC_callback', Yii::app()->controller->createAbsoluteUrl('cart/payment', array('id' => $this->modulename)));
     $str .= _xls_make_hidden('amount', round($this->objCart->total, 2));
     $str .= '</FORM>';
     Yii::log(sprintf("%s sending %s\nRequest %s", __CLASS__, $this->objCart->id_str, $str), $this->logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__);
     $arrReturn['api'] = $this->apiVersion;
     $arrReturn['jump_form'] = $str;
     return $arrReturn;
 }
 public function getAdminForm()
 {
     if (empty($this->origincountry)) {
         $this->origincountry = (int) _xls_get_conf('DEFAULT_COUNTRY', 224);
     }
     return array('title' => 'Note: You can ' . CHtml::link('Set Product Restrictions', '#', array('class' => 'basic', 'id' => get_class($this))) . ' for this module.', 'elements' => array('label' => array('type' => 'text', 'maxlength' => 64), 'mode' => array('type' => 'dropdownlist', 'items' => array('UPS' => 'Domestic US UPS Mode', 'IUPS' => 'IUPS International UPS Mode')), 'username' => array('type' => 'text', 'maxlength' => 64), 'password' => array('type' => 'text', 'maxlength' => 64), 'accesskey' => array('type' => 'text', 'maxlength' => 64), 'originpostcode' => array('type' => 'text', 'maxlength' => 64), 'origincountry' => array('type' => 'dropdownlist', 'items' => CHtml::listData(Country::model()->findAllByAttributes(array('active' => 1), array('order' => 'sort_order,country')), 'id', 'country'), 'ajax' => array('type' => 'POST', 'url' => Yii::app()->controller->createUrl('ajax/getstates'), 'data' => 'js:{"' . 'country_id' . '": $("#' . CHtml::activeId($this, 'origincountry') . ' option:selected").val()}', 'update' => '#' . CHtml::activeId($this, 'originstate'))), 'originstate' => array('type' => 'dropdownlist', 'items' => CHtml::listData(State::model()->findAllByAttributes(array('country_id' => $this->origincountry, 'active' => 1), array('order' => 'sort_order,state')), 'id', 'code')), 'offerservices' => array('type' => 'checkboxlist', 'items' => ups::$service_types, 'separator' => '', 'template' => '<div class="offerservices">{input} {label}</div>', 'label' => 'Offer these services<br><a onclick="selectall()">Select All</a><br><a onclick="selectnone()">Select None</a><br>'), 'package' => array('type' => 'dropdownlist', 'items' => ups::$package_types), 'ratecode' => array('type' => 'dropdownlist', 'items' => ups::$rate_types), 'customerclassification' => array('type' => 'dropdownlist', 'items' => array('04' => 'Retail', '03' => 'Occasional', '01' => 'Wholesale')), 'restrictcountry' => array('type' => 'dropdownlist', 'items' => Country::getAdminRestrictionList(true)), 'markup' => array('type' => 'text', 'maxlength' => 4), 'product' => array('type' => 'text', 'maxlength' => 64)));
 }
Beispiel #8
0
 /**
  * The run() function is called from Web Store to actually do the calculation. It returns an array of the service
  * levels and prices available to the customer (as keys and values in the array, respectively).
  * @return array
  */
 public function run()
 {
     if (!isset($this->config['offerservices'])) {
         return false;
     }
     $weight = $this->objCart->Weight;
     if (_xls_get_conf('WEIGHT_UNIT', 'lb') != 'lb') {
         // one KG is 2.2 pounds
         $weight = $weight * 2.2;
     }
     //USPS wants a full country name
     $objCountry = Country::Load($this->CheckoutForm->shippingCountry);
     if ($objCountry instanceof Country) {
         $country = $objCountry->country;
     } else {
         $country = "US";
     }
     if (empty($this->config['username']) || empty($this->config['originpostcode'])) {
         return false;
     }
     $this->init_vars($this->config['username'], $this->config['originpostcode'], $this->CheckoutForm->shippingPostal, $country, $this->config['markup']);
     $this->addItem(intval($weight), round(($weight - intval($weight)) * 16, 0), $this->objCart->total);
     $rates = $this->getRate();
     if ($rates === FALSE || count($rates) == 0) {
         Yii::log("USPS: Could not get rates. " . print_r($this, true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         return false;
     }
     return $this->convertRetToDisplay($rates);
 }
 /**
  * Run the payment process
  * @return mixed
  */
 public function run()
 {
     $auth_net_login_id = $this->config['login'];
     $auth_net_tran_key = $this->config['trans_key'];
     /**
      * This option, and the commented $ret['live']->AddItem('dev' , 'dev') above, are only for API development work.
      * Regular Authorize.net customers will only use "live" and "test" modes through their account, which can be
      * chosen through the Web Admin panel.
      *
      */
     if ($this->config['live'] == 'test') {
         $auth_net_url = "https://test.authorize.net/gateway/transact.dll";
     } else {
         $auth_net_url = "https://secure.authorize.net/gateway/transact.dll";
     }
     $str = "";
     $str .= sprintf('<FORM action="%s" method="POST">', $auth_net_url);
     $str .= $this->InsertFP($auth_net_login_id, $auth_net_tran_key, round($this->objCart->Total, 2), $this->objCart->currency);
     $str .= _xls_make_hidden('x_invoice_num', $this->objCart->id_str);
     $str .= _xls_make_hidden('x_first_name', $this->CheckoutForm->contactFirstName);
     $str .= _xls_make_hidden('x_last_name', $this->CheckoutForm->contactLastName);
     $str .= _xls_make_hidden('x_company', $this->CheckoutForm->contactCompany);
     $str .= _xls_make_hidden('x_address', $this->CheckoutForm->billingAddress1 . " " . $this->CheckoutForm->billingAddress2);
     $str .= _xls_make_hidden('x_city', $this->CheckoutForm->billingCity);
     $str .= _xls_make_hidden('x_state', $this->CheckoutForm->billingStateCode);
     $str .= _xls_make_hidden('x_zip', $this->CheckoutForm->billingPostal);
     $str .= _xls_make_hidden('x_country', $this->CheckoutForm->billingCountryCode);
     $str .= _xls_make_hidden('x_phone', _xls_number_only($this->CheckoutForm->contactPhone));
     $str .= _xls_make_hidden('x_email', $this->CheckoutForm->contactEmail);
     $str .= _xls_make_hidden('x_cust_id', "WC-" . $this->objCart->customer_id);
     $str .= _xls_make_hidden('x_ship_to_first_name', $this->CheckoutForm->shippingFirstName);
     $str .= _xls_make_hidden('x_ship_to_last_name', $this->CheckoutForm->shippingLastName);
     $str .= _xls_make_hidden('x_ship_to_company', $this->CheckoutForm->shippingCompany);
     $str .= _xls_make_hidden('x_ship_to_address', $this->CheckoutForm->shippingAddress1 . " " . $this->CheckoutForm->shippingAddress2);
     $str .= _xls_make_hidden('x_ship_to_city', $this->CheckoutForm->shippingCity);
     $str .= _xls_make_hidden('x_ship_to_state', $this->CheckoutForm->shippingStateCode);
     $str .= _xls_make_hidden('x_ship_to_zip', $this->CheckoutForm->shippingPostal);
     $str .= _xls_make_hidden('x_ship_to_country', $this->CheckoutForm->shippingCountryCode);
     $str .= _xls_make_hidden('x_description', _xls_get_conf('STORE_NAME', "Online") . " Order");
     $str .= _xls_make_hidden('x_login', $auth_net_login_id);
     $str .= _xls_make_hidden('x_solution_id', 'A1000010');
     $str .= _xls_make_hidden('x_type', 'AUTH_CAPTURE');
     $str .= _xls_make_hidden('x_currency_code', $this->objCart->currency);
     //trying to get currency code to submit
     $str .= _xls_make_hidden('x_amount', round($this->objCart->Total, 2));
     $str .= _xls_make_hidden('x_show_form', 'PAYMENT_FORM');
     $str .= _xls_make_hidden('x_relay_response', 'TRUE');
     $str .= _xls_make_hidden('x_relay_url', Yii::app()->controller->createAbsoluteUrl('cart/payment', array(), 'http') . '/' . $this->modulename);
     $str .= _xls_make_hidden('x_cancel_url', Yii::app()->controller->createAbsoluteUrl('cart/restore', array('getuid' => $this->objCart->linkid), 'http'));
     if (Yii::app()->params['LIGHTSPEED_MT'] > 0) {
         $str .= _xls_make_hidden('x_header_html_payment_form', str_replace("\"", "'", CHtml::image("https:" . Yii::app()->params['HEADER_IMAGE'], Yii::app()->params['STORE_NAME'], array('style' => 'max-width:580px'))));
     } else {
         $str .= _xls_make_hidden('x_header_html_payment_form', str_replace("\"", "'", CHtml::image(Yii::app()->controller->createAbsoluteUrl(Yii::app()->params['HEADER_IMAGE'], array(), 'https'), Yii::app()->params['STORE_NAME'], array('style' => 'max-width:580px'))));
     }
     $str .= '</FORM>';
     Yii::log(sprintf("%s sending %s in %s mode\nRequest %s", __CLASS__, $this->objCart->id_str, $this->objCart->id_str, $str), $this->logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__);
     $arrReturn['api'] = $this->apiVersion;
     $arrReturn['jump_form'] = $str;
     return $arrReturn;
 }
Beispiel #10
0
 public static function CreateEvent($strModule, $strController, $strAction, $data_id = null, $product_id = null)
 {
     if ($strController == "amazon") {
         $MerchantID = _xls_get_conf('AMAZON_MERCHANT_ID');
         $MarketplaceID = _xls_get_conf('AMAZON_MARKETPLACE_ID');
         $MWS_ACCESS_KEY_ID = _xls_get_conf('AMAZON_MWS_ACCESS_KEY_ID');
         $MWS_SECRET_ACCESS_KEY = _xls_get_conf('AMAZON_MWS_SECRET_ACCESS_KEY');
         if (empty($MerchantID) || empty($MarketplaceID) || empty($MWS_ACCESS_KEY_ID) || empty($MWS_SECRET_ACCESS_KEY)) {
             return false;
         }
     }
     //Check to make sure it's not duplicate
     $objTask = TaskQueue::model()->findByAttributes(array('module' => $strModule, 'controller' => $strController, 'action' => $strAction, 'data_id' => $data_id, 'product_id' => $product_id));
     if ($objTask instanceof TaskQueue) {
         return;
     }
     $objTask = new TaskQueue();
     $objTask->module = $strModule;
     $objTask->controller = $strController;
     $objTask->action = $strAction;
     $objTask->data_id = $data_id;
     $objTask->product_id = $product_id;
     if (!$objTask->save()) {
         Yii::log("Error creating Task {$strModule}, {$strController}, {$strAction} " . print_r($objTask->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
     }
 }
 /**
  * We want to ensure Wish lists are enabled before a user can view,
  * search and-or create lists. So, we display an exception to prevent
  *  running any of these processes.
  *
  * @param CAction $action
  * @return bool
  * @throws CHttpException
  */
 public function beforeAction($action)
 {
     if (_xls_get_conf('ENABLE_WISH_LIST', 0) == 0) {
         _xls_404('Wish lists are not enabled on this store.');
         return false;
     }
     return parent::beforeAction($action);
 }
Beispiel #12
0
 public function init()
 {
     parent::init();
     // US spelling for US stores
     if (_xls_get_conf('DEFAULT_COUNTRY') == '224') {
         $this->defaultName = "Check";
     }
 }
Beispiel #13
0
 public static function garbageCollect()
 {
     $intLogRotateDays = _xls_get_conf('LOG_ROTATE_DAYS', 0);
     if ($intLogRotateDays > 0) {
         $lastDate = date('YmdHis', strtotime("-" . $intLogRotateDays . " days"));
         $sql = "DELETE from xlsws_log where DATE_FORMAT(`created`, '%Y%m%d%H%i%s')<'" . $lastDate . "'";
         Yii::app()->db->createCommand($sql)->execute();
     }
 }
Beispiel #14
0
 /**
  * @param $strCode
  * @param null $intCountryId
  * @return CActiveRecord
  */
 public static function LoadByCode($strCode, $intCountryId = null)
 {
     if (is_null($intCountryId)) {
         $intCountryId = _xls_get_conf('DEFAULT_COUNTRY', 224);
     }
     if (!is_numeric($intCountryId)) {
         $intCountryId = Country::IdByCode($intCountryId);
     }
     return State::model()->find('code=:code_id AND country_id=:c_id', array(':code_id' => $strCode, ':c_id' => $intCountryId));
 }
 public function GetPrice($objTaxCode, $intTaxStatus, $taxExclusive = false)
 {
     if ($taxExclusive) {
         return $this->price;
     } elseif (_xls_get_conf('TAX_INCLUSIVE_PRICING', '') == '1') {
         $arrPrice = Tax::calculatePricesWithTax($this->price, $objTaxCode->id, $intTaxStatus);
         return $arrPrice['fltSellTotalWithTax'];
     } else {
         return $this->price;
     }
 }
    public static function renderCssJsResource()
    {
        ?>
		<style type="text/css">
			.product_cell .product_cell_graphic a {
			  position: relative;
			}
			.product_cell a{width:100%;height:100%;float:left;}
			.product_cell img.hover {
			  max-height: <?php 
        echo _xls_get_conf('LISTING_IMAGE_HEIGHT');
        ?>
px;
			  top: 0;
			  opacity: 0;
			  position: absolute;
			  width: 100%;
			  height:100%;
			  max-width: <?php 
        echo _xls_get_conf('LISTING_IMAGE_WIDTH');
        ?>
px;
			}
		</style>
		<script type="text/javascript" >
		jQuery(document).ready(function(){
			$('.product_cell_graphic a').hover(function(){
				if(!$(this).children('.hover').length>0){
					return;
				}
				$(this).children('.normal').animate({
					opacity: 0,
				}, 200, function() {
				});
					$(this).children('.hover').animate({
				opacity: 1,
				}, 200, function() {
				});
			},function(){
				$(this).children('.normal').animate({
					opacity: 1,
				}, 200, function() {
				});
					$(this).children('.hover').animate({
				opacity: 0,
				}, 200, function() {
				});
			});
		});
		</script>
<?php 
    }
 /**
  * Displays the contact page
  */
 public function actionContact()
 {
     $model = CustomPage::LoadByRequestUrl('contact-us');
     $this->pageTitle = $model->PageTitle;
     $this->pageDescription = $model->meta_description;
     $this->breadcrumbs = array($model->title => $model->RequestUrl);
     $this->layout = "//layouts/column" . $model->column_template;
     $ContactForm = new ContactForm();
     if (isset($_POST['ContactForm'])) {
         $ContactForm->attributes = $_POST['ContactForm'];
         if ($ContactForm->validate()) {
             $objEmail = new EmailQueue();
             if (!Yii::app()->user->isGuest) {
                 $objCustomer = Customer::GetCurrent();
                 $objEmail->customer_id = $objCustomer->id;
                 $ContactForm->fromName = $objCustomer->mainname;
                 $ContactForm->fromEmail = $objCustomer->email;
             }
             $strHtmlBody = $this->renderPartial('/mail/_contactform', array('model' => $ContactForm), true);
             $strSubject = Yii::t('email', 'Contact Us:') . $ContactForm->contactSubject;
             $objEmail->htmlbody = $strHtmlBody;
             $objEmail->subject = $strSubject;
             $orderEmail = _xls_get_conf('ORDER_FROM', '');
             $objEmail->to = empty($orderEmail) ? _xls_get_conf('EMAIL_FROM') : $orderEmail;
             $objHtml = new HtmlToText();
             //If we get back false, it means conversion failed which 99.9% of the time means improper HTML.
             $strPlain = $objHtml->convert_html_to_text($strHtmlBody);
             if ($strPlain !== false) {
                 $objEmail->plainbody = $strPlain;
             }
             if (!$objEmail->save()) {
                 Yii::log("Error creating email " . print_r($objEmail, true) . " " . print_r($objEmail->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
             }
             Yii::app()->user->setFlash('success', Yii::t('email', 'Message sent. Thank you for contacting us. We will respond to you as soon as possible.'));
             //Attempt to use an AJAX call to send the email. If it doesn't work, the Download process will catch it anyway.
             $jsScript = "\$.ajax({url:\"" . CController::createUrl('site/sendemail', array("id" => $objEmail->id)) . "\"});";
             Yii::app()->clientScript->registerScript('sendemail', $jsScript, CClientScript::POS_READY);
         } else {
             Yii::app()->user->setFlash('error', Yii::t('cart', 'Please check your form for errors.'));
             if (YII_DEBUG) {
                 Yii::app()->user->setFlash('error', print_r($ContactForm->getErrors(), true));
             }
         }
     }
     if (!Yii::app()->user->isGuest) {
         $objCustomer = Customer::GetCurrent();
         $ContactForm->fromName = $objCustomer->mainname;
         $ContactForm->fromEmail = $objCustomer->email;
     }
     $this->canonicalUrl = $model->canonicalUrl;
     $this->render('contact', array('ContactForm' => $ContactForm, 'model' => $model));
 }
 public function beforeAction($action)
 {
     date_default_timezone_set(_xls_get_conf('TIMEZONE'));
     if (Multicategory::CheckSetDb() === false) {
         Multicategory::model()->SetDb();
     } else {
         Multicategory::model()->Checkversion($this->InfoModule['router'], $this->InfoModule['version']);
     }
     $this->upgradeDataBase();
     $SelfmenuItems = array();
     $this->menuItems = $this->menuItems = Argoworks::model()->createMenuArgo($SelfmenuItems, $this->InfoModule['router']);
     return parent::beforeAction($action);
 }
Beispiel #19
0
 public function run()
 {
     parent::run();
     $addTransactionScript = $this->setAddTransactionScript();
     $addItemScript = $this->setAddItemsScript();
     $sendScript = $this->setSendScript();
     Yii::app()->clientScript->registerScript('google transaction analytics', $addTransactionScript . $addItemScript . $sendScript, CClientScript::POS_HEAD);
     if (Yii::app()->params['GOOGLE_ADWORDS'] == '') {
         // We need not proceed any further unless we have an AdWords ID number
         return;
     }
     $this->render('googleconversion', array('conversionID' => Yii::app()->params['GOOGLE_ADWORDS'], 'conversionLabel' => _xls_get_conf('GOOGLE_LABEL', 'purchase'), 'conversionValue' => $this->objCart->subtotal, 'currency' => $this->objCart->currency));
 }
Beispiel #20
0
 public function run()
 {
     if (!isset($this->config['offerservices'])) {
         return false;
     }
     $weight = $this->objCart->Weight;
     if (_xls_get_conf('WEIGHT_UNIT', 'kg') != 'kg') {
         $weight = $weight / 2.2;
     }
     // one KG is 2.2 pounds
     $length = $this->objCart->Length;
     $width = $this->objCart->Width;
     $height = $this->objCart->Height;
     if (_xls_get_conf('DIMENSION_UNIT', 'cm') != 'cm') {
         $length = round($length * 2.54);
         $width = round($width * 2.54);
         $height = round($height * 2.54);
     }
     $found = 0;
     $ret = array();
     $url = "http://sellonline.canadapost.ca:30000";
     $xml = "<?xml version=\"1.0\" ?>\n\t\t<eparcel>\n\t\t\t<language>en</language>\n\t\t\t<ratesAndServicesRequest>\n\t\t\t\t<merchantCPCID>" . $this->config['cpc'] . "</merchantCPCID>\n\t\t\t\t<turnAroundTime>120</turnAroundTime>\n\t\t\t\t<itemsPrice>" . $this->objCart->subtotal . "</itemsPrice>\n\t\t\t\t<lineItems>\n\t\t\t\t\t<item>\n\t\t\t\t\t\t<quantity>1</quantity>\n\t\t\t\t\t\t<weight>" . $weight . "</weight>\n\t\t\t\t\t\t<length>" . $length . "</length>\n\t\t\t\t\t\t<width>" . $width . "</width>\n\t\t\t\t\t\t<height>" . $height . "</height>\n\t\t\t\t\t\t<description>Canada Post Shipping</description>\n\t\t\t\t\t\t<readyToShip />\n\t\t\t\t\t</item>\n\t\t\t\t</lineItems>\n\t\t\t\t" . "<city>" . $this->CheckoutForm['shippingCity'] . "</city>\n" . "<provOrState>" . $this->CheckoutForm['shippingStateCode'] . "</provOrState>\n" . "<country>" . $this->CheckoutForm['shippingCountryCode'] . "</country>\n" . "<postalCode>" . $this->CheckoutForm['shippingPostal'] . "</postalCode>\n" . "</ratesAndServicesRequest>\n\t\t</eparcel>\n\t\t";
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     $result = curl_exec($ch);
     Yii::log(get_class($this) . " sending " . $xml, $this->logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__);
     Yii::log(get_class($this) . " receiving " . $result, $this->logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__);
     $oXML = new SimpleXMLElement($result);
     if ($oXML->error) {
         //What we have is ... failure to communicate
         Yii::log('Could not get shipping for Canada Post: ' . $oXML->error->statusMessage, 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         return false;
     }
     foreach ($oXML->ratesAndServicesResponse->product as $key => $val) {
         $strKey = $val->name;
         $strRate = $val->rate;
         $strKey = $this->cleanMethodName($strKey);
         $ret[$strKey] = floatval($this->cleanPrice($strRate));
         $found++;
     }
     if ($found <= 0) {
         $this->reportShippingFailure();
         return false;
     }
     return $this->convertRetToDisplay($ret);
 }
Beispiel #21
0
 /**
  * Authenticate user
  * @return type
  */
 public function authenticate()
 {
     $user = Customer::model()->findByAttributes(array('facebook' => $this->password));
     if ($user instanceof Customer) {
         $this->loginHousekeeping($user);
     } else {
         //We didn't find the Facebook ID in the database, but let's see if the user has an account already
         $user = Customer::model()->findByAttributes(array('email' => $this->username));
         if ($user instanceof Customer) {
             //We found an existing account under this email
             if (is_null($user->facebook)) {
                 //We found an account, merge them
                 $user->facebook = $this->password;
                 $user->save();
                 $this->loginHousekeeping($user);
             } else {
                 //Somehow we've found an existing account with an email from facebook but not the same ID
                 //Clear Facebook ID and bail, this is a serious conflict
                 $user->facebook = $this->password;
                 $user->save();
                 $this->redirect(Yii::app()->homeUrl);
             }
         } else {
             //New user to our site using Facebook, so set up an account
             $model = new Customer();
             $model->scenario = 'createfb';
             $results = Yii::app()->facebook->api('/me');
             $model->first_name = $results['first_name'];
             $model->last_name = $results['last_name'];
             $model->email = $results['email'];
             $model->email_repeat = $results['email'];
             $model->record_type = Customer::REGISTERED;
             $model->newsletter_subscribe = 1;
             $model->facebook = $results['id'];
             if (_xls_get_conf('MODERATE_REGISTRATION', 0) == 1) {
                 $this->errorCode = self::ERROR_NOT_APPROVED;
                 $model->allow_login = Customer::UNAPPROVED_USER;
             } else {
                 $model->allow_login = Customer::NORMAL_USER;
                 if (!$model->save()) {
                     Yii::log("Error creating Facebook account " . print_r($model->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
                     die("A serious error has occurred creating a Facebook account");
                 }
                 $this->loginHousekeeping($model);
             }
         }
     }
     return $this->errorCode;
 }
 public function beforeAction($action)
 {
     date_default_timezone_set(_xls_get_conf('TIMEZONE'));
     if (Addimglist::CheckSetDb() === false) {
         Addimglist::model()->SetDb();
     } else {
         Addimglist::model()->Checkversion($this->InfoModule['router'], $this->InfoModule['version']);
     }
     if (!Argoworks::model()->checkLicense($this->InfoModule['router'])) {
         $this->redirect($this->createUrl('argoworks/license?router=' . $this->InfoModule['router']));
         // Check license . If fail will ridirect to activate
     }
     $SelfmenuItems = array(array('label' => 'Thumbnail Products', 'url' => array('addimglist/list'), 'linkOptions' => array('class' => 'level-1')), array('label' => 'Import Dual Thumbnail', 'url' => array('addimglist/import'), 'linkOptions' => array('class' => 'level-1')));
     $this->menuItems = $this->menuItems = Argoworks::model()->createMenuArgo($SelfmenuItems, $this->InfoModule['router']);
     return parent::beforeAction($action);
 }
 public function getPurchaseStatusLabel()
 {
     if (is_null($this->cart_item_id) && !$this->product->web) {
         return Yii::t('wishlist', 'Item no longer for sale');
     } elseif (is_null($this->cart_item_id) && (!$this->product->IsDisplayable || !$this->product->IsAddable)) {
         return Yii::t('wishlist', 'Item Unavailable');
     } elseif (is_null($this->cart_item_id)) {
         return Yii::t('wishlist', 'Not purchased');
     } elseif ($this->cartItem->cart->cart_type == CartType::cart) {
         return Yii::t('wishlist', 'Being Purchased');
     } elseif ($this->purchased_by == Yii::app()->user->id) {
         return Yii::t('wishlist', 'Purchased on {date}', array('{date}' => date(_xls_get_conf('DATE_FORMAT', 'Y-m-d'), strtotime($this->cartItem->datetime_added))));
     } else {
         return Yii::t('wishlist', 'Gifted on {date}', array('{date}' => date(_xls_get_conf('DATE_FORMAT', 'Y-m-d'), strtotime($this->cartItem->datetime_added))));
     }
 }
Beispiel #24
0
 public function getSubform()
 {
     //No actual form fields, just need to display a note to the user when they choose this payment option
     if (_xls_get_conf('DEFAULT_COUNTRY') == '224') {
         $strAlert = Yii::t(get_class($this), 'Please note your order will be pending until the check has cleared.');
     } else {
         $strAlert = Yii::t(get_class($this), 'Please note your order will be pending until the cheque has cleared.');
     }
     $objModule = Modules::LoadByName(substr(get_class($this), 0, -4));
     if ($objModule) {
         $arrConfig = $objModule->ConfigValues;
         if (isset($arrConfig['customeralert'])) {
             $strAlert = $arrConfig['customeralert'];
         }
     }
     return array('title' => Yii::t(get_class($this), $strAlert));
 }
Beispiel #25
0
 public function authenticate()
 {
     //We're logging in directly from Lightspeed
     $key = _xls_get_conf('LSKEY');
     $passwords = array(md5(gmdate('d') . $key), md5(gmdate('d', strtotime('-1 day')) . $key), md5(gmdate('d', strtotime('+1 day')) . $key));
     if (isset($this->username) && isset($this->password) && in_array($this->password, $passwords)) {
         $this->errorCode = self::ERROR_NONE;
         $this->_id = 1;
         $this->setState('fullname', "Lightspeed");
         $this->setState('firstname', "Lightspeed");
         $this->setState('internal', true);
         $this->setState('role', 'admin');
     } else {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
     }
     return !$this->errorCode;
 }
Beispiel #26
0
 /**
  * Create the email notifications and save to the db.
  *
  * @param Cart/ShoppingCart $objCart
  * @return void
  * @throws Exception
  */
 public static function emailReceipts($objCart)
 {
     if ($objCart instanceof Cart === false && $objCart instanceof ShoppingCart == false) {
         Yii::log("Invalid Cart Object passed. Emails notifications not created", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         throw new Exception(Yii::t('checkout', 'Error creating email notifications, the cart was not valid.'));
     }
     if (_xls_get_conf('EMAIL_SEND_CUSTOMER', 0) == 1) {
         $strHtmlBody = Yii::app()->controller->renderPartial('/mail/_customerreceipt', array('cart' => $objCart), true);
         $strSubject = _xls_format_email_subject('EMAIL_SUBJECT_CUSTOMER', $objCart->customer->first_name . ' ' . $objCart->customer->last_name, $objCart->id_str);
         $objEmail = new EmailQueue();
         $objEmail->customer_id = $objCart->customer_id;
         $objEmail->htmlbody = $strHtmlBody;
         $objEmail->cart_id = $objCart->id;
         $objEmail->subject = $strSubject;
         $objEmail->to = $objCart->customer->email;
         // If we get back false, it means conversion failed which 99.9% of
         // the time means improper HTML.
         $strPlain = strip_tags($strHtmlBody);
         if ($strPlain !== false) {
             $objEmail->plainbody = $strPlain;
         }
         $objEmail->save();
     }
     if (_xls_get_conf('EMAIL_SEND_STORE', 0) == 1) {
         $strHtmlBody = Yii::app()->controller->renderPartial('/mail/_customerreceipt', array('cart' => $objCart), true);
         $strSubject = _xls_format_email_subject('EMAIL_SUBJECT_OWNER', $objCart->customer->first_name . ' ' . $objCart->customer->last_name, $objCart->id_str);
         $objEmail = new EmailQueue();
         $objEmail->customer_id = $objCart->customer_id;
         $objEmail->htmlbody = $strHtmlBody;
         $objEmail->cart_id = $objCart->id;
         $objEmail->subject = $strSubject;
         $orderEmail = _xls_get_conf('ORDER_FROM', '');
         $objEmail->to = empty($orderEmail) ? _xls_get_conf('EMAIL_FROM') : $orderEmail;
         // If we get back false, it means conversion failed which 99.9% of
         // the time means improper HTML.
         $strPlain = strip_tags($strHtmlBody);
         if ($strPlain !== false) {
             $objEmail->plainbody = $strPlain;
         }
         $objEmail->save();
     }
 }
 public function run()
 {
     $fltCriteria = $this->objCart->subtotal;
     if ($this->config['tierbased'] == "weight") {
         $fltCriteria = $this->objCart->Weight;
     }
     if (_xls_get_conf('DEBUG_SHIPPING', false)) {
         Yii::log(get_class($this) . " evaluating " . $fltCriteria . ' as ' . $this->config['tierbased'], 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
     }
     $model = ShippingTiers::model()->find(array('condition' => 'class_name=:class and start_price <= :flt and end_price >= :flt', 'params' => array(':class' => get_class($this), ':flt' => $fltCriteria)));
     if (!isset($model)) {
         //Price falls into a tier table price gap, so tell user we can't calculate and report error.
         Yii::log(get_class($this) . "The cart " . $fltCriteria . " does not fall into any defined tier.", 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
         return false;
     } else {
         $desc = isset($this->config['offerservices']) ? $this->config['offerservices'] : Yii::t('global', 'Standard 3-5 Business Days');
         $ret[$desc] = $model->rate;
         return $this->convertRetToDisplay($ret);
     }
 }
Beispiel #28
0
 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";
 }
 /**
  * Load anything we need globally, such as items we're going to use in our main.php template.
  * If you create init() in any other controller, you need to run parent::init() too or this
  * will be skipped. If you run your own init() and don't call this, you must call Controller::initParams(); 
  * or nothing will work.
  */
 public function init()
 {
     self::initParams();
     if (isset($_GET['nosni'])) {
         Yii::app()->user->setFlash('warning', Yii::t('global', 'NOTE: Your older operating system does not support certain security features this site uses. You have been redirected to {link} for your session which will ensure your information is properly protected.', array('{link}' => "<b>" . Yii::app()->params['LIGHTSPEED_HOSTING_LIGHTSPEED_URL'] . "</b>")));
     }
     $filename = Yii::getPathOfAlias('webroot.themes') . DIRECTORY_SEPARATOR . DEFAULT_THEME;
     if (!file_exists($filename) && _xls_get_conf('LIGHTSPEED_MT', 0) == '0') {
         if (!downloadTheme(DEFAULT_THEME)) {
             die("missing " . DEFAULT_THEME);
         } else {
             $this->redirect(Yii::app()->createUrl("site/index"));
         }
     }
     if (!Yii::app()->theme) {
         if (_xls_get_conf('THEME')) {
             //We can't find our theme for some reason, switch back to default
             _xls_set_conf('THEME', DEFAULT_THEME);
             _xls_set_conf('CHILD_THEME', 'light');
             Yii::log("Couldn't find our theme, switched back to " . DEFAULT_THEME . " for emergency", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
             $this->redirect(Yii::app()->createUrl('site/index'));
         } else {
             die("you have no theme set");
         }
     }
     if (isset($_GET['theme']) && isset($_GET['themekey'])) {
         $strTheme = CHtml::encode($_GET['theme']);
         $strThemeKey = CHtml::encode($_GET['themekey']);
         if ($this->verifyPreviewThemeKey($strTheme, $strThemeKey)) {
             Yii::app()->theme = $strTheme;
             $this->registerPreviewThemeScript($strTheme, $strThemeKey);
         } else {
             Yii::log("Invalid theme preview link for" . $strTheme . ". Navigate to Admin Panel to generate a new link.", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         }
     }
     $strViewset = Yii::app()->theme->info->viewset;
     if (!empty($strViewset)) {
         Yii::app()->setViewPath(Yii::getPathOfAlias('application') . "/views-" . $strViewset);
     }
 }
 /**
  * Default action.
  *
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  *
  * @return void
  */
 public function actionIndex()
 {
     $homePage = _xls_get_conf('HOME_PAGE', '*products');
     switch ($homePage) {
         case "*index":
             if (Yii::app()->params['LIGHTSPEED_MT'] == '1') {
                 if (Yii::app()->theme->info->showCustomIndexOption) {
                     $this->render("/site/index");
                 } else {
                     $this->forward("search/browse");
                 }
             } else {
                 $this->render("/site/index");
             }
             break;
         case "*products":
             $this->forward("search/browse");
             break;
         default:
             //Custom Page
             $objCustomPage = CustomPage::LoadByKey($homePage);
             $productsGrid = null;
             $dataProvider = null;
             if (!$objCustomPage instanceof CustomPage) {
                 _xls_404();
             }
             $this->pageTitle = $objCustomPage->PageTitle;
             $this->pageDescription = $objCustomPage->meta_description;
             $this->pageImageUrl = '';
             $this->breadcrumbs = array($objCustomPage->title => $objCustomPage->RequestUrl);
             if (CPropertyValue::ensureInteger($objCustomPage->product_display) === 2) {
                 $productsGrid = new ProductGrid($objCustomPage->getProductGridCriteria());
             } else {
                 $dataProvider = $objCustomPage->taggedProducts();
             }
             $this->canonicalUrl = $objCustomPage->canonicalUrl;
             $this->render('/custompage/index', array('model' => $objCustomPage, 'dataProvider' => $dataProvider, 'productsGrid' => $productsGrid));
             break;
     }
 }