public function init() { Yii::import('application.vendors.Mailchimp.*'); //Required to set our include path so the required_once's everywhere work require_once 'MCAPI.class.php'; $this->objModule = Modules::LoadByName(get_class($this)); //Load our module entry so we can access settings $this->api = new MCAPI($this->objModule->getConfig('api_key')); }
public function init() { Yii::import('ext.yii-aws.components.*'); //Required to set our include path so the required_once's everywhere work $this->objModule = Modules::LoadByName(get_class($this)); //Load our module entry so we can access settings if (file_exists(Yii::getPathOfAlias('webroot.config') . '/cloudinary.php')) { $this->arrCloudinary = (require Yii::getPathOfAlias('webroot.config') . '/cloudinary.php'); Yii::import('application.vendors.cloudinary.src.*'); } }
public function getSubform() { //No actual form fields, just need to display a note to the user when they choose this payment option $strAlert = "Please call us with your credit card details"; $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)); }
public function init() { $this->objCart = Yii::app()->shoppingcart; $this->config = $this->getConfigValues(get_class($this)); if (!isset($this->config['markup'])) { $this->config['markup'] = 0; } $objModule = Modules::LoadByName(get_class($this)); if ($objModule instanceof Modules) { $this->active = $objModule->active; } else { $this->active = false; } }
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)); }
public function init() { $this->objModule = Modules::LoadByName(get_class($this)); //Load our module entry so we can access settings $this->MerchantID = $this->objModule->getConfig('AMAZON_MERCHANT_ID'); $this->MarketplaceID = $this->objModule->getConfig('AMAZON_MARKETPLACE_ID'); $amazon_check_time = $this->objModule->getConfig('amazon_check_time'); if (!empty($amazon_check_time)) { $this->amazon_check_time = $this->objModule->getConfig('amazon_check_time'); } $amazon_tag = $this->objModule->getConfig('amazon_tag'); if (!empty($amazon_tag)) { $this->amazon_tag = $amazon_tag; } $no_image_upload_tag = $this->objModule->getConfig('no_image_upload_tag'); if (!empty($no_image_upload_tag)) { $this->no_image_upload_tag = $no_image_upload_tag; } $this->MWS_ACCESS_KEY_ID = $this->objModule->getConfig('AMAZON_MWS_ACCESS_KEY_ID'); $this->MWS_SECRET_ACCESS_KEY = $this->objModule->getConfig('AMAZON_MWS_SECRET_ACCESS_KEY'); $this->APPLICATION_NAME = _xls_get_conf('STORENAME') . " MyCompany_AmazonMWS"; Yii::import('application.vendors.Amazon.*'); //Required to set our include path so the required_once's everywhere work require_once 'MarketplaceWebService/Client.php'; require_once 'MarketplaceWebServiceOrders/Client.php'; require_once 'MarketplaceWebServiceOrders/Interface.php'; require_once 'MarketplaceWebService/Model/SubmitFeedRequest.php'; require_once 'MarketplaceWebService/Model/GetFeedSubmissionListRequest.php'; require_once 'MarketplaceWebService/Model/GetFeedSubmissionResultRequest.php'; require_once 'MarketplaceWebServiceOrders/Model/ListOrdersRequest.php'; require_once 'MarketplaceWebServiceOrders/Model/ListOrdersResponse.php'; require_once 'MarketplaceWebServiceOrders/Model/ListOrdersResult.php'; require_once 'MarketplaceWebServiceOrders/Model/ListOrdersResult.php'; require_once 'MarketplaceWebServiceOrders/Model/ListOrderItemsRequest.php'; require_once 'MarketplaceWebServiceOrders/Model/ListOrderItemsResponse.php'; require_once 'MarketplaceWebServiceOrders/Model/ListOrderItemsResult.php'; require_once 'MarketplaceWebServiceOrders/Model/MarketplaceIdList.php'; require_once 'MarketplaceWebService/Model/IdList.php'; if (!defined('DATE_FORMAT')) { define('DATE_FORMAT', 'Y-m-d\\TH:i:s\\Z'); } $config = array('ServiceURL' => $this->getMWSUrl(), 'ProxyHost' => null, 'ProxyPort' => -1, 'MaxErrorRetry' => 3); $this->service = new MarketplaceWebService_Client($this->MWS_ACCESS_KEY_ID, $this->MWS_SECRET_ACCESS_KEY, $config, $this->APPLICATION_NAME, $this->APPLICATION_VERSION); parent::init(); }
/** * If a customer selects in-store pickup we clear * all the fields in the checkoutForm related to another form * of shipping and put in values that respects the in-store pickup * shipping option. * * @return void */ public function fillFieldsForStorePickup() { // clear any existing shipping address info from the form $this->clearAddressFields(); // No validations around the these values $this->shippingFirstName = $this->pickupFirstName; $this->shippingLastName = $this->pickupLastName; $this->shippingPhone = $this->pickupPersonPhone; $this->contactFirstName = $this->pickupFirstName; $this->contactLastName = $this->pickupLastName; $this->contactPhone = $this->pickupPersonPhone; $this->orderNotes = $this->_storePickupNotes(); $this->cardNameOnCard = $this->shippingFirstName . ' ' . $this->shippingLastName; $obj = Modules::LoadByName('storepickup'); $data = unserialize($obj->configuration); $this->shippingProvider = $obj->id; $this->shippingPriority = $data['offerservices']; $this->saveFormToSession(); }
/** * Look for all modules (class files) in extensions folder. * * @param string $moduletype Type of module which determines what folder to scan. * * @return void */ public function scanModules($moduletype = "payment") { if ($moduletype == "theme") { $files = glob(YiiBase::getPathOfAlias('webroot.themes') . '/*', GLOB_ONLYDIR); foreach ($files as $key => $file) { if (stripos($file, '/themes/trash') > 0 || stripos($file, '/themes/_customcss') > 0) { unset($files[$key]); } } } else { $arrCustom = array(); if (file_exists(YiiBase::getPathOfAlias("custom.extensions." . $moduletype))) { $arrCustom = glob(realpath(YiiBase::getPathOfAlias("custom.extensions." . $moduletype)) . '/*', GLOB_ONLYDIR); } if (!is_array($arrCustom)) { $arrCustom = array(); } $files = array_merge(glob(realpath(YiiBase::getPathOfAlias('ext.ws' . $moduletype)) . '/*', GLOB_ONLYDIR), $arrCustom); } foreach ($files as $file) { $moduleName = mb_pathinfo($file, PATHINFO_BASENAME); $version = 0; $name = $moduleName; if ($moduletype === 'theme') { $model = Yii::app()->getComponent('wstheme')->getAdminModel($moduleName); $configuration = ''; if ($model) { $version = $model->version; $name = $model->name; $configuration = $model->getDefaultConfiguration(); } } else { try { $version = Yii::app()->getComponent($moduleName)->Version; $name = Yii::app()->getComponent($moduleName)->AdminNameNormal; $configuration = Yii::app()->getComponent($moduleName)->getDefaultConfiguration(); } catch (Exception $e) { Yii::log("{$moduleName} component can't be read " . $e, 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); } } //Check if module is already in database $objModule = Modules::LoadByName($moduleName); if (!$objModule instanceof Modules) { //The module doesn't exist, attempt to install it try { $objModule = new Modules(); $objModule->active = 0; $objModule->module = $moduleName; $objModule->category = $moduletype; $objModule->version = $version; $objModule->name = $name; $objModule->configuration = $configuration; if (!$objModule->save()) { Yii::log("Found widget {$moduleName} could not install " . print_r($objModule->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); } } catch (Exception $e) { Yii::log("Found {$moduletype} widget {$moduleName} could not install " . $e, 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); } } $objModule->version = $version; $objModule->name = $name; $objModule->save(); } }
public function init() { $this->objModule = Modules::LoadByName(get_class($this)); //Load our module entry so we can access settings }
protected function getInstalledThemes() { $arr = array(); $strThemePath = YiiBase::getPathOfAlias('webroot') . "/themes"; $d = dir($strThemePath); while (false !== ($filename = $d->read())) { if (is_dir($strThemePath . "/" . $filename) && $filename[0] != "." && $filename != "trash" && $filename != "_customcss") { $arr[$filename] = $this->loadConfiguration($filename); } } $d->close(); if (isset(Yii::app()->theme)) { $strTheme = Yii::app()->theme->name; } else { $strTheme = ''; } if (isset($arr[$strTheme])) { $hold[$strTheme] = $arr[$strTheme]; unset($arr[$strTheme]); ksort($arr); $newarray = $hold + $arr; $arr = $newarray; } if (Yii::app()->params['LIGHTSPEED_MT']) { foreach ($arr as $key => $objTheme) { $objModule = Modules::LoadByName($key); } } // WS-4074 Disable legacy themes for new installs if (_xls_get_conf('ALLOW_LEGACY_THEMES') === '0') { foreach ($arr as $key => $theme) { if (in_array($key, self::$_legacyThemes)) { unset($arr[$key]); } } } return $arr; }
/** * This action allows the store owner to view their defined customizations and see a * demo of the hosted pay page that their customers will experience when checking out. * The demo isn't a perfect replica but is close enough to the real thing. * * @return void */ public function actionCayanDemo() { $module = Modules::LoadByName('cayan'); $config = $module->getConfig('customConfig'); $colorContainerBackground = ''; $colorContainerBorder = ''; $colorLogoBackground = ''; $colorLogoBorder = ''; $colorTextBoxBorder = ''; $colorTextBoxBorderFocus = ''; if ($config['colorContainerBackground'] != '') { $colorContainerBackground = 'background-color:#' . $config['colorContainerBackground'] . ';'; } if ($config['colorContainerBorder'] != '') { $colorContainerBorder = 'border-color:#' . $config['colorContainerBorder'] . ';'; } if ($config['colorLogoBackground'] != '') { $colorLogoBackground = 'background-color:#' . $config['colorLogoBackground'] . ';'; } if ($config['colorLogoBorder'] != '') { $colorLogoBorder = 'border-color:#' . $config['colorLogoBorder'] . ';'; } if ($config['colorTextBoxBorder'] != '') { $colorTextBoxBorder = 'border-color:#' . $config['colorTextBoxBorder'] . ';'; } if ($config['colorTextBoxBorderFocus'] != '') { $colorTextBoxBorderFocus = 'border-color:#' . $config['colorTextBoxBorderFocus'] . ';'; } $this->registerAsset('css/cayan.css'); $this->renderPartial('_cayanpreview', array('config' => $config, 'logoUrl' => $module->getConfig('logoUrl'), 'colorContainerBackground' => $colorContainerBackground, 'colorContainerBorder' => $colorContainerBorder, 'colorLogoBackground' => $colorLogoBackground, 'colorLogoBorder' => $colorLogoBorder, 'colorTextBoxBorder' => $colorTextBoxBorder, 'colorTextBoxBorderFocus' => $colorTextBoxBorderFocus)); }
?> <br/> <?php } else { ?> <?php echo Yii::t('email', 'Gift Recipient Address'); ?> <?php } ?> <?php } else { ?> <?php $module = Modules::LoadByName('storepickup'); $config = unserialize($module->configuration); echo $config['label'] . '<br/>'; $str = ''; $str .= $cart->shipaddress->first_name . ' ' . $cart->shipaddress->last_name . '<br>'; $str .= $cart->shipaddress->store_pickup_email ? CHtml::mailto($cart->shipaddress->store_pickup_email, $cart->shipaddress->store_pickup_email, array('target' => '_blank', 'style' => 'color: #3287cc;text-decoration: none;')) : CHtml::mailto($cart->customer->email, $cart->customer->email, array('target' => '_blank', 'style' => 'color: #3287cc;text-decoration: none;')); $str .= $cart->shipaddress->phone ? '<br>' . $cart->shipaddress->phone : ''; echo $str; ?> <?php } ?> </td> </tr> <tr>
<?php if ($isPaypalValid === true) { $paypal = Modules::LoadByName('paypal'); echo '<div class="outofbandpayment">'; echo '<div class="buttons">'; echo CHtml::htmlButton(Yii::t('checkout', 'Pay with ') . "<span></span>", array('class' => 'paypal', 'type' => 'submit', 'name' => 'Paypal', 'id' => 'Paypal', 'value' => $paypal->id)); if ($paypal->isOnlyActivePaymentMethod() === false) { echo CHtml::tag('div', array('class' => 'or-block'), ''); } echo '</div>'; echo '</div>'; }
/** * Did the payment have a subform? * * @return bool */ public function hasSubForm() { $form = MultiCheckoutForm::loadFromSessionOrNew(); $objModule = Modules::LoadByName($this->payment_module); return array_key_exists($objModule->id, $form->getAlternativePaymentMethodsThatUseSubForms()); }