本文整理汇总了PHP中CurrencyDisplay类的典型用法代码示例。如果您正苦于以下问题:PHP CurrencyDisplay类的具体用法?PHP CurrencyDisplay怎么用?PHP CurrencyDisplay使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CurrencyDisplay类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
//Load helpers
$this->loadHelper('currencydisplay');
$this->loadHelper('html');
// Get the data
$model = VmModel::getModel('product');
// Create filter
$this->addStandardDefaultViewLists($model);
$inventorylist = $model->getProductListing(false, false);
$pagination = $model->getPagination();
$this->assignRef('pagination', $pagination);
// Apply currency
$currencydisplay = CurrencyDisplay::getInstance();
foreach ($inventorylist as $virtuemart_product_id => $product) {
//TODO oculd be interesting to show the price for each product, and all stored ones $product->product_in_stock
$product->product_instock_value = $currencydisplay->priceDisplay($product->product_price, '', $product->product_in_stock, false);
$product->product_price_display = $currencydisplay->priceDisplay($product->product_price, '', 1, false);
$product->weigth_unit_display = ShopFunctions::renderWeightUnit($product->product_weight_uom);
}
$this->assignRef('inventorylist', $inventorylist);
$options = array();
$options[] = JHTML::_('select.option', '', JText::_('COM_VIRTUEMART_DISPLAY_STOCK') . ':');
$options[] = JHTML::_('select.option', 'stocklow', JText::_('COM_VIRTUEMART_STOCK_LEVEL_LOW'));
$options[] = JHTML::_('select.option', 'stockout', JText::_('COM_VIRTUEMART_STOCK_LEVEL_OUT'));
$this->lists['stockfilter'] = JHTML::_('select.genericlist', $options, 'search_type', 'onChange="document.adminForm.submit(); return false;"', 'value', 'text', JRequest::getVar('search_type'));
$this->lists['filter_product'] = JRequest::getVar('filter_product');
// $this->assignRef('lists', $lists);
/* Toolbar */
$this->SetViewTitle('PRODUCT_INVENTORY');
JToolBarHelper::publish();
JToolBarHelper::unpublish();
parent::display($tpl);
}
示例2: plgVmConfirmedOrder
function plgVmConfirmedOrder($cart, $order)
{
if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
return null;
// Another method was selected, do nothing
}
if (!$this->selectedThisElement($method->payment_element)) {
return false;
}
$session = JFactory::getSession();
$return_context = $session->getId();
$this->_debug = $method->debug;
$this->logInfo('plgVmConfirmedOrder order number: ' . $order['details']['BT']->order_number, 'message');
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
if (!class_exists('VirtueMartModelCurrency')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
}
//$usr = & JFactory::getUser();
$html = '';
$usrBT = $order['details']['BT'];
$address = isset($order['details']['ST']) ? $order['details']['ST'] : $order['details']['BT'];
$vendorModel = new VirtueMartModelVendor();
$vendorModel->setId(1);
$vendor = $vendorModel->getVendor();
$this->getPaymentCurrency($method);
$q = 'SELECT `currency_code_3` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $method->payment_currency . '" ';
$db =& JFactory::getDBO();
$db->setQuery($q);
$currency_code_3 = $db->loadResult();
//$paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
//$totalInPaymentCurrency = round($paymentCurrency->convertCurrencyTo($method->payment_currency, $order['details']['BT']->order_total,false), 2);
$totalInPaymentCurrency = round($order['details']['BT']->order_total, 2);
$cd = CurrencyDisplay::getInstance($cart->pricesCurrency);
$user_title = $address->title;
$user_email = $address->email;
$user_name = $address->first_name . ' ' . $address->last_name;
$user_city = $address->city;
$user_address = $address->address_1;
$user_zip = $address->zip;
$user_country = ShopFunctions::getCountryByID($address->virtuemart_country_id, 'country_3_code');
$msg_1 = $user_name . " Kd-nr " . $usrBT->virtuemart_user_id;
$msg_2 = "Bestellnr " . $order['details']['BT']->order_number;
$cont = $method->payment_uid . "|" . $method->payment_pid . "|||||" . $totalInPaymentCurrency . "|" . $currency_code_3 . "|" . $msg_1 . "|" . $msg_2 . "|" . $order['details']['BT']->order_number . "|" . $order['details']['BT']->virtuemart_paymentmethod_id . "|VM v2.1||||" . $method->payment_pas;
$hash = md5($cont);
$html .= '<div style="text-align: left; margin-top: 25px; margin-bottom: 25px;">';
$html .= 'Ihre Bestellung ist bei uns eingegangen und wird umgehend von uns bearbeitet.';
$html .= '</div>';
// Prepare data that should be stored in the database
$dbValues = array();
$dbValues['order_number'] = $order['details']['BT']->order_number;
$dbValues['payment_name'] = $this->renderPluginName($method, $order);
$dbValues['virtuemart_paymentmethod_id'] = $cart->virtuemart_paymentmethod_id;
$dbValues['payment_currency'] = $method->payment_currency;
$dbValues['payment_order_total'] = $totalInPaymentCurrency;
$this->storePSPluginInternalData($dbValues);
$new_status = 'C';
return $this->processConfirmedOrderPaymentResponse(1, $cart, $order, $html, $dbValues['payment_name'], $new_status);
}
示例3: getList
JLoader::import('product', JPATH_ADMINISTRATOR . '/components/com_virtuemart/models');
}
if (!class_exists('VmModel')) {
require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/vmmodel.php';
}
abstract class modNSSP2VMHelper
{
public static function getList($params, $count)
{
$productModel = VmModel::getModel('Product');
$products = $productModel->getProductListing($params->get('vmordering', 'latest'), $count, true, true, false, true, $params->get('vmcat', NULL));
$productModel->addImages($products);
$currency = CurrencyDisplay::getInstance();
if (count($products)) {
foreach ($products as $item) {
$author =& JFactory::getUser($item->created_by);
$item->created = $item->created_on;
$item->author = $author->name;
$item->hits = $item->hits;
$item->category = $item->category_name;
$item->cat_link = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $item->virtuemart_category_id);
$item->image = $item->images[0]->file_url;
$item->title = $item->product_name;
$item->introtext = $item->product_s_desc;
$item->price = round($item->prices['salesPrice'], 2) . $currency->getSymbol();
$item->addtocart = self::addtocart($item);
示例4: plgVmOnDisplayProductVariantFE
function plgVmOnDisplayProductVariantFE($field,&$idx,&$group) {
// default return if it's not this plugin
if ($field->custom_element != $this->_name) return '';
$this->parseCustomParams($field);
$options = explode(',', $field->custom_drop);
$class='';
$selects= array();
if(!class_exists('CurrencyDisplay')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'currencydisplay.php');
$currency = CurrencyDisplay::getInstance();
foreach ($options as $valuesWithPrice) {
$valueWithPrice = explode('|', $valuesWithPrice);
if ( isset ($valueWithPrice[1]) ) {
$op = $valueWithPrice[1][0];
$price = substr($valueWithPrice[1], 1) ;
$text = $valueWithPrice[0].' ('.$op.$currency->priceDisplay((float)$price).')';
} else {
$text = $valueWithPrice[0] ;
}
$selects[] = array('value' =>$valueWithPrice[0], 'text' => $text );
}
// vmdebug('plgVmOnDisplayProductVariantFE',$field,$idx,$group);
$html = JHTML::_('select.genericlist', $selects,'customPlugin['.$field->virtuemart_customfield_id.']['.$this->_name.'][custom_drop]','','value','text',$selects[0],false,true);
$group->display .= $html;
return true;
}
示例5: setTotal
/**
* @param $total
*/
public function setTotal($total)
{
if (!class_exists('CurrencyDisplay')) {
require JPATH_VM_ADMINISTRATOR . '/helpers/currencydisplay.php';
}
$this->total = vmPSPlugin::getAmountValueInCurrency($total, $this->_method->payment_currency);
$cd = CurrencyDisplay::getInstance($this->cart->pricesCurrency);
}
示例6: plgVmConfirmedOrder
function plgVmConfirmedOrder($cart, $order)
{
if (!($method = $this->getVmPluginMethod($order["details"]["BT"]->virtuemart_paymentmethod_id))) {
return null;
}
if (!$this->selectedThisElement($method->payment_element)) {
return false;
}
$this->logInfo('plgVmOnConfirmedOrderGetPaymentForm order number: ' . $order['details']['BT']->order_number, 'message');
$lang = JFactory::getLanguage();
$lang->load('plg_vmpayment_epay', JPATH_ADMINISTRATOR);
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
if (!class_exists('VirtueMartModelCurrency')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
}
$new_status = '';
$usrBT = $order['details']['BT'];
$address = isset($order['details']['ST']) ? $order['details']['ST'] : $order['details']['BT'];
$vendorModel = new VirtueMartModelVendor();
$vendorModel->setId(1);
$vendor = $vendorModel->getVendor();
$this->getPaymentCurrency($method);
$q = ' SELECT `currency_numeric_code` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $method->payment_currency . '" ';
$db =& JFactory::getDBO();
$db->setQuery($q);
$currency_numeric_code = $db->loadResult();
$paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
$totalInPaymentCurrency = round($paymentCurrency->convertCurrencyTo($method->payment_currency, $order['details']['BT']->order_total, false), 2);
$cd = CurrencyDisplay::getInstance($cart->pricesCurrency);
$session = JFactory::getSession();
$post_variables = array('merchantnumber' => $method->epay_merchant, 'instantcapture' => $method->epay_instantcapture, 'ownreceipt' => $method->epay_ownreceipt, 'group' => $method->epay_group, 'mailreceipt' => $method->epay_authmail, 'language' => $this->_getEpayLanguage(), 'orderid' => $order['details']['BT']->order_number, "amount" => $totalInPaymentCurrency * 100, "currency" => $currency_numeric_code, "accepturl" => JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id), "callbackurl" => JROUTE::_(JURI::root() . 'index.php?callback=1&option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id), "cancelurl" => JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginUserPaymentCancel&on=' . $order['details']['BT']->order_number . '&pm=' . $order['details']['BT']->virtuemart_paymentmethod_id), "windowstate" => $method->epay_windowstate);
$hash = md5(implode($post_variables, "") . $method->epay_md5key);
// Prepare data that should be stored in the database
$dbValues['payment_name'] = $this->renderPluginName($method, $order);
$dbValues['order_number'] = $order['details']['BT']->order_number;
$dbValues['virtuemart_paymentmethod_id'] = $cart->virtuemart_paymentmethod_id;
$this->storePSPluginInternalData($dbValues);
// add spin image
$html = '<script type="text/javascript" src="https://ssl.ditonlinebetalingssystem.dk/integration/ewindow/paymentwindow.js" charset="UTF-8"></script>';
$html .= '<script type="text/javascript">';
$html .= 'paymentwindow = new PaymentWindow({';
foreach ($post_variables as $name => $value) {
$html .= '\'' . $name . '\': "' . $value . '",';
}
$html .= '\'hash\': "' . $hash . '"';
$html .= '});';
$html .= '</script><input type="button" onclick="javascript: paymentwindow.open()" value="Go to payment" />';
$html .= ' <script type="text/javascript">';
$html .= ' paymentwindow.open();';
$html .= ' </script>';
// 2 = don't delete the cart, don't send email and don't redirect
$cart->_confirmDone = false;
$cart->_dataValidated = false;
$cart->setCartIntoSession();
JRequest::setVar('html', $html);
}
示例7: display
public function display($tpl = null)
{
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
$session = JFactory::getSession();
$cmp = $session->get('compare', '');
$listpid = explode(",", $cmp);
if (empty($cmp)) {
$valid = 0;
$this->assignRef('valid', $valid);
//$app =& JFactory::getApplication();
//$app->enqueueMessage('Your Wishlist is Empty Please Add any product to Wishlist', 'error');
//$app->redirect('index.php');
//exit;
} else {
$valid = 1;
$this->assignRef('valid', $valid);
$this->assignRef('wids', $wids);
$productModel = VmModel::getModel('product');
$products = $productModel->getProducts($listpid);
//echo "<pre>";
//print_r($wishlist);
//exit;
$productModel->addImages($products, 1);
$this->assignRef('products', $products);
foreach ($products as $product) {
$product->stock = $productModel->getStockIndicator($product);
}
$show_prices = VmConfig::get('show_prices', 1);
if ($show_prices == '1') {
if (!class_exists('calculationHelper')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
}
}
$this->assignRef('show_prices', $show_prices);
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
$showBasePrice = Permissions::getInstance()->check('admin');
//todo add config settings
$this->assignRef('showBasePrice', $showBasePrice);
$currency = CurrencyDisplay::getInstance();
$this->assignRef('currency', $currency);
$pagination = $productModel->getPagination(3);
$this->assignRef('vmPagination', $pagination);
/*** rating ***/
$ratingModel = VmModel::getModel('ratings');
$showRating = $ratingModel->showRating($product->virtuemart_product_id);
$this->assignRef('showRating', $showRating);
if ($showRating) {
$vote = $ratingModel->getVoteByProduct($product->virtuemart_product_id);
$this->assignRef('vote', $vote);
$rating = $ratingModel->getRatingByProduct($product->virtuemart_product_id);
$this->assignRef('rating', $rating);
}
}
parent::display($tpl);
}
示例8: ValidateCouponCode
/**
* Check if the given coupon code exists, is (still) valid and valid for the total order amount
* @param string $_code Coupon code
* @param float $_billTotal Total amount for the order
* @author Oscar van Eijk
* @author Max Milbers
* @return string Empty when the code is valid, otherwise the error message
*/
public static function ValidateCouponCode($_code, $_billTotal)
{
if (empty($_code) or $_code == vmText::_('COM_VIRTUEMART_COUPON_CODE_ENTER')) {
return '';
}
$couponData = 0;
JPluginHelper::importPlugin('vmcoupon');
$dispatcher = JDispatcher::getInstance();
$returnValues = $dispatcher->trigger('plgVmValidateCouponCode', array($_code, $_billTotal));
if (!empty($returnValues)) {
foreach ($returnValues as $returnValue) {
if ($returnValue !== null) {
//Take a look on this seyi, I am not sure about that, but it should work at least simular note by Max
return $returnValue;
}
}
}
if (empty($couponData)) {
$_db = JFactory::getDBO();
$_q = 'SELECT IFNULL( NOW() >= `coupon_start_date` OR `coupon_start_date`="0000-00-00 00:00:00" , 1 ) AS started
, `coupon_start_date`
, IFNULL (`coupon_expiry_date`!="0000-00-00 00:00:00" and NOW() > `coupon_expiry_date`,0) AS `ended`
, `coupon_expiry_date`
, `coupon_value_valid`
, `coupon_used`
FROM `#__virtuemart_coupons`
WHERE `coupon_code` = "' . $_db->escape($_code) . '"';
$_db->setQuery($_q);
$couponData = $_db->loadObject();
}
if (!$couponData) {
return vmText::_('COM_VIRTUEMART_COUPON_CODE_INVALID');
}
if ($couponData->coupon_used) {
$session = JFactory::getSession();
$session_id = $session->getId();
if ($couponData->coupon_used != $session_id) {
return vmText::_('COM_VIRTUEMART_COUPON_CODE_INVALID');
}
}
if (!$couponData->started) {
return vmText::_('COM_VIRTUEMART_COUPON_CODE_NOTYET') . $couponData->coupon_start_date;
}
if ($couponData->ended) {
self::RemoveCoupon($_code, true);
return vmText::_('COM_VIRTUEMART_COUPON_CODE_EXPIRED');
}
if ($_billTotal < $couponData->coupon_value_valid) {
if (!class_exists('CurrencyDisplay')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
}
$currency = CurrencyDisplay::getInstance();
$coupon_value_valid = $currency->priceDisplay($couponData->coupon_value_valid);
return vmText::_('COM_VIRTUEMART_COUPON_CODE_TOOLOW') . " " . $coupon_value_valid;
}
return '';
}
示例9: setTotal
/**
* @param $total
*/
public function setTotal($total)
{
if (!class_exists('CurrencyDisplay')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
}
// $this->total = vmPSPlugin::getAmountValueInCurrency($total, $this->_method->payment_currency);
$this->total = $total;
$cd = CurrencyDisplay::getInstance($this->cart->pricesCurrency);
}
示例10: _autocomplete
public function _autocomplete($search_category_id, $search_name, $params)
{
VmConfig::loadJLang('com_virtuemart', true);
VmConfig::loadConfig();
$list = array();
$limitation = (int) $params->get('limit', 8);
$source_group = null;
$catids = $search_category_id == 0 ? 0 : $search_category_id;
$query = ' * , pp.product_price FROM `#__virtuemart_products_en_gb` p LEFT JOIN #__virtuemart_product_prices pp ON p.virtuemart_product_id = pp.virtuemart_product_id';
if ($search_category_id != 0) {
$query .= " LEFT JOIN `#__virtuemart_product_categories` pc ON (p.virtuemart_product_id = pc.virtuemart_product_id) WHERE pc.virtuemart_category_id = " . $search_category_id . " AND p.product_name LIKE '%" . $search_name . "%'";
} else {
$query .= " WHERE p.product_name LIKE '%" . $search_name . "%'";
}
//$source_group = null;
$productModel = VmModel::getModel('Product');
//$productModel = new VirtuemartModelProductExtend();
$items = $productModel->exeSortSearchListQuery(0, $query, '', '', '', '', '', $limitation);
if ($limitation == 0) {
$productModel->_noLimit = true;
} else {
$productModel->_noLimit = false;
}
//$productModel->addImages($items,1);
$ratingModel = VmModel::getModel('ratings');
$small_image_config = array('type' => $params->get('imgcfg_type'), 'width' => $params->get('imgcfg_width'), 'height' => $params->get('imgcfg_height'), 'quality' => 90, 'function' => $params->get('imgcfg_function') == 'none' ? null : 'resize', 'function_mode' => $params->get('imgcfg_function') == 'none' ? null : substr($params->get('imgcfg_function'), 7), 'transparency' => $params->get('imgcfg_transparency', 1) ? true : false, 'background' => $params->get('imgcfg_background'));
if (!class_exists('CurrencyDisplay')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
}
$currency = CurrencyDisplay::getInstance();
foreach ($items as $item) {
$virtuemart_product_id = $item->virtuemart_product_id;
$quantity = 1;
$product_info = $productModel->getProduct($virtuemart_product_id, TRUE, TRUE, TRUE, $quantity);
$productModel->addImages($product_info);
$item_img = VmSearchProHelper::getVmImage($product_info, $params);
$image = VmSearchProHelper::imageTag($item_img, $small_image_config);
$salesPrice = "";
$discountAmount = "";
if (!empty($product_info->prices['salesPrice'])) {
$salesPrice = $currency->createPriceDiv('salesPrice', JText::_("SALES_PRICE"), $product_info->prices, false, false, 1.0);
}
if (!empty($product_info->prices['discountAmount'])) {
$discountAmount = $currency->createPriceDiv('discountAmount', JText::_("DISCOUNT_AMOUNT"), $product_info->prices, false, false, 1.0);
}
$list[] = array('name' => $item->product_name, 'product_id' => $item->virtuemart_product_id, 'salesPrice' => $salesPrice, 'discountAmount' => $discountAmount, 'image' => $image, 'link' => JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $product_info->virtuemart_category_id . '&virtuemart_product_id=' . $product_info->virtuemart_product_id . '&keyword=' . $search_name . ''), 'category_name' => $product_info->category_name);
}
die(json_encode($list));
}
示例11: display
function display($tpl = null)
{
if (!class_exists('VmImage')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
}
VmConfig::loadJLang('com_virtuemart_orders', TRUE);
$model = VmModel::getModel('virtuemart');
$nbrCustomers = $model->getTotalCustomers();
$this->assignRef('nbrCustomers', $nbrCustomers);
$nbrActiveProducts = $model->getTotalActiveProducts();
$this->assignRef('nbrActiveProducts', $nbrActiveProducts);
$nbrInActiveProducts = $model->getTotalInActiveProducts();
$this->assignRef('nbrInActiveProducts', $nbrInActiveProducts);
$nbrFeaturedProducts = $model->getTotalFeaturedProducts();
$this->assignRef('nbrFeaturedProducts', $nbrFeaturedProducts);
$ordersByStatus = $model->getTotalOrdersByStatus();
$this->assignRef('ordersByStatus', $ordersByStatus);
$recentOrders = $model->getRecentOrders();
if (!class_exists('CurrencyDisplay')) {
require JPATH_VM_ADMINISTRATOR . 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->assignRef('recentOrders', $recentOrders);
$recentCustomers = $model->getRecentCustomers();
$this->assignRef('recentCustomers', $recentCustomers);
if (!class_exists('ShopFunctions')) {
require JPATH_VM_ADMINISTRATOR . '/helpers/shopfunctions.php';
}
$extensionsFeed = ShopFunctions::getExtensionsRssFeed();
$this->assignRef('extensionsFeed', $extensionsFeed);
$virtuemartFeed = ShopFunctions::getVirtueMartRssFeed();
$this->assignRef('virtuemartFeed', $virtuemartFeed);
// Options button.
// if ( !JVM_VERSION===1) {
// if (JFactory::getUser()->authorise('core.admin', 'com_virtuemart')) {
// JToolBarHelper::preferences('com_virtuemart');
// }
// }
parent::display($tpl);
}
示例12: display
function display($tpl = null)
{
// Get data from the model
$rows =& $this->get('Data');
$pagination =& $this->get('Pagination');
if (!class_exists('CurrencyDisplay')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
}
$currency = CurrencyDisplay::getInstance();
JToolBarHelper::title(JText::_('COM_VMCOUPONS_STATISTICS'), 'generic.png');
// push data into the template
$this->assignRef('rows', $rows);
$this->assignRef('pagination', $pagination);
$this->assignRef('currency', $currency);
parent::display($tpl);
}
示例13: prepare
function prepare(&$products)
{
// Get user
$user = JFactory::getUser();
// Get null date
$db = JFactory::getDBO();
$nullDate = $db->getNullDate();
// Get trash state
$mainframe = JFactory::getApplication();
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$trash = $mainframe->getUserStateFromRequest("{$option}.{$view}.trash", 'trash', -1, 'int');
// Require Virtuemart classes for price display
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php';
$currency = CurrencyDisplay::getInstance();
// Cast the input to array
if (!is_array($products)) {
$rows = array($products);
} else {
$rows = $products;
}
// Prepare the products
foreach ($rows as $key => $product) {
$product->parity = $key % 2;
$product->key = $key + 1;
$product->checkout = JHTML::_('grid.checkedout', $product, $key);
$product->price = $currency->priceDisplay($product->price, (int) $product->currency, true);
$product->featuredToggler = K2martHTMLHelper::stateToggler($product, $key, 'featured', array('K2MART_FEATURED', 'K2MART_NOT_FEATURED'), array('K2MART_REMOVE_FEATURED_FLAG', 'K2MART_FLAG_AS_FEATURED'));
$product->publishedToggler = K2martHTMLHelper::stateToggler($product, $key, 'published', array('K2MART_PUBLISHED', 'K2MART_UNPUBLISHED'), array('K2MART_UNPUBLISH', 'K2MART_PUBLISH'));
if (JTable::isCheckedOut($user->get('id'), $product->checked_out) || $trash == 1) {
$product->link = false;
$product->featuredToggler = strip_tags($product->featuredToggler, '<img>');
$product->publishedToggler = strip_tags($product->publishedToggler, '<img>');
} else {
$product->link = JRoute::_('index.php?option=com_k2&view=item&cid=' . $product->id);
}
$product->categoryLink = JRoute::_('index.php?option=com_k2&view=category&cid=' . $product->catid);
if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache' . DS . md5("Image" . $product->id) . '_XL.jpg')) {
$product->image = JURI::root(true) . '/media/k2/items/cache/' . md5("Image" . $product->id) . '_XL.jpg';
} else {
$product->image = false;
}
$product->created = JHTML::_('date', $product->created);
$product->modified = $product->modified == $nullDate ? JText::_('K2MART_NEVER') : JHTML::_('date', $product->modified);
}
}
示例14: ValidateCouponCode
/**
* Check if the given coupon code exists, is (still) valid and valid for the total order amount
* @param string $_code Coupon code
* @param float $_billTotal Total amount for the order
* @author Oscar van Eijk
* @author Max Milbers
* @return string Empty when the code is valid, otherwise the error message
*/
public static function ValidateCouponCode($_code, $_billTotal)
{
$couponData = 0;
JPluginHelper::importPlugin('vmcoupon');
$dispatcher = JDispatcher::getInstance();
$returnValues = $dispatcher->trigger('plgVmValidateCouponCode', array($_code, $_billTotal));
if (!empty($returnValues)) {
foreach ($returnValues as $returnValue) {
if ($returnValue !== null) {
//Take a look on this seyi, I am not sure about that, but it should work at least simular note by Max
return $returnValue;
}
}
}
if (empty($couponData)) {
$_db = JFactory::getDBO();
$_q = 'SELECT IF( NOW() >= `coupon_start_date` , 1, 0 ) AS started ' . ', `coupon_start_date` ' . ', IFNULL( 0, IF( NOW() > `coupon_expiry_date`, 1, 0 )) AS ended ' . ', `coupon_value_valid` ' . 'FROM `#__virtuemart_coupons` ' . 'WHERE `coupon_code` = "' . $_db->escape($_code) . '"';
$_db->setQuery($_q);
$couponData = $_db->loadObject();
}
if (!$couponData) {
return JText::_('COM_VIRTUEMART_COUPON_CODE_INVALID');
}
if (!$couponData->started) {
return JText::_('COM_VIRTUEMART_COUPON_CODE_NOTYET') . $couponData->coupon_start_date;
}
if ($couponData->ended) {
self::RemoveCoupon($_code, true);
return JText::_('COM_VIRTUEMART_COUPON_CODE_EXPIRED');
}
if ($_billTotal < $couponData->coupon_value_valid) {
JLoader::register('CurrencyDisplay', JPATH_VM_ADMINISTRATOR . '/helpers/currencydisplay.php');
$currency = CurrencyDisplay::getInstance();
$coupon_value_valid = $currency->priceDisplay($couponData->coupon_value_valid);
return JText::_('COM_VIRTUEMART_COUPON_CODE_TOOLOW') . " " . $coupon_value_valid;
}
return '';
}
示例15: display
function display($tpl = null)
{
VmConfig::loadJLang('com_virtuemart_orders', TRUE);
$app = JFactory::getApplication();
// Load the helper(s)
if (JFactory::getUser()->authorise('core.admin', 'com_virtuemart')) {
if ($app->isadmin()) {
JToolBarHelper::preferences('com_virtuemart');
}
}
$this->loadHelper('image');
JToolBarHelper::title(JText::_('COM_VIRTUEMART'), 'home');
$model = VmModel::getModel('virtuemart');
$this->nbrCustomers = $model->getTotalCustomers();
$this->nbrActiveProducts = $model->getTotalActiveProducts();
$this->nbrInActiveProducts = $model->getTotalInActiveProducts();
$this->nbrFeaturedProducts = $model->getTotalFeaturedProducts();
$this->ordersByStatus = $model->getTotalOrdersByStatus();
$recentOrders = $model->getRecentOrders();
if (!class_exists('CurrencyDisplay')) {
require JPATH_VM_ADMINISTRATOR . '/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;
$this->recentCustomers = $model->getRecentCustomers();
parent::display($tpl);
}