本文整理汇总了PHP中vmSetStartTime函数的典型用法代码示例。如果您正苦于以下问题:PHP vmSetStartTime函数的具体用法?PHP vmSetStartTime怎么用?PHP vmSetStartTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vmSetStartTime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: defined
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://tsmart.net
*/
/* Require the config */
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
if (!class_exists('tsmConfig')) {
require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
}
tsmConfig::loadConfig();
vmRam('Start');
vmSetStartTime('Start');
tsmConfig::loadJLang('com_virtuemart', true);
$doc = JFactory::getDocument();
JHtml::_('jquery.framework');
$doc->addScript(JUri::root() . '/media/system/js/jquery.utility.js');
$doc->addScript(JUri::root() . '/media/system/js/bootstrap-notify-master/bootstrap-notify.js');
$doc->addScript(JUri::root() . '/media/system/js/tipso-master/src/tipso.js');
$doc->addStyleSheet(JUri::root() . '/media/system/js/tipso-master/src/tipso.css');
$doc->addLessStyleSheet(JUri::root() . '/components/com_virtuemart/assets/less/etravelservice.less');
if (tsmConfig::get('shop_is_offline', 0)) {
//$cache->setCaching (1);
$_controller = 'tsmart';
require VMPATH_SITE . DS . 'controllers' . DS . 'tsmart.php';
vRequest::setVar('view', 'tsmart');
$task = '';
$basePath = VMPATH_SITE;
开发者ID:cuongnd,项目名称:etravelservice,代码行数:31,代码来源:tsmart.php
示例2: getChildCategoryList
/**
* Get the list of child categories for a given category, is cached
*
* @param int $virtuemart_category_id Category id to check for child categories
* @return object List of objects containing the child categories
*
*/
public function getChildCategoryList($vendorId, $virtuemart_category_id, $selectedOrdering = null, $orderDir = null, $useCache = true)
{
if (empty($this) or get_class($this) != 'VirtueMartModelCategory') {
$useCache = false;
}
if ($selectedOrdering === null) {
if ($useCache) {
$selectedOrdering = $this->_selectedOrdering;
} else {
$selectedOrdering = VmConfig::get('browse_cat_orderby_field', 'category_name');
}
}
if (trim($selectedOrdering) == 'c.ordering') {
$selectedOrdering = 'c.ordering,category_name';
}
if (!in_array($selectedOrdering, self::$_validOrderingFields)) {
$selectedOrdering = 'c.ordering,category_name';
}
if ($orderDir === null) {
if ($useCache) {
$orderDir = $this->_selectedOrderingDir;
} else {
$orderDir = VmConfig::get('cat_brws_orderby_dir', 'ASC');
}
}
$validOrderingDir = array('ASC', 'DESC');
if (!in_array(strtoupper($orderDir), $validOrderingDir)) {
$orderDir = 'ASC';
}
static $_childCategoryList = array();
$key = (int) $vendorId . '_' . (int) $virtuemart_category_id . $selectedOrdering . $orderDir . VmConfig::$vmlang;
//We have here our internal key to preven calling of the cache
if (!array_key_exists($key, $_childCategoryList)) {
vmSetStartTime('com_virtuemart_cats');
if ($useCache) {
$cache = JFactory::getCache('com_virtuemart_cats', 'callback');
$cache->setCaching(true);
vmdebug('Calling cache getChildCategoryListObject');
$_childCategoryList[$key] = $cache->call(array('VirtueMartModelCategory', 'getChildCategoryListObject'), $vendorId, $virtuemart_category_id, $selectedOrdering, $orderDir, VmConfig::$vmlang);
} else {
$_childCategoryList[$key] = VirtueMartModelCategory::getChildCategoryListObject($vendorId, $virtuemart_category_id, $selectedOrdering, $orderDir, VmConfig::$vmlang);
}
vmTime('Time to load cats ' . (int) $useCache, 'com_virtuemart_cats');
}
return $_childCategoryList[$key];
}
开发者ID:sam-akopyan,项目名称:hamradio,代码行数:53,代码来源:category.php
示例3: loadConfig
/**
* Loads the configuration and works as singleton therefore called static. The call using the program cache
* is 10 times faster then taking from the session. The session is still approx. 30 times faster then using the file.
* The db is 10 times slower then the session.
*
* Performance:
*
* Fastest is
* Program Cache: 1.5974044799805E-5
* Session Cache: 0.00016094612121582
*
* First config db load: 0.00052118301391602
* Parsed and in session: 0.001554012298584
*
* After install from file: 0.0040450096130371
* Parsed and in session: 0.0051419734954834
*
*
* Functions tests if already loaded in program cache, session cache, database and at last the file.
*
* Load the configuration values from the database into a session variable.
* This step is done to prevent accessing the database for every configuration variable lookup.
*
* @author Max Milbers
* @param $force boolean Forces the function to load the config from the db
* Note Patrick Kohl STUDIO42
* added prefix from joomla in like to prevent getting false config for multiple use of joomla in same database
*/
public static function loadConfig($force = FALSE, $fresh = FALSE)
{
if ($fresh) {
return self::$_jpConfig = new VmConfig();
}
vmSetStartTime('loadConfig');
if (!$force) {
if (!empty(self::$_jpConfig) && !empty(self::$_jpConfig->_params)) {
return self::$_jpConfig;
}
}
self::$_jpConfig = new VmConfig();
$db = JFactory::getDBO();
$prefix = $db->getPrefix();
$query = 'SHOW TABLES LIKE "' . $prefix . 'virtuemart_configs"';
$db->setQuery($query);
$configTable = $db->loadResult();
// self::$_debug = true;
if (empty($configTable)) {
self::$_jpConfig->installVMconfig();
}
$app = JFactory::getApplication();
$install = 'no';
if (empty(self::$_jpConfig->_raw)) {
$query = ' SELECT `config` FROM `#__virtuemart_configs` WHERE `virtuemart_config_id` = "1";';
$db->setQuery($query);
self::$_jpConfig->_raw = json_decode($db->loadResult(), TRUE);
if (empty(self::$_jpConfig->_raw)) {
if (self::installVMconfig()) {
$install = 'yes';
$db->setQuery($query);
self::$_jpConfig->_raw = json_decode($db->loadResult(), TRUE);
self::$_jpConfig->_params =& self::$_jpConfig->_raw;
} else {
$app->enqueueMessage('Error loading configuration file', 'Error loading configuration file, please contact the storeowner');
}
}
}
$i = 0;
$pair = array();
if (!empty(self::$_jpConfig->_raw)) {
// $pair['sctime'] = microtime(true);
self::$_jpConfig->_params =& self::$_jpConfig->_raw;
self::$_jpConfig->set('sctime', microtime(TRUE));
self::$_jpConfig->set('vmlang', self::setdbLanguageTag());
self::$_jpConfig->setSession();
vmTime('loadConfig db ' . $install, 'loadConfig');
return self::$_jpConfig;
}
$app->enqueueMessage('Attention config is empty');
return self::$_jpConfig;
}
开发者ID:denis1001,项目名称:Virtuemart-2-Joomla-3-Bootstrap,代码行数:80,代码来源:config.php
示例4: getOrderByList
/**
* Get the Order By Select List
*
* notice by Max Milbers html tags should never be in a model. This function should be moved to a helper or simular,...
*
* @author Kohl Patrick
* @access public
* @param $fieds from config Back-end
* @return $orderByList
* Order,order By, manufacturer and category link List to echo Out
**/
function getOrderByList($virtuemart_category_id = FALSE)
{
$getArray = vRequest::getGet();
$fieldLink = '';
foreach ($getArray as $key => $value) {
if (is_array($value)) {
foreach ($value as $k => $v) {
if ($v == '') {
continue;
}
$fieldLink .= '&' . urlencode($key) . '[' . urlencode($k) . ']' . '=' . urlencode($v);
}
} else {
if ($key == 'dir' or $key == 'orderby') {
continue;
}
if ($value == '') {
continue;
}
$fieldLink .= '&' . urlencode($key) . '=' . urlencode($value);
}
}
$fieldLink = 'index.php?' . ltrim($fieldLink, '&');
$orderDirLink = '';
$orderDirConf = VmConfig::get('prd_brws_orderby_dir');
$orderDir = vRequest::getCmd('dir', $orderDirConf);
if ($orderDir != $orderDirConf) {
$orderDirLink .= '&dir=' . $orderDir;
//was '&order='
}
$orderbyTxt = '';
$orderby = vRequest::getString('orderby', VmConfig::get('browse_orderby_field'));
$orderby = $this->checkFilterOrder($orderby);
$orderbyCfg = VmConfig::get('browse_orderby_field');
if ($orderby != $orderbyCfg) {
$orderbyTxt = '&orderby=' . $orderby;
}
$manufacturerTxt = '';
$manufacturerLink = '';
if (VmConfig::get('show_manufacturers')) {
$manuM = VmModel::getModel('manufacturer');
vmSetStartTime('mcaching');
$mlang = (!VmConfig::get('prodOnlyWLang', false) and VmConfig::$defaultLang != VmConfig::$vmlang and Vmconfig::$langCount > 1);
if (true) {
$cache = JFactory::getCache('com_virtuemart_cat_manus', 'callback');
$cache->setCaching(true);
$manufacturers = $cache->call(array('VirtueMartModelManufacturer', 'getManufacturersOfProductsInCategory'), $virtuemart_category_id, VmConfig::$vmlang, $mlang);
vmTime('Manufacturers by Cache', 'mcaching');
} else {
$manufacturers = $manuM->getManufacturersOfProductsInCategory($virtuemart_category_id, VmConfig::$vmlang, $mlang);
vmTime('Manufacturers by function', 'mcaching');
}
// manufacturer link list
$manufacturerLink = '';
$virtuemart_manufacturer_id = vRequest::getInt('virtuemart_manufacturer_id', '');
if ($virtuemart_manufacturer_id != '') {
$manufacturerTxt = '&virtuemart_manufacturer_id=' . $virtuemart_manufacturer_id;
}
if (count($manufacturers) > 0) {
$manufacturerLink = '<div class="orderlist">';
if ($virtuemart_manufacturer_id > 0) {
$allLink = str_replace($manufacturerTxt, $fieldLink, '');
$allLink .= '&virtuemart_manufacturer_id=0';
$manufacturerLink .= '<div><a title="" href="' . JRoute::_($allLink . $orderbyTxt . $orderDirLink, FALSE) . '">' . vmText::_('COM_VIRTUEMART_SEARCH_SELECT_ALL_MANUFACTURER') . '</a></div>';
}
if (count($manufacturers) > 1) {
foreach ($manufacturers as $mf) {
$link = JRoute::_($fieldLink . '&virtuemart_manufacturer_id=' . $mf->virtuemart_manufacturer_id . $orderbyTxt . $orderDirLink, FALSE);
if ($mf->virtuemart_manufacturer_id != $virtuemart_manufacturer_id) {
$manufacturerLink .= '<div><a title="' . $mf->mf_name . '" href="' . $link . '">' . $mf->mf_name . '</a></div>';
} else {
$currentManufacturerLink = '<div class="title">' . vmText::_('COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL') . '</div><div class="activeOrder">' . $mf->mf_name . '</div>';
}
}
} elseif ($virtuemart_manufacturer_id > 0) {
$currentManufacturerLink = '<div class="title">' . vmText::_('COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL') . '</div><div class="activeOrder">' . $manufacturers[0]->mf_name . '</div>';
} else {
$currentManufacturerLink = '<div class="title">' . vmText::_('COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL') . '</div><div class="Order"> ' . $manufacturers[0]->mf_name . '</div>';
}
$manufacturerLink .= '</div>';
}
}
/* order by link list*/
$orderByLink = '';
$fields = VmConfig::get('browse_orderby_fields');
if (count($fields) > 1) {
$orderByLink = '<div class="orderlist">';
foreach ($fields as $field) {
if ($field != $orderby) {
//.........这里部分代码省略.........
开发者ID:sam-akopyan,项目名称:hamradio,代码行数:101,代码来源:product.php
示例5: prepareCartData
/**
* prepare display of cart
*
* @author RolandD
* @author Max Milbers
* @access public
*/
public function prepareCartData($checkAutomaticSelected = true)
{
vmSetStartTime('prepareCartData');
if (!empty($this->couponCode)) {
$this->setCouponCode($this->couponCode);
vmdebug('ValidateCouponCode', $this->couponCode);
//CouponHelper::ValidateCouponCode($this->couponCode, $this->pricesUnformatted['salesPrice']);
} else {
// Get the products for the cart, the setCouponCode does it for us
$this->getCartPrices($checkAutomaticSelected);
}
if (empty($this->pricesUnformatted)) {
return null;
}
if (!class_exists('CurrencyDisplay')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
}
$currency = CurrencyDisplay::getInstance();
$calculator = calculationHelper::getInstance();
$this->pricesCurrency = $currency->getCurrencyForDisplay();
if (!class_exists('vmPSPlugin')) {
require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
}
JPluginHelper::importPlugin('vmpayment');
$dispatcher = JDispatcher::getInstance();
$returnValues = $dispatcher->trigger('plgVmgetPaymentCurrency', array($this->virtuemart_paymentmethod_id, &$this->paymentCurrency));
$cartData = $calculator->getCartData();
return $cartData;
}
开发者ID:Roma48,项目名称:abazherka_old,代码行数:36,代码来源:cart.php
示例6: checkFilterOrder
function checkFilterOrder($toCheck)
{
if (empty($toCheck)) {
return $this->_selectedOrdering;
}
if (!in_array($toCheck, $this->_validOrderingFieldName)) {
$break = false;
vmSetStartTime();
foreach ($this->_validOrderingFieldName as $name) {
if (!empty($name) and strpos($name, $toCheck) !== FALSE) {
$this->_selectedOrdering = $name;
$break = true;
break;
}
}
if (!$break) {
$app = JFactory::getApplication();
$view = vRequest::getCmd('view');
if (empty($view)) {
$view = 'virtuemart';
}
$app->setUserState('com_virtuemart.' . $view . '.filter_order', $this->_selectedOrdering);
}
} else {
$this->_selectedOrdering = $toCheck;
}
return $this->_selectedOrdering;
}
开发者ID:thumbs-up-sign,项目名称:TuVanDuAn,代码行数:28,代码来源:vmmodel.php
示例7: load
/**
* Technic to inject params as table attributes
* @author Max Milbers
* $TableJoins array of table names to add and left join to find ID
*/
function load($oid = null, $overWriteLoadName = 0, $andWhere = 0, $tableJoins = array(), $joinKey = 0)
{
if ($this->_translatable) {
vmSetStartTime('vmtableload');
}
if ($overWriteLoadName !== 0) {
$k = $overWriteLoadName;
} else {
$k = $this->_pkey;
}
if ($oid !== null) {
$this->{$k} = $oid;
} else {
$oid = $this->{$k};
}
if (empty($oid)) {
if (!empty($this->_xParams)) {
if (!empty($this->_varsToPushParam)) {
foreach ($this->_varsToPushParam as $key => $v) {
if (!isset($this->{$key})) {
$this->{$key} = $v[0];
}
}
} else {
//vmdebug('_varsToPushParam empty ',$this);
}
}
//vmdebug('vmtable load empty $oid return proto',$this);
return $this;
}
//Version load the tables using JOIN
if ($this->_translatable) {
$mainTable = $this->_tbl;
$langTable = $this->_tbl . '_' . $this->_langTag;
$select = 'SELECT `' . $mainTable . '`.* ,`' . $langTable . '`.* ';
$from = ' FROM `' . $mainTable . '` INNER JOIN `' . $langTable . '` using (`' . $this->_tbl_key . '`)';
} else {
$mainTable = $this->_tbl;
$select = 'SELECT `' . $mainTable . '`.* ';
$from = ' FROM `' . $mainTable . '` ';
}
if (count($tableJoins)) {
if (!$joinKey) {
$joinKey = $this->_tbl_key;
}
foreach ($tableJoins as $tableId => $table) {
if (strpos($tableId, ',') !== false) {
$tableIds = explode(',', $tableId);
foreach ($tableIds as $sel) {
if (strpos($sel, ' as ') !== false) {
$temp = explode(' as ', $sel);
$select .= ',`' . $table . '`.`' . trim($temp[0]) . '` as ' . $temp[1] . ' ';
} else {
$select .= ',`' . $table . '`.`' . $sel . '` ';
}
}
} else {
$select .= ',`' . $table . '`.`' . $tableId . '` ';
}
$from .= ' LEFT JOIN `' . $table . '` on `' . $table . '`.`' . $joinKey . '`=`' . $mainTable . '`.`' . $joinKey . '`';
}
}
//the cast to int here destroyed the query for keys like tsmart_userinfo_id, so no cast on $oid
// $query = $select.$from.' WHERE '. $mainTable .'.`'.$this->_tbl_key.'` = "'.$oid.'"';
if ($andWhere === 0) {
$andWhere = '';
}
$query = $select . $from . ' WHERE `' . $mainTable . '`.`' . $k . '` = "' . $oid . '" ' . $andWhere;
$hashVarsToPush = '';
if (!empty($this->_varsToPushParam)) {
$hashVarsToPush = json_encode($this->_varsToPushParam);
}
$this->_lhash = md5($oid . $select . $k . $mainTable . $andWhere . $hashVarsToPush);
//$this->showFullColumns();
if (isset(self::$_cache['l'][$this->_lhash])) {
$this->bind(self::$_cache['l'][$this->_lhash]);
if (!empty($this->_xParams) and !empty($this->_varsToPushParam)) {
self::bindParameterable($this, $this->_xParams, $this->_varsToPushParam);
}
if ($this->_cryptedFields) {
$this->decryptFields($this);
}
//vmTime('loaded by cache '.$this->_pkey.' '.$this->_slugAutoName.' '.$oid,'vmtableload');
return $this;
} else {
//vmdebug('loading '.$this->_pkey.' '.$this->_slugAutoName.' '.$oid);
}
$db = $this->getDBO();
$db->setQuery($query);
$result = $db->loadAssoc();
if ($result) {
$this->_loaded = true;
$this->bind($result);
if (!empty($this->_xParams)) {
//Maybe better to use for $this an &
//.........这里部分代码省略.........
开发者ID:cuongnd,项目名称:etravelservice,代码行数:101,代码来源:tsmtable.php
示例8: loadConfig
/**
* Loads the configuration and works as singleton therefore called static. The call using the program cache
* is 10 times faster then taking from the session. The session is still approx. 30 times faster then using the file.
* The db is 10 times slower then the session.
*
* Performance:
*
* Fastest is
* Program Cache: 1.5974044799805E-5
* Session Cache: 0.00016094612121582
*
* First config db load: 0.00052118301391602
* Parsed and in session: 0.001554012298584
*
* After install from file: 0.0040450096130371
* Parsed and in session: 0.0051419734954834
*
*
* Functions tests if already loaded in program cache, session cache, database and at last the file.
*
* Load the configuration values from the database into a session variable.
* This step is done to prevent accessing the database for every configuration variable lookup.
*
* @author Max Milbers
* @param $force boolean Forces the function to load the config from the db
*/
public static function loadConfig($force = FALSE, $fresh = FALSE)
{
if ($fresh) {
return self::$_jpConfig = new VmConfig();
}
vmSetStartTime('loadConfig');
if (!$force) {
if (!empty(self::$_jpConfig) && !empty(self::$_jpConfig->_params)) {
return self::$_jpConfig;
}
}
self::$_jpConfig = new VmConfig();
if (!class_exists('VirtueMartModelConfig')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'config.php';
}
$configTable = VirtueMartModelConfig::checkConfigTableExists();
$db = JFactory::getDBO();
$app = JFactory::getApplication();
$freshInstall = vRequest::getInt('install', false);
if (empty($configTable) or $freshInstall) {
if (!$freshInstall) {
$installed = VirtueMartModelConfig::checkVirtuemartInstalled();
if (!$installed) {
$jlang = JFactory::getLanguage();
$selectedLang = $jlang->getTag();
if (empty($selectedLang)) {
$selectedLang = $jlang->setLanguage($selectedLang);
}
$msg = '';
$q = 'SELECT `element` FROM `#__extensions` WHERE type = "language" and enabled = "1"';
$db->setQuery($q);
$knownLangs = $db->loadColumn();
//vmdebug('Selected language '.$selectedLang.' $knownLangs ',$knownLangs);
if ($app->isAdmin() and !in_array($selectedLang, $knownLangs)) {
$link = 'index.php?option=com_installer&view=languages';
$msg = 'Install your selected language <b>' . $selectedLang . '</b> first in <a href="' . $link . '">joomla language manager</a>, just select then the component VirtueMart under menu "component", to proceed with the installation ';
$app->enqueueMessage($msg);
}
//else {
if ($app->isSite()) {
$link = 'index.php?option=com_virtuemart';
} else {
$link = 'index.php?option=com_virtuemart&view=updatesmigration&install=1';
$msg = 'Install Virtuemart first, click on the menu component and select VirtueMart';
}
if ($app->isSite()) {
$link = JURI::root(true) . '/administrator/' . $link;
}
$app->redirect($link, $msg);
//}
}
if ($installed) {
self::$_jpConfig->installVMconfig();
}
} else {
self::$_jpConfig->installVMconfig($freshInstall);
}
}
$install = 'no';
if (empty(self::$_jpConfig->_raw)) {
$query = ' SELECT `config` FROM `#__virtuemart_configs` WHERE `virtuemart_config_id` = "1";';
$db->setQuery($query);
self::$_jpConfig->_raw = $db->loadResult();
if (empty(self::$_jpConfig->_raw)) {
if (self::installVMconfig($freshInstall)) {
$install = 'yes';
$db->setQuery($query);
self::$_jpConfig->_raw = $db->loadResult();
self::$_jpConfig->_params = NULL;
} else {
$app->enqueueMessage('Error loading configuration file', 'Error loading configuration file, please contact the storeowner');
}
}
}
//.........这里部分代码省略.........
开发者ID:juanmcortez,项目名称:Lectorum,代码行数:101,代码来源:config.php
示例9: getTax
//.........这里部分代码省略.........
}
$lines[] = $line;
}
$line = new Line();
$line->setNo(++$n);
//$lineNumbersToCartProductId[$n] = count($products)+1;
$line->setItemCode($cart->virtuemart_shipmentmethod_id);
$line->setDescription('Shipment');
$line->setQty(1);
//$line->setTaxCode();
$cartPrices = $calculationHelper->getCartPrices();
//vmdebug('$calculationHelper $cartPrices',$cartPrices);
$line->setAmount($cartPrices['shipmentValue']);
if (isset($shopperData['tax_exemption_number'])) {
$line->setExemptionNo($shopperData['tax_exemption_number']);
//string
}
if (isset($shopperData['tax_usage_type'])) {
$line->setCustomerUsageType($shopperData['tax_usage_type']);
//string
}
$lines[] = $line;
//vmdebug('avalaragetTax setLines',$lines);
$request->setLines($lines);
//vmdebug('My request',$request);
$totalTax = 0.0;
try {
if (!class_exists('TaxLine')) {
require VMAVALARA_CLASS_PATH . DS . 'TaxLine.class.php';
}
if (!class_exists('TaxDetail')) {
require VMAVALARA_CLASS_PATH . DS . 'TaxDetail.class.php';
}
vmSetStartTime('avagetTax');
$getTaxResult = $client->getTax($request);
vmTime('Avalara getTax', 'avagetTax');
/*
* [0] => getDocCode
[1] => getAdjustmentDescription
[2] => getAdjustmentReason
[3] => getDocDate
[4] => getTaxDate
[5] => getDocType
[6] => getDocStatus
[7] => getIsReconciled
[8] => getLocked
[9] => getTimestamp
[10] => getTotalAmount
[11] => getTotalDiscount
[12] => getTotalExemption
[13] => getTotalTaxable
[14] => getTotalTax
[15] => getHashCode
[16] => getVersion
[17] => getTaxLines
[18] => getTotalTaxCalculated
[19] => getTaxSummary
[20] => getTaxLine
[21] => getTransactionId
[22] => getResultCode
[23] => getMessages
*/
//vmdebug( 'GetTax is: '. $getTaxResult->getResultCode(),$getTaxResult);
if ($getTaxResult->getResultCode() == SeverityLevel::$Success) {
//vmdebug("DocCode: ".$request->getDocCode() );
//vmdebug("DocId: ".$getTaxResult->getDocId()."\n");
开发者ID:romuland,项目名称:khparts,代码行数:67,代码来源:avalara.php
示例10: getCheckoutPrices
//.........这里部分代码省略.........
}
}
// next step is handling a coupon, if given
$this->_cart->cartData['vmVat'] = TRUE;
$this->_cart->cartPrices['salesPriceCoupon'] = 0.0;
if (!empty($this->_cart->couponCode)) {
$this->couponHandler($this->_cart->couponCode);
}
// now calculate the discount for hole cart and reduce subTotal for each taxRulesBill, to calculate correct tax, also if there are more than one tax rules
$totalDiscountBeforeTax = $this->_cart->cartPrices['salesPriceCoupon'];
foreach ($this->_cart->cartData['taxRulesBill'] as $k => &$rule) {
if (!empty($rule['subTotal'])) {
if (isset($this->_cart->cartData['VatTax'][$k]['DBTax'])) {
$rule['subTotal'] += $this->_cart->cartData['VatTax'][$k]['DBTax'];
}
if (!isset($rule['percentage']) && $rule['subTotal'] < $this->_cart->cartPrices['salesPrice']) {
$rule['percentage'] = $rule['subTotal'] / ($this->_cart->cartPrices['salesPrice'] + $cartdiscountBeforeTax);
} else {
if (!isset($rule['percentage'])) {
$rule['percentage'] = 1;
}
}
$rule['subTotal'] += $totalDiscountBeforeTax * $rule['percentage'];
} else {
$rule['subTotal'] = $toTax;
}
}
// now each taxRule subTotal is reduced with DBTax and we can calculate the cartTax
$cartTax = $this->roundInternal($this->cartRuleCalculation($this->_cart->cartData['taxRulesBill'], $toTax));
// toDisc is new subTotal after tax, now it comes discount afterTax and we can calculate the final cart price with tax.
$toDisc = $toTax + $cartTax;
$cartdiscountAfterTax = $this->roundInternal($this->cartRuleCalculation($this->_cart->cartData['DATaxRulesBill'], $toDisc));
$this->_cart->cartPrices['withTax'] = $toDisc + $cartdiscountAfterTax;
vmSetStartTime('methods');
if (!$shipmentCalculated) {
$this->calculateShipmentPrice();
}
$this->calculatePaymentPrice();
vmTime('Time consumed for shipment/payment plugins', 'methods');
if ($this->_currencyDisplay->_priceConfig['salesPrice']) {
$this->_cart->cartPrices['billSub'] = $this->_cart->cartPrices['basePrice'] + $this->_cart->cartPrices['shipmentValue'] + $this->_cart->cartPrices['paymentValue'];
}
if ($this->_currencyDisplay->_priceConfig['discountAmount']) {
$this->_cart->cartPrices['billDiscountAmount'] = $this->_cart->cartPrices['discountAmount'] + $cartdiscountBeforeTax + $cartdiscountAfterTax;
}
// + $this->_cart->cartPrices['shipmentValue'] + $this->_cart->cartPrices['paymentValue'] ;
if ($this->_cart->cartPrices['salesPriceShipment'] < 0) {
$this->_cart->cartPrices['billDiscountAmount'] += $this->_cart->cartPrices['salesPriceShipment'];
}
if ($this->_cart->cartPrices['salesPricePayment'] < 0) {
$this->_cart->cartPrices['billDiscountAmount'] += $this->_cart->cartPrices['salesPricePayment'];
}
if ($this->_currencyDisplay->_priceConfig['taxAmount']) {
$this->_cart->cartPrices['billTaxAmount'] = $this->_cart->cartPrices['taxAmount'] + $this->_cart->cartPrices['shipmentTax'] + $this->_cart->cartPrices['paymentTax'] + $cartTax;
}
//+ $this->_cart->cartPrices['withTax'] - $toTax
//The coupon handling is only necessary if a salesPrice is displayed, otherwise we have a kind of catalogue mode
if ($this->_currencyDisplay->_priceConfig['salesPrice']) {
$this->_cart->cartPrices['billTotal'] = $this->_cart->cartPrices['salesPriceShipment'] + $this->_cart->cartPrices['salesPricePayment'] + $this->_cart->cartPrices['withTax'] + $this->_cart->cartPrices['salesPriceCoupon'];
if (empty($this->_cart->cartPrices['billTotal']) or $this->_cart->cartPrices['billTotal'] < 0) {
$this->_cart->cartPrices['billTotal'] = 0.0;
}
if ($this->_cart->cartData['vmVat'] and (!empty($cartdiscountBeforeTax) and isset($this->_cart->cartData['VatTax']) and count($this->_cart->cartData['VatTax']) > 0) or !empty($this->_cart->couponCode)) {
$totalDiscountToTax = $this->_cart->cartPrices['salesPriceCoupon'];
foreach ($this->_cart->cartData['VatTax'] as &$vattax) {
if (isset($vattax['subTotal']) && !isset($vattax['percentage'])) {
开发者ID:sam-akopyan,项目名称:hamradio,代码行数:67,代码来源:calculationh.php
示例11: defined
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
/* Require the config */
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
if (!class_exists('VmConfig')) {
require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
}
VmConfig::loadConfig();
vmRam('Start');
//vmTime('joomla start until Vm is called','joomlaStart');
vmSetStartTime('vmStart');
VmConfig::loadJLang('com_virtuemart', true);
if (VmConfig::get('shop_is_offline', 0)) {
//$cache->setCaching (1);
$_controller = 'virtuemart';
require VMPATH_SITE . DS . 'controllers' . DS . 'virtuemart.php';
vRequest::setVar('view', 'virtuemart');
$task = '';
$basePath = VMPATH_SITE;
} else {
// Front-end helpers
if (!class_exists('VmImage')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
}
//dont remove that file it is actually in every view except the state view
if (!class_exists('shopFunctionsF')) {
开发者ID:virtuemart-fr,项目名称:virtuemart-fr,代码行数:31,代码来源:virtuemart.php
示例12: calculateCostprice
public function calculateCostprice($productId, $data)
{
$this->_revert = true;
vmSetStartTime('calculateCostprice');
$this->_db->setQuery('SELECT * FROM #__virtuemart_product_prices WHERE `virtuemart_product_id`="' . $productId . '" ');
$row = $this->_db->loadAssoc();
if ($row) {
if (!empty($row['product_price'])) {
// $costPrice = $row['product_price'];
$this->productCurrency = $row['product_currency'];
// $this->override = $row['override'];
// $this->product_override_price = $row['product_override_price'];
$this->product_tax_id = $row['product_tax_id'];
$this->product_discount_id = $row['product_discount_id'];
} else {
$app = Jfactory::getApplication();
$app->enqueueMessage('cost Price empty, if child, everything okey, this is just a dev note');
return false;
}
}
$this->_db->setQuery('SELECT `virtuemart_vendor_id` FROM #__virtuemart_products WHERE `virtuemart_product_id`="' . $productId . '" ');
$single = $this->_db->loadResult();
$this->productVendorId = $single;
if (empty($this->productVendorId)) {
$this->productVendorId = 1;
}
$this->_db->setQuery('SELECT `virtuemart_category_id` FROM #__virtuemart_product_categories WHERE `virtuemart_product_id`="' . $productId . '" ');
$this->_cats = $this->_db->loadResultArray();
// vmTime('getProductPrices no object given query time','getProductCalcs');
if (VmConfig::get('multix', 'none') != 'none' and empty($this->vendorCurrency)) {
$this->_db->setQuery('SELECT `vendor_currency` FROM #__virtuemart_vendors WHERE `virtuemart_vendor_id`="' . $this->productVendorId . '" ');
$single = $this->_db->loadResult();
$this->vendorCurrency = $single;
}
if (!empty($amount)) {
$this->_amount = $amount;
}
//$this->setCountryState($this->_cart);
$this->rules['Marge'] = $this->gatherEffectingRulesForProductPrice('Marge', $this->product_marge_id);
$this->rules['Tax'] = $this->gatherEffectingRulesForProductPrice('Tax', $this->product_tax_id);
$this->rules['VatTax'] = $this->gatherEffectingRulesForProductPrice('VatTax', $this->product_tax_id);
$this->rules['DBTax'] = $this->gatherEffectingRulesForProductPrice('DBTax', $this->product_discount_id);
$this->rules['DATax'] = $this->gatherEffectingRulesForProductPrice('DATax', $this->product_discount_id);
$salesPrice = $data['salesPrice'];
$withoutVatTax = $this->roundInternal($this->executeCalculation($this->rules['VatTax'], $salesPrice));
$withoutVatTax = !empty($withoutVatTax) ? $withoutVatTax : $salesPrice;
$withDiscount = $this->roundInternal($this->executeCalculation($this->rules['DATax'], $withoutVatTax));
$withDiscount = !empty($withDiscount) ? $withDiscount : $withoutVatTax;
// vmdebug('Entered final price '.$salesPrice.' discount '.$withDiscount);
$withTax = $this->roundInternal($this->executeCalculation($this->rules['Tax'], $withDiscount));
$withTax = !empty($withTax) ? $withTax : $withDiscount;
$basePriceP = $this->roundInternal($this->executeCalculation($this->rules['DBTax'], $withTax));
$basePriceP = !empty($basePriceP) ? $basePriceP : $withTax;
$basePrice = $this->roundInternal($this->executeCalculation($this->rules['Marge'], $basePriceP));
$basePrice = !empty($basePrice) ? $basePrice : $basePriceP;
$productCurrency = CurrencyDisplay::getInstance();
$costprice = $productCurrency->convertCurrencyTo($this->productCurrency, $basePrice, false);
// $productCurrency = CurrencyDisplay::getInstance();
$this->_revert = false;
return $costprice;
}
开发者ID:Gskflute,项目名称:joomla25,代码行数:61,代码来源:calculationh.php
示例13: checkFilterOrder
function checkFilterOrder($toCheck)
{
//vmdebug('checkFilterOrder',$this->_validOrderingFieldName);
if (!in_array($toCheck, $this->_validOrderingFieldName)) {
$break = false;
vmSetStartTime();
foreach ($this->_validOrderingFieldName as $name) {
if (strpos($name, $toCheck) !== FALSE) {
$this->_selectedOrdering = $name;
$break = true;
break;
}
}
if (!$break) {
$app = JFactory::getApplication();
$view = JRequest::getWord('view', 'virtuemart');
$app->setUserState('com_virtuemart.' . $view . '.filter_order', $this->_selectedOrdering);
}
//vmdebug('checkValidOrderingField:'.get_class($this).' programmer choosed invalid ordering '.$toCheck.', use '.$this->_selectedOrdering);
} else {
$this->_selectedOrdering = $toCheck;
}
return $this->_selectedOrdering;
}
开发者ID:Arturogcalleja,项目名称:herbolario,代码行数:24,代码来源:vmmodel.php
示例14: creditMemo
//.........这里部分代码省略.........
self::$vmadd = $orderDetails['details']['BT'];
}
$toInvoice = VmConfig::get('inv_os', array('C'));
if (!is_array($toInvoice)) {
$toInvoice = (array) $toInvoice;
}
//Lets find first if the committ was already done, the committ was already done, if one of history orderstatuses
//have one status for create invoice.
//vmdebug('my orderDetails ',$orderDetails);
self::$vmadd['taxOverride'] = null;
foreach ($orderDetails['history'] as $item) {
if (in_array($item->order_status_code, $toInvoice)) {
//the date of the order status used to create the invoice
self::$vmadd['taxOverride'] = $this->createTaxOverride(substr($item->created_on, 0, 10), $data->order_status, $item->comments);
//self::$vmadd['paymentDate'] = substr($item->created_on,0,10);
//Date when order is created
//self::$vmadd['taxOverride'] = $orderDetails['details']['BT']->created_on;
break;
}
}
//Accrual Accounting means the committ is done directly after pressing the confirm button in the cart
//Therefore the date of the committ/invoice is the first order date and we dont need to check the order history
if (empty(self::$vmadd['taxOverride']) and $calc['accrual']) {
self::$vmadd['taxOverride'] = $this->createTaxOverride($orderDetails['details']['BT']->created_on, $data->order_status);
}
//create the products
$products = array();
foreach ($orderDetails['items'] as $k => $item) {
$product = array();
$item = (array) $item;
//vmdebug('my item',$item);
$product['product_sku'] = $item['order_item_sku'];
$product['product_name'] = $item['order_item_name'];
$product['amount'] = $item['product_quantity'];
//$product['price'] = $item['product_final_price'];
$product['price'] = $item['product_item_price'];
$product['discount'] = $item['product_subtotal_discount'];
$model = VmModel::getModel('product');
$rProduct = $model->getProduct($item['virtuemart_product_id']);
$product['categories'] = $rProduct->categories;
$products[] = $product;
}
if (!empty($orderDetails['details']['BT']->virtuemart_shipmentmethod_id)) {
$shipment = array();
$shipment['product_sku'] = 'VMShipmentId_' . $orderDetails['details']['BT']->virtuemart_shipmentmethod_id;
$shipmentModel = VmModel::getModel('Shipmentmethod');
$shipmentModel->setId($orderDetails['details']['BT']->virtuemart_shipmentmethod_id);
$shipmentMethod = $shipmentModel->getShipment();
$shipment['product_name'] = $shipmentMethod->shipment_name;
$shipment['amount'] = 1;
$shipment['price'] = $orderDetails['details']['BT']->order_shipment;
//decimal // TotalAmmount
$shipment['discount'] = 0.0;
$products[] = $shipment;
}
$products['discountAmount'] = $orderDetails['details']['BT']->order_discountAmount - $orderDetails['details']['BT']->coupon_discount;
if ($data->order_status == 'R') {
$sign = -1;
} else {
$sign = 1;
}
$request = $this->createStandardRequest($calc, $products, $sign);
$request->setCompanyCode($calc['company_code']);
// Your Company Code From the Dashboard
$request->setDocDate(date('Y-m-d'));
//date
$request->setCustomerCode($orderDetails['details']['BT']->customer_number);
//string Required
if ($orderDetails['details']['BT']->order_number) {
$request->setPurchaseOrderNo($orderDetails['details']['BT']->order_number);
//string Optional
}
$totalTax = 0.0;
$invoiceNumber = 'onr_' . $orderDetails['details']['BT']->order_number;
vRequest::setVar('create_invoice', 1);
$orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumber);
if (is_array($invoiceNumber)) {
$invoiceNumber = $invoiceNumber[0];
}
if ($calc['committ'] and $invoiceNumber) {
if ($data->order_status == 'R') {
$request->setDocType(DocumentType::$ReturnInvoice);
} else {
$request->setDocType(DocumentType::$SalesInvoice);
}
// Only supported types are SalesInvoice or SalesOrder
$request->setCommit(true);
$request->setDocCode($invoiceNumber);
self::$_taxResult = FALSE;
}
vmSetStartTime('avagetTax');
self::$_taxResult = $this->executeRequest($request);
vmTime('Avalara executeRequest ', 'avagetTax');
if (self::$_taxResult) {
if (isset(self::$_taxResult['totalTax'])) {
$totalTax = self::$_taxResult['totalTax'];
}
}
return $totalTax;
}
开发者ID:sam-akopyan,项目名称:hamradio,代码行数:101,代码来源:avalara.php
示例15: display
function display($tpl = null) {
if (!class_exists('VmImage'))
require(VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php');
VmConfig::loadJLang('com_virtuemart_orders',TRUE);
$model = VmModel::getModel('virtuemart');
$nbrCustomers = $model->getTotalCustomers();
$this->nbrCustomers=$nbrCustomers;
$nbrActiveProducts = $model->getTotalActiveProducts();
$this->nbrActiveProducts= $nbrActiveProducts;
$nbrInActiveProducts = $model->getTotalInActiveProducts();
$this->nbrInActiveProducts= $nbrInActiveProducts;
$nbrFeaturedProducts = $model->getTotalFeaturedProducts();
$this->nbrFeaturedProducts= $nbrFeaturedProducts;
$ordersByStatus = $model->getTotalOrdersByStatus();
$this->ordersByStat
|
请发表评论