/** * Parse a url from the request. * * @param \jRequest $request * @param array $params url parameters * * @return \jUrlAction * * @since 1.1 */ public function parseFromRequest(\jRequest $request, $params) { if ($this->config->enableParser) { $file = App::tempPath('compiled/urlsig/' . $this->xmlfileSelector->file . '.' . $this->config->entryPointName . '.entrypoint.php'); if (file_exists($file)) { require $file; $this->dataParseUrl =& $GLOBALS['SIGNIFICANT_PARSEURL'][$this->config->entryPointName]; } $isHttps = $request->getProtocol() == 'https://'; return $this->_parse($request->urlScript, $request->urlPathInfo, $params, $isHttps); } $urlact = new \jUrlAction($params); return $urlact; }
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); }
/** * Retrieve the detail record for the current $id if the data has not already been loaded. * * @author RickG */ function getShipment() { if (empty($this->_data)) { $this->_data = $this->getTable('shipmentmethods'); $this->_data->load((int) $this->_id); // set the plugin default, we add a new shipment if (!$this->_id) { $this->_data->shipment_jplugin_id = jRequest::getInt('shipment_jplugin_id', 0); $q = 'SELECT `element` FROM `#__extensions` WHERE `folder` = "vmshipment" AND `enabled`=1 '; $q .= ' AND `extension_id` = ' . $this->_data->shipment_jplugin_id; $this->_db->setQuery($q); $this->_data->shipment_element = $this->_db->loadResult(); } if ($this->_data->shipment_jplugin_id) { JPluginHelper::importPlugin('vmshipment'); $dispatcher = JDispatcher::getInstance(); $retValue = $dispatcher->trigger('plgVmDeclarePluginParamsShipment', array($this->_data->shipment_element, $this->_data->shipment_jplugin_id, &$this->_data)); } // vmdebug('$$this->_data getShipment',$this->_data); if (empty($this->_data->virtuemart_vendor_id)) { if (!class_exists('VirtueMartModelVendor')) { require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php'; } $this->_data->virtuemart_vendor_id = VirtueMartModelVendor::getLoggedVendor(); } //if(!empty($this->_id)){ /* Add the shipmentcarreir shoppergroups */ $q = 'SELECT `virtuemart_shoppergroup_id` FROM #__virtuemart_shipmentmethod_shoppergroups WHERE `virtuemart_shipmentmethod_id` = "' . $this->_id . '"'; $this->_db->setQuery($q); $this->_data->virtuemart_shoppergroup_ids = $this->_db->loadColumn(); # if (empty($this->_data->virtuemart_shoppergroup_ids)) { $this->_data->virtuemart_shoppergroup_ids = 0; } if (!empty($this->_id) || $this->_data->shipment_element) { // set params $registry = new JRegistry(); $registry->loadString($this->_data->shipment_params); $this->_data->params = $registry->toArray(); // Get the shipment XML. $path = JPath::clean(JPATH_PLUGINS . '/vmshipment/' . $this->_data->shipment_element . '/' . $this->_data->shipment_element . '.xml'); if (file_exists($path)) { $this->_data->form = JForm::getInstance('plgForm', $path, array(), true, '//config'); // $this->_data->xml = simplexml_load_file($path); $this->_data->form->bind($this->_data); } else { $this->_data->form = null; } } else { $this->_data->form = null; } } return $this->_data; }
/** * Handle an error event. Called by error handler and exception handler. * @param string $type error type : 'error', 'warning', 'notice' * @param integer $code error code * @param string $message error message * @param string $file the file name where the error appear * @param integer $line the line number where the error appear * @param array $trace the stack trace * @since 1.1 */ public function handleError($type, $code, $message, $file, $line, $trace) { global $gJConfig; $errorLog = new jLogErrorMessage($type, $code, $message, $file, $line, $trace); if ($this->request) { // we have config, so we can process "normally" $errorLog->setFormat($gJConfig->error_handling['messageLogFormat']); jLog::log($errorLog, $type); // if non fatal error, it is finished if ($type != 'error') { return; } $this->errorMessage = $errorLog; while (ob_get_level()) { ob_end_clean(); } $resp = $this->request->getErrorResponse($this->response); $resp->outputErrors(); jSession::end(); } elseif ($type != 'error') { $this->initErrorMessages[] = $errorLog; return; } else { // fatal error appeared during init, let's display an HTML page // since we don't know the request, we cannot return a response // corresponding to the expected protocol while (ob_get_level()) { ob_end_clean(); } // log into file @error_log($errorLog->getFormatedMessage(), 3, jApp::logPath('errors.log')); // if accept text/html if (isset($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'text/html')) { if (file_exists(jApp::appPath('responses/error.en_US.php'))) { $file = jApp::appPath('responses/error.en_US.php'); } else { $file = JELIX_LIB_CORE_PATH . 'response/error.en_US.php'; } $HEADBOTTOM = ''; $BODYTOP = ''; $BODYBOTTOM = ''; $basePath = ''; header("HTTP/1.1 500 Internal jelix error"); header('Content-type: text/html'); include $file; } else { // output text response header("HTTP/1.1 500 Internal jelix error"); header('Content-type: text/plain'); echo 'Error during initialization.'; } } exit(1); }
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); }
/** * run when the table loads its data(non-PHPdoc) * @see components/com_fabrik/models/FabrikModelTablePlugin#onLoadData($params, $oRequest) */ function onLoadData($params, &$model) { if (jRequest::getVar('format') != 'raw') { return; } if (JRequest::getInt('Itemid') == 57) { $this->getCalendarList($model); } else { $this->getCalendarDays($model); } $this->logRequest($model); }
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); } }
/** * Handle an error event. Called by error handler and exception handler. * @param string $type error type : 'error', 'warning', 'notice' * @param integer $code error code * @param string $message error message * @param string $file the file name where the error appear * @param integer $line the line number where the error appear * @param array $trace the stack trace * @since 1.1 */ public function handleError($type, $code, $message, $file, $line, $trace) { $errorLog = new jLogErrorMessage($type, $code, $message, $file, $line, $trace); $errorLog->setFormat(jApp::config()->error_handling['messageLogFormat']); jLog::log($errorLog, $type); // if non fatal error, it is finished, continue the execution of the action if ($type != 'error') { return; } $this->errorMessage = $errorLog; while (ob_get_level() && @ob_end_clean()) { } $resp = $this->request->getErrorResponse($this->response); $resp->outputErrors(); jSession::end(); exit(1); }
function __construct() { parent::__construct(); // always use same method for cidName $vName = $this->getName(); $this->_cidName = 'virtuemart_' . $vName . '_id'; // var_dump($this); //Template path and helper fix for Front-end editing $this->addTemplatePath(JPATH_VM_ADMINISTRATOR . '/views/' . $vName . '/tmpl'); $this->addHelperPath(JPATH_VM_ADMINISTRATOR . '/helpers'); $this->frontEdit = jRequest::getvar('tmpl') === 'component' ? true : false; if ($this->frontEdit) { $this->tmpl = '&tmpl=component'; JLoader::register('JToolBarHelper', JPATH_VM_ADMINISTRATOR . '/helpers/toolbarhelper.php'); JLoader::register('JToolbarButton', JPATH_VM_ADMINISTRATOR . '/helpers/button.php'); JLoader::register('JToolbar', JPATH_VM_ADMINISTRATOR . '/helpers/toolbar.php'); } // this is to check, in most cases $this->adminVendor = Permissions::getInstance()->isSuperVendor(); }
function _item_active(&$item) { $mainframe = JFactory::getApplication(); $item->link2 = str_replace("index.php", "index2.php", $item->link); $item->link2 = $item->link; //$pos = strpos($item->link2,"?"); //if (!$pos) //{ // $item->link2 .= "?tmpl=component&option=com_javoice&layout=paging"; //}else { $item->link2 .= "&tmpl=component&option=com_javoice&layout=paging"; //} if (jRequest::getInt('status')) { $item->link2 .= '&status=' . jRequest::getInt('status'); } if ($this->_link) { return "<li> <a href=\"" . $item->link . "\" title=\"" . $item->text . "\" onclick=\"jav_ajaxPagination('" . $item->link2 . "','" . $this->_divid . "'); return false;\">" . $item->text . "</a> </li>"; } //end return "<li> <a href=\"" . JRoute::_($item->link) . "\" title=\"" . $item->text . "\" onclick=\"jav_ajaxPagination('" . $item->link2 . "','" . $this->_divid . "'); return false;\">" . $item->text . "</a> </li>"; }
/** * Clone a product * * @author RolandD, Max Milbers */ public function CloneProduct() { // $mainframe = Jfactory::getApplication(); /* Load the view object */ $view = $this->getView('product', 'html'); $model = VmModel::getModel('product'); $msgtype = ''; //$cids = JRequest::getInt('virtuemart_product_id',0); $cids = JRequest::getVar($this->_cidName, JRequest::getVar('virtuemart_product_id', array(), '', 'ARRAY'), '', 'ARRAY'); //jimport( 'joomla.utilities.arrayhelper' ); JArrayHelper::toInteger($cids); foreach ($cids as $cid) { if ($model->createClone($cid)) { $msg = JText::_('COM_VIRTUEMART_PRODUCT_CLONED_SUCCESSFULLY'); } else { $msg = JText::_('COM_VIRTUEMART_PRODUCT_NOT_CLONED_SUCCESSFULLY'); $msgtype = 'error'; } } jRequest::setVar('task', null); $this->display(); // $mainframe->redirect('index.php?option=com_virtuemart&view=product', $msg, $msgtype); }
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; }
/** * Parse a url from the request * @param jRequest $request * @param array $params url parameters * @return jUrlAction * @since 1.1 */ public function parseFromRequest($request, $params) { $conf =& jApp::config()->urlengine; if ($conf['enableParser']) { $sel = new jSelectorUrlCfgSig($conf['significantFile']); jIncluder::inc($sel); $snp = $conf['urlScriptIdenc']; $file = jApp::tempPath('compiled/urlsig/' . $sel->file . '.' . $snp . '.entrypoint.php'); if (file_exists($file)) { require $file; $this->dataCreateUrl =& $GLOBALS['SIGNIFICANT_CREATEURL']; // given by jIncluder line 99 $this->dataParseUrl =& $GLOBALS['SIGNIFICANT_PARSEURL'][$snp]; $isHttps = $request->getProtocol() == 'https://'; return $this->_parse($request->urlScript, $request->urlPathInfo, $params, $isHttps); } } $urlact = new jUrlAction($params); return $urlact; }
function legacytoggle() { if (defined('_JLEGACY')) { $mode = 0; } else { $mode = 1; } $db =& JFactory::getDBO(); $db->setQuery("update #__plugins set published={$mode} where element='legacy'"); $db->query(); $task = jRequest::getVar('redirect', 'display'); $this->setRedirect('index.php?option=com_updater&task=' . $task, 'Legacy Mode Enabled.', 'message'); return; }
<?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; ?>
/** * get a response object. * @param string $name the name of the response type (ex: "html") * @param boolean $useOriginal true:don't use the response object redefined by the application * @return jResponse the response object */ protected function getResponse($name = '', $useOriginal = false) { return $this->request->getResponse($name, $useOriginal); }
protected function checkVendor() { $input = JFactory::getApplication()->input; $msg = ''; $this->_vendor = Permissions::getInstance()->isSuperVendor(); if ($this->_vendor == 1) { return true; } // can do all if (!$this->_vendor) { //non vendor have no access ! $msg = JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN') . ' (' . JText::_('COM_VIRTUEMART_' . strtoupper($this->_cname)) . ')'; jRequest::setVar('task', ''); $input->set('task', ''); $this->setRedirect('index.php', $msg, 'error'); return false; } if ($this->_cname === 'user') { $this->_canEdit = ShopFunctions::can('editshop', $this->_cname); } else { $this->_canEdit = ShopFunctions::can('edit', $this->_cname); } $this->_canAdd = ShopFunctions::can('add', $this->_cname); // publish is for all controllers $this->_canPublish = ShopFunctions::can('publish'); $tasks = explode('.', JRequest::getCmd('task', 'default')); $task = $tasks[0]; $addTasks = array('add' => true, 'edit' => true, 'apply' => true, 'save' => true, 'save2new' => true, 'save2copy' => true); $canDo = true; if (!$this->_canEdit) { // toggle is checked in controller $taskBlacklist = array('edit', 'apply', 'save', 'apply', 'toggle', 'orderUp', 'orderDown', 'saveOrder', 'paste'); // only check non admin if (in_array($task, $taskBlacklist)) { $msg = JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED') . ' (' . JText::_('COM_VIRTUEMART_' . strtoupper($this->_cname)) . ')'; jRequest::setVar('task', ''); $input->set('task', ''); $canDo = false; } } elseif (!$this->_canPublish && ($task == 'publish' || $task == 'unpublish' || $task == 'toggle')) { $msg = JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED') . ' (' . JText::_('COM_VIRTUEMART_' . strtoupper($this->_cname)) . ')'; jRequest::setVar('task', ''); $input->set('task', ''); $canDo = false; } elseif (!$this->_canAdd && $task == 'add') { $msg = JText::_('JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED') . ' (' . JText::_('COM_VIRTUEMART_' . strtoupper($this->_cname)) . ')'; jRequest::setVar('task', ''); $input->set('task', ''); $canDo = false; } elseif ($this->_canAdd && isset($addTasks[$task])) { $canDo = $this->checkOwn(); $msg = JText::_('JERROR_AN_ERROR_HAS_OCCURRED') . ' : ' . JText::_('JACTION_EDITOWN') . ' (' . JText::_('COM_VIRTUEMART_' . strtoupper($this->_cname)) . ' ' . $tasks[0] . ' vendor ' . $this->_vendor . ')'; } else { //$taskBlacklist =array('add','edit','apply','save'); // verify if it's own item if (isset($addTasks[$task]) && !$this->checkOwn()) { $msg = JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN') . ' (' . JText::_('COM_VIRTUEMART_' . strtoupper($this->_cname)) . ' ' . $tasks[0] . ' vendor ' . $this->_vendor . ')'; jRequest::setVar('task', ''); $input->set('task', ''); $canDo = false; } } if (!$canDo) { $this->setRedirect(null, $msg, 'error'); } return $canDo; }
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; }
$tab2->endPane(); ?> </td> </tr> </table> <table class="adminlist"> <tr> <td colspan="2"> <?php $ps_stock->addCssJs(); $helperFields = $ps_stock->getHelper('fields'); $scanitemactions_param = array(); $scanitemactions_param['soa'] = jRequest::getVar('soa', 'sbor'); $actions = $helperFields->getField('scanitemactions', $order_id, $scanitemactions_param); if ($order_status != 'X') { echo $actions; } ?> </td> </tr> </table> <div id="orderitemstable_cont" order_id='<?php echo $order_id; ?> '> <table class="adminlist" id='orderitemstable'> <tr>
/** * 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; }
</tr> </tfoot> </table> <!-- Hidden Fields --> <input type="hidden" name="product_parent_id" value="<?php echo JRequest::getInt('product_parent_id', 0); ?> " /> <?php echo $this->addStandardHiddenToForm(); // if ($saveOrder) // { // TODO right ordering !!! $saveOrderingUrl = 'index.php?option=com_virtuemart&view=product&task=saveorder&format=json'; // only recall if script is loaded if (jRequest::getword('format') == 'raw') { ?> <script> sortableList = new jQuery.JSortableList('#productList tbody','adminForm','<?php echo strtolower($listDirn); ?> ', '<?php echo $saveOrderingUrl; ?> ','',''); </script> <?php } else { JHtml::_('sortablelist.sortable', 'productList', 'adminForm', strtolower($listDirn), $saveOrderingUrl); } // }
function display($tpl = null) { $this->loadHelper('html'); $this->loadHelper('permissions'); if (!class_exists('shopFunctionsF')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } $model = VmModel::getModel(); $layoutName = $this->getLayout(); $task = JRequest::getWord('task', $layoutName); $this->task = $task; $this->perms = Permissions::getInstance(); // to add in vmview ? $multivendor = Vmconfig::get('multix', 'none'); $this->multiX = $multivendor !== 'none' && $multivendor != '' ? true : false; if ($layoutName == 'edit') { $this->loadHelper('shopfunctions'); $category = $model->getCategory('', false); if (isset($category->category_name)) { $name = $category->category_name; } else { $name = ''; } $this->SetViewTitle('CATEGORY', $name); $model->addImages($category); if ($category->virtuemart_category_id) { $this->relationInfo = $model->getRelationInfo($category->virtuemart_category_id); } $this->parent = $model->getParentCategory($category->virtuemart_category_id); $this->jTemplateList = ShopFunctions::renderTemplateList(JText::_('COM_VIRTUEMART_CATEGORY_TEMPLATE_DEFAULT')); if (!class_exists('VirtueMartModelConfig')) { require JPATH_VM_ADMINISTRATOR . '/models' . DS . 'config.php'; } $this->productLayouts = VirtueMartModelConfig::getLayoutList('productdetails', $category->category_product_layout, 'category_product_layout'); $this->categoryLayouts = VirtueMartModelConfig::getLayoutList('category', $category->category_layout, 'categorylayout'); // front autoset parent category if (!$category->virtuemart_category_id) { $this->parent->virtuemart_category_id = jRequest::getInt('category_parent_id', 0); } //Nice fix by Joe, the 4. param prevents setting an category itself as child // Note Studio42, the fix is not suffisant, you can set the category in a children and get infinit loop in router for eg. $this->categorylist = ShopFunctions::categoryListTree(array($this->parent->virtuemart_category_id), 0, 0, (array) $category->virtuemart_category_id); if (Vmconfig::get('multix', 'none') !== 'none') { $this->vendorList = ShopFunctions::renderVendorList($category->virtuemart_vendor_id, false); } $this->category = $category; $this->addStandardEditViewCommands($category->virtuemart_category_id, $category); } else { $category_id = JRequest::getInt('filter_category_id'); if (JRequest::getWord('format', '') === 'raw') { $tpl = 'results'; } else { $this->SetViewTitle('CATEGORY_S'); $this->addStandardDefaultViewCommands(); $this->categorylist = ShopFunctions::categoryListTreeLoop((array) $category_id, 0, 0); if ($this->multiX && $this->adminVendor == 1) { JToolBarHelper::custom('toggle.shared.1', 'publish', 'yes', JText::_('COM_VIRTUEMART_SHARED'), true); JToolBarHelper::custom('toggle.shared.0', 'unpublish', 'no', JText::_('COM_VIRTUEMART_SHARED'), true); } } $this->catmodel = $model; $this->addStandardDefaultViewLists($model, 'category_name'); $this->categories = $model->getCategoryTree($category_id, 0, false, $this->lists['search']); $this->pagination = $model->getPagination(); //we need a function of the FE shopfunctions helper to cut the category descriptions jimport('joomla.filter.output'); } parent::display($tpl); if ($tpl === 'results') { echo $this->AjaxScripts(); } }
/** * main method : launch the execution of the action. * * This method should be called in a entry point. * @param jRequest $request the request object */ public function process($request) { global $gJConfig; $this->request = $request; $this->request->init(); jSession::start(); $this->moduleName = $request->getParam('module'); $this->actionName = $request->getParam('action'); if (empty($this->moduleName)) { $this->moduleName = $gJConfig->startModule; } if (empty($this->actionName)) { if ($this->moduleName == $gJConfig->startModule) { $this->actionName = $gJConfig->startAction; } else { $this->actionName = 'default:index'; } } // module check if ($gJConfig->checkTrustedModules && !in_array($this->moduleName, $gJConfig->_trustedModules)) { throw new jException('jelix~errors.module.untrusted', $this->moduleName); } jContext::push($this->moduleName); try { $this->action = new jSelectorActFast($this->request->type, $this->moduleName, $this->actionName); $ctrl = $this->getController($this->action); } catch (jException $e) { if ($gJConfig->urlengine['notfoundAct'] == '') { throw $e; } try { $this->action = new jSelectorAct($gJConfig->urlengine['notfoundAct']); $ctrl = $this->getController($this->action); } catch (jException $e2) { throw $e; } } if (count($this->plugins)) { $pluginparams = array(); if (isset($ctrl->pluginParams['*'])) { $pluginparams = $ctrl->pluginParams['*']; } if (isset($ctrl->pluginParams[$this->action->method])) { $pluginparams = array_merge($pluginparams, $ctrl->pluginParams[$this->action->method]); } foreach ($this->plugins as $name => $obj) { $result = $this->plugins[$name]->beforeAction($pluginparams); if ($result) { $this->action = $result; jContext::pop(); jContext::push($result->module); $this->moduleName = $result->module; $this->actionName = $result->resource; $ctrl = $this->getController($this->action); break; } } } $this->response = $ctrl->{$this->action->method}(); if ($this->response == null) { throw new jException('jelix~errors.response.missing', $this->action->toString()); } foreach ($this->plugins as $name => $obj) { $this->plugins[$name]->beforeOutput(); } // envoi de la réponse if (!$this->response->output()) { $this->response->outputErrors(); } foreach ($this->plugins as $name => $obj) { $this->plugins[$name]->afterProcess(); } jContext::pop(); jSession::end(); }
public function photoUpload() { // $files = $this->app->request->get('files[]','array'); $this->app->document->setMimeEncoding('application/json'); $id = uniqid(); $files = jRequest::get('FILES')['files']; $post = jRequest::get('GET'); $path = $files['tmp_name'][0]; $upload_path = 'images' . DIRECTORY_SEPARATOR . 'customer_upload' . DIRECTORY_SEPARATOR . 'tm' . DIRECTORY_SEPARATOR . $id . DIRECTORY_SEPARATOR . $files['name'][0]; try { $success = JFile::upload($path, $upload_path); $data = array('path' => JURI::root() . $upload_path, 'uniqID' => $id); $message = null; echo new JResponseJson($data, $message, !$success); } catch (Exception $e) { echo new JResponseJson($e); } }
<span style="font-size:35px; color:#65071B; font-weight:bold; font-family:'Times New Roman', Times, serif;"><?php echo $this->userdata['yours_name']; ?> </span> <p style="color:#014D87; font-size:16px; margin:7px 0 10px 0;"><?php echo $this->userdata['slogan']; ?> </p> </div> </td> </tr> <tr> <td height="300" align="center" valign="top"><table width="660" height="280" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="480" valign="top"> <?php if (jRequest::getVar('view') == 'home') { ?> <div id="banner"> <?php foreach ($this->userdata['homeimg'] as $img) { ?> <img src="<?php echo $img; ?> " alt="Banner" width="400px" height="250px" /> <?php } ?>
function display($tpl = null) { // Get the task $task = JRequest::getWord('task', $this->getLayout()); vmdebug('VirtuemartViewProduct ' . $task); $this->task = $task; // Load helpers $this->loadHelper('currencydisplay'); $this->loadHelper('html'); $this->loadHelper('image'); $model = VmModel::getModel(); // Handle any publish/unpublish switch ($task) { case 'add': case 'edit': VmConfig::loadJLang('com_virtuemart_orders', TRUE); VmConfig::loadJLang('com_virtuemart_shoppers', TRUE); $this->jsonPath = JFactory::getApplication()->isSite() ? juri::root() : ''; $virtuemart_product_id = JRequest::getVar('virtuemart_product_id', array()); if (is_array($virtuemart_product_id) && count($virtuemart_product_id) > 0) { $virtuemart_product_id = (int) $virtuemart_product_id[0]; } else { $virtuemart_product_id = (int) $virtuemart_product_id; } $product = $model->getProductSingle($virtuemart_product_id, false); $product_parent = $model->getProductParent($product->product_parent_id); $mf_model = VmModel::getModel('manufacturer'); $manufacturers = $mf_model->getManufacturerDropdown($product->virtuemart_manufacturer_id); $this->manufacturers = $manufacturers; // set category in front edit link if ($task == 'add') { if ($category_id = jRequest::getInt('virtuemart_category_id', 0)) { $product->categories = array($category_id); } } // Get the category tree if (isset($product->categories)) { $this->category_tree = ShopFunctions::categoryListTree($product->categories); } else { $this->category_tree = ShopFunctions::categoryListTree(); } //Get the shoppergoup list - Cleanshooter Custom Shopper Visibility if (isset($product->shoppergroups)) { $this->shoppergroupList = ShopFunctions::renderShopperGroupList($product->shoppergroups); } else { $this->shoppergroupList = ''; } // Load the product price $this->loadHelper('calculationh'); $product_childIds = $model->getProductChildIds($virtuemart_product_id); $product_childs = array(); foreach ($product_childIds as $id) { $product_childs[] = $model->getProductSingle($id, false); } $this->assignRef('product_childs', $product_childs); JLoader::register('VirtueMartModelConfig', JPATH_VM_ADMINISTRATOR . '/models/config.php'); $this->productLayouts = VirtueMartModelConfig::getLayoutList('productdetails', $product->layout); // Load Images $model->addImages($product); if (is_Dir(VmConfig::get('vmtemplate') . DS . 'images' . DS . 'availability' . DS)) { $imagePath = VmConfig::get('vmtemplate') . '/images/availability/'; } else { $imagePath = '/components/com_virtuemart/assets/images/availability/'; } $this->imagePath = $imagePath; // Load the vendors $vendor_model = VmModel::getModel('vendor'); if (Vmconfig::get('multix', 'none') !== 'none') { if ($task == 'add') { $vendor_id = $this->adminVendor; } else { $vendor_id = $product->virtuemart_vendor_id; } $lists['vendors'] = Shopfunctions::renderVendorList($vendor_id); } // Load the currencies $currency_model = VmModel::getModel('currency'); $this->loadHelper('permissions'); $vendor_model->setId(Permissions::getInstance()->isSuperVendor()); $vendor = $vendor_model->getVendor(); if (empty($product->product_currency)) { $product->product_currency = $vendor->vendor_currency; } //STUDIO42 fix for currency, old method set 2 time same currency symbol // TODO verify all others $currencyModel = VmModel::getModel('currency'); $currencyModel->setId($vendor->vendor_currency); $currency = $currencyModel->getData(); $this->vendor_currency = $currency->currency_symbol; $currencyModel->setId($product->product_currency); $currency = $currencyModel->getData(); $this->product_currency = $currency->currency_symbol; if (count($manufacturers) > 0) { $lists['manufacturers'] = JHTML::_('select.genericlist', $manufacturers, 'virtuemart_manufacturer_id', 'class="inputbox"', 'value', 'text', $product->virtuemart_manufacturer_id); } $lists['product_weight_uom'] = ShopFunctions::renderWeightUnitList('product_weight_uom', $task == 'add' ? VmConfig::get('weight_unit_default') : $product->product_weight_uom); $lists['product_iso_uom'] = ShopFunctions::renderUnitIsoList('product_unit', $task == 'add' ? VmConfig::get('weight_unit_default') : $product->product_unit); $lists['product_lwh_uom'] = ShopFunctions::renderLWHUnitList('product_lwh_uom', $task == 'add' ? VmConfig::get('lwh_unit_default') : $product->product_lwh_uom); if (empty($product->product_available_date)) { $product->product_available_date = date("Y-m-d"); } $waitinglistmodel = VmModel::getModel('waitinglist'); /* Load waiting list */ if ($product->virtuemart_product_id) { //$waitinglist = $this->get('waitingusers', 'waitinglist'); $waitinglist = $waitinglistmodel->getWaitingusers($product->virtuemart_product_id); $this->assignRef('waitinglist', $waitinglist); } $productShoppers = $model->getProductShoppersByStatus($product->virtuemart_product_id, array('S')); $this->assignRef('productShoppers', $productShoppers); $orderstatusModel = VmModel::getModel('orderstatus'); $lists['OrderStatus'] = $orderstatusModel->renderOSList(array(), 'order_status', TRUE); $field_model = VmModel::getModel('customfields'); $fieldTypes = $field_model->getField_types(); $this->assignRef('fieldTypes', $fieldTypes); /* Load product types lists */ if ($customsList = $field_model->getCustomsList()) { $emptyOption = JHTML::_('select.option', '', '- ' . JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION') . ' :', 'value', 'text'); array_unshift($customsList, $emptyOption); $customlist = JHTML::_('select.genericlist', $customsList, 'customlist'); if ($task == "add") { if ($customfieldsDefault = $this->getBLankCustomfields()) { $product->customfields = $customfieldsDefault; // var_dump( $customfieldsDefault);jexit(); } } } $this->assignRef('customsList', $customlist); $ChildCustomRelation = $field_model->getProductChildCustomRelation(); $this->assignRef('ChildCustomRelation', $ChildCustomRelation); if ($product->product_parent_id > 0) { $parentRelation = $field_model->getProductParentRelation($product->virtuemart_product_id); $this->assignRef('parentRelation', $parentRelation); // Set up labels $info_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_INFO_LBL'); $status_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_STATUS_LBL'); $dim_weight_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_DIM_WEIGHT_LBL'); $images_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_IMAGES_LBL'); $delete_message = JText::_('COM_VIRTUEMART_PRODUCT_FORM_DELETE_ITEM_MSG'); } else { if ($task == 'add') { $action = JText::_('COM_VIRTUEMART_PRODUCT_FORM_NEW_PRODUCT_LBL'); } else { $action = JText::_('COM_VIRTUEMART_PRODUCT_FORM_UPDATE_ITEM_LBL'); } $info_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_INFO_LBL'); $status_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_STATUS_LBL'); $dim_weight_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_DIM_WEIGHT_LBL'); $images_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_IMAGES_LBL'); $delete_message = JText::_('COM_VIRTUEMART_PRODUCT_FORM_DELETE_PRODUCT_MSG'); } $this->assignRef('product', $product); $product_empty_price = array('virtuemart_product_price_id' => 0, 'virtuemart_product_id' => $virtuemart_product_id, 'virtuemart_shoppergroup_id' => NULL, 'product_price' => NULL, 'override' => NULL, 'product_override_price' => NULL, 'product_tax_id' => NULL, 'product_discount_id' => NULL, 'product_currency' => $vendor->vendor_currency, 'product_price_publish_up' => NULL, 'product_price_publish_down' => NULL, 'price_quantity_start' => NULL, 'price_quantity_end' => NULL); $this->assignRef('product_empty_price', $product_empty_price); $this->assignRef('product_parent', $product_parent); /* Assign label values */ $this->assignRef('action', $action); $this->assignRef('info_label', $info_label); $this->assignRef('status_label', $status_label); $this->assignRef('dim_weight_label', $dim_weight_label); $this->assignRef('images_label', $images_label); $this->assignRef('delete_message', $delete_message); $this->assignRef('lists', $lists); // Toolbar if ($product->product_sku) { $sku = ' (' . $product->product_sku . ')'; } else { $sku = ""; } if (!empty($product->canonCatLink)) { $canonLink = '&virtuemart_category_id=' . $product->canonCatLink; } else { $canonLink = ''; } if (!empty($product->virtuemart_product_id)) { $text = '<a href="' . juri::root() . 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . $canonLink . '" target="_blank" >' . $product->product_name . $sku . '<span class="vm2-modallink"></span></a>'; } else { $text = $product->product_name . $sku; } $this->SetViewTitle('PRODUCT', $text); //JToolBarHelper::custom('sentproductemailtocustomer', 'email_32', 'email_32', 'COM_VIRTUEMART_PRODUCT_EMAILTOSHOPPER' ,false); $this->addStandardEditViewCommands($product->virtuemart_product_id); break; case 'massxref_cats': case 'massxref_cats_exe': //TODO test if path is ok addpath is now in the constructor $this->addTemplatePath(JPATH_VM_ADMINISTRATOR . '/views' . DS . 'category' . DS . 'tmpl'); $this->SetViewTitle('PRODUCT_MASSXREF'); // $this->setLayout('massxref'); $this->loadHelper('permissions'); $this->perms = Permissions::getInstance(); $this->showVendors = $this->perms->check('admin'); $keyWord = ''; $catmodel = VmModel::getModel('category'); $this->catmodel = $catmodel; //$this->addStandardDefaultViewCommands(); $this->addStandardDefaultViewLists($catmodel, 'category_name'); $this->categories = $catmodel->getCategoryTree(0, 0, false, $this->lists['search']); $this->pagination = $catmodel->getPagination(); // restore icon is good but not the word JToolBarHelper::custom('display', 'restore', 'restore', JText::_('JTOOLBAR_BACK'), false); JToolBarHelper::custom('massxref_cats_exe', 'assign', 'assign', JText::_('COM_VIRTUEMART_MASS_REPLACE'), false); JToolBarHelper::custom('massxref_cats_add', 'new', 'new', JText::_('COM_VIRTUEMART_MASS_ADD'), true); break; case 'massxref_sgrps': case 'massxref_sgrps_exe': $this->SetViewTitle('PRODUCT_MASSXREF'); //TODO test if path is ok addpath is now in the constructor $this->addTemplatePath(JPATH_VM_ADMINISTRATOR . '/views' . DS . 'shoppergroup' . DS . 'tmpl'); $this->loadHelper('permissions'); $this->perms = Permissions::getInstance(); $this->showVendors = $this->perms->check('admin'); $sgrpmodel = VmModel::getModel('shoppergroup'); $this->addStandardDefaultViewLists($sgrpmodel); $this->shoppergroups = $sgrpmodel->getShopperGroups(false, true); $this->pagination = $sgrpmodel->getPagination(); JToolBarHelper::custom('massxref_sgrps_exe', 'groups-add', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_SGRPS_EXE'), false); break; default: if ($product_parent_id = JRequest::getInt('product_parent_id', false)) { $product_parent = $model->getProductSingle($product_parent_id, false); if ($product_parent) { $title = 'PRODUCT_CHILDREN_LIST'; $link_to_parent = JHTML::_('link', JRoute::_('index.php?view=product&task=edit&virtuemart_product_id=' . $product_parent->virtuemart_product_id . '&option=com_virtuemart'), $product_parent->product_name, array('class' => 'hasTooltip', 'title' => JText::_('COM_VIRTUEMART_EDIT_PARENT') . ' ' . $product_parent->product_name)); $msg = JText::_('COM_VIRTUEMART_PRODUCT_OF') . " " . $link_to_parent; } else { $title = 'PRODUCT_CHILDREN_LIST'; $msg = 'Parent with product_parent_id ' . $product_parent_id . ' not found'; } } else { $title = 'PRODUCT'; $msg = ""; } $this->db = JFactory::getDBO(); $this->loadHelper('permissions'); $this->SetViewTitle($title, $msg); $this->addStandardDefaultViewLists($model, 'created_on', 'DESC', 'filter_product'); $vendor_id = $this->adminVendor; if ($vendor_id == 1) { $vendor_id = null; } // fix ??? $catid = JRequest::getInt('uctlist = ', 0); /* Get the list of products */ $productlist = $model->getProductListing(false, false, false, false, true, true, $catid, $vendor_id); //The pagination must now always set AFTER the model load the listing $this->pagination = $model->getPagination(); /* Get the category tree */ $categoryId = $model->virtuemart_category_id; //OSP switched to filter in model, was JRequest::getInt('virtuemart_category_id'); $this->category_tree = ShopFunctions::categoryListTree(array($categoryId)); /* Load the product price */ $this->loadHelper('calculationh'); $vendor_model = VmModel::getModel('vendor'); $productreviews = VmModel::getModel('ratings'); foreach ($productlist as $virtuemart_product_id => $product) { if (isset($product->virtuemart_media_id)) { $product->mediaitems = count($product->virtuemart_media_id); } else { $product->mediaitems = 'none'; } $product->reviews = $productreviews->countReviewsForProduct($product->virtuemart_product_id); $vendor_model->setId($product->virtuemart_vendor_id); $vendor = $vendor_model->getVendor(); $currencyDisplay = CurrencyDisplay::getInstance($vendor->vendor_currency, $vendor->virtuemart_vendor_id); if (!empty($product->product_price) && !empty($product->product_currency)) { $product->product_price_display = $currencyDisplay->priceDisplay($product->product_price, (int) $product->product_currency, 1, true); } /* Write the first 5 categories in the list */ $product->categoriesList = shopfunctions::renderGuiList('virtuemart_category_id', '#__virtuemart_product_categories', 'virtuemart_product_id', $product->virtuemart_product_id, 'category_name', '#__virtuemart_categories', 'virtuemart_category_id', 'category'); } $mf_model = VmModel::getModel('manufacturer'); $this->manufacturers = $mf_model->getManufacturerDropdown(); /* add Search filter in lists*/ /* Search type */ $options = array('' => JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'), 'parent' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_PARENT_PRODUCT'), 'product' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRODUCT'), 'price' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRICE'), 'withoutprice' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_WITHOUTPRICE')); $this->lists['search_type'] = VmHTML::selectList('search_type', JRequest::getVar('search_type'), $options, 1, '', 'onchange="Joomla.ajaxSearch(this); return false;"', 'input-medium'); /* Search order */ $options = array('bf' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_BEFORE'), 'af' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_AFTER')); $this->lists['search_order'] = VmHTML::selectList('search_order', JRequest::getVar('search_order'), $options, 1, '', '', 'input-small'); // Toolbar //JToolBarHelper::save('sentproductemailtoshoppers', JText::_('COM_VIRTUEMART_PRODUCT_EMAILTOSHOPPERS')); JToolBarHelper::custom('massxref_cats', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_CAT'), true); JToolBarHelper::custom('massxref_sgrps', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_SGRPS'), true); JToolBarHelper::custom('createchild', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_CHILD'), true); JToolBarHelper::custom('cloneproduct', 'copy', 'copy', JText::_('COM_VIRTUEMART_PRODUCT_CLONE'), true); JToolBarHelper::custom('addrating', 'star-2', '', JText::_('COM_VIRTUEMART_ADD_RATING'), true); $this->addStandardDefaultViewCommands(); $this->productlist = $productlist; $this->virtuemart_category_id = $categoryId; $this->model = $model; break; } parent::display($tpl); }
/** * 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; }
/** * 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)); } }
/** * 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 }