本文整理汇总了PHP中XLite类的典型用法代码示例。如果您正苦于以下问题:PHP XLite类的具体用法?PHP XLite怎么用?PHP XLite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XLite类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testGetTotalRate
public function testGetTotalRate()
{
$tax = \XLite\Core\Database::getRepo('XLite\\Module\\CDev\\VAT\\Model\\Tax')->getTax();
foreach ($tax->getRates() as $rate) {
\XLite\Core\Database::getEM()->remove($rate);
}
$tax->getRates()->clear();
$tax->setEnabled(true);
$rate = new \XLite\Module\CDev\VAT\Model\Tax\Rate();
$rate->setValue(10);
$rate->setPosition(1);
\XLite\Core\Database::getEM()->persist($rate);
$tax->addRates($rate);
$rate->setTax($tax);
$rate = new \XLite\Module\CDev\VAT\Model\Tax\Rate();
$rate->setValue(20);
$rate->setPosition(0);
\XLite\Core\Database::getEM()->persist($rate);
$tax->addRates($rate);
$rate->setTax($tax);
$memberships = \XLite\Core\Database::getRepo('XLite\\Model\\Membership')->findAll();
$membership = array_shift($memberships);
$rate->setMembership($membership);
$tax->setVATMembership($membership);
\XLite\Core\Database::getEM()->flush();
$method = new \XLite\Model\Shipping\Method();
$method->setEnabled(true);
$rate = new \XLite\Model\Shipping\Rate();
$rate->setBaseRate(10);
$rate->setMarkupRate(10);
$rate->setMethod($method);
$this->assertEquals(16.67, \XLite::getInstance()->getCurrency()->formatValue($rate->getTotalRate()), 'check cost');
}
开发者ID:kingsj,项目名称:core,代码行数:33,代码来源:Rate.php
示例2: getGaqOptions
/**
* Get _gaq options list
*
* @return array
*/
protected function getGaqOptions()
{
$list = array(sprintf('\'_setAccount\', \'%s\'', \XLite\Core\Config::getInstance()->CDev->GoogleAnalytics->ga_account));
if (2 == \XLite\Core\Config::getInstance()->CDev->GoogleAnalytics->ga_tracking_type) {
$list[] = '\'_setDomainName\', \'.\' + self.location.host.replace(/^[^\\.]+\\./, \'\')';
} elseif (3 == \XLite\Core\Config::getInstance()->CDev->GoogleAnalytics->ga_tracking_type) {
$list[] = '\'_setDomainName\', \'none\'';
$list[] = '\'_setAllowLinker\', true';
}
$list[] = '\'_trackPageview\'';
$controller = \XLite::getController();
if ($this->isEcommercePartEnabled() && $controller instanceof \XLite\Controller\Customer\CheckoutSuccess) {
$orders = \XLite\Core\Session::getInstance()->gaProcessedOrders;
if (!is_array($orders)) {
$orders = array();
}
$order = $this->getOrder();
if ($order->getProfile() && !in_array($order->getOrderId(), $orders)) {
$bAddress = $order->getProfile()->getBillingAddress();
$city = $bAddress ? $bAddress->getCity() : '';
$state = $bAddress && $bAddress->getState() ? $bAddress->getState()->getState() : '';
$country = $bAddress && $bAddress->getCountry() ? $bAddress->getCountry()->getCountry() : '';
$tax = $order->getSurchargeSumByType(\XLite\Model\Base\Surcharge::TYPE_TAX);
$shipping = $order->getSurchargeSumByType(\XLite\Model\Base\Surcharge::TYPE_SHIPPING);
$list[] = '\'_addTrans\', ' . '\'' . $order->getOrderNumber() . '\', ' . '\'' . $this->escapeJavascript(\XLite\Core\Config::getInstance()->Company->company_name) . '\', ' . '\'' . $order->getTotal() . '\', ' . '\'' . $tax . '\', ' . '\'' . $shipping . '\', ' . '\'' . $this->escapeJavascript($city) . '\', ' . '\'' . $this->escapeJavascript($state) . '\', ' . '\'' . $this->escapeJavascript($country) . '\'';
foreach ($order->getItems() as $item) {
$list[] = '\'_addItem\', ' . '\'' . $order->getOrderNumber() . '\', ' . '\'' . $this->escapeJavascript($item->getSku()) . '\', ' . '\'' . $this->escapeJavascript($item->getName()) . '\', ' . '\'\', ' . '\'' . $item->getPrice() . '\', ' . '\'' . $item->getAmount() . '\'';
}
$list[] = '\'_trackTrans\'';
$orders[] = $order->getOrderId();
\XLite\Core\Session::getInstance()->gaProcessedOrders = $orders;
}
}
return $list;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:40,代码来源:Traditional.php
示例3: getTabberPages
/**
* Get prepared pages array for tabber
*
* @return void
*/
protected function getTabberPages()
{
$pages = array();
$url = $this->get('url');
$switch = $this->getParam(self::PARAM_SWITCH);
$functionName = $this->getParam(self::PARAM_TAB_PAGES);
// $functionName - from PARAM_TAB_PAGES parameter
$dialogPages = \XLite::getController()->{$functionName}();
if (is_array($dialogPages)) {
foreach ($dialogPages as $page => $title) {
$p = new \XLite\Base();
$pageURL = preg_replace('/' . $switch . '=(\\w+)/', $switch . '=' . $page, $url);
$p->set('url', $pageURL);
$p->set('title', $title);
$pageSwitch = sprintf($switch . '=' . $page);
$p->set('selected', preg_match('/' . preg_quote($pageSwitch) . '(\\Z|&)/Ss', $url));
$pages[] = $p;
}
}
// if there is only one tab page, set it as a seleted with the default URL
if (1 == count($pages) || 'default' === $this->getPage()) {
$pages[0]->set('selected', $url);
}
return $pages;
}
开发者ID:kingsj,项目名称:core,代码行数:30,代码来源:Tabber.php
示例4: addEnabledCondition
/**
* Adds additional condition to the query for checking if method is enabled
*
* @param \Doctrine\ORM\QueryBuilder $qb Query builder object
* @param string $alias Entity alias OPTIONAL
*
* @return \Doctrine\ORM\QueryBuilder
*/
protected function addEnabledCondition(\Doctrine\ORM\QueryBuilder $qb, $alias = 'm')
{
if (!\XLite::getInstance()->isAdminZone()) {
$qb->andWhere($alias . '.enabled = 1');
}
return $qb;
}
开发者ID:kingsj,项目名称:core,代码行数:15,代码来源:Method.php
示例5: getMarketplaceURL
protected function getMarketplaceURL($module)
{
list(, $limit) = $this->getWidget(array(), 'XLite\\View\\Pager\\Admin\\Module\\Install')->getLimitCondition()->limit;
$pageId = $module->getRepository()->getMarketplacePageId($module->getAuthor(), $module->getName(), $limit);
$params = array('clearCnd' => 1, 'clearSearch' => 1, \XLite\View\Pager\APager::PARAM_PAGE_ID => $pageId, \XLite\View\ItemsList\AItemsList::PARAM_SORT_BY => \XLite\View\ItemsList\Module\AModule::SORT_OPT_ALPHA);
return \XLite::getInstance()->getShopURL(sprintf('%s#%s', \XLite\Core\Converter::buildURL('addons_list_marketplace', '', $params), $module->getName()));
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:7,代码来源:AutomateShippingRoutine.php
示例6: connect
/**
* Connect
*
* @return void
*/
public function connect()
{
if (\XLite::isAdminZone()) {
\Includes\Utils\ConfigParser::registerConfigFile('config.demo.php');
}
parent::connect();
}
开发者ID:kingsj,项目名称:core,代码行数:12,代码来源:Database.php
示例7: getFormButtons
/**
* Return list of the "Button" widgets
*
* @return array
*/
protected function getFormButtons()
{
$result = parent::getFormButtons();
if ($this->getModule() && 'CDev\\Bestsellers' == $this->getModule()->getActualName()) {
$result['sales_calculation'] = new \XLite\View\Button\Link(array(\XLite\View\Button\AButton::PARAM_LABEL => 'Sales calculation', \XLite\View\Button\Link::PARAM_LOCATION => $this->buildURL('sales_calculation', 'sales', array(\XLite::FORM_ID => \XLite::getFormId())), \XLite\View\Button\AButton::PARAM_STYLE => 'action always-enabled'));
}
return $result;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:ModuleSettings.php
示例8: getName
/**
* get Shipping Method name
* for Canada Post add '(Canada Post)' (except admin area, shipping methods page)
*
* @return string
*/
public function getName()
{
$name = parent::getName();
if ('capost' == $this->getProcessor() && !(\XLite::isAdminZone() && \XLite::getController() instanceof \XLite\Controller\Admin\ShippingMethods)) {
$name = 'Canada Post ' . $name;
}
return $name;
}
开发者ID:kewaunited,项目名称:xcart,代码行数:14,代码来源:Method.php
示例9: getDefaultTemplate
/**
* Return widget default template
*
* @return string
*/
protected function getDefaultTemplate()
{
if (!\XLite::isAdminZone() && method_exists('\\XLite\\Core\\Request', 'isMobileDevice') && \XLite\Core\Request::isMobileDevice()) {
return 'modules/Amazon/PayWithAmazon/checkout_mobile.tpl';
} else {
return 'modules/Amazon/PayWithAmazon/checkout.tpl';
}
}
开发者ID:kewaunited,项目名称:xcart,代码行数:13,代码来源:AmazonCheckout.php
示例10: getCSSFiles
/**
* Return list of required CSS files
*
* @return array
*/
public function getCSSFiles()
{
$list = parent::getCSSFiles();
if (!\XLite::isAdminZone()) {
$list[] = 'common/grid-list.css';
}
return $list;
}
开发者ID:kingsj,项目名称:core,代码行数:13,代码来源:Subcategories.php
示例11: getDefaultParams
/**
* Return list of the form default parameters
*
* @return array
*/
protected function getDefaultParams()
{
$params = array();
if (\XLite::isAdminZone()) {
$params = array('profile_id' => \XLite\Core\Request::getInstance()->profile_id);
}
return $params;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:SavedCards.php
示例12: getTotalRate
/**
* Get total rate
*
* @return float
*/
public function getTotalRate()
{
$total = parent::getTotalRate();
if (!\XLite::isAdminZone() && $this->getMethod()) {
$total = \XLite\Module\CDev\VAT\Logic\Shipping\Tax::getInstance()->calculateRateCost($this, $total);
}
return $total;
}
开发者ID:kingsj,项目名称:core,代码行数:13,代码来源:Rate.php
示例13: getDefaultParams
/**
* Return list of the form default parameters
*
* @return array
*/
protected function getDefaultParams()
{
$params = array();
if (\XLite::isAdminZone()) {
$params = array('amount' => \XLite\Core\Request::getInstance()->amount, 'order_number' => \XLite\Core\Request::getInstance()->order_number);
}
return $params;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:PopupSavedCards.php
示例14: getRequiredFieldsByType
/**
* Get required fields by address type
*
* @param string $atype Address type code
*
* @return array
*/
public function getRequiredFieldsByType($atype)
{
$list = parent::getRequiredFieldsByType($atype);
if ('express_checkout_return' === \XLite::getController()->getAction()) {
$list = array_diff($list, array('phone'));
}
return $list;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:15,代码来源:Address.php
示例15: getCommonJSData
/**
* Return common data to send to JS
*
* @return array
*/
protected function getCommonJSData()
{
$data = parent::getCommonJSData();
if (!\XLite::isAdminZone()) {
$data += $this->getCloudSearchInitData();
}
return $data;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:Controller.php
示例16: registerIfScheduled
/**
* Register CloudSearch if it has been scheduled
*
* @return void
*/
public function registerIfScheduled()
{
if ($this->isScheduled() && !\XLite::isCacheBuilding()) {
$apiClient = ServiceApiClient::getInstance();
$this->unschedule();
$apiClient->register();
}
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:RegistrationScheduler.php
示例17: dispatchRequest
/**
* Dispatch request
*
* @return string
*/
protected static function dispatchRequest()
{
$result = parent::dispatchRequest();
if (strlen(\XLite\Core\Request::getInstance()->response_order_id) > 2 && isset(\XLite\Core\Request::getInstance()->response_order_id) && isset(\XLite\Core\Request::getInstance()->result) && isset(\XLite\Core\Request::getInstance()->trans_name) && isset(\XLite\Core\Request::getInstance()->cardholder) && isset(\XLite\Core\Request::getInstance()->message)) {
$result = 'payment_return';
}
return $result;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:XLite.php
示例18: getLocationURL
/**
* We make the full location path for the provided URL
*
* @return string
*/
protected function getLocationURL()
{
$repo = \XLite\Core\Database::getRepo('XLite\\Model\\Module');
$module = $repo->find($this->getParam(static::PARAM_MODULE_ID));
$pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getInstalledPageId($module->getAuthor(), $module->getName(), \XLite\View\Pager\Admin\Module\Manage::getInstance()->getItemsPerPage());
$params = array('clearCnd' => 1, \XLite\View\Pager\APager::PARAM_PAGE_ID => $pageId);
return \XLite::getInstance()->getShopURL(sprintf('%s#%s', $this->buildURL('addons_list_installed', '', $params), $module->getName()));
}
开发者ID:kewaunited,项目名称:xcart,代码行数:13,代码来源:BackToModulesLink.php
示例19: getAllowedTargets
/**
* Return list of allowed targets
*
* @return array
*/
public static function getAllowedTargets()
{
$targets = parent::getAllowedTargets();
$targets[] = 'order';
if (!\XLite::isAdminZone()) {
$targets[] = 'checkoutSuccess';
}
return $targets;
}
开发者ID:kewaunited,项目名称:xcart,代码行数:14,代码来源:PrintInvoice.php
示例20: getPagesStatic
/**
* Get pages static
*
* @return array
*/
public static function getPagesStatic()
{
$list = array();
if (\XLite::isFreeLicense() && \XLite\Core\Auth::getInstance()->isPermissionAllowed(\XLite\Model\Role\Permission::ROOT_ACCESS)) {
$list['volume_discounts'] = array('name' => static::t('Volume discounts'), 'tpl' => 'promotions/volume_discounts.tpl');
$list['coupons'] = array('name' => static::t('Coupons'), 'tpl' => 'promotions/coupons.tpl');
}
return $list;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:14,代码来源:Promotions.php
注:本文中的XLite类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论