Beispiel #1
0
 function save($data = 0)
 {
     $fileModel = VmModel::getModel('media');
     //Now we try to determine to which this media should be long to
     $data = array_merge(vRequest::getRequest(), vRequest::get('media'));
     //$data['file_title'] = vRequest::getVar('file_title','','post','STRING',JREQUEST_ALLOWHTML);
     if (!empty($data['file_description'])) {
         $data['file_description'] = JComponentHelper::filterText($data['file_description']);
         //vRequest::filter(); vRequest::getHtml('file_description','');
     }
     /*$data['media_action'] = vRequest::getCmd('media[media_action]');
     		$data['media_attributes'] = vRequest::getCmd('media[media_attributes]');
     		$data['file_type'] = vRequest::getCmd('media[file_type]');*/
     if (empty($data['file_type'])) {
         $data['file_type'] = $data['media_attributes'];
     }
     $msg = '';
     if ($id = $fileModel->store($data)) {
         $msg = vmText::_('COM_VIRTUEMART_FILE_SAVED_SUCCESS');
     }
     $cmd = vRequest::getCmd('task');
     if ($cmd == 'apply') {
         $redirection = 'index.php?option=com_virtuemart&view=media&task=edit&virtuemart_media_id=' . $id;
     } else {
         $redirection = 'index.php?option=com_virtuemart&view=media';
     }
     $this->setRedirect($redirection, $msg);
 }
 /**
  * We want to allow html so we need to overwrite some request data
  *
  * @author Max Milbers
  */
 function save($data = 0)
 {
     if ($data === 0) {
         $data = vRequest::getRequest();
     }
     $user = JFactory::getUser();
     if ($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart') or $user->authorise('vm.raw', 'com_virtuemart')) {
         $data['product_desc'] = vRequest::get('product_desc', '');
         $data['product_s_desc'] = vRequest::get('product_s_desc', '');
         $data['customtitle'] = vRequest::get('customtitle', '');
         if (isset($data['field'])) {
             $data['field'] = vRequest::get('field');
         }
         if (isset($data['childs'])) {
             foreach ($data['childs'] as $k => $v) {
                 if ($n = vRequest::get('product_name', false, FILTER_UNSAFE_RAW, FILTER_FLAG_NO_ENCODE, $data['childs'][$k])) {
                     $data['childs'][$k]['product_name'] = $n;
                 }
             }
         }
     } else {
         if ($user->authorise('vm.html', 'com_virtuemart')) {
             $data['product_desc'] = vRequest::getHtml('product_desc', '');
             $data['product_s_desc'] = vRequest::getHtml('product_s_desc', '');
             $data['customtitle'] = vRequest::getHtml('customtitle', '');
             if (isset($data['field'])) {
                 $data['field'] = vRequest::getHtml('field');
             }
         } else {
             $data['product_desc'] = vRequest::getString('product_desc', '');
             $data['product_s_desc'] = vRequest::getString('product_s_desc', '');
             $data['customtitle'] = vRequest::getString('customtitle', '');
             if (isset($data['field'])) {
                 $data['field'] = vRequest::getString('field');
             }
         }
         //Why we have this?
         $multix = Vmconfig::get('multix', 'none');
         if ($multix != 'none') {
             //in fact this shoudl be used, when the mode is administrated and the system is so that
             //every product must be approved by an admin.
             unset($data['published']);
             //unset($data['childs']);
         }
     }
     parent::save($data);
 }
Beispiel #3
0
 function save($data = 0)
 {
     $data = vRequest::getPost();
     if (vmAccess::manager('raw')) {
         $data['payment_name'] = vRequest::get('payment_name', '');
         $data['payment_desc'] = vRequest::get('payment_desc', '');
         if (isset($data['params'])) {
             $data['params'] = vRequest::get('params', '');
         }
     } else {
         $data['payment_name'] = vRequest::getHtml('payment_name', '');
         $data['payment_desc'] = vRequest::getHtml('payment_desc', '');
         if (isset($data['params'])) {
             $data['params'] = vRequest::getHtml('params', '');
         }
     }
     parent::save($data);
 }
 function save($data = 0)
 {
     $data = vRequest::getPost();
     $user = JFactory::getUser();
     if ($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart')) {
         $data['payment_name'] = vRequest::get('payment_name', '');
         $data['payment_desc'] = vRequest::get('payment_desc', '');
         if (isset($data['params'])) {
             $data['params'] = vRequest::get('params', '');
         }
     } else {
         $data['payment_name'] = vRequest::getHtml('payment_name', '');
         $data['payment_desc'] = vRequest::getHtml('payment_desc', '');
         if (isset($data['params'])) {
             $data['params'] = vRequest::getHtml('params', '');
         }
     }
     parent::save($data);
 }
Beispiel #5
0
	function save($data = 0) {

		if($data===0) $data = vRequest::getPost();

		$user = JFactory::getUser();
		if($user->authorise('core.admin','com_virtuemart') or $user->authorise('core.manage','com_virtuemart')){
			$data['description'] = vRequest::get('description','');
			if(isset($data['params'])){
				$data['params'] = vRequest::get('params','');
			}
		} else {
			$data['description'] = vRequest::getHtml('description','');
			if(isset($data['params'])){
				$data['params'] = vRequest::getHtml('params','');
			}
		}
		$data['name'] = vRequest::getCmd('name');
		// onSaveCustom plugin;
		parent::save($data);
	}
Beispiel #6
0
 function save($data = 0)
 {
     if ($data === 0) {
         $data = vRequest::getPost();
     }
     if (vmAccess::manager('raw')) {
         $data['description'] = vRequest::get('description', '');
         if (isset($data['params'])) {
             $data['params'] = vRequest::get('params', '');
         }
     } else {
         $data['description'] = vRequest::getHtml('description', '');
         if (isset($data['params'])) {
             $data['params'] = vRequest::getHtml('params', '');
         }
     }
     $data['name'] = vRequest::getCmd('name');
     // onSaveCustom plugin;
     parent::save($data);
 }
Beispiel #7
0
 /**
  * We want to allow html so we need to overwrite some request data
  *
  * @author Max Milbers
  */
 function save($data = 0)
 {
     $data = vRequest::getRequest();
     $user = JFactory::getUser();
     if (!($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart'))) {
         $data['product_desc'] = vRequest::get('product_desc', '');
         $data['product_s_desc'] = vRequest::get('product_s_desc', '');
         $data['customtitle'] = vRequest::get('customtitle', '');
     } else {
         $data['product_desc'] = vRequest::getHtml('product_desc', '');
         //Why we have this?
         $multix = Vmconfig::get('multix', 'none');
         if ($multix != 'none') {
             //in fact this shoudl be used, when the mode is administrated and the system is so that
             //every product must be approved by an admin.
             unset($data['published']);
             //unset($data['childs']);
         }
     }
     parent::save($data);
 }
 /**
  * We want to allow html so we need to overwrite some request data
  *
  * @author Max Milbers
  */
 function save($data = 0)
 {
     if ($data === 0) {
         $data = vRequest::getRequest();
     }
     if (vmAccess::manager('raw')) {
         $data['product_desc'] = vRequest::get('product_desc', '');
         $data['product_s_desc'] = vRequest::get('product_s_desc', '');
         $data['customtitle'] = vRequest::get('customtitle', '');
         if (isset($data['field'])) {
             $data['field'] = vRequest::get('field');
         }
         if (isset($data['childs'])) {
             foreach ($data['childs'] as $k => $v) {
                 if ($n = vRequest::get('product_name', false, FILTER_UNSAFE_RAW, FILTER_FLAG_NO_ENCODE, $data['childs'][$k])) {
                     $data['childs'][$k]['product_name'] = $n;
                 }
             }
         }
     } else {
         if (vmAccess::manager('html')) {
             $data['product_desc'] = vRequest::getHtml('product_desc', '');
             $data['product_s_desc'] = vRequest::getHtml('product_s_desc', '');
             $data['customtitle'] = vRequest::getHtml('customtitle', '');
             if (isset($data['field'])) {
                 $data['field'] = vRequest::getHtml('field');
             }
         } else {
             $data['product_desc'] = vRequest::getString('product_desc', '');
             $data['product_s_desc'] = vRequest::getString('product_s_desc', '');
             $data['customtitle'] = vRequest::getString('customtitle', '');
             if (isset($data['field'])) {
                 $data['field'] = vRequest::getString('field');
             }
         }
     }
     parent::save($data);
 }
Beispiel #9
0
 /**
  * Notify customer
  *
  * @author Seyi Awofadeju
  *
  */
 public function notifycustomer()
 {
     $data = vRequest::get('post');
     $model = VmModel::getModel('waitinglist');
     if (!$model->adduser($data)) {
         $errors = $model->getErrors();
         foreach ($errors as $error) {
             $msg = $error . '<br />';
         }
         $this->setRedirect(JRoute::_('index.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id=' . $data['virtuemart_product_id'], FALSE), $msg);
     } else {
         $msg = vmText::sprintf('COM_VIRTUEMART_STRING_SAVED', vmText::_('COM_VIRTUEMART_CART_NOTIFY'));
         $this->setRedirect(JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $data['virtuemart_product_id'], FALSE), $msg);
     }
 }
Beispiel #10
0
 /**
  * New function for sorting, searching, filtering and pagination for product ids.
  *
  * @author Max Milbers
  */
 function sortSearchListQuery($onlyPublished = TRUE, $virtuemart_category_id = FALSE, $group = FALSE, $nbrReturnProducts = FALSE, $langFields = array())
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     //User Q.Stanley said that removing group by is increasing the speed of product listing in a bigger shop (10k products) by factor 60
     //So what was the reason for that we have it? TODO experiemental, find conditions for the need of group by
     $groupBy = ' group by p.`virtuemart_product_id` ';
     //administrative variables to organize the joining of tables
     $joinLang = false;
     $joinCategory = FALSE;
     $joinCatLang = false;
     $joinMf = FALSE;
     $joinMfLang = false;
     $joinPrice = FALSE;
     $joinCustom = FALSE;
     $joinShopper = FALSE;
     $joinChildren = FALSE;
     //$joinLang = false;
     $orderBy = ' ';
     $where = array();
     //$isSite = $app->isSite ();
     $isSite = true;
     if ($app->isAdmin() or vRequest::get('manage', false) and vmAccess::getVendorId()) {
         $isSite = false;
     }
     if (!empty($this->keyword) and $this->keyword !== '' and $group === FALSE) {
         $keyword = vRequest::filter(html_entity_decode($this->keyword, ENT_QUOTES, "UTF-8"), FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_LOW);
         $keyword = '"%' . str_replace(array(' ', '-'), '%', $keyword) . '%"';
         //$keyword = '"%' . $db->escape ($this->keyword, TRUE) . '%"';
         vmdebug('Current search field', $this->valid_search_fields);
         foreach ($this->valid_search_fields as $searchField) {
             if ($searchField == 'category_name' || $searchField == 'category_description') {
                 $joinCatLang = true;
             } else {
                 if ($searchField == 'mf_name') {
                     $joinMfLang = true;
                 } else {
                     if ($searchField == 'product_price') {
                         $joinPrice = TRUE;
                     } else {
                         if ($searchField == 'product_name' or $searchField == 'product_s_desc' or $searchField == 'product_desc' or $searchField == 'slug') {
                             $langFields[] = $searchField;
                             //if (strpos ($searchField, '`') !== FALSE){
                             //$searchField = '`l`.'.$searchField;
                             $keywords_plural = preg_replace('/\\s+/', '%" AND ' . $searchField . ' LIKE "%', $keyword);
                             if ($app->isSite() and VmConfig::$defaultLang != VmConfig::$vmlang and !VmConfig::get('prodOnlyWLang', false)) {
                                 $filter_search[] = '`ld`.' . $searchField . ' LIKE ' . $keywords_plural;
                                 if (VmConfig::$defaultLang != VmConfig::$jDefLang) {
                                     $filter_search[] = '`ljd`.' . $searchField . ' LIKE ' . $keywords_plural;
                                 }
                             }
                             $searchField = '`l`.' . $searchField;
                             //}
                         }
                     }
                 }
             }
             if (strpos($searchField, '`') !== FALSE) {
                 $keywords_plural = preg_replace('/\\s+/', '%" AND ' . $searchField . ' LIKE "%', $keyword);
                 $filter_search[] = $searchField . ' LIKE ' . $keywords_plural;
             } else {
                 $keywords_plural = preg_replace('/\\s+/', '%" AND `' . $searchField . '` LIKE "%', $keyword);
                 $filter_search[] = '`' . $searchField . '` LIKE ' . $keywords_plural;
                 //$filter_search[] = '`' . $searchField . '` LIKE ' . $keyword;
             }
         }
         if (!empty($filter_search)) {
             $where[] = '(' . implode(' OR ', $filter_search) . ')';
         } else {
             $where[] = '`l`.product_name LIKE ' . $keyword;
             $langFields[] = 'product_name';
             //If they have no check boxes selected it will default to product name at least.
         }
     }
     // 		vmdebug('my $this->searchcustoms ',$this->searchcustoms);
     if (!empty($this->searchcustoms)) {
         $joinCustom = TRUE;
         foreach ($this->searchcustoms as $key => $searchcustom) {
             $custom_search[] = '(pf.`virtuemart_custom_id`="' . (int) $key . '" and pf.`customfield_value` like "%' . $db->escape($searchcustom, TRUE) . '%")';
         }
         $where[] = " ( " . implode(' OR ', $custom_search) . " ) ";
     }
     if ($isSite and !VmConfig::get('use_as_catalog', 0)) {
         if (VmConfig::get('stockhandle', 'none') == 'disableit_children') {
             $where[] = ' ( (p.`product_in_stock` - p.`product_ordered`) >"0" OR (children.`product_in_stock` - children.`product_ordered`) > "0") ';
             $joinChildren = TRUE;
         } else {
             if (VmConfig::get('stockhandle', 'none') == 'disableit') {
                 $where[] = ' p.`product_in_stock` - p.`product_ordered` >"0" ';
             }
         }
     }
     if ($virtuemart_category_id > 0) {
         $joinCategory = TRUE;
         $where[] = ' `pc`.`virtuemart_category_id` = ' . $virtuemart_category_id;
     } else {
         if ($isSite) {
             if (!VmConfig::get('show_uncat_parent_products', TRUE)) {
                 $joinCategory = TRUE;
                 $where[] = ' ((p.`product_parent_id` = "0" AND `pc`.`virtuemart_category_id` > "0") OR p.`product_parent_id` > "0") ';
             }
             if (!VmConfig::get('show_uncat_child_products', TRUE)) {
                 $joinCategory = TRUE;
                 $where[] = ' ((p.`product_parent_id` > "0" AND `pc`.`virtuemart_category_id` > "0") OR p.`product_parent_id` = "0") ';
             }
         }
     }
     if ($isSite and !VmConfig::get('show_unpub_cat_products', TRUE)) {
         $joinCategory = TRUE;
         $where[] = ' `c`.`published` = 1 ';
     }
     if ($this->product_parent_id) {
         $where[] = ' p.`product_parent_id` = ' . $this->product_parent_id;
     }
     if ($isSite) {
         $usermodel = VmModel::getModel('user');
         $currentVMuser = $usermodel->getCurrentUser();
         $virtuemart_shoppergroup_ids = (array) $currentVMuser->shopper_groups;
         if (is_array($virtuemart_shoppergroup_ids)) {
             $sgrgroups = array();
             foreach ($virtuemart_shoppergroup_ids as $key => $virtuemart_shoppergroup_id) {
                 $sgrgroups[] = '`ps`.`virtuemart_shoppergroup_id`= "' . (int) $virtuemart_shoppergroup_id . '" ';
             }
             $sgrgroups[] = '`ps`.`virtuemart_shoppergroup_id` IS NULL ';
             $where[] = " ( " . implode(' OR ', $sgrgroups) . " ) ";
             $joinShopper = TRUE;
         }
     }
     if ($this->virtuemart_manufacturer_id) {
         $joinMf = TRUE;
         if (is_array($this->virtuemart_manufacturer_id)) {
             $mans = array();
             foreach ($this->virtuemart_manufacturer_id as $key => $v) {
                 $mans[] = '`#__virtuemart_product_manufacturers`.`virtuemart_manufacturer_id`= "' . (int) $v . '" ';
             }
             $where[] = " ( " . implode(' OR ', $mans) . " ) ";
         } else {
             $where[] = ' `#__virtuemart_product_manufacturers`.`virtuemart_manufacturer_id` = ' . $this->virtuemart_manufacturer_id;
             //$virtuemart_manufacturer_id = $this->virtuemart_manufacturer_id;
         }
     }
     // Time filter
     if ($this->search_type != '') {
         $search_order = $db->escape(vRequest::getCmd('search_order') == 'bf' ? '<' : '>');
         switch ($this->search_type) {
             case 'parent':
                 $where[] = 'p.`product_parent_id` = "0"';
                 break;
             case 'product':
                 $where[] = 'p.`modified_on` ' . $search_order . ' "' . $db->escape(vRequest::getVar('search_date')) . '"';
                 break;
             case 'price':
                 $joinPrice = TRUE;
                 $where[] = 'pp.`modified_on` ' . $search_order . ' "' . $db->escape(vRequest::getVar('search_date')) . '"';
                 break;
             case 'withoutprice':
                 $joinPrice = TRUE;
                 $where[] = 'pp.`product_price` IS NULL';
                 break;
             case 'stockout':
                 $where[] = ' p.`product_in_stock`- p.`product_ordered` < 1';
                 break;
             case 'stocklow':
                 $where[] = 'p.`product_in_stock`- p.`product_ordered` < p.`low_stock_notification`';
                 break;
         }
     }
     //vmdebug('my filter ordering ',$this->filter_order);
     // special  orders case
     $ff_select_price = '';
     switch ($this->filter_order) {
         case '`p`.product_special':
             if ($isSite) {
                 $where[] = ' p.`product_special`="1" ';
                 // TODO Change  to  a  individual button
                 $orderBy = 'ORDER BY RAND()';
             } else {
                 $orderBy = 'ORDER BY p.`product_special`';
             }
             break;
         case 'category_name':
             $orderBy = ' ORDER BY `category_name` ';
             $joinCategory = TRUE;
             $joinCatLang = true;
             break;
         case 'category_description':
             $orderBy = ' ORDER BY `category_description` ';
             $joinCategory = TRUE;
             $joinCatLang = true;
             break;
         case 'mf_name':
         case '`l`.mf_name':
             $orderBy = ' ORDER BY `mf_name` ';
             $joinMf = TRUE;
             $joinMfLang = true;
             break;
         case 'ordering':
         case 'pc.ordering':
             $orderBy = ' ORDER BY `pc`.`ordering` ';
             $joinCategory = TRUE;
             break;
         case 'pc.ordering,product_name':
             $orderBy = ' ORDER BY `pc`.`ordering`,`product_name` ';
             $joinCategory = TRUE;
             $joinLang = true;
             break;
         case 'product_price':
             $orderBy = ' ORDER BY `product_price` ';
             $ff_select_price = ' , IF(pp.override, pp.product_override_price, pp.product_price) as product_price ';
             $joinPrice = TRUE;
             break;
         case 'created_on':
         case '`p`.created_on':
             $orderBy = ' ORDER BY p.`created_on` ';
             break;
         default:
             if (!empty($this->filter_order)) {
                 $orderBy = ' ORDER BY ' . $this->filter_order . ' ';
             } else {
                 $this->filter_order_Dir = '';
             }
             break;
     }
     //Group case from the modules
     if ($group) {
         $latest_products_days = VmConfig::get('latest_products_days', 7);
         $latest_products_orderBy = VmConfig::get('latest_products_orderBy', 'created_on');
         $groupBy = 'group by p.`virtuemart_product_id` ';
         switch ($group) {
             case 'featured':
                 $where[] = 'p.`product_special`="1" ';
                 $orderBy = 'ORDER BY RAND()';
                 break;
             case 'latest':
                 /*$date = JFactory::getDate (time () - (60 * 60 * 24 * $latest_products_days));
                 		$dateSql = $date->toSQL ();
                 		$where[] = 'p.`' . $latest_products_orderBy . '` > "' . $dateSql . '" ';*/
                 //vmdebug('product model ',$latest_products_orderBy);
                 $orderBy = 'ORDER BY p.`' . $latest_products_orderBy . '`';
                 $this->filter_order_Dir = 'DESC';
                 break;
             case 'random':
                 $orderBy = ' ORDER BY RAND() ';
                 //LIMIT 0, '.(int)$nbrReturnProducts ; //TODO set limit LIMIT 0, '.(int)$nbrReturnProducts;
                 break;
             case 'topten':
                 $orderBy = ' ORDER BY p.`product_sales` ';
                 //LIMIT 0, '.(int)$nbrReturnProducts;  //TODO set limitLIMIT 0, '.(int)$nbrReturnProducts;
                 $joinPrice = true;
                 $where[] = 'pp.`product_price`>"0.0" ';
                 $this->filter_order_Dir = 'DESC';
                 break;
             case 'recent':
                 $rSession = JFactory::getSession();
                 $rIds = $rSession->get('vmlastvisitedproductids', array(), 'vm');
                 // get recent viewed from browser session
                 return $rIds;
         }
         // 			$joinCategory 	= false ; //creates error
         // 			$joinMf 		= false ;	//creates error
         $joinPrice = TRUE;
         $this->searchplugin = FALSE;
         // 			$joinLang = false;
     }
     /*if ($onlyPublished and !empty($this->virtuemart_vendor_id) and vRequest::get('manage',false) and vmAccess::isSuperVendor()) {
     			$where[] = ' p.`virtuemart_vendor_id` = "'.$this->virtuemart_vendor_id.'" ';
     		} else {*/
     if (!empty($onlyPublished) and $isSite) {
         $where[] = ' p.`published`="1" ';
     }
     if (!empty($this->virtuemart_vendor_id)) {
         $where[] = ' p.`virtuemart_vendor_id` = "' . $this->virtuemart_vendor_id . '" ';
     }
     //}
     $joinedTables = array();
     //This option switches between showing products without the selected language or only products with language.
     if ($app->isSite() and !VmConfig::get('prodOnlyWLang', false)) {
         //Maybe we have to join the language to order by product name, description, etc,...
         $productLangFields = array('product_s_desc', 'product_desc', 'product_name', 'metadesc', 'metakey', 'slug');
         foreach ($productLangFields as $field) {
             if (strpos($orderBy, $field, 6) !== FALSE) {
                 $langFields[] = $field;
                 $orderbyLangField = $field;
                 $joinLang = true;
                 break;
             }
         }
     } else {
         $joinLang = true;
     }
     $selectLang = '';
     if ($joinLang or count($langFields) > 0) {
         if (!VmConfig::get('prodOnlyWLang', false) and VmConfig::$defaultLang != VmConfig::$vmlang and Vmconfig::$langCount > 1) {
             $this->useLback = true;
             $this->useJLback = false;
             $method = 'LEFT';
             if ($isSite) {
                 $method = 'INNER';
             }
             if (VmConfig::$defaultLang != VmConfig::$jDefLang) {
                 $joinedTables[] = ' ' . $method . ' JOIN `#__virtuemart_products_' . VmConfig::$jDefLang . '` as ljd using (`virtuemart_product_id`)';
                 $method = 'LEFT';
                 $this->useJLback = true;
             }
             $joinedTables[] = ' ' . $method . ' JOIN `#__virtuemart_products_' . VmConfig::$defaultLang . '` as ld using (`virtuemart_product_id`)';
             $joinedTables[] = ' LEFT JOIN `#__virtuemart_products_' . VmConfig::$vmlang . '` as l using (`virtuemart_product_id`)';
             $langFields = array_unique($langFields);
             if (count($langFields) > 0) {
                 foreach ($langFields as $langField) {
                     $expr2 = 'ld.' . $langField;
                     if ($this->useJLback) {
                         $expr2 = 'IFNULL(ld.' . $langField . ', ljd.' . $langField . ')';
                     }
                     $selectLang .= ', IFNULL(l.' . $langField . ',' . $expr2 . ') as ' . $langField . '';
                 }
             }
         } else {
             $this->useLback = false;
             $joinedTables[] = ' INNER JOIN `#__virtuemart_products_' . VmConfig::$vmlang . '` as l using (`virtuemart_product_id`)';
         }
     }
     $select = ' p.`virtuemart_product_id`' . $ff_select_price . $selectLang . ' FROM `#__virtuemart_products` as p ';
     if ($joinShopper == TRUE) {
         $joinedTables[] = ' LEFT JOIN `#__virtuemart_product_shoppergroups` as ps ON p.`virtuemart_product_id` = `ps`.`virtuemart_product_id` ';
         //$joinedTables[] = ' LEFT OUTER JOIN `#__virtuemart_shoppergroups` as s ON s.`virtuemart_shoppergroup_id` = `#__virtuemart_product_shoppergroups`.`virtuemart_shoppergroup_id` ';
     }
     if ($joinCategory == TRUE or $joinCatLang) {
         $joinedTables[] = ' LEFT JOIN `#__virtuemart_product_categories` as pc ON p.`virtuemart_product_id` = `pc`.`virtuemart_product_id` ';
         if ($isSite and !VmConfig::get('show_unpub_cat_products', TRUE)) {
             $joinedTables[] = ' LEFT JOIN `#__virtuemart_categories` as c ON c.`virtuemart_category_id` = `pc`.`virtuemart_category_id` ';
         }
         if ($joinCatLang) {
             $joinedTables[] = ' LEFT JOIN `#__virtuemart_categories_' . VmConfig::$vmlang . '` as cl ON cl.`virtuemart_category_id` = `pc`.`virtuemart_category_id`';
         }
     }
     if ($joinMf == TRUE or $joinMfLang) {
         $joinedTables[] = ' LEFT JOIN `#__virtuemart_product_manufacturers` ON p.`virtuemart_product_id` = `#__virtuemart_product_manufacturers`.`virtuemart_product_id` ';
         if ($joinMfLang) {
             $joinedTables[] = 'LEFT JOIN `#__virtuemart_manufacturers_' . VmConfig::$vmlang . '` as m ON m.`virtuemart_manufacturer_id` = `#__virtuemart_product_manufacturers`.`virtuemart_manufacturer_id` ';
         }
     }
     if ($joinPrice == TRUE) {
         $joinedTables[] = ' LEFT JOIN `#__virtuemart_product_prices` as pp ON p.`virtuemart_product_id` = pp.`virtuemart_product_id` ';
     }
     if ($this->searchcustoms) {
         $joinedTables[] = ' LEFT JOIN `#__virtuemart_product_customfields` as pf ON p.`virtuemart_product_id` = pf.`virtuemart_product_id` ';
     }
     if ($this->searchplugin !== 0) {
         if (!empty($PluginJoinTables)) {
             $plgName = $PluginJoinTables[0];
             $joinedTables[] = ' LEFT JOIN `#__virtuemart_product_custom_plg_' . $plgName . '` as ' . $plgName . ' ON ' . $plgName . '.`virtuemart_product_id` = p.`virtuemart_product_id` ';
         }
     }
     /*if ($joinShopper == TRUE) {
     			$joinedTables[] = ' LEFT JOIN `#__virtuemart_product_shoppergroups` ON p.`virtuemart_product_id` = `#__virtuemart_product_shoppergroups`.`virtuemart_product_id`
     			 LEFT  OUTER JOIN `#__virtuemart_shoppergroups` as s ON s.`virtuemart_shoppergroup_id` = `#__virtuemart_product_shoppergroups`.`virtuemart_shoppergroup_id`';
     		}/*/
     if ($joinChildren) {
         $joinedTables[] = ' LEFT OUTER JOIN `#__virtuemart_products` children ON p.`virtuemart_product_id` = children.`product_parent_id` ';
     }
     if ($this->searchplugin !== 0) {
         JPluginHelper::importPlugin('vmcustom');
         $dispatcher = JDispatcher::getInstance();
         $dispatcher->trigger('plgVmBeforeProductSearch', array(&$select, &$joinedTables, &$where, &$groupBy, &$orderBy, &$joinLang));
     }
     if (count($where) > 0) {
         $whereString = ' WHERE (' . implode(' AND ', $where) . ') ';
     } else {
         $whereString = '';
     }
     //vmdebug ( ' joined ? ',$select, $joinedTables, $whereString, $groupBy, $orderBy, $this->filter_order_Dir );		/* jexit();  */
     $this->orderByString = $orderBy;
     if ($this->_onlyQuery) {
         return array($select, $joinedTables, $where, $orderBy, $joinLang);
     }
     $joinedTables = " \n" . implode(" \n", $joinedTables);
     vmSetStartTime('sortSearchQuery');
     $product_ids = $this->exeSortSearchListQuery(2, $select, $joinedTables, $whereString, $groupBy, $orderBy, $this->filter_order_Dir, $nbrReturnProducts);
     vmTime('sortSearchQuery products', 'sortSearchQuery');
     //vmdebug('exeSortSearchLIstquery orderby ',$product_ids);
     return $product_ids;
 }
Beispiel #11
0
defined('_JEXEC') or die('');
/**
*
* Template for the shopping cart
*
* @package    VirtueMart
* @subpackage Cart
* @author Max Milbers
*
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*/
if (vRequest::getBool('display_loginform', true)) {
    $cuser = JFactory::getUser();
    if (!$cuser->guest) {
        echo shopFunctionsF::getLoginForm();
    }
}
echo '<div class="vm-wrap vm-order-done">';
if (vRequest::getBool('display_title', true)) {
    echo '<h3>' . vmText::_('COM_VIRTUEMART_CART_ORDERDONE_THANK_YOU') . '</h3>';
}
$this->html = vRequest::get('html', vmText::_('COM_VIRTUEMART_ORDER_PROCESSED'));
echo $this->html;
echo '</div>';
Beispiel #12
0
	public function updatecart($html=true){

		$cart = VirtueMartCart::getCart();
		$cart->_fromCart = true;
		$cart->_redirected = false;
		if(vRequest::get('cancel',0)){
			$cart->_inConfirm = false;
		}
		if($cart->getInCheckOut()){
			vRequest::setVar('checkout',true);
		}
		$cart->saveCartFieldsInCart();

		$cart->updateProductCart();
		$coupon_code = trim(vRequest::getString('coupon_code', ''));
		if(!empty($coupon_code)){
			$cart->prepareCartData();
			$msg = $cart->setCouponCode($coupon_code);
			if($msg) vmInfo($msg);
		}

		$cart->selected_shipto = vRequest::getVar('shipto', -1);
		if(empty($cart->selected_shipto) or $cart->selected_shipto<1){
			$cart->STsameAsBT = 1;
			$cart->selected_shipto = 0;
		} else {
			$cart->STsameAsBT = 0;
		}

		$cart->setShipmentMethod(false,!$html);
		$cart->setPaymentMethod(false,!$html);
		if ($html) {
			$this->display();
		} else {
			$json = new stdClass();
			ob_start();
			$this->display ();
			$json->msg = ob_get_clean();
			echo json_encode($json);
			jExit();
		}

	}
Beispiel #13
0
 /**
  * Get the cart from the session
  *
  * @author Max Milbers
  * @access public
  * @param array $cart the cart to store in the session
  */
 public static function getCart($setCart = true, $options = array(), $cartData = NULL)
 {
     //What does this here? for json stuff?
     if (!class_exists('JTable')) {
         require JPATH_VM_LIBRARIES . DS . 'joomla' . DS . 'database' . DS . 'table.php';
     }
     if (empty(self::$_cart)) {
         self::$_cart = new VirtueMartCart();
         if (empty($cartData)) {
             $session = JFactory::getSession($options);
             $cartSession = $session->get('vmcart', 0, 'vm');
             if (!empty($cartSession)) {
                 $sessionCart = unserialize($cartSession);
                 if (empty($sessionCart->cartProductsData) or $sessionCart->_guest and $sessionCart->_guest != JFactory::getUser()->guest) {
                     self::$_cart->loadCart($sessionCart);
                 }
             }
         } else {
             $cartSession = $cartData;
             $sessionCart = unserialize($cartSession);
         }
         $userModel = VmModel::getModel('user');
         self::$_cart->user = $userModel->getCurrentUser();
         $lang = JFactory::getLanguage();
         self::$_cart->order_language = $lang->getTag();
         if (!empty($cartSession)) {
             if (isset($sessionCart->cartProductsData)) {
                 self::$_cart->cartProductsData = $sessionCart->cartProductsData;
                 self::$_cart->vendorId = $sessionCart->vendorId;
                 self::$_cart->lastVisitedCategoryId = $sessionCart->lastVisitedCategoryId;
                 self::$_cart->virtuemart_shipmentmethod_id = $sessionCart->virtuemart_shipmentmethod_id;
                 self::$_cart->virtuemart_paymentmethod_id = $sessionCart->virtuemart_paymentmethod_id;
                 self::$_cart->automaticSelectedShipment = $sessionCart->automaticSelectedShipment;
                 self::$_cart->automaticSelectedPayment = $sessionCart->automaticSelectedPayment;
                 self::$_cart->BT = $sessionCart->BT;
                 self::$_cart->ST = $sessionCart->ST;
                 self::$_cart->cartfields = $sessionCart->cartfields;
                 self::$_cart->couponCode = $sessionCart->couponCode;
                 self::$_cart->_triesValidateCoupon = $sessionCart->_triesValidateCoupon;
                 self::$_cart->order_number = $sessionCart->order_number;
                 self::$_cart->pricesCurrency = $sessionCart->pricesCurrency;
                 self::$_cart->paymentCurrency = $sessionCart->paymentCurrency;
                 self::$_cart->_guest = $sessionCart->_guest;
                 self::$_cart->_inCheckOut = $sessionCart->_inCheckOut;
                 self::$_cart->_inConfirm = $sessionCart->_inConfirm;
                 self::$_cart->_dataValidated = $sessionCart->_dataValidated;
                 self::$_cart->_confirmDone = $sessionCart->_confirmDone;
                 self::$_cart->STsameAsBT = $sessionCart->STsameAsBT;
                 self::$_cart->selected_shipto = $sessionCart->selected_shipto;
                 self::$_cart->_fromCart = $sessionCart->_fromCart;
             }
         }
         self::$_cart->loadSetRenderBTSTAddress();
         if (empty(self::$_cart->virtuemart_shipmentmethod_id) && !empty(self::$_cart->user->virtuemart_shipmentmethod_id)) {
             self::$_cart->virtuemart_shipmentmethod_id = self::$_cart->user->virtuemart_shipmentmethod_id;
         }
         if (empty(self::$_cart->virtuemart_paymentmethod_id) && !empty(self::$_cart->user->virtuemart_paymentmethod_id)) {
             self::$_cart->virtuemart_paymentmethod_id = self::$_cart->user->virtuemart_paymentmethod_id;
         }
         if ((!empty(self::$_cart->user->agreed) || !empty(self::$_cart->BT['agreed'])) && !VmConfig::get('agree_to_tos_onorder', 0)) {
             self::$_cart->BT['tos'] = 1;
         }
         //if(empty($this->customer_number) or ($this->user->virtuemart_user_id!=0 and strpos($this->customer_number,'nonreg_')!==FALSE ) ){
         if (self::$_cart->user->virtuemart_user_id != 0 and empty(self::$_cart->customer_number) or strpos(self::$_cart->customer_number, 'nonreg_') !== FALSE) {
             self::$_cart->customer_number = $userModel->getCustomerNumberById();
         }
         if (empty(self::$_cart->customer_number) or strpos(self::$_cart->customer_number, 'nonreg_') !== FALSE) {
             $firstName = empty(self::$_cart->BT['first_name']) ? '' : self::$_cart->BT['first_name'];
             $lastName = empty(self::$_cart->BT['last_name']) ? '' : self::$_cart->BT['last_name'];
             $email = empty(self::$_cart->BT['email']) ? '' : self::$_cart->BT['email'];
             self::$_cart->customer_number = 'nonreg_' . $firstName . $lastName . $email;
         }
         $multixcart = VmConfig::get('multixcart', 0);
         if (!empty($multixcart)) {
             if ($multixcart == 'byvendor' and empty(self::$_cart->vendorId) or self::$_cart->vendorId == 1) {
                 $vendor = VmModel::getModel('vendor');
                 self::$_cart->vendorId = $vendor->getLoggedVendor();
                 if (empty(self::$_cart->vendorId)) {
                     self::$_cart->vendorId = 1;
                 }
             }
             if ($multixcart == 'byselection') {
                 self::$_cart->vendorId = vRequest::get('virtuemart_vendor_id', 1);
             }
         } else {
             self::$_cart->vendorId = 1;
         }
         vmdebug('getCart $_cart->vendorId', self::$_cart->vendorId);
     }
     return self::$_cart;
 }
Beispiel #14
0
 function plgVmOnPaymentNotification()
 {
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     $mb_data = vRequest::get('post');
     if (!isset($mb_data['transaction_id'])) {
         return;
     }
     $order_number = $mb_data['transaction_id'];
     if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($mb_data['transaction_id']))) {
         return;
     }
     if (!($payment = $this->getDataByOrderId($virtuemart_order_id))) {
         return;
     }
     $method = $this->getVmPluginMethod($payment->virtuemart_paymentmethod_id);
     if (!$this->selectedThisElement($method->payment_element)) {
         return FALSE;
     }
     if (!$payment) {
         $this->logInfo('getDataByOrderId payment not found: exit ', 'ERROR');
         return NULL;
     }
     $this->_storeInternalData($method, $mb_data, $virtuemart_order_id);
     $modelOrder = VmModel::getModel('orders');
     $vmorder = $modelOrder->getOrder($virtuemart_order_id);
     $order = array();
     $error_msg = $this->_processStatus($mb_data, $vmorder, $method);
     if ($error_msg) {
         $order['customer_notified'] = 0;
         $order['order_status'] = $method->status_canceled;
         $order['comments'] = 'process IPN ' . $error_msg;
         $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, TRUE);
         $this->logInfo('process IPN ' . $error_msg, 'ERROR');
     } else {
         $this->logInfo('process IPN OK', 'message');
     }
     if (empty($mb_data['payment_status']) || $mb_data['payment_status'] != 'Completed' && $mb_data['payment_status'] != 'Pending') {
         // can't get status or payment failed
         //return false;
     }
     $order['customer_notified'] = 1;
     if (strcmp($mb_data['payment_status'], 'Completed') == 0) {
         $order['order_status'] = $method->status_success;
         $order['comments'] = vmText::sprintf('VMPAYMENT_SKRILL_PAYMENT_STATUS_CONFIRMED', $order_number);
     } elseif (strcmp($mb_data['payment_status'], 'Pending') == 0) {
         $order['comments'] = vmText::sprintf('VMPAYMENT_SKRILL_PAYMENT_STATUS_PENDING', $order_number);
         $order['order_status'] = $method->status_pending;
     } else {
         $order['order_status'] = $method->status_canceled;
     }
     $this->logInfo('plgVmOnPaymentNotification return new_status:' . $order['order_status'], 'message');
     $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, TRUE);
     //// remove vmcart
     $this->emptyCart($payment->user_session, $mb_data['transaction_id']);
 }
Beispiel #15
0
 private function lOrderDone()
 {
     $display_title = vRequest::getBool('display_title', true);
     $this->assignRef('display_title', $display_title);
     //Do not change this. It contains the payment form
     $this->html = vRequest::get('html', vmText::_('COM_VIRTUEMART_ORDER_PROCESSED'));
     //Show Thank you page or error due payment plugins like paypal express
 }
Beispiel #16
0
 </th>
		<th width="40px" ><?php 
echo $this->sort('published');
?>
</th>
	    <th><?php 
echo $this->sort('p.virtuemart_product_id', 'COM_VIRTUEMART_ID');
?>
</th>
	</tr>

	</thead>
	<tbody>
	<?php 
$total = $this->pagination->total;
$manager = vRequest::get('manage', '');
if (!empty($manager)) {
    $manager = '&manage=1';
}
if ($totalList = count($this->productlist)) {
    $i = 0;
    $k = 0;
    $keyword = vRequest::getCmd('keyword');
    foreach ($this->productlist as $key => $product) {
        $checked = JHtml::_('grid.id', $i, $product->virtuemart_product_id, null, 'virtuemart_product_id');
        $published = JHtml::_('grid.published', $product, $i);
        $published = $this->gridPublished($product, $i);
        $is_featured = $this->toggle($product->product_special, $i, 'toggle.product_special');
        $link = 'index.php?option=com_virtuemart&view=product&task=edit&virtuemart_product_id=' . $product->virtuemart_product_id . $manager;
        ?>
			<tr class="row<?php 
Beispiel #17
0
 /**
  * Bind the post data to the JUser object and the VM tables, then saves it
  * It is used to register new users
  * This function can also change already registered users, this is important when a registered user changes his email within the checkout.
  *
  * @author Max Milbers
  * @author Oscar van Eijk
  * @return boolean True is the save was successful, false otherwise.
  */
 public function store(&$data)
 {
     $message = '';
     vRequest::vmCheckToken('Invalid Token, while trying to save user');
     if (empty($data)) {
         vmError('Developer notice, no data to store for user');
         return false;
     }
     //To find out, if we have to register a new user, we take a look on the id of the usermodel object.
     //The constructor sets automatically the right id.
     $new = false;
     if (empty($this->_id) or $this->_id < 1) {
         $new = true;
         $user = new JUser();
         //thealmega http://forum.tsmart.net/index.php?topic=99755.msg393758#msg393758
     } else {
         $cUser = JFactory::getUser();
         if (!vmAccess::manager('user.edit') and $cUser->id != $this->_id) {
             vmWarn('Insufficient permission');
             return false;
         }
         $user = JFactory::getUser($this->_id);
     }
     $gid = $user->get('gid');
     // Save original gid
     // Preformat and control user datas by plugin
     JPluginHelper::importPlugin('vmuserfield');
     $dispatcher = JDispatcher::getInstance();
     $valid = true;
     $dispatcher->trigger('plgVmOnBeforeUserfieldDataSave', array(&$valid, $this->_id, &$data, $user));
     // $valid must be false if plugin detect an error
     if (!$valid) {
         return false;
     }
     // Before I used this "if($cart && !$new)"
     // This construction is necessary, because this function is used to register a new JUser, so we need all the JUser data in $data.
     // On the other hand this function is also used just for updating JUser data, like the email for the BT address. In this case the
     // name, username, password and so on is already stored in the JUser and dont need to be entered again.
     if (empty($data['email'])) {
         $email = $user->get('email');
         if (!empty($email)) {
             $data['email'] = $email;
         }
     } else {
         $data['email'] = vRequest::getEmail('email', '');
     }
     //$data['email'] = str_replace(array('\'','"',',','%','*','/','\\','?','^','`','{','}','|','~'),array(''),$data['email']);
     //This is important, when a user changes his email address from the cart,
     //that means using view user layout edit_address (which is called from the cart)
     $user->set('email', $data['email']);
     if (empty($data['name'])) {
         $name = $user->get('name');
         if (!empty($name)) {
             $data['name'] = $name;
         }
     } else {
         $data['name'] = vRequest::getWord('name', '');
     }
     $data['name'] = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $data['name']);
     if (empty($data['username'])) {
         $username = $user->get('username');
         if (!empty($username)) {
             $data['username'] = $username;
         } else {
             $data['username'] = vRequest::getWord('username', '');
         }
     }
     if (empty($data['password'])) {
         $data['password'] = vRequest::getCmd('password', '');
         if ($data['password'] != vRequest::get('password')) {
             vmError('Password contained invalid character combination.');
             return false;
         }
     }
     if (empty($data['password2'])) {
         $data['password2'] = vRequest::getCmd('password2');
         if ($data['password2'] != vRequest::get('password2')) {
             vmError('Password2 contained invalid character combination.');
             return false;
         }
     }
     if (!$new and empty($data['password2'])) {
         unset($data['password']);
         unset($data['password2']);
     }
     if (!vmAccess::manager('core')) {
         $whiteDataToBind = array();
         if (isset($data['name'])) {
             $whiteDataToBind['name'] = $data['name'];
         }
         if (isset($data['username'])) {
             $whiteDataToBind['username'] = $data['username'];
         }
         if (isset($data['email'])) {
             $whiteDataToBind['email'] = $data['email'];
         }
         if (isset($data['language'])) {
             $whiteDataToBind['language'] = $data['language'];
         }
         if (isset($data['editor'])) {
             $whiteDataToBind['editor'] = $data['editor'];
         }
         if (isset($data['password'])) {
             $whiteDataToBind['password'] = $data['password'];
         }
         if (isset($data['password2'])) {
             $whiteDataToBind['password2'] = $data['password2'];
         }
         unset($data['isRoot']);
     } else {
         $whiteDataToBind = $data;
     }
     // Bind Joomla userdata
     if (!$user->bind($whiteDataToBind)) {
         vmdebug('Couldnt bind data to joomla user');
         //array('user'=>$user,'password'=>$data['password'],'message'=>$message,'newId'=>$newId,'success'=>false);
     }
     if ($new) {
         // If user registration is not allowed, show 403 not authorized.
         // But it is possible for admins and storeadmins to save
         $usersConfig = JComponentHelper::getParams('com_users');
         $cUser = JFactory::getUser();
         if ($usersConfig->get('allowUserRegistration') == '0' and !vmAccess::manager('user')) {
             tsmConfig::loadJLang('com_tsmart');
             vmError(tsmText::_('com_tsmart_ACCESS_FORBIDDEN'));
             return;
         }
         // Initialize new usertype setting
         $newUsertype = $usersConfig->get('new_usertype');
         if (!$newUsertype) {
             $newUsertype = 2;
         }
         // Set some initial user values
         $user->set('usertype', $newUsertype);
         $user->groups[] = $newUsertype;
         $date = JFactory::getDate();
         $user->set('registerDate', $date->toSQL());
         // If user activation is turned on, we need to set the activation information
         $useractivation = $usersConfig->get('useractivation');
         $doUserActivation = false;
         if ($useractivation == '1' or $useractivation == '2') {
             $doUserActivation = true;
         }
         if ($doUserActivation) {
             jimport('joomla.user.helper');
             $user->set('activation', vRequest::getHash(JUserHelper::genRandomPassword()));
             $user->set('block', '1');
             //$user->set('lastvisitDate', '0000-00-00 00:00:00');
         }
     }
     $option = vRequest::getCmd('option');
     // If an exising superadmin gets a new group, make sure enough admins are left...
     if (!$new && $user->get('gid') != $gid && $gid == __SUPER_ADMIN_GID) {
         if ($this->getSuperAdminCount() <= 1) {
             vmError(tsmText::_('com_tsmart_USER_ERR_ONLYSUPERADMIN'));
             return false;
         }
     }
     if (isset($data['language'])) {
         $user->setParam('language', $data['language']);
     }
     // Save the JUser object
     if (!$user->save()) {
         $msg = tsmText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $user->getError());
         vmError($msg, $msg);
         return false;
     } else {
         $data['name'] = $user->get('name');
         $data['username'] = $user->get('username');
         $data['email'] = $user->get('email');
         $data['language'] = $user->get('language');
         $data['editor'] = $user->get('editor');
     }
     $newId = $user->get('id');
     $data['tsmart_user_id'] = $newId;
     //We need this in that case, because data is bound to table later
     $this->setUserId($newId);
     //Save the VM user stuff
     if (!$this->saveUserData($data) || !self::storeAddress($data)) {
         vmError('com_tsmart_NOT_ABLE_TO_SAVE_USER_DATA');
         // 			vmError(vmText::_('com_tsmart_NOT_ABLE_TO_SAVE_USERINFO_DATA'));
     } else {
         if ($new) {
             $user->userInfo = $data;
             $password = '';
             if ($usersConfig->get('sendpassword', 1)) {
                 $password = $user->password_clear;
             }
             $this->sendRegistrationEmail($user, $password, $doUserActivation);
             if ($doUserActivation) {
                 vmInfo('com_tsmart_REG_COMPLETE_ACTIVATE');
             } else {
                 vmInfo('com_tsmart_REG_COMPLETE');
                 $user->set('activation', '');
                 $user->set('block', '0');
                 $user->set('guest', '0');
             }
         } else {
             vmInfo('com_tsmart_USER_DATA_STORED');
         }
     }
     //The extra check for isset vendor_name prevents storing of the vendor if there is no form (edit address cart)
     if ((int) $data['user_is_vendor'] == 1 and isset($data['vendor_currency'])) {
         vmdebug('vendor recognised ' . $data['tsmart_vendor_id']);
         if ($this->storeVendorData($data)) {
             if ($new) {
                 if ($doUserActivation) {
                     vmInfo('com_tsmart_REG_VENDOR_COMPLETE_ACTIVATE');
                 } else {
                     vmInfo('com_tsmart_REG_VENDOR_COMPLETE');
                 }
             } else {
                 vmInfo('com_tsmart_VENDOR_DATA_STORED');
             }
         }
     }
     return array('user' => $user, 'password' => $data['password'], 'message' => $message, 'newId' => $newId, 'success' => true);
 }
Beispiel #18
0
 /**
  * We want to allow html so we need to overwrite some request data
  *
  * @author Max Milbers
  */
 function save($data = 0)
 {
     if ($data === 0) {
         $data = vRequest::getRequest();
     }
     if (vmAccess::manager('raw')) {
         $data['product_desc'] = vRequest::get('product_desc', '');
         $data['product_s_desc'] = vRequest::get('product_s_desc', '');
         $data['customtitle'] = vRequest::get('customtitle', '');
         if (isset($data['field'])) {
             $data['field'] = vRequest::get('field');
         }
         if (isset($data['childs'])) {
             foreach ($data['childs'] as $k => $v) {
                 if ($n = vRequest::get('product_name', false, FILTER_UNSAFE_RAW, FILTER_FLAG_NO_ENCODE, $data['childs'][$k])) {
                     $data['childs'][$k]['product_name'] = $n;
                 }
             }
         }
     } else {
         if (vmAccess::manager('html')) {
             $data['product_desc'] = vRequest::getHtml('product_desc', '');
             $data['product_s_desc'] = vRequest::getHtml('product_s_desc', '');
             $data['customtitle'] = vRequest::getHtml('customtitle', '');
             if (isset($data['field'])) {
                 $data['field'] = vRequest::getHtml('field');
             }
         } else {
             $data['product_desc'] = vRequest::getString('product_desc', '');
             $data['product_s_desc'] = vRequest::getString('product_s_desc', '');
             $data['customtitle'] = vRequest::getString('customtitle', '');
             if (isset($data['field'])) {
                 $data['field'] = vRequest::getString('field');
             }
         }
         //Why we have this?
         $multix = tsmConfig::get('multix', 'none');
         if ($multix != 'none') {
             //in fact this shoudl be used, when the mode is administrated and the system is so that
             //every product must be approved by an admin.
             unset($data['published']);
             //unset($data['childs']);
         }
     }
     parent::save($data);
 }
Beispiel #19
0
 /**
  * Add the product to the cart, with JS
  * @access public
  */
 public function addJS()
 {
     $this->json = new stdClass();
     $cart = VirtueMartCart::getCart(false);
     if ($cart) {
         $view = $this->getView('cart', 'json');
         $virtuemart_category_id = shopFunctionsF::getLastVisitedCategoryId();
         $categoryLink = '';
         if ($virtuemart_category_id) {
             $categoryLink = '&view=category&virtuemart_category_id=' . $virtuemart_category_id;
         }
         $continue_link = JRoute::_('index.php?option=com_virtuemart' . $categoryLink);
         $virtuemart_product_ids = vRequest::getInt('virtuemart_product_id');
         $view = $this->getView('cart', 'json');
         $errorMsg = 0;
         $products = $cart->add($virtuemart_product_ids, $errorMsg);
         $view->setLayout('padded');
         $this->json->stat = '1';
         if (!$products or count($products) == 0) {
             $product_name = vRequest::get('pname');
             $virtuemart_product_id = vRequest::getInt('pid');
             if ($product_name && $virtuemart_product_id) {
                 $view->product_name = $product_name;
                 $view->virtuemart_product_id = $virtuemart_product_id;
             } else {
                 $this->json->stat = '2';
             }
             $view->setLayout('perror');
         }
         $view->assignRef('products', $products);
         $view->assignRef('errorMsg', $errorMsg);
         ob_start();
         $view->display();
         $this->json->msg = ob_get_clean();
     } else {
         $this->json->msg = '<a href="' . JRoute::_('index.php?option=com_virtuemart', FALSE) . '" >' . vmText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>';
         $this->json->msg .= '<p>' . vmText::_('COM_VIRTUEMART_MINICART_ERROR') . '</p>';
         $this->json->stat = '0';
     }
     echo json_encode($this->json);
     jExit();
 }
Beispiel #20
0
 public function display($tpl = null)
 {
     $show_prices = VmConfig::get('show_prices', 1);
     if ($show_prices == '1') {
         if (!class_exists('calculationHelper')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
         }
     }
     $this->assignRef('show_prices', $show_prices);
     if (!class_exists('shopFunctionsF')) {
         require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     // add javascript for price and cart, need even for quantity buttons, so we need it almost anywhere
     vmJsApi::jPrice();
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     $pathway = $app->getPathway();
     if (!class_exists('VmImage')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
     }
     $categoryModel = VmModel::getModel('category');
     $productModel = VmModel::getModel('product');
     // set search and keyword
     if ($keyword = vRequest::uword('keyword', false, ' ,-,+,.,_')) {
         $pathway->addItem($keyword);
         //$title .=' ('.$keyword.')';
     }
     //$search = vRequest::uword('keyword', null);
     $this->searchcustom = '';
     $this->searchcustomvalues = '';
     if (!empty($keyword)) {
         $this->searchcustom = $this->getSearchCustom();
         $search = $keyword;
     } else {
         $keyword = '';
         $search = NULL;
     }
     $this->assignRef('search', $search);
     $this->assignRef('keyword', $keyword);
     $categoryId = JRequest::getInt('virtuemart_category_id', -1);
     $virtuemart_manufacturer_id = JRequest::getInt('virtuemart_manufacturer_id', -1);
     if ($categoryId === -1 and $virtuemart_manufacturer_id === -1) {
         $categoryId = ShopFunctionsF::getLastVisitedCategoryId();
     }
     $this->setCanonicalLink($tpl, $document, $categoryId, $virtuemart_manufacturer_id);
     if ($categoryId === -1 and $virtuemart_manufacturer_id) {
         $categoryId = 0;
         $catType = 'manufacturer';
         $this->setCanonicalLink($tpl, $document, $virtuemart_manufacturer_id, $catType);
     }
     if ($categoryId !== -1) {
         $vendorId = 1;
         $category = $categoryModel->getCategory($categoryId);
     }
     $menus = $app->getMenu();
     $menu = $menus->getActive();
     $category_layout = 'default';
     if (!empty($menu->query['categorylayout']) and $menu->query['virtuemart_category_id'] == $categoryId) {
         $category_layout = $menu->query['categorylayout'];
     }
     $category_layout = empty($category->category_layout) ? vRequest::get('layout', $category_layout) : $category->category_layout;
     if (!empty($category)) {
         if (empty($category_layout) or $category_layout != 'categories') {
             // Load the products in the given category
             $ids = $productModel->sortSearchListQuery(TRUE, $categoryId);
             $perRow = empty($category->products_per_row) ? VmConfig::get('products_per_row', 3) : $category->products_per_row;
             $this->assignRef('perRow', $perRow);
             $pagination = $productModel->getPagination($perRow);
             $this->assignRef('vmPagination', $pagination);
             $ratingModel = VmModel::getModel('ratings');
             $showRating = $ratingModel->showRating();
             $productModel->withRating = $showRating;
             $this->assignRef('showRating', $showRating);
             $products = $productModel->getProducts($ids);
             //$products = $productModel->getProductsInCategory($categoryId);
             $productModel->addImages($products, 1);
             $this->assignRef('products', $products);
             if ($products) {
                 $currency = CurrencyDisplay::getInstance();
                 $this->assignRef('currency', $currency);
                 foreach ($products as $product) {
                     $product->stock = $productModel->getStockIndicator($product);
                 }
             }
             $orderByList = $productModel->getOrderByList($categoryId);
             $this->assignRef('orderByList', $orderByList);
             // Add feed links
             if ($products && VmConfig::get('feed_cat_published', 0) == 1) {
                 $link = '&format=feed&limitstart=';
                 $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
                 $document->addHeadLink(JRoute::_($link . '&type=rss', FALSE), 'alternate', 'rel', $attribs);
                 $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
                 $document->addHeadLink(JRoute::_($link . '&type=atom', FALSE), 'alternate', 'rel', $attribs);
             }
             if (!class_exists('Permissions')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
             }
             $showBasePrice = Permissions::getInstance()->check('admin');
             //todo add config settings
             $this->assignRef('showBasePrice', $showBasePrice);
         }
         //No redirect here, for category id = 0 means show ALL categories! note by Max Milbers
         if (!empty($categoryId) and $categoryId !== -1 and (empty($category->slug) or !$category->published)) {
             if (empty($category->slug)) {
                 vmInfo(JText::_('COM_VIRTUEMART_CAT_NOT_FOUND'));
             } else {
                 if ($category->virtuemart_id !== 0 and !$category->published) {
                     vmInfo('COM_VIRTUEMART_CAT_NOT_PUBL', $category->category_name, $categoryId);
                 }
             }
             //Fallback
             $categoryLink = '';
             //This id is here not loaded. Fallback to last used category is adequate
             /*if ($category->category_parent_id) {
             			$categoryLink = '&view=category&virtuemart_category_id=' .$category->category_parent_id;
             		} else {*/
             $last_category_id = shopFunctionsF::getLastVisitedCategoryId();
             if (!$last_category_id or $categoryId == $last_category_id) {
                 $last_category_id = JRequest::getInt('virtuemart_category_id', false);
             }
             if ($last_category_id and $categoryId != $last_category_id) {
                 $categoryLink = '&view=category&virtuemart_category_id=' . $last_category_id;
             }
             //}
             if (VmConfig::get('handle_404', 1)) {
                 $app->redirect(JRoute::_('index.php?option=com_virtuemart' . $categoryLink . '&error=404', FALSE));
             } else {
                 JError::raise(E_ERROR, '404', 'Not found');
             }
             return;
         }
         shopFunctionsF::setLastVisitedCategoryId($categoryId);
         shopFunctionsF::setLastVisitedManuId($virtuemart_manufacturer_id);
         shopFunctionsF::setLastVisitedItemId(vRequest::getInt('Itemid', false));
         // Add the category name to the pathway
         if ($category->parents) {
             foreach ($category->parents as $c) {
                 $pathway->addItem(strip_tags($c->category_name), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id, FALSE));
             }
         }
         $categoryModel->addImages($category, 1);
         if ($category_layout == 'categories' or $categoryId > 0 and $virtuemart_manufacturer_id < 1) {
             $category->children = $categoryModel->getChildCategoryList($vendorId, $categoryId, $categoryModel->getDefaultOrdering(), $categoryModel->_selectedOrderingDir);
             $categoryModel->addImages($category->children, 1);
         } else {
             $category->children = false;
         }
         if (VmConfig::get('enable_content_plugin', 0)) {
             shopFunctionsF::triggerContentPlugin($category, 'category', 'category_description');
         }
         if ($category->metadesc) {
             $document->setDescription($category->metadesc);
         }
         if ($category->metakey) {
             $document->setMetaData('keywords', $category->metakey);
         }
         if ($category->metarobot) {
             $document->setMetaData('robots', $category->metarobot);
         }
         if ($app->getCfg('MetaAuthor') == '1') {
             $document->setMetaData('author', $category->metaauthor);
         }
         if (empty($category->category_template)) {
             $category->category_template = VmConfig::get('categorytemplate');
         }
         shopFunctionsF::setVmTemplate($this, $category->category_template, 0, $category_layout);
     } else {
         //Backward compatibility
         if (!isset($category)) {
             $category = new stdClass();
             $category->category_name = '';
             $category->category_description = '';
             $category->haschildren = false;
         }
     }
     $this->assignRef('category', $category);
     // Set the titles
     if (!empty($category->customtitle)) {
         $title = strip_tags($category->customtitle);
     } elseif (!empty($category->category_name)) {
         $title = strip_tags($category->category_name);
     } else {
         $title = $this->setTitleByJMenu($app);
     }
     if (JRequest::getInt('error')) {
         $title .= ' ' . JText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND');
     }
     if (!empty($keyword)) {
         $title .= ' (' . $keyword . ')';
     }
     if ($virtuemart_manufacturer_id > 0 and !empty($products[0])) {
         $title .= ' ' . $products[0]->mf_name;
     }
     $document->setTitle($title);
     // Override Category name when viewing manufacturers products !IMPORTANT AFTER page title.
     if ($virtuemart_manufacturer_id > 0 and !empty($products[0]) and isset($category->category_name)) {
         $category->category_name = $products[0]->mf_name;
     }
     if ($app->getCfg('MetaTitle') == '1') {
         $document->setMetaData('title', $title);
     }
     parent::display($tpl);
 }
function virtuemartBuildRoute(&$query)
{
    $segments = array();
    $helper = vmrouterHelper::getInstance($query);
    // simple route , no work , for very slow server or test purpose
    if ($helper->router_disabled) {
        foreach ($query as $key => $value) {
            if ($key != 'option') {
                if ($key != 'Itemid') {
                    $segments[] = $key . '/' . $value;
                    unset($query[$key]);
                }
            }
        }
        return $segments;
    }
    if ($helper->edit) {
        return $segments;
    }
    $view = '';
    $jmenu = $helper->menu;
    //vmdebug('virtuemartBuildRoute $jmenu',$helper->query,$helper->activeMenu,$helper->menuVmitems);
    if (isset($query['langswitch'])) {
        unset($query['langswitch']);
    }
    if (isset($query['view'])) {
        $view = $query['view'];
        unset($query['view']);
    }
    switch ($view) {
        case 'virtuemart':
            $query['Itemid'] = $jmenu['virtuemart'];
            break;
        case 'category':
            $start = null;
            $limitstart = null;
            $limit = null;
            if (isset($query['virtuemart_manufacturer_id'])) {
                $segments[] = $helper->lang('manufacturer') . '/' . $helper->getManufacturerName($query['virtuemart_manufacturer_id']);
                unset($query['virtuemart_manufacturer_id']);
            }
            if (isset($query['search'])) {
                $segments[] = $helper->lang('search');
                unset($query['search']);
            }
            if (isset($query['keyword'])) {
                $segments[] = $query['keyword'];
                unset($query['keyword']);
            }
            if (isset($query['virtuemart_category_id'])) {
                $categoryRoute = $helper->getCategoryRoute($query['virtuemart_category_id']);
                if ($categoryRoute->route) {
                    $segments[] = $categoryRoute->route;
                }
                if (isset($jmenu['virtuemart_category_id'][$query['virtuemart_category_id']])) {
                    $query['Itemid'] = $jmenu['virtuemart_category_id'][$query['virtuemart_category_id']];
                } else {
                    //http://forum.virtuemart.net/index.php?topic=121642.0
                    if (!empty($categoryRoute->itemId)) {
                        $query['Itemid'] = $categoryRoute->itemId;
                    } else {
                        $query['Itemid'] = vRequest::get('Itemid', false);
                    }
                }
                unset($query['virtuemart_category_id']);
            }
            if (isset($jmenu['category'])) {
                $query['Itemid'] = $jmenu['category'];
            }
            if (isset($query['orderby'])) {
                $segments[] = $helper->lang('by') . ',' . $helper->lang($query['orderby']);
                unset($query['orderby']);
            }
            if (isset($query['dir'])) {
                if ($query['dir'] == 'DESC') {
                    $dir = 'dirDesc';
                } else {
                    $dir = 'dirAsc';
                }
                $segments[] = $dir;
                unset($query['dir']);
            }
            // Joomla replace before route limitstart by start but without SEF this is start !
            if (isset($query['limitstart'])) {
                $limitstart = $query['limitstart'];
                unset($query['limitstart']);
            }
            if (isset($query['start'])) {
                $start = $query['start'];
                unset($query['start']);
            }
            if (isset($query['limit'])) {
                $limit = $query['limit'];
                unset($query['limit']);
            }
            if ($start !== null && $limitstart !== null) {
                //$segments[] = $helper->lang('results') .',1-'.$start ;
            } else {
                if ($start > 0) {
                    // using general limit if $limit is not set
                    if ($limit === null) {
                        $limit = vmrouterHelper::$limit;
                    }
                    $segments[] = $helper->lang('results') . ',' . ($start + 1) . '-' . ($start + $limit);
                } else {
                    if ($limit !== null && $limit != vmrouterHelper::$limit) {
                        $segments[] = $helper->lang('results') . ',1-' . $limit;
                    }
                }
            }
            //limit change
            break;
            //Shop product details view
        //Shop product details view
        case 'productdetails':
            $virtuemart_product_id = false;
            if (isset($jmenu['virtuemart_product_id'][$query['virtuemart_product_id']])) {
                $query['Itemid'] = $jmenu['virtuemart_product_id'][$query['virtuemart_product_id']];
                unset($query['virtuemart_product_id']);
                unset($query['virtuemart_category_id']);
            } else {
                if (isset($query['virtuemart_product_id'])) {
                    if ($helper->use_id) {
                        $segments[] = $query['virtuemart_product_id'];
                    }
                    $virtuemart_product_id = $query['virtuemart_product_id'];
                    unset($query['virtuemart_product_id']);
                }
                if (empty($query['virtuemart_category_id'])) {
                    $query['virtuemart_category_id'] = $helper->getParentProductcategory($virtuemart_product_id);
                }
                if (!empty($query['virtuemart_category_id'])) {
                    $categoryRoute = $helper->getCategoryRoute($query['virtuemart_category_id']);
                    if ($categoryRoute->route) {
                        $segments[] = $categoryRoute->route;
                    }
                    if ($categoryRoute->itemId) {
                        $query['Itemid'] = $categoryRoute->itemId;
                    } else {
                        $query['Itemid'] = $jmenu['virtuemart'];
                    }
                } else {
                    $query['Itemid'] = $jmenu['virtuemart'] ? $jmenu['virtuemart'] : @$jmenu['virtuemart_category_id'][0];
                }
                unset($query['virtuemart_category_id']);
                if ($virtuemart_product_id) {
                    $segments[] = $helper->getProductName($virtuemart_product_id);
                }
            }
            break;
        case 'manufacturer':
            if (isset($query['virtuemart_manufacturer_id'])) {
                if (isset($jmenu['virtuemart_manufacturer_id'][$query['virtuemart_manufacturer_id']])) {
                    $query['Itemid'] = $jmenu['virtuemart_manufacturer_id'][$query['virtuemart_manufacturer_id']];
                } else {
                    $segments[] = $helper->lang('manufacturers') . '/' . $helper->getManufacturerName($query['virtuemart_manufacturer_id']);
                    if (isset($jmenu['manufacturer'])) {
                        $query['Itemid'] = $jmenu['manufacturer'];
                    } else {
                        $query['Itemid'] = $jmenu['virtuemart'];
                    }
                }
                unset($query['virtuemart_manufacturer_id']);
            } else {
                if (isset($jmenu['manufacturer'])) {
                    $query['Itemid'] = $jmenu['manufacturer'];
                } else {
                    $query['Itemid'] = $jmenu['virtuemart'];
                }
            }
            break;
        case 'user':
            if (isset($jmenu['user'])) {
                $query['Itemid'] = $jmenu['user'];
            } else {
                $segments[] = $helper->lang('user');
                $query['Itemid'] = $jmenu['virtuemart'];
            }
            if (isset($query['task'])) {
                //vmdebug('my task in user view',$query['task']);
                if ($query['task'] == 'editaddresscart') {
                    if ($query['addrtype'] == 'ST') {
                        $segments[] = $helper->lang('editaddresscartST');
                    } else {
                        $segments[] = $helper->lang('editaddresscartBT');
                    }
                } else {
                    if ($query['task'] == 'editaddresscheckout') {
                        if ($query['addrtype'] == 'ST') {
                            $segments[] = $helper->lang('editaddresscheckoutST');
                        } else {
                            $segments[] = $helper->lang('editaddresscheckoutBT');
                        }
                    } else {
                        if ($query['task'] == 'editaddress') {
                            if (isset($query['addrtype']) and $query['addrtype'] == 'ST') {
                                $segments[] = $helper->lang('editaddressST');
                            } else {
                                $segments[] = $helper->lang('editaddressBT');
                            }
                        } else {
                            if ($query['task'] == 'addST') {
                                $segments[] = $helper->lang('addST');
                            } else {
                                $segments[] = $helper->lang($query['task']);
                            }
                        }
                    }
                }
                unset($query['task'], $query['addrtype']);
            }
            break;
        case 'vendor':
            /* VM208 */
            if (isset($query['virtuemart_vendor_id'])) {
                if (isset($jmenu['virtuemart_vendor_id'][$query['virtuemart_vendor_id']])) {
                    $query['Itemid'] = $jmenu['virtuemart_vendor_id'][$query['virtuemart_vendor_id']];
                } else {
                    if (isset($jmenu['vendor'])) {
                        $query['Itemid'] = $jmenu['vendor'];
                    } else {
                        $segments[] = $helper->lang('vendor');
                        $query['Itemid'] = $jmenu['virtuemart'];
                    }
                }
            } else {
                if (isset($jmenu['vendor'])) {
                    $query['Itemid'] = $jmenu['vendor'];
                } else {
                    $segments[] = $helper->lang('vendor');
                    $query['Itemid'] = $jmenu['virtuemart'];
                }
            }
            if (isset($query['virtuemart_vendor_id'])) {
                $segments[] = $helper->getVendorName($query['virtuemart_vendor_id']);
                unset($query['virtuemart_vendor_id']);
            }
            break;
        case 'cart':
            if (!isset($query['Itemid'])) {
                if (isset($jmenu['cart'])) {
                    $query['Itemid'] = $jmenu['cart'];
                } else {
                    if (isset($jmenu['virtuemart'])) {
                        $query['Itemid'] = $jmenu['virtuemart'];
                    }
                }
            }
            $segments[] = $helper->lang('cart');
            break;
        case 'orders':
            if (isset($jmenu['orders'])) {
                $query['Itemid'] = $jmenu['orders'];
            } else {
                $segments[] = $helper->lang('orders');
                $query['Itemid'] = $jmenu['virtuemart'];
            }
            if (isset($query['order_number'])) {
                $segments[] = 'number/' . $query['order_number'];
                unset($query['order_number'], $query['layout']);
            } else {
                if (isset($query['virtuemart_order_id'])) {
                    $segments[] = 'id/' . $query['virtuemart_order_id'];
                    unset($query['virtuemart_order_id'], $query['layout']);
                }
            }
            break;
            // sef only view
        // sef only view
        default:
            $segments[] = $view;
    }
    if (isset($query['task'])) {
        $segments[] = $helper->lang($query['task']);
        unset($query['task']);
    }
    if (isset($query['layout'])) {
        $segments[] = $helper->lang($query['layout']);
        unset($query['layout']);
    }
    return $segments;
}
Beispiel #22
0
 function storeReview($apply)
 {
     vRequest::vmCheckToken();
     if (empty($data)) {
         $data = vRequest::get('post');
     }
     $model = VmModel::getModel($this->_cname);
     $id = $model->saveRating($data);
     $errors = $model->getErrors();
     if (empty($errors)) {
         $msg = vmText::sprintf('COM_VIRTUEMART_STRING_SAVED', $this->mainLangKey);
     }
     foreach ($errors as $error) {
         $msg = $error . '<br />';
     }
     $redir = $this->redirectPath;
     if ($apply) {
         $redir = 'index.php?option=com_virtuemart&view=ratings&task=edit_review&virtuemart_rating_review_id=' . $id;
     } else {
         $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;
         }
         $redir = 'index.php?option=com_virtuemart&view=ratings&task=listreviews&virtuemart_product_id=' . $virtuemart_product_id;
     }
     $this->setRedirect($redir, $msg);
 }
Beispiel #23
0
	/**
	 * Select the products to list on the product list page
	 * @param $uid integer Optional user ID to get the orders of a single user
	 * @param $_ignorePagination boolean If true, ignore the Joomla pagination (for embedded use, default false)
	 */
	public function getOrdersList($uid = 0, $noLimit = false)
	{
// 		vmdebug('getOrdersList');
		$this->_noLimit = $noLimit;
		$select = " o.*, CONCAT_WS(' ',u.first_name,u.middle_name,u.last_name) AS order_name "
		.',u.email as order_email,pm.payment_name AS payment_method ';
		$from = $this->getOrdersListQuery();

		$where = array();
		$user = JFactory::getUser();
		$virtuemart_vendor_id = vRequest::get('virtuemart_vendor_id',false);

		if($user->authorise('core.admin','com_virtuemart')){
			vmdebug('Vendor is core.admin and should see all');
			if($virtuemart_vendor_id){
				$where[]= ' o.virtuemart_vendor_id = "'.$virtuemart_vendor_id.'" ';
			}
			if(!empty($uid)){
				$where[]= ' u.virtuemart_user_id = ' . (int)$uid.' ';
			}
		}
		else if( $user->authorise('core.manage','com_virtuemart') or $user->authorise('vm.orders','com_virtuemart')){

			$virtuemart_vendor_id = VmConfig::isSuperVendor();
			vmdebug('Vendor is manager and should only see its own orders venodorId '.$virtuemart_vendor_id);
			if(!empty($virtuemart_vendor_id)){
				$where[]= ' (o.virtuemart_vendor_id = '.$virtuemart_vendor_id.' OR u.virtuemart_user_id = ' . (int)$uid.') ';
				$uid = 0;
			} else {
				//We map here as fallback to vendor 1.
				$where[]= ' u.virtuemart_user_id = ' . (int)$uid;

			}
		} else {
			//A normal user is only allowed to see its own orders, we map $uid to the user id
			$uid = (int)$user->id;
			$where = array();
		}
		if(!empty($uid)){
			$where[]= ' u.virtuemart_user_id = ' . (int)$uid.' ';
		}


		if ($search = vRequest::getString('search', false)){
			$db = JFactory::getDBO();
			$search = '"%' . $db->escape( $search, true ) . '%"' ;
			$search = str_replace(' ','%',$search);

			$searchFields = array();
			$searchFields[] = 'u.first_name';
			$searchFields[] = 'u.middle_name';
			$searchFields[] = 'u.last_name';
			$searchFields[] = 'o.order_number';
			$searchFields[] = 'u.company';
			$searchFields[] = 'u.email';
			$searchFields[] = 'u.phone_1';
			$searchFields[] = 'u.address_1';
			$searchFields[] = 'u.zip';
			$where[] = implode (' LIKE '.$search.' OR ', $searchFields) . ' LIKE '.$search.' ';
			//$where[] = ' ( u.first_name LIKE '.$search.' OR u.middle_name LIKE '.$search.' OR u.last_name LIKE '.$search.' OR `order_number` LIKE '.$search.')';
		}

		$order_status_code = vRequest::getString('order_status_code', false);
		if ($order_status_code and $order_status_code!=-1){
			$where[] = ' o.order_status = "'.$order_status_code.'" ';
		}

		if (count ($where) > 0) {
			$whereString = ' WHERE (' . implode (' AND ', $where) . ') ';
		}
		else {
			$whereString = '';
		}

		if ( vRequest::getCmd('view') == 'orders') {
			$ordering = $this->_getOrdering();
		} else {
			$ordering = ' order by o.modified_on DESC';
		}

		$this->_data = $this->exeSortSearchListQuery(0,$select,$from,$whereString,'',$ordering);


		return $this->_data ;
	}
Beispiel #24
0
 public function updatecart($html = true)
 {
     $cart = VirtueMartCart::getCart();
     $cart->_fromCart = true;
     $cart->_redirected = false;
     if (vRequest::get('cancel', 0)) {
         $cart->_inConfirm = false;
     }
     if ($cart->getInCheckOut()) {
         vRequest::setVar('checkout', true);
     }
     $cart->saveCartFieldsInCart();
     if ($cart->updateProductCart()) {
         vmInfo('COM_VIRTUEMART_PRODUCT_UPDATED_SUCCESSFULLY');
     }
     $cart->STsameAsBT = vRequest::getInt('STsameAsBT', vRequest::getInt('STsameAsBTjs', 0));
     $cart->selected_shipto = vRequest::getVar('shipto', -1);
     $currentUser = JFactory::getUser();
     if (empty($cart->selected_shipto) or $cart->selected_shipto < 1) {
         $cart->STsameAsBT = 1;
         $cart->selected_shipto = 0;
     } else {
         if ($cart->selected_shipto > 0) {
             $userModel = VmModel::getModel('user');
             $stData = $userModel->getUserAddressList($currentUser->id, 'ST', $cart->selected_shipto);
             if (isset($stData[0]) and is_object($stData[0])) {
                 $stData = get_object_vars($stData[0]);
                 //if($cart->validateUserData('ST', $stData)>0){
                 $cart->ST = $stData;
                 //}
             } else {
                 $cart->selected_shipto = 0;
                 $cart->ST = $cart->BT;
             }
         }
     }
     if (!empty($cart->STsameAsBT) or empty($cart->selected_shipto)) {
         //Guest
         $cart->ST = $cart->BT;
     }
     $cart->prepareCartData();
     $coupon_code = trim(vRequest::getString('coupon_code', ''));
     if (!empty($coupon_code)) {
         $msg = $cart->setCouponCode($coupon_code);
         if ($msg) {
             vmInfo($msg);
         }
     }
     $cart->setShipmentMethod(true, !$html);
     $cart->setPaymentMethod(true, !$html);
     if ($html) {
         $this->display();
     } else {
         $json = new stdClass();
         ob_start();
         $this->display();
         $json->msg = ob_get_clean();
         echo json_encode($json);
         jExit();
     }
 }
Beispiel #25
0
 private function lOrderDone()
 {
     $this->display_title = !isset($this->display_title) ? vRequest::getBool('display_title', true) : $this->display_title;
     $this->display_loginform = !isset($this->display_loginform) ? vRequest::getBool('display_loginform', true) : $this->display_loginform;
     //Do not change this. It contains the payment form
     $this->html = !isset($this->html) ? vRequest::get('html', vmText::_('COM_VIRTUEMART_ORDER_PROCESSED')) : $this->html;
     //Show Thank you page or error due payment plugins like paypal express
 }
Beispiel #26
0
/**
 *
 * @package VirtueMart
 * @Author Kohl Patrick
 * @subpackage router
 * @version $Id$
 * ${PHING.VM.COPYRIGHT}
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
 *
 * http://virtuemart.net
 */
function virtuemartBuildRoute(&$query)
{
    $segments = array();
    $helper = vmrouterHelper::getInstance($query);
    /* simple route , no work , for very slow server or test purpose */
    if ($helper->router_disabled) {
        foreach ($query as $key => $value) {
            if ($key != 'option') {
                if ($key != 'Itemid') {
                    $segments[] = $key . '/' . $value;
                    unset($query[$key]);
                }
            }
        }
        return $segments;
    }
    if ($helper->edit) {
        return $segments;
    }
    /* Full route , heavy work*/
    // $lang = $helper->lang ;
    $view = '';
    $jmenu = $helper->menu;
    if (isset($query['langswitch'])) {
        unset($query['langswitch']);
    }
    if (isset($query['view'])) {
        $view = $query['view'];
        unset($query['view']);
    }
    switch ($view) {
        case 'virtuemart':
            $query['Itemid'] = $jmenu['virtuemart'];
            break;
            /* Shop category or virtuemart view
            		 All ideas are wellcome to improve this
            		 because is the biggest and more used */
        /* Shop category or virtuemart view
        		 All ideas are wellcome to improve this
        		 because is the biggest and more used */
        case 'category':
            $start = null;
            $limitstart = null;
            $limit = null;
            if (isset($query['virtuemart_manufacturer_id'])) {
                $segments[] = $helper->lang('manufacturer') . '/' . $helper->getManufacturerName($query['virtuemart_manufacturer_id']);
                unset($query['virtuemart_manufacturer_id']);
            }
            if (isset($query['search'])) {
                $segments[] = $helper->lang('search');
                unset($query['search']);
            }
            if (isset($query['keyword'])) {
                $segments[] = $query['keyword'];
                unset($query['keyword']);
            }
            if (isset($query['virtuemart_category_id'])) {
                $categoryRoute = $helper->getCategoryRoute($query['virtuemart_category_id']);
                //vmdebug('my categoryRoute '.$query['virtuemart_category_id'],$categoryRoute);
                if ($categoryRoute->route) {
                    $segments[] = $categoryRoute->route;
                }
                if (isset($jmenu['virtuemart_category_id'][$query['virtuemart_category_id']])) {
                    $query['Itemid'] = $jmenu['virtuemart_category_id'][$query['virtuemart_category_id']];
                } else {
                    //http://forum.virtuemart.net/index.php?topic=121642.0
                    /*$Itemid = vRequest::get('Itemid',false);
                    		if($Itemid){
                    			$query['Itemid'] = $Itemid;
                    		} else */
                    if (!empty($categoryRoute->itemId)) {
                        $query['Itemid'] = $categoryRoute->itemId;
                    } else {
                        $query['Itemid'] = vRequest::get('Itemid', false);
                        //$query['Itemid'] = false;
                    }
                }
                unset($query['virtuemart_category_id']);
            }
            if (isset($jmenu['category'])) {
                $query['Itemid'] = $jmenu['category'];
            }
            if (isset($query['orderby'])) {
                $segments[] = $helper->lang('by') . ',' . $helper->lang($query['orderby']);
                unset($query['orderby']);
            }
            if (isset($query['dir'])) {
                if ($query['dir'] == 'DESC') {
                    $dir = 'dirDesc';
                } else {
                    $dir = 'dirAsc';
                }
                $segments[] = $dir;
                //$helper->lang('dir'.$dir) ;
                unset($query['dir']);
            }
            // Joomla replace before route limitstart by start but without SEF this is start !
            if (isset($query['limitstart'])) {
                $limitstart = $query['limitstart'];
                unset($query['limitstart']);
            }
            if (isset($query['start'])) {
                $start = $query['start'];
                unset($query['start']);
            }
            if (isset($query['limit'])) {
                $limit = $query['limit'];
                unset($query['limit']);
            }
            if ($start !== null && $limitstart !== null) {
                //$segments[] = $helper->lang('results') .',1-'.$start ;
            } else {
                if ($start > 0) {
                    // using general limit if $limit is not set
                    if ($limit === null) {
                        $limit = vmrouterHelper::$limit;
                    }
                    $segments[] = $helper->lang('results') . ',' . ($start + 1) . '-' . ($start + $limit);
                } else {
                    if ($limit !== null && $limit != vmrouterHelper::$limit) {
                        $segments[] = $helper->lang('results') . ',1-' . $limit;
                    }
                }
            }
            //limit change
            return $segments;
            break;
            /* Shop product details view  */
        /* Shop product details view  */
        case 'productdetails':
            $virtuemart_product_id = false;
            if (isset($jmenu['virtuemart_product_id'][$query['virtuemart_product_id']])) {
                $query['Itemid'] = $jmenu['virtuemart_product_id'][$query['virtuemart_product_id']];
                unset($query['virtuemart_product_id']);
                unset($query['virtuemart_category_id']);
            } else {
                if (isset($query['virtuemart_product_id'])) {
                    if ($helper->use_id) {
                        $segments[] = $query['virtuemart_product_id'];
                    }
                    $virtuemart_product_id = $query['virtuemart_product_id'];
                    unset($query['virtuemart_product_id']);
                }
                if (empty($query['virtuemart_category_id'])) {
                    $query['virtuemart_category_id'] = $helper->getParentProductcategory($virtuemart_product_id);
                }
                if (!empty($query['virtuemart_category_id'])) {
                    $categoryRoute = $helper->getCategoryRoute($query['virtuemart_category_id']);
                    if ($categoryRoute->route) {
                        $segments[] = $categoryRoute->route;
                    }
                    if ($categoryRoute->itemId) {
                        $query['Itemid'] = $categoryRoute->itemId;
                    } else {
                        $query['Itemid'] = $jmenu['virtuemart'];
                    }
                } else {
                    $query['Itemid'] = $jmenu['virtuemart'] ? $jmenu['virtuemart'] : @$jmenu['virtuemart_category_id'][0];
                }
                unset($query['virtuemart_category_id']);
                if ($virtuemart_product_id) {
                    $segments[] = $helper->getProductName($virtuemart_product_id);
                }
            }
            if (!count($query)) {
                return $segments;
            }
            break;
        case 'manufacturer':
            if (isset($query['virtuemart_manufacturer_id'])) {
                if (isset($jmenu['virtuemart_manufacturer_id'][$query['virtuemart_manufacturer_id']])) {
                    $query['Itemid'] = $jmenu['virtuemart_manufacturer_id'][$query['virtuemart_manufacturer_id']];
                } else {
                    $segments[] = $helper->lang('manufacturers') . '/' . $helper->getManufacturerName($query['virtuemart_manufacturer_id']);
                    if (isset($jmenu['manufacturer'])) {
                        $query['Itemid'] = $jmenu['manufacturer'];
                    } else {
                        $query['Itemid'] = $jmenu['virtuemart'];
                    }
                }
                unset($query['virtuemart_manufacturer_id']);
            } else {
                if (isset($jmenu['manufacturer'])) {
                    $query['Itemid'] = $jmenu['manufacturer'];
                } else {
                    $query['Itemid'] = $jmenu['virtuemart'];
                }
            }
            break;
        case 'user':
            if (isset($jmenu['user'])) {
                $query['Itemid'] = $jmenu['user'];
            } else {
                $segments[] = $helper->lang('user');
                $query['Itemid'] = $jmenu['virtuemart'];
            }
            if (isset($query['task'])) {
                //vmdebug('my task in user view',$query['task']);
                if ($query['task'] == 'editaddresscart') {
                    if ($query['addrtype'] == 'ST') {
                        $segments[] = $helper->lang('editaddresscartST');
                    } else {
                        $segments[] = $helper->lang('editaddresscartBT');
                    }
                } else {
                    if ($query['task'] == 'editaddresscheckout') {
                        if ($query['addrtype'] == 'ST') {
                            $segments[] = $helper->lang('editaddresscheckoutST');
                        } else {
                            $segments[] = $helper->lang('editaddresscheckoutBT');
                        }
                    } else {
                        if ($query['task'] == 'editaddress') {
                            if (isset($query['addrtype']) and $query['addrtype'] == 'ST') {
                                $segments[] = $helper->lang('editaddressST');
                            } else {
                                $segments[] = $helper->lang('editaddressBT');
                            }
                        } else {
                            $segments[] = $helper->lang($query['task']);
                        }
                    }
                }
                /*	if ($query['addrtype'] == 'BT' && $query['task']='editaddresscart') $segments[] = $helper->lang('editaddresscartBT') ;
                			elseif ($query['addrtype'] == 'ST' && $query['task']='editaddresscart') $segments[] = $helper->lang('editaddresscartST') ;
                			elseif ($query['addrtype'] == 'BT') $segments[] = $helper->lang('editaddresscheckoutST') ;
                			elseif ($query['addrtype'] == 'ST') $segments[] = $helper->lang('editaddresscheckoutST') ;
                			else $segments[] = $query['task'] ;*/
                unset($query['task'], $query['addrtype']);
            }
            break;
        case 'vendor':
            /* VM208 */
            if (isset($query['virtuemart_vendor_id'])) {
                if (isset($jmenu['virtuemart_vendor_id'][$query['virtuemart_vendor_id']])) {
                    $query['Itemid'] = $jmenu['virtuemart_vendor_id'][$query['virtuemart_vendor_id']];
                } else {
                    if (isset($jmenu['vendor'])) {
                        $query['Itemid'] = $jmenu['vendor'];
                    } else {
                        $segments[] = $helper->lang('vendor');
                        $query['Itemid'] = $jmenu['virtuemart'];
                    }
                }
            } else {
                if (isset($jmenu['vendor'])) {
                    $query['Itemid'] = $jmenu['vendor'];
                } else {
                    $segments[] = $helper->lang('vendor');
                    $query['Itemid'] = $jmenu['virtuemart'];
                }
            }
            if (isset($query['virtuemart_vendor_id'])) {
                //$segments[] = $helper->lang('vendor').'/'.$helper->getVendorName($query['virtuemart_vendor_id']) ;
                $segments[] = $helper->getVendorName($query['virtuemart_vendor_id']);
                unset($query['virtuemart_vendor_id']);
            }
            break;
        case 'cart':
            if (isset($jmenu['cart'])) {
                $query['Itemid'] = $jmenu['cart'];
            } else {
                $segments[] = $helper->lang('cart');
                $query['Itemid'] = $jmenu['virtuemart'];
            }
            break;
        case 'orders':
            if (isset($jmenu['orders'])) {
                $query['Itemid'] = $jmenu['orders'];
            } else {
                $segments[] = $helper->lang('orders');
                $query['Itemid'] = $jmenu['virtuemart'];
            }
            if (isset($query['order_number'])) {
                $segments[] = 'number/' . $query['order_number'];
                unset($query['order_number'], $query['layout']);
            } else {
                if (isset($query['virtuemart_order_id'])) {
                    $segments[] = 'id/' . $query['virtuemart_order_id'];
                    unset($query['virtuemart_order_id'], $query['layout']);
                }
            }
            //else unset ($query['layout']);
            break;
            // sef only view
        // sef only view
        default:
            $segments[] = $view;
    }
    //	if (!class_exists( 'VmConfig' )) require(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'.DS.'helpers'.DS.'config.php');
    //	vmdebug("case 'productdetails'",$query);
    if (isset($query['task'])) {
        $segments[] = $helper->lang($query['task']);
        unset($query['task']);
    }
    if (isset($query['layout'])) {
        $segments[] = $helper->lang($query['layout']);
        unset($query['layout']);
    }
    // sef the slimbox View
    /*	if (isset($query['tmpl'])) {
    		//if ( $query['tmpl'] = 'component') $segments[] = 'modal' ;
    		$segments[] = $query['tmpl'] ;
    		unset($query['tmpl']);
    	}*/
    return $segments;
}
Beispiel #27
0
 /**
  * Select the products to list on the product list page
  * @param $uid integer Optional user ID to get the orders of a single user
  * @param $_ignorePagination boolean If true, ignore the Joomla pagination (for embedded use, default false)
  */
 public function getOrdersList($uid = 0, $noLimit = false)
 {
     // 		vmdebug('getOrdersList');
     $tUserInfos = $this->getTable('userinfos');
     $this->_noLimit = $noLimit;
     $concat = array();
     if (property_exists($tUserInfos, 'company')) {
         $concat[] = 'u.company';
     }
     if (property_exists($tUserInfos, 'first_name')) {
         $concat[] = 'u.first_name';
     }
     if (property_exists($tUserInfos, 'middle_name')) {
         $concat[] = 'u.middle_name';
     }
     if (property_exists($tUserInfos, 'last_name')) {
         $concat[] = 'u.last_name';
     }
     if (!empty($concat)) {
         $concatStr = "CONCAT_WS(' '," . implode(',', $concat) . ")";
     } else {
         $concatStr = 'o.order_number';
     }
     // quorvia added phone, zip, city and shipping details and ST data
     $select = " o.*, " . $concatStr . " AS order_name " . ',u.email as order_email,
         pm.payment_name AS payment_method,
         u.company AS company,
         u.city AS city,
         u.zip AS zip,
         u.phone_1 AS phone,
         st.address_type AS st_type,
         st.company AS st_company,
         st.city AS st_city,
         st.zip AS st_zip,
         u.customer_note AS customer_note';
     $from = $this->getOrdersListQuery();
     $where = array();
     $virtuemart_vendor_id = vmAccess::isSuperVendor();
     if (vmAccess::manager('managevendors')) {
         vmdebug('Vendor is core.admin and should see all');
         $virtuemart_vendor_id = vRequest::get('virtuemart_vendor_id', $virtuemart_vendor_id);
         if ($virtuemart_vendor_id) {
             $where[] = ' o.virtuemart_vendor_id = "' . $virtuemart_vendor_id . '" ';
         }
         if (!empty($uid)) {
             $where[] = ' u.virtuemart_user_id = ' . (int) $uid . ' ';
         }
     } else {
         if (vmAccess::manager('orders')) {
             vmdebug('Vendor is manager and should only see its own orders venodorId ' . $virtuemart_vendor_id);
             if (!empty($virtuemart_vendor_id)) {
                 $where[] = ' (o.virtuemart_vendor_id = ' . $virtuemart_vendor_id . ' OR u.virtuemart_user_id = ' . (int) $uid . ') ';
                 $uid = 0;
             } else {
                 //We map here as fallback to vendor 1.
                 $where[] = ' u.virtuemart_user_id = ' . (int) $uid;
             }
         } else {
             //A normal user is only allowed to see its own orders, we map $uid to the user id
             $user = JFactory::getUser();
             $uid = (int) $user->id;
             $where = array();
         }
     }
     if (!empty($uid)) {
         $where[] = ' u.virtuemart_user_id = ' . (int) $uid . ' ';
     }
     if ($search = vRequest::getString('search', false)) {
         $db = JFactory::getDBO();
         $search = '"%' . $db->escape($search, true) . '%"';
         $search = str_replace(' ', '%', $search);
         $searchFields = array();
         $searchFields[] = 'u.first_name';
         $searchFields[] = 'u.middle_name';
         $searchFields[] = 'u.last_name';
         $searchFields[] = 'o.order_number';
         $searchFields[] = 'u.company';
         $searchFields[] = 'u.email';
         $searchFields[] = 'u.phone_1';
         $searchFields[] = 'u.address_1';
         $searchFields[] = 'u.zip';
         //quorvia addedd  ST data searches
         $searchFields[] = 'st.company';
         $searchFields[] = 'st.last_name';
         $searchFields[] = 'st.city';
         $searchFields[] = 'st.zip';
         $where[] = implode(' LIKE ' . $search . ' OR ', $searchFields) . ' LIKE ' . $search . ' ';
         //$where[] = ' ( u.first_name LIKE '.$search.' OR u.middle_name LIKE '.$search.' OR u.last_name LIKE '.$search.' OR `order_number` LIKE '.$search.')';
     }
     $order_status_code = vRequest::getString('order_status_code', false);
     if ($order_status_code and $order_status_code != -1) {
         $where[] = ' o.order_status = "' . $order_status_code . '" ';
     }
     if (count($where) > 0) {
         $whereString = ' WHERE (' . implode(' AND ', $where) . ') ';
     } else {
         $whereString = '';
     }
     if (vRequest::getCmd('view') == 'orders') {
         $ordering = $this->_getOrdering();
     } else {
         $ordering = ' order by o.modified_on DESC';
     }
     $this->_data = $this->exeSortSearchListQuery(0, $select, $from, $whereString, '', $ordering);
     if ($this->_data) {
         foreach ($this->_data as $k => $d) {
             $this->_data[$k]->order_name = htmlspecialchars(strip_tags(htmlspecialchars_decode($d->order_name)));
         }
     }
     return $this->_data;
 }
Beispiel #28
0
		<tr>
			<td>
				<strong>
					<?php 
if ($update) {
    echo vmText::_('COM_VIRTUEMART_UPGRADE_SUCCESSFUL');
} else {
    echo vmText::_('COM_VIRTUEMART_INSTALLATION_SUCCESSFUL');
}
?>
				</strong>

			</td>
		</tr>
		<?php 
if (vRequest::get('view', '') == 'install') {
    ?>
			<tr>
				<td>
					<strong style="color: #C00">
						<?php 
    if ($update) {
        echo vmText::_('COM_VIRTUEMART_UPDATE_AIO');
    } else {
        echo vmText::_('COM_VIRTUEMART_INSTALL_AIO');
    }
    ?>
					</strong>
					<?php 
    echo vmText::_('COM_VIRTUEMART_INSTALL_AIO_TIP');
    ?>
Beispiel #29
0
    public function addStandardHiddenToForm1($controller = null, $task = '')
    {
        if (!$controller) {
            $controller = vRequest::getCmd('view');
        }
        $option = vRequest::getCmd('option', 'com_tsmart');
        $hidden = '';
        if (array_key_exists('filter_order', $this->lists)) {
            $hidden = '
			<input type="hidden" name="filter_order" value="' . $this->lists['filter_order'] . '" />
			<input type="hidden" name="filter_order_Dir" value="' . $this->lists['filter_order_Dir'] . '" />';
        }
        if (vRequest::get('manage', false) or JFactory::getApplication()->isSite()) {
            $hidden .= '<input type="hidden" name="manage" value="1" />';
        }
        return $hidden . '
		<input type="hidden" name="task" value="' . $task . '" />
		<input type="hidden" name="option" value="' . $option . '" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="controller" value="' . $controller . '" />
		<input type="hidden" name="view" value="' . $controller . '" />
		' . JHtml::_('form.token');
    }
Beispiel #30
0
 public function updatecart()
 {
     $cart = VirtueMartCart::getCart();
     $cart->_fromCart = true;
     $cart->_redirected = false;
     if (vRequest::get('cancel', 0)) {
         $cart->_inConfirm = false;
     }
     $cart->saveCartFieldsInCart();
     $cart->updateProductCart();
     $coupon_code = vRequest::getString('coupon_code', '');
     if (!empty($coupon_code)) {
         $cart->prepareCartData();
         $msg = $cart->setCouponCode($coupon_code);
         if ($msg) {
             vmInfo($msg);
         }
     }
     $cart->selected_shipto = vRequest::getVar('shipto', -1);
     if (empty($cart->selected_shipto) or $cart->selected_shipto < 1) {
         $cart->STsameAsBT = 1;
         $cart->selected_shipto = 0;
     } else {
         $cart->STsameAsBT = 0;
         //vRequest::getInt('STsameAsBT', $this->STsameAsBT);
     }
     $cart->setShipmentMethod();
     $cart->setPaymentMethod();
     $this->display();
 }