本文整理汇总了PHP中vmTime函数的典型用法代码示例。如果您正苦于以下问题:PHP vmTime函数的具体用法?PHP vmTime怎么用?PHP vmTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vmTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($tpl = null)
{
if ($this->isMail or $this->isPdf) {
$this->writeJs = false;
}
$result = $this->loadTemplate($tpl);
if ($result instanceof Exception) {
return $result;
}
echo $result;
if ($this->writeJs) {
self::withKeepAlive();
if (get_class($this) != 'VirtueMartViewProductdetails') {
echo vmJsApi::writeJS();
}
}
vmTime('vm view Finished task ', 'Start');
}
示例2: display
public function display($tpl = null)
{
if ($this->isMail or $this->isPdf) {
$this->writeJs = false;
}
if (!class_exists('VmHTML')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
$result = $this->loadTemplate($tpl);
if ($result instanceof Exception) {
return $result;
}
echo $result;
if ($this->writeJs) {
self::withKeepAlive();
if (get_class($this) != 'VirtueMartViewProductdetails') {
echo vmJsApi::writeJS();
}
}
vmTime('vm view Finished task ', 'Start');
}
示例3: array
?>
<?php
# Vendor Store Description
echo $this->add_product_link;
if (!empty($this->vendor->vendor_store_desc) and VmConfig::get('show_store_desc', 1)) {
?>
<div class="vendor-store-desc">
<?php
echo $this->vendor->vendor_store_desc;
?>
</div>
<?php
}
?>
<?php
# load categories from front_categories if exist
if ($this->categories and VmConfig::get('show_categories', 1)) {
echo $this->renderVmSubLayout('categories', array('categories' => $this->categories));
}
# Show template for : topten,Featured, Latest Products if selected in config BE
if (!empty($this->products)) {
$products_per_row = VmConfig::get('homepage_products_per_row', 3);
echo $this->renderVmSubLayout($this->productsLayout, array('products' => $this->products, 'currency' => $this->currency, 'products_per_row' => $products_per_row, 'showRating' => $this->showRating));
//$this->loadTemplate('products');
}
?>
<?php
vmTime('vm view Finished task ', 'Start');
示例4: portLanguageFields
private function portLanguageFields()
{
$config = JFactory::getConfig();
$lang = $config->getValue('language');
$ok = false;
foreach ($this->tables as $table => $tblKey) {
if (microtime(true) - $this->starttime >= $this->maxScriptTime) {
vmWarn('language fields not copied, please rise execution time and do again');
return false;
}
vmTime('$portLanguageFields $table ' . $table);
$db = JFactory::getDBO();
$tableName = '#__virtuemart_' . $table;
$className = 'Table' . ucfirst($table);
// if(!class_exists($className)) require(JPATH_VM_ADMINISTRATOR.DS.'tables'.DS.$table.'.php');
$langTable = $this->getTable($table);
// $langTable = new $className($tableName,$tblKey,$db) ;
$query = 'SHOW COLUMNS FROM `' . $tableName . '` ';
$this->_db->setQuery($query);
$columns = $this->_db->loadResultArray(0);
// vmdebug('$portLanguageFields contains language fields ',$columns);
$translatableFields = $langTable->getTranslatableFields();
$translatableFields = array_intersect($translatableFields, $columns);
// if(in_array($translatableFields[0],$columns)){
if (count($translatableFields) > 1) {
$ok = true;
//approximatly 100 products take a 1 MB
$maxItems = $this->_getMaxItems('Language ' . $table);
$startLimit = 0;
$i = 0;
$continue = true;
while ($continue) {
$q = 'SELECT * FROM ' . $tableName . ' LIMIT ' . $startLimit . ',' . $maxItems;
$this->_db->setQuery($q);
$res = self::loadCountListContinue($q, $startLimit, $maxItems, 'port Language ' . $table);
$resultList = $res[0];
$startLimit = $res[1];
$continue = $res[2];
foreach ($resultList as $row) {
if (microtime(true) - $this->starttime >= $this->maxScriptTime) {
vmWarn('language fields not copied, please rise execution time and do again');
return false;
}
$db = JFactory::getDBO();
// $dummy = array($tblKey=>$row[$tblKey]);
// $langTable = new $className($tableName,$tblKey,$db) ;
$langTable = $this->getTable($table);
$langTable->bindChecknStore($row);
$errors = $langTable->getErrors();
if (!empty($errors)) {
foreach ($errors as $error) {
$this->setError($error);
vmError('portLanguageFields' . $error);
vmdebug('portLanguageFields table', $langTable);
}
$ok = false;
break;
}
}
}
//Okey stuff copied, now lets remove the old fields
if ($ok) {
vmdebug('I delete the columns ');
foreach ($translatableFields as $fieldname) {
if (in_array($fieldname, $columns)) {
vmdebug('I delete the column ' . $tableName . ' ' . $fieldname);
$this->_db->setQuery('ALTER TABLE `' . $tableName . '` DROP COLUMN `' . $fieldname . '` ');
if (!$this->_db->query()) {
VmError('portLanguageFields: Deleting of ' . $tableName . ' ' . $fieldname . ' failed. ' . $this->_db->getQuery());
} else {
vmdebug('I deleted the column ' . $this->_db->getQuery());
}
}
}
}
}
vmTime('$portLanguageFields $table ' . $table);
}
}
示例5: 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) {
//.........这里部分代码省略.........
示例6: 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;
}
示例7: display
function display($tpl = null)
{
if (!class_exists('VmImage')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
}
tsmConfig::loadJLang('com_tsmart_orders', TRUE);
if (JFactory::getApplication()->isSite()) {
$bar = JToolBar::getInstance('toolbar');
$bar->appendButton('Link', 'back', 'com_tsmart_LEAVE', 'index.php?option=com_tsmart&manage=0');
}
$layout = $this->getLayout();
if ($this->manager('report')) {
vmSetStartTime('report');
$model = tmsModel::getModel('tsmart');
$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->ordersByStatus = $ordersByStatus;
$recentOrders = $model->getRecentOrders();
if (!class_exists('CurrencyDisplay')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
}
/* Apply currency This must be done per order since it's vendor specific */
$_currencies = array();
// Save the currency data during this loop for performance reasons
foreach ($recentOrders as $tsmart_order_id => $order) {
//This is really interesting for multi-X, but I avoid to support it now already, lets stay it in the code
if (!array_key_exists('v' . $order->tsmart_vendor_id, $_currencies)) {
$_currencies['v' . $order->tsmart_vendor_id] = CurrencyDisplay::getInstance('', $order->tsmart_vendor_id);
}
$order->order_total = $_currencies['v' . $order->tsmart_vendor_id]->priceDisplay($order->order_total);
}
$this->recentOrders = $recentOrders;
$recentCustomers = $model->getRecentCustomers();
$this->recentCustomers = $recentCustomers;
$reportModel = tmsModel::getModel('report');
vRequest::setvar('task', '');
$myCurrencyDisplay = CurrencyDisplay::getInstance();
$revenueBasic = $reportModel->getRevenue(60, true);
$this->report = $revenueBasic['report'];
vmJsApi::addJScript("jsapi", "//google.com/jsapi", false, false, '');
vmJsApi::addJScript('vm.stats_chart', $revenueBasic['js'], false, true);
vmTime('Created report', 'report');
}
//if($layout=='default'){
$j = 'jQuery("#feed").ready(function(){
var datas = "";
vmSiteurl = "' . JURI::root() . '"
jQuery.ajax({
type: "GET",
async: true,
cache: false,
dataType: "json",
url: vmSiteurl + "index.php?option=com_tsmart&view=tsmart&task=feed",
data: datas,
dataType: "html"
})
.done(function( data ) {
jQuery("#feed").append(data);
});
})';
vmJsApi::addJScript('getFeed', $j, false, true);
//}
self::showACLPref($this);
parent::display($tpl);
}
示例8: loadConfig
//.........这里部分代码省略.........
$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');
}
}
}
$i = 0;
$pair = array();
if (!empty(self::$_jpConfig->_raw)) {
$config = explode('|', self::$_jpConfig->_raw);
foreach ($config as $item) {
$item = explode('=', $item);
if (!empty($item[1])) {
// if($item[0]!=='offline_message' && $item[0]!=='dateformat' ){
if ($item[0] !== 'offline_message') {
try {
$value = @unserialize($item[1]);
if ($value === FALSE) {
$app->enqueueMessage('Exception in loadConfig for unserialize ' . $item[0] . ' ' . $item[1]);
$uri = JFactory::getURI();
$configlink = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=config';
$app->enqueueMessage('To avoid this message, enter your virtuemart <a href="' . $configlink . '">config</a> and just save it one time');
} else {
$pair[$item[0]] = $value;
}
} catch (Exception $e) {
vmdebug('Exception in loadConfig for unserialize ' . $e->getMessage(), $item);
}
} else {
$pair[$item[0]] = unserialize(base64_decode($item[1]));
}
} else {
$pair[$item[0]] = '';
}
}
// $pair['sctime'] = microtime(true);
self::$_jpConfig->_params = $pair;
self::$_jpConfig->_params['sctime'] = microtime(TRUE);
//self::$_jpConfig->set('sctime',microtime(TRUE));
//self::setdbLanguageTag();
self::$_jpConfig->_params['vmlang'] = self::setdbLanguageTag();
vmTime('loadConfig db ' . $install, 'loadConfig');
// try plugins
if ($app->isSite()) {
if (!class_exists('VmImage')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
}
JPluginHelper::importPlugin('vmuserfield');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('plgVmInitialise', array());
}
return self::$_jpConfig;
}
$app->enqueueMessage('Attention config is empty');
return self::$_jpConfig;
}
示例9: ucfirst
/* Create the controller name */
$_class = 'VirtuemartController' . ucfirst($_controller);
if (file_exists($basePath . DS . 'controllers' . DS . $_controller . '.php')) {
if (!class_exists($_class)) {
require $basePath . DS . 'controllers' . DS . $_controller . '.php';
}
} else {
// try plugins
JPluginHelper::importPlugin('vmextended');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger($trigger, array($_controller));
}
if (class_exists($_class)) {
$controller = new $_class();
// try plugins
JPluginHelper::importPlugin('vmuserfield');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('plgVmOnMainController', array($_controller));
/* Perform the Request task */
$controller->execute($task);
//Console::logSpeed('virtuemart start');
vmTime($_class . ' Finished task ' . $task, 'Start');
vmRam('End');
vmRamPeak('Peak');
/* Redirect if set by the controller */
$controller->redirect();
} else {
vmDebug('VirtueMart controller not found: ' . $_class);
$mainframe = Jfactory::getApplication();
$mainframe->redirect('index.php?option=com_virtuemart');
}
示例10: vmError
$app = JFactory::getApplication();
vmError('Access restricted to Vendor and Administrator only (you are admin and should not see this messsage?)', 'Access restricted to Vendors and Administrator only');
$app->redirect('index.php');
}
// Require specific controller if requested
if ($_controller = JRequest::getWord('view', JRequest::getWord('controller', 'virtuemart'))) {
if (file_exists(JPATH_VM_ADMINISTRATOR . DS . 'controllers' . DS . $_controller . '.php')) {
// Only if the file exists, since it might be a Joomla view we're requesting...
require JPATH_VM_ADMINISTRATOR . DS . 'controllers' . DS . $_controller . '.php';
} else {
// try plugins
JPluginHelper::importPlugin('vmextended');
$dispatcher = JDispatcher::getInstance();
$results = $dispatcher->trigger('onVmAdminController', array($_controller));
if (empty($results)) {
$app = JFactory::getApplication();
$app->enqueueMessage('Fatal Error in maincontroller admin.virtuemart.php: Couldnt find file ' . $_controller);
$app->redirect('index.php?option=com_virtuemart');
}
}
}
// Create the controller
$_class = 'VirtueMartController' . ucfirst($_controller);
$controller = new $_class();
// Perform the Request task
$controller->execute(JRequest::getWord('task', $_controller));
vmTime($_class . ' Finished task ' . $_controller, 'Start');
vmRam('End');
vmRamPeak('Peak');
$controller->redirect();
// pure php no closing tag
示例11: 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->ordersByStatus= $ordersByStatus;
$recentOrders = $model->getRecentOrders();
if(!class_exists('CurrencyDisplay'))require(VMPATH_ADMIN.DS.'helpers'.DS.'currencydisplay.php');
/* Apply currency This must be done per order since it's vendor specific */
$_currencies = array(); // Save the currency data during this loop for performance reasons
foreach ($recentOrders as $virtuemart_order_id => $order) {
//This is really interesting for multi-X, but I avoid to support it now already, lets stay it in the code
if (!array_key_exists('v'.$order->virtuemart_vendor_id, $_currencies)) {
$_currencies['v'.$order->virtuemart_vendor_id] = CurrencyDisplay::getInstance('',$order->virtuemart_vendor_id);
}
$order->order_total = $_currencies['v'.$order->virtuemart_vendor_id]->priceDisplay($order->order_total);
}
$this->recentOrders= $recentOrders;
$recentCustomers = $model->getRecentCustomers();
$this->recentCustomers=$recentCustomers;
if (!class_exists('vmRSS')) require(VMPATH_ADMIN.'/helpers/vmrss.php');
$this->extensionsFeed = vmRSS::getExtensionsRssFeed();
$virtuemartFeed = vmRSS::getVirtueMartRssFeed();
$this->virtuemartFeed=$virtuemartFeed;
if(JFactory::getApplication()->isSite()){
$bar = JToolBar::getInstance('toolbar');
$bar->appendButton('Link', 'back', 'COM_VIRTUEMART_LEAVE', 'index.php?option=com_virtuemart&manage=0');
}
if($this->manager('report')){
vmSetStartTime('report');
$reportModel = VmModel::getModel('report');
vRequest::setvar('task','');
$myCurrencyDisplay = CurrencyDisplay::getInstance();
$revenueBasic = $reportModel->getRevenue(60,true);
$this->report = $revenueBasic['report'];
vmJsApi::addJScript( "jsapi","//google.com/jsapi",false,false,'' );
vmJsApi::addJScript('vm.stats_chart',$revenueBasic['js'],false);
vmTime('Created report','report');
}
parent::display($tpl);
}
示例12: getCheckoutPrices
//.........这里部分代码省略.........
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'])) {
if (isset($vattax['DBTax'])) {
$vattax['subTotal'] += $vattax['DBTax'];
}
if ($vattax['subTotal'] < $this->_cart->cartPrices['salesPrice']) {
$vattax['percentage'] = $vattax['subTotal'] / ($this->_cart->cartPrices['salesPrice'] + $cartdiscountBeforeTax);
示例13: getTax
//.........这里部分代码省略.........
}
$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");
vmdebug("TotalAmount: " . $getTaxResult->getTotalAmount());
$totalTax = $getTaxResult->getTotalTax();
示例14: 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];
}
示例15: vmTime
</div>
<br>
<?php
}
}
echo $this->checkout_link_html;
?>
</div>
<?php
// Continue and Checkout Button END
?>
<input type='hidden' name='order_language' value='<?php
echo $this->order_language;
?>
'/>
<input type='hidden' id='STsameAsBT' name='STsameAsBT' value='<?php
echo $this->cart->STsameAsBT;
?>
'/>
<input type='hidden' name='task' value='<?php
echo $this->checkout_task;
?>
'/>
<input type='hidden' name='option' value='com_virtuemart'/>
<input type='hidden' name='view' value='cart'/>
</form>
</div>
<?php
vmTime('Cart view Finished task ', 'Start');