/** * Retireve a list of currencies from the database. * This function is used in the backend for the currency listing, therefore no asking if enabled or not * @author Max Milbers * @return object List of currency objects */ function getCurrenciesList($search, $vendorId = 1) { $where = array(); $user = JFactory::getUser(); $shared = ''; if (vmAccess::manager()) { $shared = 'OR `shared`="1"'; } $vendorId = vmAccess::isSuperVendor(); if ($vendorId) { $where[] = '(`virtuemart_vendor_id` = "' . (int) $vendorId . '" ' . $shared . ')'; } if (empty($search)) { $search = vRequest::getString('search', false); } // add filters if ($search) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; $where[] = '`currency_name` LIKE ' . $search . ' OR `currency_code_2` LIKE ' . $search . ' OR `currency_code_3` LIKE ' . $search; } $whereString = ''; if (count($where) > 0) { $whereString = ' WHERE ' . implode(' AND ', $where); } $data = $this->exeSortSearchListQuery(0, '*', ' FROM `#__virtuemart_currencies`', $whereString, '', $this->_getOrdering()); return $data; }
function getListQuery() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('product.*,products_en_gb.product_name,tour_type.title AS tour_type,tour_style.title AS tour_style_name')->from('#__tsmart_products AS product')->leftJoin('#__tsmart_products_en_gb AS products_en_gb USING(tsmart_product_id)')->leftJoin('#__tsmart_tour_type AS tour_type USING(tsmart_tour_type_id)')->leftJoin('#__tsmart_tour_style AS tour_style USING(tsmart_tour_style_id)'); $user = JFactory::getUser(); $shared = ''; if (vmAccess::manager()) { //$query->where('transferaddon.shared=1','OR'); } $search = vRequest::getCmd('search', false); if (empty($search)) { $search = vRequest::getString('search', false); } // add filters if ($search) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; $query->where('product.product_name LIKE ' . $search); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'product.tsmart_product_id'); $orderDirn = $this->state->get('list.direction', 'asc'); if ($orderCol == 'product.ordering') { $orderCol = $db->quoteName('product.tsmart_product_id') . ' ' . $orderDirn . ', ' . $db->quoteName('product.ordering'); } $query->order($db->escape($orderCol . ' ' . $orderDirn)); return $query; }
function getListQuery() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('faq.*,categoryfaq.categoryfaq_name')->from('#__tsmart_faq AS faq')->leftJoin('#__tsmart_categoryfaq AS categoryfaq ON categoryfaq.tsmart_categoryfaq_id=faq.tsmart_categoryfaq_id'); $user = JFactory::getUser(); $shared = ''; if (vmAccess::manager()) { //$query->where('transferaddon.shared=1','OR'); } $search = vRequest::getCmd('search', false); if (empty($search)) { $search = vRequest::getString('search', false); } // add filters if ($search) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; $query->where('faq.title LIKE ' . $search); } if (empty($this->_selectedOrdering)) { vmTrace('empty _getOrdering'); } if (empty($this->_selectedOrderingDir)) { vmTrace('empty _selectedOrderingDir'); } $query->order($this->_selectedOrdering . ' ' . $this->_selectedOrderingDir); return $query; }
function getListQuery() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('hotel.*')->from('#__tsmart_hotel AS hotel')->leftJoin('#__tsmart_cityarea AS cityarea USING(tsmart_cityarea_id)')->leftJoin('#__tsmart_states AS states ON states.tsmart_state_id=cityarea.tsmart_state_id')->leftJoin('#__tsmart_countries AS countries ON countries.tsmart_country_id=states.tsmart_country_id')->select('CONCAT(cityarea.city_area_name,",",states.state_name,",",countries.country_name) AS location'); $user = JFactory::getUser(); $shared = ''; if (vmAccess::manager()) { //$query->where('transferaddon.shared=1','OR'); } $search = vRequest::getCmd('search', false); if (empty($search)) { $search = vRequest::getString('search', false); } // add filters if ($search) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; $query->where('hotel.title LIKE ' . $search); } if (empty($this->_selectedOrdering)) { vmTrace('empty _getOrdering'); } if (empty($this->_selectedOrderingDir)) { vmTrace('empty _selectedOrderingDir'); } $query->order($this->_selectedOrdering . ' ' . $this->_selectedOrderingDir); //echo $query->dump(); return $query; }
/** * constructs a VmModel * setMainTable defines the maintable of the model * @author Max Milbers */ function __construct() { parent::__construct(); $this->setMainTable('ratings'); $layout = vRequest::getString('layout','default'); $task = vRequest::getCmd('task','default'); if($layout == 'list_reviews' or $task == 'listreviews'){ vmdebug('in review list'); $myarray = array('pr.created_on','virtuemart_rating_review_id','vote'); $this->removevalidOrderingFieldName('created_on'); $this->removevalidOrderingFieldName('product_name'); $this->removevalidOrderingFieldName('virtuemart_rating_id'); $this->removevalidOrderingFieldName('rating'); $this->_selectedOrdering = 'pr.created_on'; } else { $myarray = array('created_on','product_name','virtuemart_rating_id'); $this->removevalidOrderingFieldName('pr.created_on'); $this->removevalidOrderingFieldName('virtuemart_rating_review_id'); $this->removevalidOrderingFieldName('vote'); $this->_selectedOrdering = 'created_on'; } $this->addvalidOrderingFieldName($myarray); }
function getListQuery() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('payment.*')->from('#__tsmart_payment AS payment')->leftJoin('#__tsmart_currencies AS currencies USING(tsmart_currency_id)')->select('CONCAT(currencies.currency_code_3," ",currencies.currency_symbol) AS currency_symbol'); //get list tour apply $query1 = $db->getQuery(true); $query1->select('GROUP_CONCAT(products_en_gb.product_name)')->from('#__tsmart_tour_id_payment_id AS tour_id_payment_id')->leftJoin('#__tsmart_products_en_gb AS products_en_gb USING(tsmart_product_id)')->where('tour_id_payment_id.tsmart_payment_id=payment.tsmart_payment_id'); $query->select("({$query1}) AS list_tour"); //end get list tour apply $user = JFactory::getUser(); $shared = ''; if (vmAccess::manager()) { //$query->where('payment.shared=1','OR'); } $search = vRequest::getCmd('search', false); if (empty($search)) { $search = vRequest::getString('search', false); } // add filters if ($search) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; $query->where('payment.title LIKE ' . $search); } if (empty($this->_selectedOrdering)) { vmTrace('empty _getOrdering'); } if (empty($this->_selectedOrderingDir)) { vmTrace('empty _selectedOrderingDir'); } $query->order($this->_selectedOrdering . ' ' . $this->_selectedOrderingDir); return $query; }
function getListQuery() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('country.*,COUNT(states.tsmart_state_id) AS total_state')->from('#__tsmart_countries AS country')->leftJoin('#__tsmart_states AS states using (tsmart_country_id)')->leftJoin('#__tsmart_currencies AS currency using (tsmart_currency_id)')->select('currency.currency_name')->leftJoin('#__tsmart_language AS language using (tsmart_language_id)')->select('language.language_name')->group('country.tsmart_country_id'); $user = JFactory::getUser(); $shared = ''; if (vmAccess::manager()) { //$query->where('transferaddon.shared=1','OR'); } $search = vRequest::getCmd('search', false); if (empty($search)) { $search = vRequest::getString('search', false); } // add filters if ($search) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; $query->where('country.country_name LIKE ' . $search); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'country.tsmart_country_id'); $orderDirn = $this->state->get('list.direction', 'asc'); if ($orderCol == 'country.ordering') { $orderCol = $db->quoteName('country.tsmart_country_id') . ' ' . $orderDirn . ', ' . $db->quoteName('country.ordering'); } $query->order($db->escape($orderCol . ' ' . $orderDirn)); return $query; }
function display ($tpl = null) { // Load the helper(s) jimport('joomla.filesystem.file'); $config = JFactory::getConfig(); $log_path = $config->get('log_path', VMPATH_ROOT . "/log"); $layoutName = vRequest::getCmd('layout', 'default'); VmConfig::loadJLang('com_virtuemart_log'); if ($layoutName == 'edit') { $logFile = vRequest::getString('logfile', ''); $this->SetViewTitle('LOG', $logFile); $fileContent = file_get_contents($log_path . DS . $logFile); $fileContentByLine = explode("\n", $fileContent); $this->assignRef('fileContentByLine', $fileContentByLine); JToolBarHelper::cancel(); } else { if(!class_exists('JFolder')) require(VMPATH_LIBS.DS.'joomla'.DS.'filesystem'.DS.'folder.php'); $logFiles = JFolder::files($log_path, $filter = '.', true, false, array('index.html')); $this->SetViewTitle('LOG'); $this->assignRef('logFiles', $logFiles); $this->assignRef('path', $log_path); } parent::display($tpl); }
function getListQuery() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('state.*, countries.flag AS country_flag,countries.country_name,COUNT(cityarea.tsmart_cityarea_id) AS total_city')->from('#__tsmart_states AS state')->leftJoin('#__tsmart_countries AS countries using (tsmart_country_id)')->leftJoin('#__tsmart_cityarea AS cityarea using (tsmart_state_id)')->group('state.tsmart_state_id')->leftJoin('#__tsmart_states AS states ON states.tsmart_state_id=cityarea.tsmart_state_id')->leftJoin('#__tsmart_airport AS airport ON airport.tsmart_cityarea_id=cityarea.tsmart_cityarea_id')->select('GROUP_CONCAT(airport.airport_name,"(",airport.ata_code,")") AS list_airport_name'); $user = JFactory::getUser(); $shared = ''; if (vmAccess::manager()) { //$query->where('transferaddon.shared=1','OR'); } $search = vRequest::getCmd('search', false); if (empty($search)) { $search = vRequest::getString('search', false); } // add filters if ($search) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; $query->where('state.state_name LIKE ' . $search); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'state.tsmart_state_id'); $orderDirn = $this->state->get('list.direction', 'asc'); if ($orderCol == 'state.ordering') { $orderCol = $db->quoteName('state.tsmart_state_id') . ' ' . $orderDirn . ', ' . $db->quoteName('state.ordering'); } $query->order($db->escape($orderCol . ' ' . $orderDirn)); return $query; }
function getListQuery() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('excursion_addon.*')->from('#__tsmart_excursion_addon AS excursion_addon')->leftJoin('me1u8_tsmart_cityarea AS cityarea USING(tsmart_cityarea_id)')->select('cityarea.city_area_name AS city_area_name'); $user = JFactory::getUser(); $shared = ''; if (vmAccess::manager()) { //$query->where('excursionaddon.shared=1','OR'); } $search = vRequest::getCmd('search', false); if (empty($search)) { $search = vRequest::getString('search', false); } // add filters if ($search) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; $query->where('excursion_addon.excursion_addon_name LIKE ' . $search); } if (empty($this->_selectedOrdering)) { vmTrace('empty _getOrdering'); } if (empty($this->_selectedOrderingDir)) { vmTrace('empty _selectedOrderingDir'); } $query->order($this->_selectedOrdering . ' ' . $this->_selectedOrderingDir); return $query; }
/** * Retireve a list of currencies from the database. * This function is used in the backend for the currency listing, therefore no asking if enabled or not * @author Max Milbers * @return object List of currency objects */ function getItemList($search = '') { $select = ' supplier.* FROM #__tsmart_supplier AS supplier'; $where = array(); $user = JFactory::getUser(); $shared = ''; if (vmAccess::manager()) { $shared = 'OR `supplier.shared`="1"'; } if (empty($search)) { $search = vRequest::getString('search', false); } // add filters if ($search) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; $where[] = '`supplier.supplier_name` LIKE ' . $search; } $whereString = ''; if (count($where) > 0) { $whereString = ' WHERE ' . implode(' AND ', $where); } $data = $this->exeSortSearchListQuery(0, $select, '', $whereString, '', $this->_getOrdering()); return $data; }
function getListQuery() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('group_size.*')->from('#__tsmart_group_size AS group_size'); $user = JFactory::getUser(); $shared = ''; if (vmAccess::manager()) { //$query->where('transferaddon.shared=1','OR'); } $search = vRequest::getCmd('search', false); if (empty($search)) { $search = vRequest::getString('search', false); } // add filters if ($search) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; $query->where('group_size.group_name LIKE ' . $search); } if (empty($this->_selectedOrdering)) { vmTrace('empty _getOrdering'); } if (empty($this->_selectedOrderingDir)) { vmTrace('empty _selectedOrderingDir'); } $query->order('group_size.' . $this->_selectedOrdering . ' ' . $this->_selectedOrderingDir); //echo $query->dump(); return $query; }
function getListQuery() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('language.*')->from('#__tsmart_language AS language'); $user = JFactory::getUser(); $shared = ''; if (vmAccess::manager()) { //$query->where('transferaddon.shared=1','OR'); } $search = vRequest::getCmd('search', false); if (empty($search)) { $search = vRequest::getString('search', false); } // add filters if ($search) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; $query->where('language.language_name LIKE ' . $search); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'language.tsmart_language_id'); $orderDirn = $this->state->get('list.direction', 'asc'); if ($orderCol == 'language.ordering') { $orderCol = $db->quoteName('language.language_name') . ' ' . $orderDirn . ', ' . $db->quoteName('language.ordering'); } $query->order($db->escape($orderCol . ' ' . $orderDirn)); return $query; }
function getListQuery() { $app = JFactory::getApplication(); $input = $app->input; $tsmart_product_id = $input->getInt('tsmart_product_id', 0); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('itinerary.*,cityarea.city_area_name,accommodation.tsmart_accommodation_id')->from('#__tsmart_itinerary AS itinerary')->where('itinerary.tsmart_product_id=' . (int) $tsmart_product_id)->leftJoin('#__tsmart_accommodation AS accommodation USING(tsmart_itinerary_id)')->leftJoin('#__tsmart_cityarea AS cityarea USING(tsmart_cityarea_id)')->group('itinerary.tsmart_itinerary_id'); $user = JFactory::getUser(); $shared = ''; if (vmAccess::manager()) { //$query->where('transferaddon.shared=1','OR'); } $search = vRequest::getCmd('search', false); if (empty($search)) { $search = vRequest::getString('search', false); } // add filters if ($search) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; $query->where('itinerary.title LIKE ' . $search); } $orderCol = $this->state->get('list.ordering', 'itinerary.ordering'); $orderDirn = $this->state->get('list.direction', 'asc'); if ($orderCol == 'itinerary.ordering') { $orderCol = $db->quoteName('itinerary.title') . ' ' . $orderDirn . ', ' . $db->quoteName('itinerary.ordering'); } $query->order($db->escape($orderCol . ' ' . $orderDirn)); return $query; }
/** * Send the ask question email. * @author Kohl Patrick, Christopher Roussel */ public function mailAskquestion() { vRequest::vmCheckToken(); if (!class_exists('shopFunctionsF')) { require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } $model = tmsModel::getModel('vendor'); $mainframe = JFactory::getApplication(); $vars = array(); $min = tsmConfig::get('asks_minimum_comment_length', 50) + 1; $max = tsmConfig::get('asks_maximum_comment_length', 2000) - 1; $commentSize = vRequest::getString('comment'); if (function_exists('mb_strlen')) { $commentSize = mb_strlen($commentSize); } else { $commentSize = strlen($commentSize); } $validMail = filter_var(vRequest::getVar('email'), FILTER_VALIDATE_EMAIL); $virtuemart_vendor_id = vRequest::getInt('virtuemart_vendor_id', 1); if (!class_exists('VirtueMartModelVendor')) { require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php'; } $userId = VirtueMartModelVendor::getUserIdByVendorId($virtuemart_vendor_id); //$vendorUser = JFactory::getUser($userId); if ($commentSize < $min || $commentSize > $max || !$validMail) { $this->setRedirect(JRoute::_('index.php?option=com_virtuemart&view=vendor&task=contact&virtuemart_vendor_id=' . $virtuemart_vendor_id, FALSE), tsmText::_('COM_VIRTUEMART_COMMENT_NOT_VALID_JS')); return; } $user = JFactory::getUser(); $fromMail = vRequest::getVar('email'); //is sanitized then $fromName = vRequest::getVar('name', ''); //is sanitized then $fromMail = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $fromMail); $fromName = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $fromName); if (!empty($user->id)) { if (empty($fromMail)) { $fromMail = $user->email; } if (empty($fromName)) { $fromName = $user->name; } } $vars['user'] = array('name' => $fromName, 'email' => $fromMail); $VendorEmail = $model->getVendorEmail($virtuemart_vendor_id); $vars['vendor'] = array('vendor_store_name' => $fromName); if (shopFunctionsF::renderMail('vendor', $VendorEmail, $vars, 'vendor')) { $string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY'; } else { $string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY'; } $mainframe->enqueueMessage(tsmText::_($string)); // Display it all $view = $this->getView('vendor', 'html'); $view->setLayout('mail_confirmed'); $view->display(); }
/** * Method to display the view * * @access public * @author RickG, Max Milbers */ public function __construct() { parent::__construct(); $stateModel = VmModel::getModel('state'); $states = array(); //retrieving countries id $countries = vRequest::getString('virtuemart_country_id'); $countries = explode(',', $countries); foreach ($countries as $country) { $states[$country] = $stateModel->getStates(JFilterInput::clean($country, 'INTEGER'), true, true); } echo json_encode($states); jExit(); }
function display($tpl = null) { $states = array(); $db = JFactory::getDBO(); //retrieving countries id $country_ids = vRequest::getString('virtuemart_country_id'); $country_ids = explode(',', $country_ids); foreach ($country_ids as $country_id) { $q = 'SELECT `virtuemart_state_id`, `state_name` FROM `#__virtuemart_states` WHERE `virtuemart_country_id`= "' . (int) $country_id . '" ORDER BY `#__virtuemart_states`.`state_name`'; $db->setQuery($q); $states[$country_id] = $db->loadAssocList(); } echo json_encode($states); }
public function __construct() { parent::__construct(); $stateModel = VmModel::getModel('state'); $states = array(); //retrieving countries id $countries = vRequest::getString('virtuemart_country_id'); $countries = explode(',', $countries); foreach ($countries as $country) { $states[$country] = $stateModel->getStates((int) $country, true, true); } JResponse::setHeader("Content-type", "application/json"); JResponse::sendHeaders(); echo json_encode($states); jExit(); }
public function loadPost() { $this->_selected_method = vRequest::getInt('virtuemart_paymentmethod_id', 0); $saved_cc_selected = vRequest::getInt('saved_cc_selected', 0); //$saved_cc_selected = vRequest::getInt('saved_cc_selected' , 0); if ($saved_cc_selected) { $this->_saved_cc_selected = $saved_cc_selected; } $this->_save_card = vRequest::getInt('save_card', 0); $dcc_choice = vRequest::getInt('dcc_choice', ''); if ($dcc_choice) { $this->_dcc_choice = $dcc_choice; } $cctype = vRequest::getString('cc_type', ''); if ($cctype) { $this->_cc_type = $cctype; } /** * name on CC should be restricted to letters only. */ $cc_name = vRequest::getString('cc_name', ''); if ($cc_name) { $this->_cc_name = $cc_name; } $cc_number = vRequest::getString('cc_number', ''); if ($cc_number) { $this->_cc_number = $cc_number; } $cc_cvv = vRequest::getInt('cc_cvv', ''); if ($cc_cvv) { $this->_cc_cvv = $cc_cvv; } $cc_expire_month = vRequest::getInt('cc_expire_month', ''); if ($cc_expire_month) { $this->_cc_expire_month = $cc_expire_month; } $cc_expire_year = vRequest::getInt('cc_expire_year', ''); if ($cc_expire_year) { $this->_cc_expire_year = $cc_expire_year; } $cc_cvv_realvault = vRequest::getInt('cc_cvv_realvault', ''); if ($cc_cvv_realvault) { $this->_cc_cvv_realvault = $cc_cvv_realvault; } $this->save(); }
public static function getList($params) { if (class_exists('VirtueMartCart')) { $productModel = VmModel::getModel('product'); $calculator = calculationHelper::getInstance(); $customfields = VmModel::getModel('Customfields'); $cart = VirtueMartCart::getCart(false); $cart->pricesUnformatted = $calculator->getCheckoutPrices($cart, true); $viewName = vRequest::getString('view', 0); if ($viewName == 'cart') { $checkAutomaticPS = true; } else { $checkAutomaticPS = false; } $cart->prepareAjaxData($checkAutomaticPS); $productModel->addImages($cart->products); ini_set('xdebug.var_display_max_depth', 10); return $cart; } }
/** * Retireve a list of currencies from the database. * This function is used in the backend for the currency listing, therefore no asking if enabled or not * @author Max Milbers * @return object List of currency objects */ function getdepartureList($search) { $where = array(); $user = JFactory::getUser(); if (empty($search)) { $search = vRequest::getString('search', false); } // add filters if ($search) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; $where[] = '`departure_name` LIKE ' . $search; } $whereString = ''; if (count($where) > 0) { $whereString = ' WHERE ' . implode(' AND ', $where); } $data = $this->exeSortSearchListQuery(0, '*', ' FROM `#__tsmart_departure`', $whereString, '', $this->_getOrdering()); return $data; }
/** * Method to render the plugin datas * this is an entry point to plugin to easy renders json or html * * * @access public */ function Plugin() { $user = JFactory::getUser(); if (!($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart'))) { return false; } $type = vRequest::getCmd('type', 'vmcustom'); $typeWhiteList = array('vmshopper', 'vmcustom', 'vmcalculation', 'vmpayment', 'vmshipment', 'vmuserfield'); if (!in_array($type, $typeWhiteList)) { return false; } $name = vRequest::getString('name', ''); JPluginHelper::importPlugin($type, $name); $dispatcher = JDispatcher::getInstance(); // if you want only one render simple in the plugin use jExit(); // or $render is an array of code to echo as html or json Object! $render = null; $dispatcher->trigger('plgVmOnSelfCallBE', array($type, $name, &$render)); if ($render) { // Get the document object. $document = JFactory::getDocument(); if (vRequest::getCmd('cache', 'no')) { JResponse::setHeader('Cache-Control', 'no-cache, must-revalidate'); JResponse::setHeader('Expires', 'Mon, 6 Jul 2000 10:00:00 GMT'); } $format = vRequest::getCmd('format', 'json'); if ($format == 'json') { $document->setMimeEncoding('application/json'); // Change the suggested filename. JResponse::setHeader('Content-Disposition', 'attachment;filename="' . $type . '".json"'); echo json_encode($render); } else { echo $render; } } return true; }
private function initRealexInterface($loadCDFromPost = true) { // TODO check if cart is empty $virtuemart_paymentmethod_id = vRequest::getInt('pm', false); $this->_currentMethod = $this->getVmPluginMethod($virtuemart_paymentmethod_id); if (!$this->selectedThisElement($this->_currentMethod->payment_element)) { vmError('Programmer error: missing the pm parameter'); $this->redirectToCart(); return FALSE; } $realexInterface = $this->_loadRealexInterface(); $realexInterface->loadCustomerData($loadCDFromPost); $order_number = vRequest::getString('order_number', false); if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) { $this->redirectToCart(); return FALSE; } $orderModel = VmModel::getModel('orders'); $order = $orderModel->getOrder($virtuemart_order_id); $realexInterface->setOrder($order); $realexInterface->setPaymentCurrency(); $realexInterface->setTotalInPaymentCurrency($order['details']['BT']->order_total); return $realexInterface; }
public static function setdbLanguageTag() { if (self::$vmlang) { return self::$vmlang; } $langs = (array) self::get('active_languages', array()); self::$langCount = count($langs); $siteLang = vRequest::getString('vmlang', false); $params = JComponentHelper::getParams('com_languages'); $defaultLang = $params->get('site', 'en-GB'); //use default joomla if (JFactory::getApplication()->isSite()) { if (!$siteLang) { jimport('joomla.language.helper'); $siteLang = JFactory::getLanguage()->getTag(); } } else { if (!$siteLang) { $siteLang = $defaultLang; } } if (!in_array($siteLang, $langs)) { if (count($langs) === 0) { $siteLang = $defaultLang; } else { $siteLang = $langs[0]; } } self::$vmlangTag = $siteLang; self::$vmlang = strtolower(strtr($siteLang, '-', '_')); self::$defaultLang = strtolower(strtr($defaultLang, '-', '_')); vmdebug('$siteLang: ' . $siteLang . ' self::$_jpConfig->lang ' . self::$vmlang); //@deprecated just fallback defined('VMLANG') or define('VMLANG', self::$vmlang); return self::$vmlang; }
/** * If a filter was set, get the SQL WHERE clase * * @return string text to add to the SQL statement */ function _getFilter() { if ($search = vRequest::getString('search', false)) { $db = JFactory::getDBO(); $search = '"%' . $db->escape($search, true) . '%"'; //$search = $db->Quote($search, false); $searchArray = array('name', 'username', 'email', 'usertype', 'shopper_group_name'); $where = ' WHERE '; foreach ($searchArray as $field) { $where .= ' `' . $field . '` LIKE ' . $search . ' OR '; } $where = substr($where, 0, -3); return $where; } return ''; }
/** * @param $orderDetails */ function plgVmOnUserOrder(&$orderDetails) { // the order has not been created, the payment table has not been updated return; if (!($this->_currentMethod = $this->getVmPluginMethod($orderDetails->virtuemart_paymentmethod_id))) { return NULL; // Another method was selected, do nothing } if (!$this->selectedThisElement($this->_currentMethod->payment_element)) { return NULL; } $klarna_checkout_uri = vRequest::getString('klarna_order', ''); if (preg_match("/\\/([^\\/]+)\$/", $klarna_checkout_uri, $match)) { $klarna_checkout_id = $match[1]; } else { return NULL; } if (!($payment = $this->getDataByKlarnaID($klarna_checkout_id))) { return NULL; } if ($payment->klarna_status == "checkout_complete") { $orderDetails->order_number = $payment->klarna_reservation; } return NULL; }
function onShowUserDisplayUserfield($userId, $fieldName) { if ($userId == 0) { return; } $html = ''; if (!class_exists('VmHTML')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php'; } $view = vRequest::getString('view', ''); $this->loadJLang('plg_vmpayment_realex_hpp_api', 'vmpayment'); if ($view == 'user') { $storedCreditCards = $this->getStoredCreditCards($userId); if (empty($storedCreditCards)) { return vmText::_('VMUSERFIELD_REALEX_HPP_API_NO_CARD_SAVED'); } //$storedCreditCards = $this->isValidExpiredDate($storedCreditCards); $deleteUpdateAuthorized = true; $html = $this->renderByLayout("creditcardlist", array("storedCreditCards" => $storedCreditCards, 'deleteUpdateAuthorized' => $deleteUpdateAuthorized)); } elseif ($view == 'order') { $userlink = JROUTE::_('index.php?option=com_virtuemart&view=user&task=edit&virtuemart_user_id[]=' . $userId, FALSE); $html = JHTML::_('link', JRoute::_($userlink, FALSE), JText::_('VMUSERFIELD_REALEX_HPP_API_MANAGE_CARDS'), array('title' => JText::_('VMUSERFIELD_REALEX_HPP_API_MANAGE_CARDS'))); } return $html; }
function display($tpl = null) { //Load helpers if (!class_exists('CurrencyDisplay')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php'; } if (!class_exists('VmHTML')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php'; } if (!class_exists('vmPSPlugin')) { require VMPATH_PLUGINLIBS . DS . 'vmpsplugin.php'; } $orderStatusModel = tmsModel::getModel('orderstatus'); $orderStates = $orderStatusModel->getOrderStatusList(true); $this->SetViewTitle('ORDER'); $orderModel = tmsModel::getModel(); $curTask = vRequest::getCmd('task'); if ($curTask == 'edit') { tsmConfig::loadJLang('com_tsmart_shoppers', TRUE); tsmConfig::loadJLang('com_tsmart_orders', true); //For getOrderStatusName if (!class_exists('ShopFunctions')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php'; } // Load addl models $userFieldsModel = tmsModel::getModel('userfields'); // Get the data $tsmart_order_id = vRequest::getInt('tsmart_order_id'); $order = $orderModel->getOrder($tsmart_order_id); if (empty($order['details'])) { JFactory::getApplication()->redirect('index.php?option=com_tsmart&view=orders', tsmText::_('com_tsmart_ORDER_NOTFOUND')); } $_orderID = $order['details']['BT']->tsmart_order_id; $orderbt = $order['details']['BT']; $orderst = array_key_exists('ST', $order['details']) ? $order['details']['ST'] : $orderbt; $orderbt->invoiceNumber = $orderModel->getInvoiceNumber($orderbt->tsmart_order_id); $currency = CurrencyDisplay::getInstance('', $order['details']['BT']->tsmart_vendor_id); $this->assignRef('currency', $currency); $_userFields = $userFieldsModel->getUserFields('account', array('captcha' => true, 'delimiters' => true), array('delimiter_userinfo', 'user_is_vendor', 'username', 'name', 'password', 'password2', 'agreed', 'address_type')); $userFieldsCart = $userFieldsModel->getUserFields('cart', array('captcha' => true, 'delimiters' => true), array('delimiter_userinfo', 'user_is_vendor', 'username', 'password', 'password2', 'agreed', 'address_type')); $_userFields = array_merge($userFieldsCart, $_userFields); //Fallback for customer_note if (empty($orderbt->customer_note) and !empty($orderbt->oc_note)) { $orderbt->customer_note = $orderbt->oc_note; } $userfields = $userFieldsModel->getUserFieldsFilled($_userFields, $orderbt, 'BT_'); $_userFields = $userFieldsModel->getUserFields('shipment', array(), array('delimiter_userinfo', 'username', 'email', 'password', 'password2', 'agreed', 'address_type')); $shipmentfields = $userFieldsModel->getUserFieldsFilled($_userFields, $orderst, 'ST_'); // Create an array to allow orderlinestatuses to be translated // We'll probably want to put this somewhere in ShopFunctions... $_orderStatusList = array(); foreach ($orderStates as $orderState) { //$_orderStatusList[$orderState->tsmart_orderstate_id] = $orderState->order_status_name; //When I use update, I have to use this? $_orderStatusList[$orderState->order_status_code] = tsmText::_($orderState->order_status_name); } $_itemStatusUpdateFields = array(); $_itemAttributesUpdateFields = array(); foreach ($order['items'] as $_item) { $_itemStatusUpdateFields[$_item->tsmart_order_item_id] = JHtml::_('select.genericlist', $orderStates, "item_id[" . $_item->tsmart_order_item_id . "][order_status]", 'class="selectItemStatusCode"', 'order_status_code', 'order_status_name', $_item->order_status, 'order_item_status' . $_item->tsmart_order_item_id, true); } if (!isset($_orderStatusList[$orderbt->order_status])) { if (empty($orderbt->order_status)) { $orderbt->order_status = 'unknown'; } $_orderStatusList[$orderbt->order_status] = tsmText::_('com_tsmart_UNKNOWN_ORDER_STATUS'); } $this->lists['search'] = ''; /* Assign the data */ $this->assignRef('orderdetails', $order); $this->assignRef('orderID', $_orderID); $this->assignRef('userfields', $userfields); $this->assignRef('shipmentfields', $shipmentfields); $this->assignRef('orderstatuslist', $_orderStatusList); $this->assignRef('itemstatusupdatefields', $_itemStatusUpdateFields); $this->assignRef('itemattributesupdatefields', $_itemAttributesUpdateFields); $this->assignRef('orderbt', $orderbt); $this->assignRef('orderst', $orderst); $this->assignRef('tsmart_shipmentmethod_id', $orderbt->tsmart_shipmentmethod_id); /* Data for the Edit Status form popup */ $_currentOrderStat = $order['details']['BT']->order_status; // used to update all item status in one time $_orderStatusSelect = JHtml::_('select.genericlist', $orderStates, 'order_status', 'style="width:100px;"', 'order_status_code', 'order_status_name', $_currentOrderStat, 'order_items_status', true); $this->assignRef('orderStatSelect', $_orderStatusSelect); $this->assignRef('currentOrderStat', $_currentOrderStat); /* Toolbar */ if (JVM_VERSION < 3) { $backward = "back"; $list = 'back'; } else { $backward = 'backward'; $list = 'list'; } JToolBarHelper::custom('prevItem', $backward, '', 'com_tsmart_ITEM_PREVIOUS', false); JToolBarHelper::custom('nextItem', 'forward', '', 'com_tsmart_ITEM_NEXT', false); JToolBarHelper::divider(); JToolBarHelper::custom('cancel', $list, '', 'com_tsmart_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 = tmsModel::getModel(); $orderId = vRequest::getString('orderId', ''); $orderLineItem = vRequest::getVar('orderLineId', ''); $this->assignRef('tsmart_order_id', $orderId); $this->assignRef('tsmart_order_item_id', $orderLineItem); $orderItem = $model->getOrderLineDetails($orderId, $orderLineItem); $this->assignRef('orderitem', $orderItem); } else { $this->setLayout('orders'); $model = tmsModel::getModel(); $this->addStandardDefaultViewLists($model, 'created_on'); $orderStatusModel = tmsModel::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 $tsmart_order_id => $order) { if (!empty($order->order_currency)) { $currency = $order->order_currency; } else { if ($order->tsmart_vendor_id) { if (!class_exists('tsmartModelVendor')) { require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php'; } $currObj = tsmartModelVendor::getVendorCurrency($order->tsmart_vendor_id); $currency = $currObj->tsmart_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->tsmart_vendor_id); } $order->order_total = $_currencies['curr' . $currency]->priceDisplay($order->order_total); $order->invoiceNumber = $model->getInvoiceNumber($order->tsmart_order_id); } } //update order items button /*$q = 'SELECT * FROM #__tsmart_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_tsmart_REPORT_UPDATEORDERITEMS'),false); vmError('com_tsmart_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', tsmText::_('com_tsmart_UPDATE_STATUS')); if (vmAccess::manager('orders.delete')) { JToolBarHelper::spacer('80'); JToolBarHelper::deleteList(); } /* Assign the data */ $this->assignRef('orderslist', $orderslist); $this->pagination = $model->getPagination(); } } if (JFactory::getApplication()->isSite()) { $bar = JToolBar::getInstance('toolbar'); $bar->appendButton('Link', 'back', 'com_tsmart_LEAVE', 'index.php?option=com_tsmart&manage=0'); } shopFunctions::checkSafePath(); parent::display($tpl); }
function unpublish($cidname = 0, $table = 0, $redirect = 0) { vRequest::vmCheckToken(); $layout = vRequest::getString('layout', 'default'); if ($layout == 'list_reviews') { $virtuemart_product_id = vRequest::getInt('virtuemart_product_id'); 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; } $redPath = ''; if (!empty($virtuemart_product_id)) { $redPath = '&task=listreviews&virtuemart_product_id=' . $virtuemart_product_id; } parent::unpublish('virtuemart_rating_review_id', 'rating_reviews', $this->redirectPath . $redPath); } else { parent::unpublish(); } }
/** * @return bool|null */ function plgVmOnPaymentNotification() { //$this->_debug = true; if (!class_exists('VirtueMartModelOrders')) { require VMPATH_ADMIN . DS . 'models' . DS . 'orders.php'; } $virtuemart_paymentmethod_id = vRequest::getInt('pm', 0); //$this->_debug=true; if (!($this->_currentMethod = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) { return NULL; // Another method was selected, do nothing } if (!$this->selectedThisElement($this->_currentMethod->payment_element)) { return FALSE; } $order_number = vRequest::getString('on', ''); if (empty($order_number)) { return FALSE; } if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) { return FALSE; } if (!($payments = $this->getDatasByOrderId($virtuemart_order_id))) { return FALSE; } $this->debugLog('OK', 'plgVmOnPaymentNotification', 'debug'); if (!class_exists('SofortLib')) { require VMPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'sofort' . DS . 'sofort' . DS . 'library' . DS . 'sofortLib.php'; } $sofortLib_Notification = new SofortLib_Notification(); $this->sofortLog($sofortLib_Notification); $transactionId = $sofortLib_Notification->getNotification(); if ($sofortLib_Notification->isError()) { $this->debugLog('SOFORT notification return Error ' . $sofortLib_Notification->getError(), 'plgVmOnPaymentNotification', 'error'); } //no valid parameters/xml if (empty($transactionId)) { $this->debugLog('no transaction ID for order number ' . $order_number, 'plgVmOnPaymentNotification', 'error'); } if (empty($transactionId) || $sofortLib_Notification->isError()) { return FALSE; } $this->debugLog($transactionId, 'plgVmOnPaymentNotification Transaction ID ', 'debug'); $sofortLib_TransactionData = new SofortLib_TransactionData(trim($this->_currentMethod->configuration_key)); $this->sofortLog($sofortLib_TransactionData); $sofortLib_TransactionData->setTransaction($transactionId)->sendRequest(); // check that secret , and order are identical $security = vRequest::getString('security', ''); if ($security != $payments[0]->security) { $this->debugLog("security token received: " . $security . " security token expected: " . $payments[0]->security, 'plgVmOnPaymentNotification', 'error'); return false; } $paymentMethod = $sofortLib_TransactionData->getPaymentMethod(); if ($paymentMethod != self::SU_SOFORTBANKING) { $this->debugLog("Payment method is " . $paymentMethod . " Should be SU" . 'plgVmOnPaymentNotification', 'error'); return false; } $sofort_data['sofort_response_amount'] = $sofortLib_TransactionData->getAmount(); $sofort_data['sofort_response_currency'] = $sofortLib_TransactionData->getCurrency(); // check that the amount is the same if (!$this->_checkAmountAndCurrency($sofort_data, $payments)) { return false; } $modelOrder = VmModel::getModel('orders'); $order_history = array(); $status = 'status_' . $sofortLib_TransactionData->getStatus(); //$this->debugLog('plgVmOnPaymentNotification getStatus:' .$status. ' '.var_export($method, true) , 'message'); $order_history['customer_notified'] = true; $order_history['order_status'] = $this->_currentMethod->{$status}; $order_history['comments'] = vmText::_('VMPAYMENT_SOFORT_RESPONSE_STATUS_REASON_' . $sofortLib_TransactionData->getStatusReason()); $sofort_data['sofort_response_status_reason'] = $sofortLib_TransactionData->getStatusReason(); $sofort_data['sofort_response_transaction'] = $sofortLib_TransactionData->getTransaction(); $sofort_data['payment_name'] = str_replace(array('\\t', '\\n'), '', $this->renderPluginName($this->_currentMethod)); $sofort_data['virtuemart_order_id'] = $payments[0]->virtuemart_order_id; $sofort_data['order_number'] = $payments[0]->order_number; $sofort_data['virtuemart_paymentmethod_id'] = $payments[0]->virtuemart_paymentmethod_id; $sofort_data['sofort_response_status'] = $sofortLib_TransactionData->getStatus(); $sofort_data['sofort_response_status_reason'] = $sofortLib_TransactionData->getStatusReason(); $this->debugLog(var_export($sofort_data, true), 'plgVmOnPaymentNotification storePSPluginInternalData ', 'debug'); $this->storePSPluginInternalData($sofort_data); $modelOrder->updateStatusForOneOrder($payments[0]->virtuemart_order_id, $order_history, false); }