本文整理汇总了PHP中VirtueMartModelVendor::getVendorCurrency方法的典型用法代码示例。如果您正苦于以下问题:PHP VirtueMartModelVendor::getVendorCurrency方法的具体用法?PHP VirtueMartModelVendor::getVendorCurrency怎么用?PHP VirtueMartModelVendor::getVendorCurrency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtueMartModelVendor
的用法示例。
在下文中一共展示了VirtueMartModelVendor::getVendorCurrency方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
// Load the helper(s)
$this->addHelperPath(VMPATH_ADMIN . DS . 'helpers');
if (!class_exists('vmPSPlugin')) {
require VMPATH_PLUGINLIBS . DS . 'vmpsplugin.php';
}
if (!class_exists('VmHTML')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
$model = VmModel::getModel();
$layoutName = vRequest::getCmd('layout', 'default');
$this->SetViewTitle();
$layoutName = vRequest::getCmd('layout', 'default');
if ($layoutName == 'edit') {
VmConfig::loadJLang('plg_vmpsplugin', false);
JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields');
$shipment = $model->getShipment();
// Get the payment XML.
$formFile = vRequest::filterPath(VMPATH_ROOT . DS . 'plugins' . DS . 'vmshipment' . DS . $shipment->shipment_element . DS . $shipment->shipment_element . '.xml');
if (file_exists($formFile)) {
$shipment->form = JForm::getInstance($shipment->shipment_element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]');
$shipment->params = new stdClass();
$varsToPush = vmPlugin::getVarsToPushFromForm($shipment->form);
VmTable::bindParameterableToSubField($shipment, $varsToPush);
$shipment->form->bind($shipment->getProperties());
} else {
$shipment->form = null;
}
if (!class_exists('VmImage')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
}
if (!class_exists('VirtueMartModelVendor')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
}
$vendor_id = 1;
$currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
$this->assignRef('vendor_currency', $currency->currency_symbol);
if ($this->showVendors()) {
$vendorList = ShopFunctions::renderVendorList($shipment->virtuemart_vendor_id);
$this->assignRef('vendorList', $vendorList);
}
$this->pluginList = self::renderInstalledShipmentPlugins($shipment->shipment_jplugin_id);
$this->assignRef('shipment', $shipment);
$this->shopperGroupList = ShopFunctions::renderShopperGroupList($shipment->virtuemart_shoppergroup_ids, true);
$this->addStandardEditViewCommands($shipment->virtuemart_shipmentmethod_id);
} else {
JToolBarHelper::custom('cloneshipment', 'copy', 'copy', vmText::_('COM_VIRTUEMART_SHIPMENT_CLONE'), true);
$this->addStandardDefaultViewCommands();
$this->addStandardDefaultViewLists($model);
$this->shipments = $model->getShipments();
VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
foreach ($this->shipments as &$data) {
// Write the first 5 shoppergroups in the list
$data->shipmentShoppersList = shopfunctions::renderGuiList($data->virtuemart_shoppergroup_ids, 'shoppergroups', 'shopper_group_name', 'shopper');
}
$this->pagination = $model->getPagination();
}
parent::display($tpl);
}
示例2: getOptions
protected function getOptions()
{
$options = array();
if (!class_exists('VirtueMartModelVendor')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
}
$vendor_id = VirtueMartModelVendor::getLoggedVendor();
// set currency_id to logged vendor
if (empty($this->value)) {
$currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
$this->value = $currency->virtuemart_currency_id;
}
// why not logged vendor? shared is missing
$db = JFactory::getDBO();
$query = 'SELECT `virtuemart_currency_id` AS value, `currency_name` AS text
FROM `#__virtuemart_currencies`
WHERE `virtuemart_vendor_id` = "1" AND `published` = "1" ORDER BY `currency_name` ASC ';
// default value should be vendor currency
$db->setQuery($query);
$values = $db->loadObjectList();
foreach ($values as $v) {
$options[] = JHtml::_('select.option', $v->value, $v->text);
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例3: display
function display($tpl = null)
{
// Load the helper(s)
$this->addHelperPath(JPATH_VM_ADMINISTRATOR . DS . 'helpers');
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
if (!class_exists('vmPSPlugin')) {
require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
}
if (!class_exists('VmHTML')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
}
$model = VmModel::getModel();
$layoutName = JRequest::getWord('layout', 'default');
$this->SetViewTitle();
$layoutName = JRequest::getWord('layout', 'default');
if ($layoutName == 'edit') {
$shipment = $model->getShipment();
if (!class_exists('VmImage')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
}
if (!class_exists('vmParameters')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'parameterparser.php';
}
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$vendor_id = 1;
$currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
$this->assignRef('vendor_currency', $currency->currency_symbol);
if (Vmconfig::get('multix', 'none') !== 'none') {
$vendorList = ShopFunctions::renderVendorList($shipment->virtuemart_vendor_id);
$this->assignRef('vendorList', $vendorList);
}
$this->assignRef('pluginList', self::renderInstalledShipmentPlugins($shipment->shipment_jplugin_id));
$this->assignRef('shipment', $shipment);
$this->assignRef('shopperGroupList', ShopFunctions::renderShopperGroupList($shipment->virtuemart_shoppergroup_ids, true));
$this->addStandardEditViewCommands($shipment->virtuemart_shipmentmethod_id);
} else {
JToolBarHelper::custom('cloneshipment', 'copy', 'copy', JText::_('COM_VIRTUEMART_SHIPMENT_CLONE'), true);
$this->addStandardDefaultViewCommands();
$this->addStandardDefaultViewLists($model);
$shipments = $model->getShipments();
$this->assignRef('shipments', $shipments);
$pagination = $model->getPagination();
$this->assignRef('pagination', $pagination);
}
parent::display($tpl);
}
示例4: display
function display($tpl = null)
{
// Load the helper(s)
$this->addHelperPath(JPATH_VM_ADMINISTRATOR . '/helpers');
$this->loadHelper('permissions');
$this->loadHelper('vmpsplugin');
$this->loadHelper('html');
$model = VmModel::getModel();
$layoutName = JRequest::getWord('layout', 'default');
$layoutName = JRequest::getWord('layout', 'default');
if ($layoutName == 'edit') {
$shipment = $model->getShipment();
$this->loadHelper('image');
// $this->loadHelper('html');
// $this->loadHelper('parameterparser');
// jimport('joomla.html.pane');
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . '/models' . DS . 'vendor.php';
}
$vendor_id = 1;
$currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
$this->vendor_currency = $currency->currency_symbol;
if (Vmconfig::get('multix', 'none') !== 'none') {
$this->vendorList = ShopFunctions::renderVendorList($shipment->virtuemart_vendor_id);
}
$this->pluginList = self::renderInstalledShipmentPlugins($shipment->shipment_jplugin_id);
$this->shipment = $shipment;
$this->shopperGroupList = ShopFunctions::renderShopperGroupList($shipment->virtuemart_shoppergroup_ids, true);
$this->SetViewTitle('', $shipment->shipment_name);
$this->addStandardEditViewCommands($shipment->virtuemart_shipmentmethod_id);
} else {
if (JRequest::getWord('format', '') === 'raw') {
$tpl = 'results';
} else {
$this->SetViewTitle();
JToolBarHelper::custom('cloneshipment', 'copy', 'copy', JText::_('COM_VIRTUEMART_SHIPMENT_CLONE'), true);
$this->addStandardDefaultViewCommands();
$this->installedShipments = $this->shipmentsPlgList();
}
$this->addStandardDefaultViewLists($model);
$this->shipments = $model->getShipments();
$this->pagination = $model->getPagination();
}
parent::display($tpl);
if ($tpl === 'results') {
echo $this->AjaxScripts();
}
}
示例5: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
$db = JFactory::getDBO();
$query = 'SELECT `virtuemart_currency_id` AS value, `currency_name` AS text
FROM `#__virtuemart_currencies`
WHERE `virtuemart_vendor_id` = "1" AND `published` = "1" ORDER BY `currency_name` ASC ';
// default value should be vendor currency
$db->setQuery($query);
$currencies = $db->loadObjectList();
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$vendor_id = VirtueMartModelVendor::getLoggedVendor();
if (empty($value)) {
$currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
$value = $currency->virtuemart_currency_id;
}
return JHTML::_('select.genericlist', $currencies, $control_name . '[' . $name . '][]', $class, 'value', 'text', $value, $control_name . $name);
}
示例6: display
function display($tpl = null)
{
// Load the helper(s)
$this->addHelperPath(JPATH_VM_ADMINISTRATOR . DS . 'helpers');
$this->loadHelper('permissions');
$this->loadHelper('vmpsplugin');
$this->loadHelper('html');
$model = VmModel::getModel();
$layoutName = JRequest::getWord('layout', 'default');
$this->SetViewTitle();
$layoutName = JRequest::getWord('layout', 'default');
if ($layoutName == 'edit') {
$shipment = $model->getShipment();
$this->loadHelper('image');
// $this->loadHelper('html');
$this->loadHelper('parameterparser');
// jimport('joomla.html.pane');
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$vendor_id = 1;
$currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
$this->assignRef('vendor_currency', $currency->currency_symbol);
if (Vmconfig::get('multix', 'none') !== 'none') {
$vendorList = ShopFunctions::renderVendorList($shipment->virtuemart_vendor_id);
$this->assignRef('vendorList', $vendorList);
}
$this->assignRef('pluginList', self::renderInstalledShipmentPlugins($shipment->shipment_jplugin_id));
$this->assignRef('shipment', $shipment);
$this->assignRef('shopperGroupList', ShopFunctions::renderShopperGroupList($shipment->virtuemart_shoppergroup_ids, true));
$this->addStandardEditViewCommands($shipment->virtuemart_shipmentmethod_id);
} else {
$this->addStandardDefaultViewCommands();
$this->addStandardDefaultViewLists($model);
$shipments = $model->getShipments();
$this->assignRef('shipments', $shipments);
$pagination = $model->getPagination();
$this->assignRef('pagination', $pagination);
}
parent::display($tpl);
}
示例7: _getVendorCurrencyId
/**
* @return mixed
*/
function _getVendorCurrencyId()
{
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$vendor_id = 1;
$vendor_currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
return $vendor_currency->virtuemart_currency_id;
}
示例8: calculateSalesPrice
/**
* calculateSalesPrice
* overrides default function to remove currency conversion
* @author Zasilkovna
*/
function calculateSalesPrice($cart, $method, $cart_prices)
{
$value = $this->getCosts($cart, $method, $cart_prices);
$tax_id = @$method->tax_id;
$vendor_id = $cart->vendorId;
if (empty($vendor_id)) {
$vendor_id = 1;
}
$vendor_currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
$db = JFactory::getDBO();
$calculator = calculationHelper::getInstance();
$currency = CurrencyDisplay::getInstance();
$taxrules = array();
if (!empty($tax_id)) {
$q = 'SELECT * FROM #__virtuemart_calcs WHERE `virtuemart_calc_id`="' . $tax_id . '" ';
$db->setQuery($q);
$taxrules = $db->loadAssocList();
}
if (count($taxrules) > 0) {
$salesPrice = $calculator->roundInternal($calculator->executeCalculation($taxrules, $value));
} else {
$salesPrice = $value;
}
return $salesPrice;
}
示例9: display
//.........这里部分代码省略.........
if (JVM_VERSION < 3) { $backward="back"; $list='back';} else {$backward='backward';$list='list';}
JToolBarHelper::custom( 'prevItem', $backward,'','COM_VIRTUEMART_ITEM_PREVIOUS',false);
JToolBarHelper::custom( 'nextItem', 'forward','','COM_VIRTUEMART_ITEM_NEXT',false);
JToolBarHelper::divider();
JToolBarHelper::custom( 'cancel', $list,'','COM_VIRTUEMART_ORDER_LIST_LBL',false,false);
}
else if ($curTask == 'editOrderItem') {
if(!class_exists('calculationHelper')) require(VMPATH_ADMIN.DS.'helpers'.DS.'calculationh.php');
$this->assignRef('orderstatuses', $orderStates);
$model = VmModel::getModel();
$orderId = vRequest::getString('orderId', '');
$orderLineItem = vRequest::getVar('orderLineId', '');
$this->assignRef('virtuemart_order_id', $orderId);
$this->assignRef('virtuemart_order_item_id', $orderLineItem);
$orderItem = $model->getOrderLineDetails($orderId, $orderLineItem);
$this->assignRef('orderitem', $orderItem);
}
else {
$this->setLayout('orders');
$model = VmModel::getModel();
$this->addStandardDefaultViewLists($model,'created_on');
$orderStatusModel =VmModel::getModel('orderstatus');
$orderstates = vRequest::getCmd('order_status_code','');
$this->lists['state_list'] = $orderStatusModel->renderOSList($orderstates,'order_status_code',FALSE,' onchange="this.form.submit();" ');
$orderslist = $model->getOrdersList();
$this->assignRef('orderstatuses', $orderStates);
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
if ($orderslist) {
foreach ($orderslist as $virtuemart_order_id => $order) {
if(!empty($order->order_currency)){
$currency = $order->order_currency;
} else if($order->virtuemart_vendor_id){
if(!class_exists('VirtueMartModelVendor')) require(VMPATH_ADMIN.DS.'models'.DS.'vendor.php');
$currObj = VirtueMartModelVendor::getVendorCurrency($order->virtuemart_vendor_id);
$currency = $currObj->virtuemart_currency_id;
}
//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('curr'.$currency, $_currencies)) {
$_currencies['curr'.$currency] = CurrencyDisplay::getInstance($currency,$order->virtuemart_vendor_id);
}
$order->order_total = $_currencies['curr'.$currency]->priceDisplay($order->order_total);
$order->invoiceNumber = $model->getInvoiceNumber($order->virtuemart_order_id);
}
}
//update order items button
/*$q = 'SELECT * FROM #__virtuemart_order_items WHERE `product_discountedPriceWithoutTax` IS NULL ';
$db = JFactory::getDBO();
$db->setQuery($q);
//$res = $db->loadRow();
if(true) {
JToolBarHelper::custom('updateCustomsOrderItems', 'new', 'new', vmText::_('COM_VIRTUEMART_REPORT_UPDATEORDERITEMS'),false);
vmError('COM_VIRTUEMART_UPDATEORDERITEMS_WARN');
}*/
/*
* UpdateStatus removed from the toolbar; don't understand how this was intented to work but
* the order ID's aren't properly passed. Might be readded later; the controller needs to handle
* the arguments.
*/
/* Toolbar */
//JToolBarHelper::customX( 'CreateOrderHead', 'new','new','New',false);
JToolBarHelper::save('updatestatus', vmText::_('COM_VIRTUEMART_UPDATE_STATUS'));
if ($this->canDo->get('core.admin') || $this->canDo->get('vm.orders.delete')) {
JToolBarHelper::spacer('100');
JToolBarHelper::deleteList();
}
/* Assign the data */
$this->assignRef('orderslist', $orderslist);
$pagination = $model->getPagination();
$this->assignRef('pagination', $pagination);
}
if(JFactory::getApplication()->isSite()) {
$bar = JToolBar::getInstance( 'toolbar' );
$bar->appendButton( 'Link', 'back', 'COM_VIRTUEMART_LEAVE', 'index.php?option=com_virtuemart&manage=0' );
}
shopFunctions::checkSafePath();
parent::display($tpl);
}
示例10: getInvoiceFeeInclTax
/**
* The invoice fee is in the vendor currency, and should be converted to the payment currency
*
* @static
* @param $method
* @param $country
* @return mixed
*/
public static function getInvoiceFeeInclTax($method, $country, $cartPricesCurrency, $cartPaymentCurrency, &$display_invoice_fee, &$invoice_fee)
{
$method_invoice_fee = self::getInvoiceFee($method, $country);
$invoice_tax_id = self::getInvoiceTaxId($method, $country);
vmdebug('getInvoiceFeeInclTax', $cartPaymentCurrency, $invoice_fee);
if (!class_exists('calculationHelper')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
}
if (!class_exists('CurrencyDisplay')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
}
if (!class_exists('VirtueMartModelVendor')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
}
$vendor_id = 1;
$vendor_currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
//$currency = CurrencyDisplay::getInstance ();
$paymentCurrency = CurrencyDisplay::getInstance($cartPaymentCurrency);
$invoice_fee = (double) round($paymentCurrency->convertCurrencyTo($cartPaymentCurrency, $method_invoice_fee, FALSE), 2);
$currencyDisplay = CurrencyDisplay::getInstance($cartPricesCurrency);
$paymentCurrency = CurrencyDisplay::getInstance($cartPaymentCurrency);
$display_invoice_fee = $paymentCurrency->priceDisplay($method_invoice_fee, $cartPaymentCurrency);
$currencyDisplay = CurrencyDisplay::getInstance($cartPricesCurrency);
vmdebug('getInvoiceFeeInclTax', $cartPaymentCurrency, $invoice_fee, $invoice_tax_id, $display_invoice_fee);
return;
}
示例11: calculateSalesPrice
/**
* calculateSalesPrice
*
* @param $value
* @param $tax_id: tax id
* @return $salesPrice
*/
protected function calculateSalesPrice($cart, $method, $cart_prices)
{
$value = $this->getCosts($cart, $method, $cart_prices);
$tax_id = @$method->tax_id;
if (!class_exists('calculationHelper')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
}
if (!class_exists('CurrencyDisplay')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
}
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$vendor_id = 1;
$vendor_currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
$db = JFactory::getDBO();
$calculator = calculationHelper::getInstance();
$currency = CurrencyDisplay::getInstance();
$value = $currency->convertCurrencyTo($vendor_currency->virtuemart_currency_id, $value);
$taxrules = array();
if (!empty($tax_id)) {
$q = 'SELECT * FROM #__virtuemart_calcs WHERE `virtuemart_calc_id`="' . $tax_id . '" ';
$db->setQuery($q);
$taxrules = $db->loadAssocList();
}
if (count($taxrules) > 0) {
$salesPrice = $calculator->roundInternal($calculator->executeCalculation($taxrules, $value));
} else {
$salesPrice = $value;
}
return $salesPrice;
}
示例12: display
//.........这里部分代码省略.........
}
$order->order_total = $_currencies['v' . $order->virtuemart_vendor_id]->priceDisplay($order->order_total);
$order->invoiceNumber = $model->getInvoiceNumber($order->virtuemart_order_id);
}
}
/* Assign the data */
$this->assignRef('orderslist', $orderslist);
$this->assignRef('services', $this->services);
$pagination = $model->getPagination();
$this->assignRef('pagination', $pagination);
$this->SetViewTitle('MDS Confirm Collivery', 'MDS shipping awaiting confirmation');
} else {
// old version!
$model = VmModel::getModel();
$this->addStandardDefaultViewLists($model, 'created_on');
$orderStatusModel = VmModel::getModel('orderstatus');
$orderstates = JRequest::getWord('order_status_code', '');
$orderslist = $model->getOrdersList();
$this->assignRef('orderstatuses', $orderStates);
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
if ($orderslist) {
foreach ($orderslist as $virtuemart_order_id => $order) {
if (!empty($order->order_currency)) {
$currency = $order->order_currency;
} elseif ($order->virtuemart_vendor_id) {
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$currObj = VirtueMartModelVendor::getVendorCurrency($order->virtuemart_vendor_id);
$currency = $currObj->virtuemart_currency_id;
}
//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('curr' . $currency, $_currencies)) {
$_currencies['curr' . $currency] = CurrencyDisplay::getInstance($currency, $order->virtuemart_vendor_id);
}
$order->order_total = $_currencies['curr' . $currency]->priceDisplay($order->order_total);
$order->invoiceNumber = $model->getInvoiceNumber($order->virtuemart_order_id);
}
}
/* Assign the data */
$this->assignRef('orderslist', $orderslist);
$this->assignRef('services', $this->services);
$pagination = $model->getPagination();
$this->assignRef('pagination', $pagination);
$this->SetViewTitle('MDS Confirm Collivery', 'MDS shipping awaiting confirmation');
}
} elseif ($curTask == 'config') {
$shippingModel = VmModel::getModel();
$post = JRequest::get('post');
if (!empty($post)) {
// change our password
$this->db->setQuery("UPDATE `#__mds_collivery_config` SET `password` = '" . $post['password'] . "', `username` = '" . $post['username'] . "', `risk_cover` = '" . $post['risk_cover'] . "' WHERE `id` = 1;");
$this->db->query();
}
$this->setLayout('config');
$config = $shippingModel->getConfig();
$this->assignRef('config', $config);
$this->SetViewTitle('MDS Collivery Config', 'Account settings & Update option');
} elseif ($curTask == 'view') {
$model = VmModel::getModel();
$waybill = JRequest::getInt('waybill');
示例13: getInvoiceFeeInclTax
public static function getInvoiceFeeInclTax($method, $country)
{
$invoice_fee = self::getInvoiceFee($method, $country);
$invoice_tax_id = self::getInvoiceTaxId($method, $country);
if (!class_exists('calculationHelper')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
}
if (!class_exists('CurrencyDisplay')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
}
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
}
$vendor_id = 1;
$vendor_currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
$db = JFactory::getDBO();
$calculator = calculationHelper::getInstance();
$currency = CurrencyDisplay::getInstance();
$value = $currency->convertCurrencyTo($vendor_currency->virtuemart_currency_id, $invoice_fee);
$taxrules = array();
if (!empty($invoice_tax_id)) {
$q = 'SELECT * FROM #__virtuemart_calcs WHERE `virtuemart_calc_id`="' . $invoice_tax_id . '" ';
$db->setQuery($q);
$taxrules = $db->loadAssocList();
}
if (count($taxrules) > 0) {
$salesPrice = $calculator->roundInternal($calculator->executeCalculation($taxrules, $value));
} else {
$salesPrice = $value;
}
return $salesPrice;
}
示例14: insert_com_virtuemart
//.........这里部分代码省略.........
$query->order($this->db->qn('p.product_price') . ' DESC');
break;
case 'price_asc':
$query->order($this->db->qn('p.product_price') . ' ASC');
break;
case 'name_desc':
$query->order($this->db->qn('pl.product_name') . ' DESC');
break;
case 'name_asc':
$query->order($this->db->qn('pl.product_name') . ' ASC');
break;
case 'cat_desc':
$query->order($this->db->qn('cl.category_name') . ' DESC');
break;
case 'cat_asc':
$query->order($this->db->qn('cl.category_name') . ' ASC');
break;
case 'random':
$query->order('RAND()');
break;
}
/*
$query = 'SELECT DISTINCT a.virtuemart_product_id as product_id,a.product_name,a.product_s_desc,a.product_desc,
b.product_price, cur.currency_code_3 as product_currency,
c.virtuemart_category_id as category_id,
d.category_name,
med.file_url_thumb as product_thumb_image, med.file_url as product_image,
a.virtuemart_product_id as tax_rate
FROM #__virtuemart_product_prices as b
INNER JOIN #__virtuemart_products as a ON a.virtuemart_product_id = b.virtuemart_product_id
INNER JOIN #__virtuemart_product_categories as c ON a.virtuemart_product_id = c.virtuemart_product_id
INNER JOIN #__virtuemart_categories as d ON c.virtuemart_category_id = d.virtuemart_category_id
INNER JOIN #__virtuemart_currencies as cur ON b.product_currency = cur.virtuemart_currency_id
INNER JOIN #__virtuemart_product_medias as m ON a.virtuemart_product_id = m.virtuemart_product_id
INNER JOIN #__virtuemart_medias as med ON m.virtuemart_media_id = med.virtuemart_media_id
WHERE a.published = 1 '
.$where
.$order;
*/
$this->db->setQuery($query);
$products = $this->db->loadObjectList();
if (count($products)) {
foreach ($products as $prod) {
$product_content = '';
$prod->tax_rate = 0;
$product_content .= $prod->product_name . '<br />';
if ($componentsOptions['vm_price']) {
require_once JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php';
require_once JPATH_ADMINISTRATOR . '/components/com_virtuemart/models/vendor.php';
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_virtuemart/models');
$productModel = JModelLegacy::getInstance('Product', 'VirtueMartModel');
$prices = $productModel->getPrice($prod->product_id, 1);
$price = $prices['salesPrice'];
$currency = VirtueMartModelVendor::getVendorCurrency(1);
if ($componentsOptions['vm_curr_symbol']) {
$prod->product_currency = $currency->currency_symbol;
} else {
$prod->product_currency = $currency->currency_code_3;
}
if ($componentsOptions['vm_curr_first']) {
$product_content .= $prod->product_currency . ' ' . number_format($price, 2) . '<br />';
} else {
$product_content .= number_format($price, 2) . ' ' . $prod->product_currency . '<br />';
}
}
if ($componentsOptions['vm_img']) {
$product_content .= '<img src="' . $this->getThumb($prod->product_thumb_image, $prod->product_image) . '" border="0" />';
}
if ($componentsOptions['vm_link']) {
$link = $createModel::getSefLink(array($prod->product_id, $prod->category_id), 'com_virtuemart');
$product_content = '<a href="' . $link . '">' . $product_content . '</a>';
}
if ($componentsOptions['vm_short_desc']) {
$product_content .= '<p>' . $prod->product_s_desc . '</p>';
}
if ($componentsOptions['vm_desc']) {
$product_content .= '<p>' . $prod->product_desc . '</p>';
}
$processedContent .= str_ireplace('<#vm_content#>', $product_content, $repeater);
}
$processedContent = preg_replace('!<#vm_repeater#[^>]*>(.*)<#/vm_repeater#>!is', $processedContent, $container[0]);
$processedContent = str_ireplace(array('<#vm_repeater#>', '<#/vm_repeater#>', '<#vm_products#>', '<#/vm_products#>'), '', $processedContent);
}
}
// remove tiny mce stuff like mce_src="..."
$processedContent = preg_replace('(mce_style=".*?")', '', $processedContent);
$processedContent = preg_replace('(mce_src=".*?")', '', $processedContent);
$processedContent = preg_replace('(mce_href=".*?")', '', $processedContent);
$processedContent = preg_replace('(mce_bogus=".*?")', '', $processedContent);
// convert relative to absolute paths
$processedContent = preg_replace('#(href|src)="([^:"]*)("|(?:(?:%20|\\s|[.]|\\+)[^"]*"))#i', $abs_path, $processedContent);
// escape dollar signs
$processedContent = str_ireplace('$', '\\$', $processedContent);
// insert articles
$template = preg_replace('!<#vm_products#>(.*)<#/vm_products#>!is', $processedContent, $template);
// remove placeholders
$response['template'] = str_ireplace(array('<#vm_products#>', '<#/vm_products#>'), '', $template);
}
return $response;
}