function display($tpl = 'pdf') { $type = 'raw'; $this->assignRef('type', $type); $viewName = jRequest::getWord('view', 'productdetails'); $class = 'VirtueMartView' . ucfirst($viewName); JLoader::register($class, JPATH_VM_SITE . '/views/' . $viewName . '/view.html.php'); $view = new $class(); $view->display($tpl); }
function display($tpl = 'pdf') { if (!file_exists(JPATH_VM_LIBRARIES . '/tcpdf/tcpdf.php')) { vmError('View pdf: For the pdf invoice, you must install the tcpdf library at ' . JPATH_VM_LIBRARIES . '/tcpdf'); } else { $viewName = jRequest::getWord('view', 'productdetails'); $class = 'VirtueMartView' . ucfirst($viewName); JLoader::register($class, JPATH_VM_SITE . '/views/' . $viewName . '/view.html.php'); $view = new $class(); $view->display($tpl); } }
function display($tpl = 'pdf') { $type = 'raw'; $this->assignRef('type', $type); $viewName = jRequest::getWord('view', 'productdetails'); $class = 'VirtueMartView' . ucfirst($viewName); if (!class_exists($class)) { require JPATH_VM_SITE . DS . 'views' . DS . $viewName . DS . 'view.html.php'; } $view = new $class(); $view->display($tpl); }
function display($tpl = 'pdf') { if (!file_exists(JPATH_VM_LIBRARIES . DS . 'tcpdf' . DS . 'tcpdf.php')) { vmError('View pdf: For the pdf invoice, you must install the tcpdf library at ' . JPATH_VM_LIBRARIES . DS . 'tcpdf'); } else { $viewName = jRequest::getWord('view', 'productdetails'); $class = 'VirtueMartView' . ucfirst($viewName); if (!class_exists($class)) { require JPATH_VM_SITE . DS . 'views' . DS . $viewName . DS . 'view.html.php'; } $view = new $class(); $view->display($tpl); } }
/** * For Express Checkout * @param $type * @param $name * @param $render * @return bool|null */ function plgVmOnSelfCallFE($type, $name, &$render) { if ($name != $this->_name || $type != 'vmpayment') { return FALSE; } $action = jRequest::getWord('action'); $virtuemart_paymentmethod_id = JRequest::getInt('virtuemart_paymentmethod_id'); //Load the method if (!($this->_currentMethod = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) { return NULL; // Another method was selected, do nothing } if ($action != 'SetExpressCheckout') { return false; } if (!class_exists('VirtueMartCart')) { require(JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php'); } $cart = VirtueMartCart::getCart(); $cart->virtuemart_paymentmethod_id = $virtuemart_paymentmethod_id; $cart->setCartIntoSession(); $paypalInterface = $this->_loadPayPalInterface(); $paypalInterface->setCart($cart); $paypalInterface->setTotal($cart->pricesUnformatted['billTotal']); $paypalInterface->loadCustomerData(); $paypalInterface->getExtraPluginInfo($this->_currentMethod); if (!$paypalInterface->validate()) { VmInfo('VMPAYMENT_PAYPAL_PAYMENT_NOT_VALID'); return false; } else { $app = JFactory::getApplication(); $app->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart&Itemid=' . JRequest::getInt('Itemid'), false)); } }
<?php /** * @package Joomla.Libraries * @subpackage Toolbar * * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; $view = jRequest::getWord('view', 'admin'); $langCurrent = jRequest::getWord('lang', null); $langs = VmConfig::get('active_languages', false); $flagPath = JURI::root(true) . '/administrator/components/com_virtuemart/assets/images/flag/'; ?> <footer class="navbar navbar-default navbar-fixed-bottom dark" role="navigation"> <div class="container"><span style="padding: 0px 32px"><?php echo jText::_('JFIELD_LANGUAGE_LABEL') . ' [' . $langCurrent . '] </span> '; foreach ($langs as $lang) { $tag = substr($lang, 0, 2); $url = JRoute::_('index.php?option=com_virtuemart&view=' . $view . '&lang=' . $tag . '&langswitch=' . $lang . '&tmpl=component', true); if ($langCurrent == $tag) { $btn = 'primary'; } else { $btn = 'default'; } $flagImage = '<img style="vertical-align: middle;" alt="' . $lang . '" src="' . $flagPath . $tag . '.png"> '; ?> <a class="btn btn-<?php echo $btn; ?>
function getLimitBox($sequence = 0) { $app = JFactory::getApplication(); // Initialize variables $limits = array(); //_viewall removed in j3 $viewall = isset($this->viewall) ? $this->viewall : $this->_viewall; $selected = $viewall ? 0 : $this->limit; // Build the select list if ($app->isAdmin() || jRequest::getWord('tmpl') == "component") { if (empty($sequence)) { $sequence = VmConfig::get('pagseq', 0); } if (!empty($sequence)) { $sequenceArray = explode(',', $sequence); if (count($sequenceArray > 1)) { foreach ($sequenceArray as $items) { $limits[$items] = JHtml::_('select.option', $items); } } } if (empty($limits)) { // $limits[15] = JHTML::_('select.option', 15); $limits[20] = JHTML::_('select.option', 20); $limits[50] = JHTML::_('select.option', 50); $limits[100] = JHTML::_('select.option', 100); $limits[200] = JHTML::_('select.option', 200); $limits[500] = JHTML::_('select.option', 500); } if (!array_key_exists($this->limit, $limits)) { $limits[$this->limit] = JHTML::_('select.option', $this->limit); ksort($limits); } $html = JHTML::_('select.genericlist', $limits, 'limit', 'class="inputbox input-mini" onchange="Joomla.submitform();"', 'value', 'text', $selected); } else { $getArray = JRequest::get('get'); $link = ''; //FIX BY STUDIO 42 unset($getArray['limit'], $getArray['language']); // foreach ($getArray as $key => $value ) $link .= '&'.$key.'='.$value; foreach ($getArray as $key => $value) { if (is_array($value)) { foreach ($value as $k => $v) { $link .= '&' . $key . '[' . $k . ']' . '=' . $v; } } else { $link .= '&' . $key . '=' . $value; } } $link[0] = "?"; $link = 'index.php' . $link; if (empty($sequence)) { $sequence = VmConfig::get('pagseq_' . $this->_perRow); } if (!empty($sequence)) { $sequenceArray = explode(',', $sequence); if (count($sequenceArray > 1)) { foreach ($sequenceArray as $items) { $limits[$items] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $items, false), $items); } } } if (empty($limits) or !is_array($limits)) { if ($this->_perRow === 1) { $this->_perRow = 5; } $limits[$this->_perRow * 5] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 5, false), $this->_perRow * 5); $limits[$this->_perRow * 10] = JHTML::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 10, false), $this->_perRow * 10); $limits[$this->_perRow * 20] = JHTML::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 20, false), $this->_perRow * 20); $limits[$this->_perRow * 50] = JHTML::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 50, false), $this->_perRow * 50); } if (!array_key_exists($this->limit, $limits)) { $limits[$this->limit] = JHTML::_('select.option', JRoute::_($link . '&limit=' . $this->limit, false), $this->limit); ksort($limits); } // fix studio42 false missing $selected = JRoute::_($link . '&limit=' . $selected, false); $js = 'onchange="window.top.location.href=this.options[this.selectedIndex].value"'; $html = JHTML::_('select.genericlist', $limits, '', 'class="inputbox input-mini" size="1" ' . $js, 'value', 'text', $selected); } return $html; }
/** * Creates structured option fields for all categories * * @todo: Connect to vendor data * @author RolandD, Max Milbers, jseros * @param array $selectedCategories All category IDs that will be pre-selected * @param int $cid Internally used for recursion * @param int $level Internally used for recursion * @return string $category_tree HTML: Category tree list */ public static function categoryListTreeLoop($selectedCategories = array(), $cid = 0, $level = 0, $disabledFields = array()) { self::$counter++; static $categoryTree = ''; static $isSite = null; if ($isSite === null) { $isSite = JFactory::getApplication()->isSite() && jRequest::getWord('tmpl') !== 'component'; } // $virtuemart_vendor_id = 1; static $vendorId = null; if ($vendorId === null) { if (!class_exists('Permissions')) { require JPATH_VM_ADMINISTRATOR . '/helpers/permissions.php'; } $vendorId = Permissions::getInstance()->isSupervendor(); } // vmSetStartTime('getCategories'); $categoryModel = VmModel::getModel('category'); $level++; $categoryModel->_noLimit = TRUE; // $app = JFactory::getApplication (); $records = $categoryModel->getCategories(false, $cid); // vmTime('getCategories','getCategories'); $selected = ""; if (!empty($records)) { foreach ($records as $key => $category) { $childId = $category->category_child_id; // block all childrens to prevent infinit loop if (in_array($childId, $disabledFields)) { continue; } if ($childId != $cid) { if (in_array($childId, $selectedCategories)) { $selected = 'selected="selected"'; } else { $selected = ''; } $disabled = ''; if (in_array($childId, $disabledFields)) { $disabled = 'disabled="disabled"'; } elseif ($category->shared == '0' && $vendorId != $category->virtuemart_vendor_id) { $disabled = 'disabled="disabled"'; } if ($disabled != '' && stristr($_SERVER['HTTP_USER_AGENT'], 'msie')) { //IE7 suffers from a bug, which makes disabled option fields selectable } else { $categoryTree .= '<option ' . $selected . ' ' . $disabled . ' value="' . $childId . '">'; $categoryTree .= str_repeat(' - ', $level - 1); $categoryTree .= $category->category_name . '</option>'; } } if ($categoryModel->hasChildren($childId)) { self::categoryListTreeLoop($selectedCategories, $childId, $level, $disabledFields); } } } return $categoryTree; }
/** * Start the administrator area table * * The entire administrator area with contained in a table which include the admin ribbon menu * in the left column and the content in the right column. This function sets up the table and * displayes the admin menu in the left column. */ static function startAdminArea($backEnd = true) { if (JRequest::getWord('format') == 'pdf') { return; } if (JRequest::getWord('tmpl') == 'component') { self::$backEnd = false; include 'front/edit.html.php'; } if (self::$vmAdminAreaStarted) { return; } self::$vmAdminAreaStarted = true; $front = JURI::root(true) . '/components/com_virtuemart/assets/'; $admin = JURI::root(true) . '/administrator/components/com_virtuemart/assets/'; $document = JFactory::getDocument(); //loading defaut admin CSS // $document->addStyleSheet($admin.'css/admin_ui.css'); // $document->addStyleSheet($admin.'css/admin_menu.css'); JHtml::_('bootstrap.framework'); if (JVM_VERSION === 2 || self::$backEnd === false) { $document->addStyleSheet($front . 'css/ui/bootstrap.min.css'); // JHtml::_('bootstrap.loadCss') ; JHtml::_('bootstrap.tooltip'); if (JVM_VERSION === 2) { $document->addScript($admin . 'js/j25fixes.js'); } $document->setMetadata('viewport', 'width=device-width, initial-scale=1.0'); JHtml::_('behavior.framework'); } $document->addStyleSheet($admin . 'css/admin.styles.css'); $document->addStyleSheet($admin . 'css/toolbar_images.css'); $document->addStyleSheet($admin . 'css/menu_images.css'); $document->addStyleSheet($admin . 'css/fileinput.css'); // $document->addStyleSheet($front.'css/chosen.css'); // $document->addStyleSheet($front.'css/vtip.css'); $document->addStyleSheet($front . 'css/jquery.fancybox-1.3.4.css'); //$document->addStyleSheet($admin.'css/jqtransform.css'); //loading defaut script JHtml::_('behavior.framework'); // JHtml::_('bootstrap.tooltip'); $document->addScript($front . 'js/fancybox/jquery.mousewheel-3.0.4.pack.js'); $document->addScript($front . 'js/fancybox/jquery.easing-1.3.pack.js'); $document->addScript($front . 'js/fancybox/jquery.fancybox-1.3.4.pack.js'); $document->addScript($admin . 'js/jquery.coookie.js'); // $document->addScript($front.'js/chosen.jquery.min.js'); JHtml::_('formbehavior.chosen', 'select'); $document->addScript($admin . 'js/vm2admin.js'); $document->addScript($admin . 'js/fileinput.js'); //$document->addScript($admin.'js/jquery.jqtransform.js'); if (JText::_('COM_VIRTUEMART_JS_STRINGS') == 'COM_VIRTUEMART_JS_STRINGS') { $vm2string = "editImage: 'edit image',select_all_text: 'select all options',select_some_options_text: 'select some options'"; } else { $vm2string = JText::_('COM_VIRTUEMART_JS_STRINGS'); } //prevent joomlaJtext bug. JText::script('JGLOBAL_SELECT_SOME_OPTIONS'); // old type image var tip_image='".JURI::root(true)."/components/com_virtuemart/assets/js/images/vtip_arrow.png'; // fix for jsonRequest in front admin $baseUrlCurrent = self::$backEnd === false ? '/' : '/administrator/'; $document->addScriptDeclaration("\n//<![CDATA[\n\t\tvar vmBaseUrl = '" . JURI::root(true) . $baseUrlCurrent . "';\n\t\tvar vm2string ={" . $vm2string . "} ;\n\t\t jQuery( function(\$) {\n\n\t\t\t\$('dl#system-message').hide().slideDown(400);\n\t\t\t\$('.virtuemart-admin-area .toggler').vm2admin('toggle');\n\t\t\t\$('#admin-ui-menu').vm2admin('accordeon');\n\t\t\t// if ( \$('#adminForm > ul').length ) {\n\t\t\t\t// \$('#adminForm > ul').vm2admin('tabs',virtuemartcookie);\n\t\t\t\t//.find('select').chosen({enable_select_all: true,select_all_text : vm2string.select_all_text,select_some_options_text:vm2string.select_some_options_text}); \n\t\t\t// }\n\n\t\t\t// TIPS IS now from bootstrap \$('#content-box [title]').vm2admin('tips',tip_image);\n\t\t\tjQuery('.hasTip').tooltip({});\n\n\t\t\t\$('.fb-modal-toggle,.modalbox').fancybox();\n\t\t\t// \$('.modal').modal();\n\t\t\t\$('.reset-value').click( function(e){\n\t\t\t\te.preventDefault();\n\t\t\t\tnone = '';\n\t\t\t\tjQuery(this).parent().find('.ui-autocomplete-input').val(none);\n\t\t\t\t\n\t\t\t});\n\n\t\t});\n//]]>\n\t\t"); ?> <?php // Include ALU System if (self::$backEnd) { require_once JPATH_VM_ADMINISTRATOR . DS . 'liveupdate' . DS . 'liveupdate.php'; ?> <div class="vm2admin"> <div class="row-fluid"> <div class="span12"> <div class="btn btn-large btn-inverse" id="sidebar-toggle"><i class="icon-chevron-left"></i></div> <div class="span3 j-sidebar-container" id="j-sidebar-container"> <div class="well well-small"><a href="index.php?option=com_virtuemart&view=virtuemart" ><div class="menu-vmlogo"></div></a></div> <?php AdminUIHelper::showAdminMenu(); if ($admin = JFactory::getUser()->authorise('core.admin')) { ?> <div class="menu-notice hidden-phone"> <?php echo LiveUpdate::getIcon(array(), 'notice'); ?> <?php echo VmConfig::getInstalledVersion(); ?> </div> <?php } ?> </div> <?php } $view = jRequest::getWord('view', 'virtuemart'); if (!self::$backEnd) { $span = $view === 'virtuemart' ? 'span8' : ''; } elseif ($view == 'virtuemart') { $span = 'span5'; } else { $span = 'span9'; } ?> <div id="j-main-container" class="<?php echo $span; ?> "> <?php }
function saveorder($cids = array(), $orders, $filter = NULL) { // JSession::checkToken () or jexit ('Invalid Token'); $virtuemart_category_id = JRequest::getInt('virtuemart_category_id', 0); $orderDir = jRequest::getWord('filter_order_Dir') == 'ASC' ? 'ASC' : 'DESC'; $ordered = 0; $msg = ''; // get old orders $q = 'SELECT `id`,`virtuemart_product_id`,`ordering` FROM `#__virtuemart_product_categories` WHERE virtuemart_category_id=' . (int) $virtuemart_category_id . ' ORDER BY `ordering` ASC'; //'.$orderDir; $this->_db->setQuery($q); $products = $this->_db->loadObjectList(); // set new order array(); $newOrders = array(); foreach ($cids as $key => $cid) { $newOrders[$cid] = $key; } $toUpdate = array(); // list of product to update $when = ''; // check ordered products from DB foreach ($products as $oldOrder => $product) { $ordering = $oldOrder; // set the theorical ordering from this level //test if we have a new ordering if (isset($newOrders[$product->virtuemart_product_id])) { if (!isset($start)) { $start = $ordering; // set the first found from request Index if ($orderDir === 'DESC') { $start += count($cids); } // add counted from request to start for DESC order } // set the new order from requested index key $tmpOrder = $newOrders[$product->virtuemart_product_id]; if ($orderDir === 'ASC') { $ordering = $start + $tmpOrder; } else { $ordering = $start - $tmpOrder; } } //only apply for new orderings if ($product->ordering === $ordering) { continue; } $when .= ' WHEN ' . $product->id . ' THEN "' . $ordering . '" '; $toUpdate[] = $product->id; $msg .= $ordering . ' ' . $product->id . ', '; $ordered++; } // this update all, in one sql connection if ($ordered) { $in = implode(",", $toUpdate); $this->_db->setQuery('UPDATE `#__virtuemart_product_categories` SET ordering = CASE id ' . $when . ' END WHERE id IN (' . $in . ')'); if (!$this->_db->execute()) { vmError($this->_db->getErrorMsg()); return FALSE; } } // jexit(); return $ordered; }
/** * Order category group * * order is saved for all viewed records, this mean old function was obselete * @author Patrick Kohl/Studio42 * @param array $cats categories to order * @return bool */ public function saveorder($cids, $order) { $category_id = JRequest::getInt('filter_category_id'); $search = jRequest::getVar('search'); $orderDir = jRequest::getWord('filter_order_Dir') == 'ASC' ? 'ASC' : 'DESC'; // impossible case if (empty($cids[0])) { return 0; } // get old orders(including all items from same parent to get the right INDEX in array) $q = 'SELECT * FROM `#__virtuemart_category_categories` WHERE category_parent_id in (SELECT category_parent_id FROM `#__virtuemart_category_categories` WHERE category_child_id = ' . (int) $cids[0] . ') ORDER BY `ordering` ASC'; $this->_db->setQuery($q); $categories = $this->_db->loadObjectList(); $ordered = 0; $msg = ''; // set new order array(); $newOrders = array(); foreach ($cids as $key => $cid) { $newOrders[$cid] = $key; } $toUpdate = array(); // list of category to update $when = ''; // check ordered categories from DB foreach ($categories as $oldOrder => $category) { $ordering = $oldOrder; // set the theorical ordering from this level //test if we have a new ordering if (isset($newOrders[$category->category_child_id])) { if (!isset($start)) { $start = $ordering; if ($orderDir === 'DESC') { $start += count($cids); } // add counted from request to start for DESC order } // set the new order from request $tmpOrder = $newOrders[$category->category_child_id]; $ordering = $start; if ($orderDir === 'ASC') { $ordering = $ordering + $tmpOrder; } else { $ordering = $ordering - $tmpOrder; } } //only apply for new orderings if ($category->ordering === $ordering) { continue; } $when .= ' WHEN ' . $category->category_child_id . ' THEN "' . $ordering . '" '; $toUpdate[] = $category->category_child_id; $msg .= $ordering . ' ' . $category->category_child_id . ', '; $ordered++; } if ($ordered) { $in = implode(",", $toUpdate); // this update all, in one sql connection $this->_db->setQuery('UPDATE `#__virtuemart_category_categories` SET ordering = CASE category_child_id ' . $when . ' END WHERE category_child_id IN (' . $in . ')'); if (!$this->_db->execute()) { vmError($this->_db->getErrorMsg()); return FALSE; } } // echo json_encode($newOrders); return $ordered . ' ' . $msg; }
public function massxref_cats_exe($add = false) { $db = JFactory::getDbo(); $virtuemart_cat_ids = JRequest::getVar('cid', array(), '', 'ARRAY'); JArrayHelper::toInteger($virtuemart_cat_ids); $session = JFactory::getSession(); $cids = unserialize($session->get('vm_product_ids', array(), 'vm')); $productModel = VmModel::getModel('product'); foreach ($cids as $cid) { // get old categries if ($add) { $q = 'SELECT `virtuemart_category_id` FROM `#__virtuemart_product_categories` '; $q .= ' WHERE `virtuemart_product_id` =' . (int) $cid; $db->setQuery($q); if (!($old_ids = $db->loadColumn())) { $old_ids = array(); } $cat_ids = array_merge($old_ids, $virtuemart_cat_ids); $cat_ids = array_unique($cat_ids, SORT_NUMERIC); } else { $cat_ids = $virtuemart_cat_ids; } $data = array('virtuemart_product_id' => $cid, 'virtuemart_category_id' => $cat_ids); $data = $productModel->updateXrefAndChildTables($data, 'product_categories', TRUE); } $q = 'SELECT `category_name` FROM `#__virtuemart_categories_' . VMLANG . '` '; $q .= ' WHERE `virtuemart_category_id` IN (' . implode(',', $virtuemart_cat_ids) . ')'; $db->setQuery($q); if ($results = $db->loadColumn()) { $msg = (string) $add . ' ' . implode(',', $results + $cat_ids); } else { $msg = 'no results'; } if (jRequest::getWord('format') == "json") { $this->setRedirect(null, $msg); } // this is always done in json, no need to go in another task }
/** * Loads the pagination * * @author Max Milbers, Patrick Kohl */ public function getPagination($perRow = 5) { $app = JFactory::getApplication(); if (empty($this->_limit)) { $this->setPaginationLimits(); } if ($app->isAdmin() || jRequest::getWord('tmpl') == "component") { JLoader::register('VmPagination', JPATH_VM_ADMINISTRATOR . '/helpers/vmpagination.php'); } else { JLoader::register('VmPagination', JPATH_VM_SITE . '/helpers/vmpagination.php'); } $this->_pagination = new VmPagination($this->_total, $this->_limitStart, $this->_limit, $perRow); // } // vmdebug('$this->pagination $total '.$this->_total,$this->_pagination);vmTrace('getPagination'); return $this->_pagination; }