function display($tpl = null)
 {
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $this->vendorId = VmConfig::isSuperVendor();
     // TODO add icon for media view
     $this->SetViewTitle();
     $model = VmModel::getModel('media');
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         $this->media = $model->getFile();
         $this->addStandardEditViewCommands();
     } 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;
         }
         $cat_id = vRequest::getInt('virtuemart_category_id', 0);
         JToolBarHelper::custom('synchronizeMedia', 'new', 'new', vmText::_('COM_VIRTUEMART_TOOLS_SYNC_MEDIA_FILES'), false);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model, null, null, 'searchMedia');
         $options = array('' => vmText::_('COM_VIRTUEMART_LIST_ALL_TYPES'), 'product' => vmText::_('COM_VIRTUEMART_PRODUCT'), 'category' => vmText::_('COM_VIRTUEMART_CATEGORY'), 'manufacturer' => vmText::_('COM_VIRTUEMART_MANUFACTURER'), 'vendor' => vmText::_('COM_VIRTUEMART_VENDOR'));
         $this->lists['search_type'] = VmHTML::selectList('search_type', vRequest::getVar('search_type'), $options, 1, '', 'onchange="this.form.submit();"');
         $options = array('' => vmText::_('COM_VIRTUEMART_LIST_ALL_ROLES'), 'file_is_displayable' => vmText::_('COM_VIRTUEMART_FORM_MEDIA_DISPLAYABLE'), 'file_is_downloadable' => vmText::_('COM_VIRTUEMART_FORM_MEDIA_DOWNLOADABLE'), 'file_is_forSale' => vmText::_('COM_VIRTUEMART_FORM_MEDIA_SET_FORSALE'));
         $this->lists['search_role'] = VmHTML::selectList('search_role', vRequest::getVar('search_role'), $options, 1, '', 'onchange="this.form.submit();"');
         $this->files = $model->getFiles(false, false, $virtuemart_product_id, $cat_id);
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
 }
Exemple #2
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel();
     $layoutName = $this->getLayout();
     $task = vRequest::getCmd('task', $layoutName);
     $this->assignRef('task', $task);
     if ($layoutName == 'edit') {
         //For shoppergroup specific price display
         VmConfig::loadJLang('com_virtuemart_config');
         VmConfig::loadJLang('com_virtuemart_shoppers', true);
         $shoppergroup = $model->getShopperGroup();
         $this->SetViewTitle('SHOPPERGROUP', $shoppergroup->shopper_group_name);
         $vendors = ShopFunctions::renderVendorList($shoppergroup->virtuemart_vendor_id);
         $this->assignRef('vendorList', $vendors);
         $this->assignRef('shoppergroup', $shoppergroup);
         $this->addStandardEditViewCommands();
     } else {
         $this->SetViewTitle();
         $showVendors = $this->showVendors();
         $this->assignRef('showVendors', $showVendors);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $shoppergroups = $model->getShopperGroups(false, true);
         $this->assignRef('shoppergroups', $shoppergroups);
         $pagination = $model->getPagination();
         $this->assignRef('sgrppagination', $pagination);
     }
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel();
     $config = JFactory::getConfig();
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         $cid = vRequest::getInt('cid');
         $task = vRequest::getCmd('task', 'add');
         if ($task != 'add' && !empty($cid) && !empty($cid[0])) {
             $cid = (int) $cid[0];
         } else {
             $cid = 0;
         }
         $model->setId($cid);
         $this->currency = $model->getCurrency();
         $this->SetViewTitle('', $this->currency->currency_name);
         $this->addStandardEditViewCommands();
     } else {
         $this->SetViewTitle();
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model, 0, 'ASC');
         $this->currencies = $model->getCurrenciesList(vRequest::getCmd('search', false));
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $this->SetViewTitle();
     $model = VmModel::getModel();
     $this->state = $model->getSingleState();
     $this->virtuemart_country_id = vRequest::getInt('virtuemart_country_id', $this->state->virtuemart_country_id);
     $isNew = count($this->state) < 1;
     if (empty($countryId) && $isNew) {
         vmWarn('Country id is 0');
         return false;
     }
     $country = VmModel::getModel('country');
     $country->setId($this->virtuemart_country_id);
     $this->country_name = $country->getData()->country_name;
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         $zoneModel = VmModel::getModel('Worldzones');
         $this->worldZones = $zoneModel->getWorldZonesSelectList();
         $this->addStandardEditViewCommands();
     } else {
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $this->states = $model->getStates($this->virtuemart_country_id);
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
 }
Exemple #5
0
	function display ($tpl = null) {

		// Load the helper(s)


		jimport('joomla.filesystem.file');
		$config = JFactory::getConfig();
		$log_path = $config->get('log_path', VMPATH_ROOT . "/log");
		$layoutName = vRequest::getCmd('layout', 'default');
		VmConfig::loadJLang('com_virtuemart_log');

		if ($layoutName == 'edit') {
			$logFile = vRequest::getString('logfile', '');
			$this->SetViewTitle('LOG', $logFile);
			$fileContent = file_get_contents($log_path . DS . $logFile);
			$fileContentByLine = explode("\n", $fileContent);

			$this->assignRef('fileContentByLine', $fileContentByLine);
			JToolBarHelper::cancel();

		} else {
			if(!class_exists('JFolder')) require(VMPATH_LIBS.DS.'joomla'.DS.'filesystem'.DS.'folder.php');

			$logFiles = JFolder::files($log_path, $filter = '.', true, false, array('index.html'));

			$this->SetViewTitle('LOG');
			$this->assignRef('logFiles', $logFiles);
			$this->assignRef('path', $log_path);
		}

		parent::display($tpl);
	}
Exemple #6
0
 function display($tpl = null)
 {
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     //$this->addStandardEditViewCommands();
     parent::display($tpl);
 }
Exemple #7
0
	function display($tpl = null) {


		//Load helpers

		if (!class_exists('CurrencyDisplay'))
			require(VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php');

		if (!class_exists('VmHTML'))
			require(VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php');

		// Get the data
		$model = VmModel::getModel('product');

		// Create filter
		$this->addStandardDefaultViewLists($model);

		$inventorylist = $model->getProductListing();

		$pagination = $model->getPagination();
		$this->assignRef('pagination', $pagination);

		// Apply currency
		$currencydisplay = CurrencyDisplay::getInstance();

		foreach ($inventorylist as $virtuemart_product_id => $product) {

			//TODO oculd be interesting to show the price for each product, and all stored ones $product->product_in_stock
			$price = isset($product->allPrices[$product->selectedPrice]['product_price'])? $product->allPrices[$product->selectedPrice]['product_price']:0;

			$product->product_instock_value = $currencydisplay->priceDisplay($price,'',$product->product_in_stock,false);
			$product->product_price_display = $currencydisplay->priceDisplay($price,'',1,false);

			$product->weigth_unit_display= ShopFunctions::renderWeightUnit($product->product_weight_uom);
		}
		$this->assignRef('inventorylist', $inventorylist);


		$options = array();
		$options[] = JHtml::_('select.option', '', vmText::_('COM_VIRTUEMART_DISPLAY_STOCK').':');
		$options[] = JHtml::_('select.option', 'stocklow', vmText::_('COM_VIRTUEMART_STOCK_LEVEL_LOW'));
		$options[] = JHtml::_('select.option', 'stockout', vmText::_('COM_VIRTUEMART_STOCK_LEVEL_OUT'));
		$this->lists['stockfilter'] = JHtml::_('select.genericlist', $options, 'search_type', 'onChange="document.adminForm.submit(); return false;"', 'value', 'text', vRequest::getVar('search_type'));
		$this->lists['filter_product'] = vRequest::getVar('filter_product');
		// $this->assignRef('lists', $lists);

		/* Toolbar */
		$this->SetViewTitle('PRODUCT_INVENTORY');
		JToolBarHelper::publish();
		JToolBarHelper::unpublish();

		parent::display($tpl);
	}
Exemple #8
0
    function display($tpl = null) {

		// Load the helper(s)
		if (!class_exists( 'VmConfig' )) require(JPATH_COMPONENT_ADMINISTRATOR .'/helpers/config.php');
		VmConfig::loadConfig();
		VmConfig::loadJLang('com_virtuemart_countries');

		if (!class_exists('VmHTML'))
			require(VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php');


		$model = VmModel::getModel('country');
		$zoneModel = VmModel::getModel('worldzones');

		$this->SetViewTitle();


		$layoutName = vRequest::getCmd('layout', 'default');
		if ($layoutName == 'edit') {
			$country = $model->getData();

		    $this->assignRef('country',	$country);
			$wzsList = $zoneModel->getWorldZonesSelectList();
		    $this->assignRef('worldZones', $wzsList	);

			$this->addStandardEditViewCommands();

		}
		else {

			$this->addStandardDefaultViewCommands(true,false);

			//First the view lists, it sets the state of the model
			$this->addStandardDefaultViewLists($model,0,'ASC');

			$filter_country = vRequest::getCmd('filter_country', false);
			$countries = $model->getCountries(false, false, $filter_country);
			$this->assignRef('countries',	$countries);

			$pagination = $model->getPagination();
			$this->assignRef('pagination', $pagination);

		}

		parent::display($tpl);
    }
Exemple #9
0
 function display($tpl = null)
 {
     $latestVersion = vRequest::getVar('latestverison', '');
     JToolBarHelper::title(vmText::_('COM_VIRTUEMART_UPDATE_MIGRATION'), 'head vm_config_48');
     if (!class_exists('VmImage')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
     }
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $this->assignRef('checkbutton_style', $checkbutton_style);
     $this->assignRef('downloadbutton_style', $downloadbutton_style);
     $this->assignRef('latestVersion', $latestVersion);
     $freshInstall = vRequest::getInt('redirected', 0);
     if ($freshInstall) {
         $this->setLayout('install');
     }
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel();
     $layoutName = vRequest::getCmd('layout', 'default');
     // 'A' : sotck Available
     // 'O' : stock Out
     // 'R' : stock reserved
     $this->stockHandelList = array('A' => 'COM_VIRTUEMART_ORDER_STATUS_STOCK_AVAILABLE', 'R' => 'COM_VIRTUEMART_ORDER_STATUS_STOCK_RESERVED', 'O' => 'COM_VIRTUEMART_ORDER_STATUS_STOCK_OUT');
     $this->lists = array();
     $this->lists['vmCoreStatusCode'] = $model->getVMCoreStatusCode();
     if ($layoutName == 'edit') {
         $this->orderStatus = $model->getData();
         $this->SetViewTitle('', vmText::_($this->orderStatus->order_status_name));
         if ($this->orderStatus->virtuemart_orderstate_id < 1) {
             $this->ordering = vmText::_('COM_VIRTUEMART_NEW_ITEMS_PLACE');
         } else {
             if (!class_exists('ShopFunctions')) {
                 require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php';
             }
             $this->ordering = ShopFunctions::renderOrderingList('orderstates', 'order_status_name', $this->orderStatus->ordering);
         }
         // Vendor selection
         $vendor_model = VmModel::getModel('vendor');
         $vendor_list = $vendor_model->getVendors();
         $this->lists['vendors'] = JHtml::_('select.genericlist', $vendor_list, 'virtuemart_vendor_id', '', 'virtuemart_vendor_id', 'vendor_name', $this->orderStatus->virtuemart_vendor_id);
         $this->addStandardEditViewCommands();
     } else {
         $this->SetViewTitle('');
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $this->orderStatusList = $model->getOrderStatusList();
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
 }
Exemple #11
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     // get necessary model
     $model = VmModel::getModel();
     $this->SetViewTitle('MANUFACTURER_CATEGORY');
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         $manufacturerCategory = $model->getData();
         $this->assignRef('manufacturerCategory', $manufacturerCategory);
         $this->addStandardEditViewCommands($manufacturerCategory->virtuemart_manufacturercategories_id);
     } else {
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $manufacturerCategories = $model->getManufacturerCategories();
         $this->assignRef('manufacturerCategories', $manufacturerCategories);
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
 }
Exemple #12
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     // get necessary models
     $model = VmModel::getModel('manufacturer');
     $categoryModel = VmModel::getModel('manufacturercategories');
     $this->SetViewTitle();
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         $this->manufacturer = $model->getManufacturer();
         $isNew = $this->manufacturer->virtuemart_manufacturer_id < 1;
         $model->addImages($this->manufacturer);
         /* Process the images */
         $mediaModel = VmModel::getModel('media');
         $mediaModel->setId($this->manufacturer->virtuemart_media_id);
         $image = $mediaModel->getFile('manufacturer', 'image');
         $this->manufacturerCategories = $categoryModel->getManufacturerCategories(false, true);
         $this->addStandardEditViewCommands($this->manufacturer->virtuemart_manufacturer_id);
         if (!class_exists('VirtueMartModelVendor')) {
             require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
         }
         $this->virtuemart_vendor_id = VirtueMartModelVendor::getLoggedVendor();
     } else {
         $mainframe = JFactory::getApplication();
         $categoryFilter = $categoryModel->getCategoryFilter();
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model, 'mf_name');
         $this->manufacturers = $model->getManufacturers();
         $this->pagination = $model->getPagination();
         $virtuemart_manufacturercategories_id = $mainframe->getUserStateFromRequest('com_virtuemart.virtuemart_manufacturercategories_id', 'virtuemart_manufacturercategories_id', 0, 'int');
         $this->lists['virtuemart_manufacturercategories_id'] = JHtml::_('select.genericlist', $categoryFilter, 'virtuemart_manufacturercategories_id', 'class="inputbox" onchange="this.form.submit()"', 'value', 'text', $virtuemart_manufacturercategories_id);
     }
     parent::display($tpl);
 }
Exemple #13
0
 function display($tpl = null)
 {
     VmConfig::loadJLang('com_virtuemart_countries');
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel('country');
     $zoneModel = VmModel::getModel('worldzones');
     $this->SetViewTitle();
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         $this->country = $model->getData();
         $this->wzsList = $zoneModel->getWorldZonesSelectList();
         $this->addStandardEditViewCommands();
     } else {
         $this->addStandardDefaultViewCommands(true, false);
         //First the view lists, it sets the state of the model
         $this->addStandardDefaultViewLists($model, 0, 'ASC');
         $filter_country = vRequest::getCmd('filter_country', false);
         $this->countries = $model->getCountries(false, false, $filter_country);
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
 }
Exemple #14
0
 function display($tpl = null)
 {
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel('calc');
     //@todo should be depended by loggedVendor
     $this->vendorId = vmAccess::getVendorId();
     $this->SetViewTitle();
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         $calc = $model->getCalc();
         $this->assignRef('calc', $calc);
         $isNew = $calc->virtuemart_calc_id < 1;
         if ($isNew) {
             $calc->virtuemart_vendor_id = $this->vendorId;
             $db = JFactory::getDBO();
             //get default currency of the vendor, if not set get default of the shop
             $q = 'SELECT `vendor_currency` FROM `#__virtuemart_vendors` WHERE `virtuemart_vendor_id` = "' . $this->vendorId . '"';
             $db->setQuery($q);
             $currency = $db->loadResult();
             if (empty($currency)) {
                 $q = 'SELECT `vendor_currency` FROM `#__virtuemart_vendors` WHERE `virtuemart_vendor_id` = "1" ';
                 $db->setQuery($q);
                 $currency = $db->loadResult();
                 $calc->calc_currency = $currency;
             } else {
                 $calc->calc_currency = $currency;
             }
         }
         $this->entryPointsList = self::renderEntryPointsList($calc->calc_kind);
         $this->mathOpList = self::renderMathOpList($calc->calc_value_mathop);
         if (empty($calc->calc_categories)) {
             $calc->calc_categories = array();
         } else {
             if (!is_array($calc->calc_categories)) {
                 $calc->calc_categories = array($calc->calc_categories);
             }
         }
         $calc_categories = $calc->calc_categories;
         $this->categoryTree = ShopFunctions::categoryListTree($calc_categories);
         $currencyModel = VmModel::getModel('currency');
         $this->currencies = $currencyModel->getCurrencies();
         $this->shopperGroupList = ShopFunctions::renderShopperGroupList($calc->virtuemart_shoppergroup_ids, True);
         if (!class_exists('ShopFunctionsF')) {
             require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
         }
         $this->countriesList = ShopFunctionsF::renderCountryList($calc->calc_countries, True);
         $this->statesList = ShopFunctionsF::renderStateList($calc->virtuemart_state_ids, '', True);
         $this->manufacturerList = ShopFunctions::renderManufacturerList($calc->virtuemart_manufacturers, true);
         if ($this->showVendors()) {
             $this->vendorList = ShopFunctions::renderVendorList($calc->virtuemart_vendor_id);
         }
         $this->addStandardEditViewCommands();
     } else {
         if ($this->showVendors()) {
             JToolBarHelper::custom('toggle.shared.1', 'publish', 'yes', vmText::_('COM_VIRTUEMART_SHARED_TOGGLE_ON'), true);
             JToolBarHelper::custom('toggle.shared.0', 'unpublish', 'no', vmText::_('COM_VIRTUEMART_SHARED_TOGGLE_OFF'), true);
         }
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $search = vRequest::getCmd('search', false);
         $this->calcs = $model->getCalcs(false, false, $search);
         VmConfig::loadJLang('com_virtuemart_shoppers', true);
         foreach ($this->calcs as &$data) {
             $data->calcCategoriesList = shopfunctions::renderGuiList($data->virtuemart_calc_id, 'categories', 'category_name', 'category', 'calc_categories', 'virtuemart_calc_id');
             $data->calcShoppersList = shopfunctions::renderGuiList($data->virtuemart_calc_id, 'shoppergroups', 'shopper_group_name', 'shoppergroup', 'calc_shoppergroups', 'virtuemart_calc_id');
             $data->calcCountriesList = shopfunctions::renderGuiList($data->virtuemart_calc_id, 'countries', 'country_name', 'country', 'calc_countries', 'virtuemart_calc_id');
             $data->calcStatesList = shopfunctions::renderGuiList($data->virtuemart_calc_id, 'states', 'state_name', 'states', 'calc_states', 'virtuemart_calc_id');
             $data->calcManufacturersList = shopfunctions::renderGuiList($data->virtuemart_calc_id, 'manufacturers', 'mf_name', 'manufacturer', 'calc_manufacturers', 'virtuemart_calc_id');
         }
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
 }
Exemple #15
0
	function display($tpl = null) {


		//Load helpers
		if (!class_exists('CurrencyDisplay'))
			require(VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php');

		if (!class_exists('VmHTML'))
			require(VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php');

		if(!class_exists('vmPSPlugin')) require(VMPATH_PLUGINLIBS.DS.'vmpsplugin.php');
		$orderStatusModel=VmModel::getModel('orderstatus');
		$orderStates = $orderStatusModel->getOrderStatusList();

		$this->SetViewTitle( 'ORDER');

		$orderModel = VmModel::getModel();

		$curTask = vRequest::getCmd('task');
		if ($curTask == 'edit') {
			VmConfig::loadJLang('com_virtuemart_shoppers',TRUE);
			VmConfig::loadJLang('com_virtuemart_orders', true);

			//For getOrderStatusName
			if (!class_exists('ShopFunctions'))	require(VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php');

			// Load addl models
			$userFieldsModel = VmModel::getModel('userfields');

			// Get the data
			$virtuemart_order_id = vRequest::getInt('virtuemart_order_id');
			$order = $orderModel->getOrder($virtuemart_order_id);


			$_orderID = $order['details']['BT']->virtuemart_order_id;
			$orderbt = $order['details']['BT'];
			$orderst = (array_key_exists('ST', $order['details'])) ? $order['details']['ST'] : $orderbt;
			$orderbt ->invoiceNumber = $orderModel->getInvoiceNumber($orderbt->virtuemart_order_id);

			$currency = CurrencyDisplay::getInstance('',$order['details']['BT']->virtuemart_vendor_id);

			$this->assignRef('currency', $currency);

			$_userFields = $userFieldsModel->getUserFields(
					 'account'
					, array('captcha' => true, 'delimiters' => true) // Ignore these types
					, array('delimiter_userinfo','user_is_vendor' ,'username','name','password', 'password2', 'agreed', 'address_type') // Skips
			);
			$userFieldsCart = $userFieldsModel->getUserFields(
				'cart'
				, array('captcha' => true, 'delimiters' => true) // Ignore these types
				, array('delimiter_userinfo','user_is_vendor' ,'username','password', 'password2', 'agreed', 'address_type') // Skips
			);
			$_userFields = array_merge($userFieldsCart,$_userFields);

			//Fallback for customer_note
			if(empty($orderbt->customer_note) and !empty($orderbt->oc_note)){
				$orderbt->customer_note = $orderbt->oc_note;
			}

			$userfields = $userFieldsModel->getUserFieldsFilled(
					 $_userFields
					,$orderbt
					,'BT_'
			);

			$_userFields = $userFieldsModel->getUserFields(
					 'shipment'
					, array() // Default switches
					, array('delimiter_userinfo', 'username', 'email', 'password', 'password2', 'agreed', 'address_type') // Skips
			);

			$shipmentfields = $userFieldsModel->getUserFieldsFilled(
					 $_userFields
					,$orderst
					,'ST_'
			);

			// Create an array to allow orderlinestatuses to be translated
			// We'll probably want to put this somewhere in ShopFunctions...
			$_orderStatusList = array();
			foreach ($orderStates as $orderState) {
				//$_orderStatusList[$orderState->virtuemart_orderstate_id] = $orderState->order_status_name;
				//When I use update, I have to use this?
				$_orderStatusList[$orderState->order_status_code] = vmText::_($orderState->order_status_name);
			}

			$_itemStatusUpdateFields = array();
			$_itemAttributesUpdateFields = array();
			foreach($order['items'] as $_item) {
				$_itemStatusUpdateFields[$_item->virtuemart_order_item_id] = JHtml::_('select.genericlist', $orderStates, "item_id[".$_item->virtuemart_order_item_id."][order_status]", 'class="selectItemStatusCode"', 'order_status_code', 'order_status_name', $_item->order_status, 'order_item_status'.$_item->virtuemart_order_item_id,true);

			}

			if(!isset($_orderStatusList[$orderbt->order_status])){
				if(empty($orderbt->order_status)){
					$orderbt->order_status = 'unknown';
				}
				$_orderStatusList[$orderbt->order_status] = vmText::_('COM_VIRTUEMART_UNKNOWN_ORDER_STATUS');
			}

			$this->lists['search'] = '';

			/* Assign the data */
			$this->assignRef('orderdetails', $order);
			$this->assignRef('orderID', $_orderID);
			$this->assignRef('userfields', $userfields);
			$this->assignRef('shipmentfields', $shipmentfields);
			$this->assignRef('orderstatuslist', $_orderStatusList);
			$this->assignRef('itemstatusupdatefields', $_itemStatusUpdateFields);
			$this->assignRef('itemattributesupdatefields', $_itemAttributesUpdateFields);
			$this->assignRef('orderbt', $orderbt);
			$this->assignRef('orderst', $orderst);
			$this->assignRef('virtuemart_shipmentmethod_id', $orderbt->virtuemart_shipmentmethod_id);

			/* Data for the Edit Status form popup */
			$_currentOrderStat = $order['details']['BT']->order_status;
			// used to update all item status in one time
			$_orderStatusSelect = JHtml::_('select.genericlist', $orderStates, 'order_status', '', 'order_status_code', 'order_status_name', $_currentOrderStat, 'order_items_status',true);
			$this->assignRef('orderStatSelect', $_orderStatusSelect);
			$this->assignRef('currentOrderStat', $_currentOrderStat);

			/* Toolbar */
			if (JVM_VERSION < 3) { $backward="back"; $list='back';} else {$backward='backward';$list='list';}
			JToolBarHelper::custom( 'prevItem', $backward,'','COM_VIRTUEMART_ITEM_PREVIOUS',false);
			JToolBarHelper::custom( 'nextItem', 'forward','','COM_VIRTUEMART_ITEM_NEXT',false);
			JToolBarHelper::divider();
			JToolBarHelper::custom( 'cancel', $list,'','COM_VIRTUEMART_ORDER_LIST_LBL',false,false);
		}
		else if ($curTask == 'editOrderItem') {
			if(!class_exists('calculationHelper')) require(VMPATH_ADMIN.DS.'helpers'.DS.'calculationh.php');

			$this->assignRef('orderstatuses', $orderStates);

			$model = VmModel::getModel();
			$orderId = vRequest::getString('orderId', '');
			$orderLineItem = vRequest::getVar('orderLineId', '');
			$this->assignRef('virtuemart_order_id', $orderId);
			$this->assignRef('virtuemart_order_item_id', $orderLineItem);

			$orderItem = $model->getOrderLineDetails($orderId, $orderLineItem);
			$this->assignRef('orderitem', $orderItem);
		}
		else {
			$this->setLayout('orders');

			$model = VmModel::getModel();
			$this->addStandardDefaultViewLists($model,'created_on');
			$orderStatusModel =VmModel::getModel('orderstatus');
			$orderstates = vRequest::getCmd('order_status_code','');
			$this->lists['state_list'] = $orderStatusModel->renderOSList($orderstates,'order_status_code',FALSE,' onchange="this.form.submit();" ');
			$orderslist = $model->getOrdersList();

			$this->assignRef('orderstatuses', $orderStates);

			if(!class_exists('CurrencyDisplay'))require(VMPATH_ADMIN.DS.'helpers'.DS.'currencydisplay.php');

			/* Apply currency This must be done per order since it's vendor specific */
			$_currencies = array(); // Save the currency data during this loop for performance reasons

			if ($orderslist) {

			    foreach ($orderslist as $virtuemart_order_id => $order) {

				    if(!empty($order->order_currency)){
					    $currency = $order->order_currency;
				    } else if($order->virtuemart_vendor_id){
					    if(!class_exists('VirtueMartModelVendor')) require(VMPATH_ADMIN.DS.'models'.DS.'vendor.php');
					    $currObj = VirtueMartModelVendor::getVendorCurrency($order->virtuemart_vendor_id);
				        $currency = $currObj->virtuemart_currency_id;
				   }
				    //This is really interesting for multi-X, but I avoid to support it now already, lets stay it in the code
				    if (!array_key_exists('curr'.$currency, $_currencies)) {

					    $_currencies['curr'.$currency] = CurrencyDisplay::getInstance($currency,$order->virtuemart_vendor_id);
				    }

				    $order->order_total = $_currencies['curr'.$currency]->priceDisplay($order->order_total);
				    $order->invoiceNumber = $model->getInvoiceNumber($order->virtuemart_order_id);
			    }

			}

			//update order items button
			/*$q = 'SELECT * FROM #__virtuemart_order_items WHERE `product_discountedPriceWithoutTax` IS NULL ';
			$db = JFactory::getDBO();
			$db->setQuery($q);
			//$res = $db->loadRow();
			if(true) {
				JToolBarHelper::custom('updateCustomsOrderItems', 'new', 'new', vmText::_('COM_VIRTUEMART_REPORT_UPDATEORDERITEMS'),false);
				vmError('COM_VIRTUEMART_UPDATEORDERITEMS_WARN');
			}*/
			/*
			 * UpdateStatus removed from the toolbar; don't understand how this was intented to work but
			 * the order ID's aren't properly passed. Might be readded later; the controller needs to handle
			 * the arguments.
			 */

			/* Toolbar */
			//JToolBarHelper::customX( 'CreateOrderHead', 'new','new','New',false);
			JToolBarHelper::save('updatestatus', vmText::_('COM_VIRTUEMART_UPDATE_STATUS'));

			if ($this->canDo->get('core.admin') || $this->canDo->get('vm.orders.delete')) {
				JToolBarHelper::spacer('100');
				JToolBarHelper::deleteList();
			}

			/* Assign the data */
			$this->assignRef('orderslist', $orderslist);

			$pagination = $model->getPagination();
			$this->assignRef('pagination', $pagination);

		}
		if(JFactory::getApplication()->isSite()) {
			$bar = JToolBar::getInstance( 'toolbar' );
			$bar->appendButton( 'Link', 'back', 'COM_VIRTUEMART_LEAVE', 'index.php?option=com_virtuemart&manage=0' );
		}

		shopFunctions::checkSafePath();

		parent::display($tpl);
	}
Exemple #16
0
	/**
	 * This is wrong
	 *@deprecated
	 */
	function renderMail() {
		$this->setLayout('mail_html_waitlist');
		$this->subject = vmText::sprintf('COM_VIRTUEMART_PRODUCT_WAITING_LIST_EMAIL_SUBJECT', $this->productName);
		$notice_body = vmText::sprintf('COM_VIRTUEMART_PRODUCT_WAITING_LIST_EMAIL_BODY', $this->productName, $this->url);

		parent::display();
	}
Exemple #17
0
	function display($tpl = null) {

		// Load the helper(s)


		if (!class_exists('VmHTML'))
			require(VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php');

		$model = VmModel::getModel();

		$coupon = $model->getCoupon();
		$this->SetViewTitle('', $coupon->coupon_code);


		$layoutName = vRequest::getCmd('layout', 'default');


// 		if(Vmconfig::get('multix','none')!=='none'){
// 				$vendorList= ShopFunctions::renderVendorList($coupon->virtuemart_vendor_id);
// 				$this->assignRef('vendorList', $vendorList);
// 		}

		 $vendorModel = VmModel::getModel('Vendor');
		$vendorModel->setId(1);
		$vendor = $vendorModel->getVendor();

		$currencyModel = VmModel::getModel('Currency');
		$currencyModel = $currencyModel->getCurrency($vendor->vendor_currency);
		$this->assignRef('vendor_currency', $currencyModel->currency_symbol);

		if ($layoutName == 'edit') {
			if ($coupon->virtuemart_coupon_id < 1) {
				// Set a default expiration date
				$_expTime = explode(',', VmConfig::get('coupons_default_expire','14,D'));

				if (!empty( $_expTime[1]) && $_expTime[1] == 'W') {
					$_expTime[0] = $_expTime[0] * 7;
					$_expTime[1] = 'D';
				}
				if (version_compare(PHP_VERSION, '5.3.0', '<')) {
					$_dtArray = getdate(time());
					if ($_expTime[1] == 'D') {
						$_dtArray['mday'] += $_expTime[0];
					} elseif ($_expTime[1] == 'M') {
						$_dtArray['mon'] += $_expTime[0];
					} elseif ($_expTime[1] == 'Y') {
						$_dtArray['year'] += $_expTime[0];
					}
					$coupon->coupon_expiry_date =
						  mktime($_dtArray['hours'], $_dtArray['minutes'], $_dtArray['seconds']
						, $_dtArray['mon'], $_dtArray['mday'], $_dtArray['year']);
				} else {
					$_expDate = new DateTime();
					$_expDate->add(new DateInterval('P'.$_expTime[0].$_expTime[1]));
					$coupon->coupon_expiry_date = $_expDate->format("U");
				}
			}

			$this->assignRef('coupon',	$coupon);

			$this->addStandardEditViewCommands();
        } else {

			$this->addStandardDefaultViewCommands();
			$this->addStandardDefaultViewLists($model);

			$coupons = $model->getCoupons();
			$this->assignRef('coupons',	$coupons);

			$pagination = $model->getPagination();
			$this->assignRef('pagination', $pagination);

		}

		parent::display($tpl);
	}
Exemple #18
0
 function renderMailLayout($doVendor = false)
 {
     $tpl = $doVendor ? 'mail_html_regvendor' : 'mail_html_reguser';
     $this->setLayout($tpl);
     $vendorModel = VmModel::getModel('vendor');
     $vendorId = 1;
     $vendorModel->setId($vendorId);
     $vendor = $vendorModel->getVendor();
     $vendorModel->addImages($vendor);
     $this->assignRef('subject', $doVendor ? vmText::sprintf('COM_VIRTUEMART_NEW_USER_MESSAGE_VENDOR_SUBJECT', $this->user->get('email')) : vmText::sprintf('COM_VIRTUEMART_NEW_USER_MESSAGE_SUBJECT', $vendor->vendor_store_name));
     parent::display();
 }
Exemple #19
0
	function display($tpl = null) {

		// Load the helper(s)


		if (!class_exists('VmHTML'))
			require(VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php');

		$this->SetViewTitle();


		$model = VmModel::getModel();

//		$stateId = vRequest::getVar('virtuemart_state_id');
//		$model->setId($stateId);
		$state = $model->getSingleState();

		$countryId = vRequest::getInt('virtuemart_country_id', 0);
		if(empty($countryId)) $countryId = $state->virtuemart_country_id;
		$this->assignRef('virtuemart_country_id',	$countryId);

        $isNew = (count($state) < 1);

		if(empty($countryId) && $isNew){
			vmWarn('Country id is 0');
			return false;
		}

		$country = VmModel::getModel('country');
		$country->setId($countryId);
		$this->assignRef('country_name', $country->getData()->country_name);


		$layoutName = vRequest::getCmd('layout', 'default');
		if ($layoutName == 'edit') {


			$this->assignRef('state', $state);

			$zoneModel = VmModel::getModel('Worldzones');
			$wzsList = $zoneModel->getWorldZonesSelectList();
			$this->assignRef('worldZones', $wzsList);

			$this->addStandardEditViewCommands();

		} else {

			$this->addStandardDefaultViewCommands();
			$this->addStandardDefaultViewLists($model);

			$states = $model->getStates($countryId);
			$this->assignRef('states',	$states);

			$pagination = $model->getPagination();
			$this->assignRef('pagination', $pagination);

		}

		parent::display($tpl);
	}
 function display($tpl = null)
 {
     JToolBarHelper::title(vmText::_('COM_VIRTUEMART_ABOUT') . "::" . vmText::_('COM_VIRTUEMART_CONTROL_PANEL'), 'vm_store_48');
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     $mainframe = Jfactory::getApplication();
     $option = vRequest::getCmd('option');
     //Load helpers
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     /* Get the review IDs to retrieve (input variable may be cid, cid[] or virtuemart_rating_review_id */
     $cids = vRequest::getInt('cid', vRequest::getVar('virtuemart_rating_review_id', 0));
     if ($cids && !is_array($cids)) {
         $cids = array($cids);
     }
     // Figure out maximum rating scale (default is 5 stars)
     $this->max_rating = VmConfig::get('vm_maximum_rating_scale', 5);
     $model = VmModel::getModel();
     $this->SetViewTitle('REVIEW_RATE');
     /* Get the task */
     $task = vRequest::getCmd('task');
     switch ($task) {
         case 'edit':
             /* Get the data
             				$rating = $model->getRating($cids);
             				$this->addStandardEditViewCommands();
             
             				break;*/
         /* Get the data
         				$rating = $model->getRating($cids);
         				$this->addStandardEditViewCommands();
         
         				break;*/
         case 'listreviews':
             /* Get the data */
             $this->addStandardDefaultViewLists($model);
             $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;
             }
             $this->reviewslist = $model->getReviews($virtuemart_product_id);
             $lists = array();
             $lists['filter_order'] = $mainframe->getUserStateFromRequest($option . 'filter_order', 'filter_order', '', 'cmd');
             $lists['filter_order_Dir'] = $mainframe->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
             $this->pagination = $model->getPagination();
             $this->addStandardDefaultViewCommands(false, true);
             break;
         case 'edit_review':
             JToolBarHelper::divider();
             // Get the data
             $this->rating = $model->getReview($cids);
             if (!empty($this->rating)) {
                 $this->SetViewTitle('REVIEW_RATE', $this->rating->product_name . " (" . $this->rating->customer . ")");
                 JToolBarHelper::custom('saveReview', 'save', 'save', vmText::_('COM_VIRTUEMART_SAVE'), false);
                 JToolBarHelper::custom('applyReview', 'apply', 'apply', vmText::_('COM_VIRTUEMART_APPLY'), false);
             } else {
                 $this->SetViewTitle('REVIEW_RATE', 'ERROR');
             }
             JToolBarHelper::custom('cancelEditReview', 'cancel', 'cancel', vmText::_('COM_VIRTUEMART_CANCEL'), false);
             break;
         default:
             $this->addStandardDefaultViewCommands(false, true);
             $this->addStandardDefaultViewLists($model);
             $this->ratingslist = $model->getRatings();
             $this->pagination = $model->getPagination();
             break;
     }
     parent::display($tpl);
 }
Exemple #22
0
 function display($tpl = null)
 {
     if (!class_exists('VmImage')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
     }
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel();
     $usermodel = VmModel::getModel('user');
     JToolBarHelper::title(vmText::_('COM_VIRTUEMART_CONFIG'), 'head vm_config_48');
     $this->addStandardEditViewCommands();
     $this->config = VmConfig::loadConfig();
     if (!empty($this->config->_params)) {
         unset($this->config->_params['pdf_invoice']);
         // parameter remove and replaced by inv_os
     }
     $this->userparams = JComponentHelper::getParams('com_users');
     $this->jTemplateList = ShopFunctions::renderTemplateList(vmText::_('COM_VIRTUEMART_ADMIN_CFG_JOOMLA_TEMPLATE_DEFAULT'));
     $this->vmLayoutList = $model->getLayoutList('virtuemart');
     $this->cartLayoutList = $model->getLayoutList('cart', array('padded.php', 'perror.php'));
     $this->categoryLayoutList = $model->getLayoutList('category');
     $this->productLayoutList = $model->getLayoutList('productdetails');
     $this->productsFieldList = $model->getFieldList('products');
     $this->noimagelist = $model->getNoImageList();
     $this->orderStatusModel = VmModel::getModel('orderstatus');
     $this->os_Options = $this->osWoP_Options = $this->osDel_Options = $this->orderStatusModel->getOrderStatusNames();
     $emptyOption = JHtml::_('select.option', -1, vmText::_('COM_VIRTUEMART_NONE'), 'order_status_code', 'order_status_name');
     unset($this->osWoP_Options['P']);
     array_unshift($this->os_Options, $emptyOption);
     $deldate_inv = JHtml::_('select.option', 'm', vmText::_('COM_VIRTUEMART_DELDATE_INV'), 'order_status_code', 'order_status_name');
     unset($this->osDel_Options['P']);
     array_unshift($this->osDel_Options, $deldate_inv);
     array_unshift($this->osDel_Options, $emptyOption);
     //vmdebug('my $this->os_Options',$this->osWoP_Options);
     $this->currConverterList = $model->getCurrencyConverterList();
     $this->activeLanguages = $model->getActiveLanguages(VmConfig::get('active_languages'));
     $this->orderByFieldsProduct = $model->getProductFilterFields('browse_orderby_fields');
     VmModel::getModel('category');
     foreach (VirtueMartModelCategory::$_validOrderingFields as $key => $field) {
         if ($field == 'c.category_shared') {
             continue;
         }
         $fieldWithoutPrefix = $field;
         $dotps = strrpos($fieldWithoutPrefix, '.');
         if ($dotps !== false) {
             $prefix = substr($field, 0, $dotps + 1);
             $fieldWithoutPrefix = substr($field, $dotps + 1);
         }
         $text = vmText::_('COM_VIRTUEMART_' . strtoupper($fieldWithoutPrefix));
         $orderByFieldsCat[] = JHtml::_('select.option', $field, $text);
     }
     $this->orderByFieldsCat = $orderByFieldsCat;
     $this->searchFields = $model->getProductFilterFields('browse_search_fields');
     $this->aclGroups = $usermodel->getAclGroupIndentedTree();
     if (!class_exists('VmTemplate')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
     }
     $this->vmtemplate = VmTemplate::loadVmTemplateStyle();
     $this->imagePath = shopFunctions::getAvailabilityIconUrl($this->vmtemplate);
     $this->listShipment = $this->listIt('shipment');
     $this->listPayment = $this->listIt('payment');
     shopFunctions::checkSafePath();
     $this->checkTCPDFinstalled();
     $this->checkVmUserVendor();
     //$this -> checkClientIP();
     parent::display($tpl);
 }
Exemple #23
0
 function display($tpl = null)
 {
     if (!class_exists('VirtueMartModelConfig')) {
         require VMPATH_ADMIN . 'models/config.php';
     }
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel();
     $layoutName = $this->getLayout();
     $task = vRequest::getCmd('task', $layoutName);
     $this->assignRef('task', $task);
     $this->user = $user = JFactory::getUser();
     if ($layoutName == 'edit') {
         $category = $model->getCategory('', false);
         // Toolbar
         $text = '';
         if (isset($category->category_name)) {
             $name = $category->category_name;
         } else {
             $name = '';
         }
         if (!empty($category->virtuemart_category_id)) {
             $text = '<a href="' . juri::root() . 'index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id . '" target="_blank" >' . $name . '<span class="vm2-modallink"></span></a>';
         }
         $this->SetViewTitle('CATEGORY', $text);
         $model->addImages($category);
         if ($category->virtuemart_category_id > 1) {
             $relationInfo = $model->getRelationInfo($category->virtuemart_category_id);
             $this->assignRef('relationInfo', $relationInfo);
         }
         $parent = $model->getParentCategory($category->virtuemart_category_id);
         $this->assignRef('parent', $parent);
         if (!class_exists('ShopFunctions')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php';
         }
         $templateList = ShopFunctions::renderTemplateList(vmText::_('COM_VIRTUEMART_CATEGORY_TEMPLATE_DEFAULT'));
         $this->assignRef('jTemplateList', $templateList);
         $categoryLayoutList = VirtueMartModelConfig::getLayoutList('category');
         $this->assignRef('categoryLayouts', $categoryLayoutList);
         $productLayouts = VirtueMartModelConfig::getLayoutList('productdetails');
         $this->assignRef('productLayouts', $productLayouts);
         //Nice fix by Joe, the 4. param prevents setting an category itself as child
         $categorylist = ShopFunctions::categoryListTree(array($parent->virtuemart_category_id), 0, 0, (array) $category->virtuemart_category_id);
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $vendorList = ShopFunctions::renderVendorList($category->virtuemart_vendor_id, false);
             $this->assignRef('vendorList', $vendorList);
         }
         $this->assignRef('category', $category);
         $this->assignRef('categorylist', $categorylist);
         $this->addStandardEditViewCommands($category->virtuemart_category_id, $category);
     } else {
         $this->SetViewTitle('CATEGORY_S');
         $keyWord = '';
         $this->assignRef('catmodel', $model);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model, 'category_name');
         $categories = $model->getCategoryTree(0, 0, false, $this->lists['search']);
         $this->assignRef('categories', $categories);
         $pagination = $model->getPagination();
         $this->assignRef('catpagination', $pagination);
         //we need a function of the FE shopfunctions helper to cut the category descriptions
         if (!class_exists('shopFunctionsF')) {
             require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
         }
     }
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     // Load the helper(s)
     $this->addHelperPath(VMPATH_ADMIN . DS . 'helpers');
     if (!class_exists('vmPSPlugin')) {
         require VMPATH_PLUGINLIBS . DS . 'vmpsplugin.php';
     }
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel();
     $layoutName = vRequest::getCmd('layout', 'default');
     $this->SetViewTitle();
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         VmConfig::loadJLang('plg_vmpsplugin', false);
         JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields');
         $shipment = $model->getShipment();
         // Get the payment XML.
         $formFile = vRequest::filterPath(VMPATH_ROOT . DS . 'plugins' . DS . 'vmshipment' . DS . $shipment->shipment_element . DS . $shipment->shipment_element . '.xml');
         if (file_exists($formFile)) {
             $shipment->form = JForm::getInstance($shipment->shipment_element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]');
             $shipment->params = new stdClass();
             $varsToPush = vmPlugin::getVarsToPushFromForm($shipment->form);
             VmTable::bindParameterableToSubField($shipment, $varsToPush);
             $shipment->form->bind($shipment->getProperties());
         } else {
             $shipment->form = null;
         }
         if (!class_exists('VmImage')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
         }
         if (!class_exists('VirtueMartModelVendor')) {
             require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
         }
         $vendor_id = 1;
         $currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
         $this->assignRef('vendor_currency', $currency->currency_symbol);
         if ($this->showVendors()) {
             $vendorList = ShopFunctions::renderVendorList($shipment->virtuemart_vendor_id);
             $this->assignRef('vendorList', $vendorList);
         }
         $this->pluginList = self::renderInstalledShipmentPlugins($shipment->shipment_jplugin_id);
         $this->assignRef('shipment', $shipment);
         $this->shopperGroupList = ShopFunctions::renderShopperGroupList($shipment->virtuemart_shoppergroup_ids, true);
         $this->addStandardEditViewCommands($shipment->virtuemart_shipmentmethod_id);
     } else {
         JToolBarHelper::custom('cloneshipment', 'copy', 'copy', vmText::_('COM_VIRTUEMART_SHIPMENT_CLONE'), true);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $this->shipments = $model->getShipments();
         VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
         foreach ($this->shipments as &$data) {
             // Write the first 5 shoppergroups in the list
             $data->shipmentShoppersList = shopfunctions::renderGuiList($data->virtuemart_shoppergroup_ids, 'shoppergroups', 'shopper_group_name', 'shopper');
         }
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
 }
Exemple #25
0
 function display($tpl = null)
 {
     VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
     $option = vRequest::getCmd('option');
     $mainframe = JFactory::getApplication();
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $layoutName = vRequest::getCmd('layout', 'default');
     $model = VmModel::getModel();
     // The list of fields which can't be toggled
     //$lists['coreFields']= array( 'name','username', 'email', 'password', 'password2' );
     $lists['coreFields'] = $model->getCoreFields();
     if ($layoutName == 'edit') {
         $this->editor = JFactory::getEditor();
         $this->userField = $model->getUserfield();
         //vmdebug('user plugin $this->userField',$this->userField);
         $this->SetViewTitle('USERFIELD', $this->userField->name);
         $this->assignRef('viewName', $viewName);
         $userFieldPlugin = '';
         if (!class_exists('ShopFunctions')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php';
         }
         $this->ordering = ShopFunctions::renderOrderingList('userfields', 'name', $this->userField->ordering);
         if ($this->userField->virtuemart_userfield_id < 1) {
             // Insert new userfield
             $userFieldValues = array();
             $attribs = '';
             $lists['type'] = JHtml::_('select.genericlist', $this->_getTypes(), 'type', $attribs, 'type', 'text', $this->userField->type);
         } else {
             // Update existing userfield
             // Ordering dropdown
             $userFieldValues = $model->getUserfieldValues();
             $lists['type'] = $this->_getTypes($this->userField->type) . '<input id="type" type="hidden" name="type" value="' . $this->userField->type . '" />';
             if (strpos($this->userField->type, 'plugin') !== false) {
                 $userFieldPlugin = self::renderUserfieldPlugin(substr($this->userField->type, 6), $this->userField);
             }
         }
         $this->assignRef('userFieldPlugin', $userFieldPlugin);
         JToolBarHelper::divider();
         JToolBarHelper::save();
         JToolBarHelper::apply();
         JToolBarHelper::cancel();
         $notoggle = '';
         // (in_array($this->userField->name, $lists['coreFields']) ? 'class="readonly"' : '');
         // Vendor selection
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $lists['vendors'] = ShopFunctions::renderVendorList($this->userField->virtuemart_vendor_id);
         }
         // Shopper groups for EU VAT Id
         $shoppergroup_model = VmModel::getModel('shoppergroup');
         $shoppergroup_list = $shoppergroup_model->getShopperGroups(true);
         array_unshift($shoppergroup_list, '0');
         $lists['shoppergroups'] = JHtml::_('select.genericlist', $shoppergroup_list, 'virtuemart_shoppergroup_id', '', 'virtuemart_shoppergroup_id', 'shopper_group_name', $this->userField->get('virtuemart_shoppergroup_id'));
         // Minimum age select
         $ages = array();
         for ($i = 13; $i <= 25; $i++) {
             $ages[] = array('key' => $i, 'value' => $i . ' ' . vmText::_('COM_VIRTUEMART_YEAR_S'));
         }
         $lists['minimum_age'] = JHtml::_('select.genericlist', $ages, 'minimum_age', '', 'key', 'value', $this->userField->get('minimum_age', 18));
         // Web address types
         $webaddress_types = array(array('key' => 0, 'value' => vmText::_('COM_VIRTUEMART_USERFIELDS_URL_ONLY')), array('key' => 2, 'value' => vmText::_('COM_VIRTUEMART_USERFIELDS_HYPERTEXT_URL')));
         $lists['webaddresstypes'] = JHtml::_('select.genericlist', $webaddress_types, 'webaddresstype', '', 'key', 'value', $this->userField->get('webaddresstype'));
         // Userfield values
         if (($n = count($userFieldValues)) < 1) {
             $lists['userfield_values'] = '<tr>' . '<td><input type="text" value="" name="vValues[0]" /></td>' . '<td><input type="text" size="50" value="" name="vNames[0]" /></td>' . '</tr>';
             $i = 1;
         } else {
             $lists['userfield_values'] = '';
             $lang = JFactory::getLanguage();
             for ($i = 0; $i < $n; $i++) {
                 $translate = $lang->hasKey($userFieldValues[$i]->fieldtitle) ? " (" . vmText::_($userFieldValues[$i]->fieldtitle) . ")" : "";
                 $lists['userfield_values'] .= '<tr>' . '<td><input type="text" value="' . $userFieldValues[$i]->fieldvalue . '" name="vValues[' . $i . ']" /></td>' . '<td><input type="text" size="50" value="' . $userFieldValues[$i]->fieldtitle . '" name="vNames[' . $i . ']"   />' . $translate . '<input type="button" class="button deleteRow" value=" - " /></td>' . '</tr>';
             }
         }
         $this->valueCount = --$i;
         $userFieldTable = $model->getTable();
         $this->existingFields = '"' . implode('","', $userFieldTable->showFullColumns(0, 'Field')) . '"';
         // Toggles
         $lists['required'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_FIELDMANAGER_REQUIRED', 'required', $this->userField->required, $notoggle);
         $lists['published'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_PUBLISHED', 'published', $this->userField->published, $notoggle);
         $lists['cart'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_ON_CART', 'cart', $this->userField->cart, $notoggle);
         $lists['shipment'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_ON_SHIPPING', 'shipment', $this->userField->shipment, $notoggle);
         $lists['account'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_ON_ACCOUNT', 'account', $this->userField->account, $notoggle);
         $lists['readonly'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_USERFIELDS_READONLY', 'readonly', $this->userField->readonly, $notoggle);
         $this->assignRef('lists', $lists);
         $this->assignRef('userFieldValues', $userFieldValues);
     } else {
         JToolBarHelper::title(vmText::_('COM_VIRTUEMART_MANAGE_USER_FIELDS'), 'vm_user_48 head');
         JToolBarHelper::addNew();
         JToolBarHelper::editList();
         JToolBarHelper::divider();
         JToolBarHelper::custom('toggle.required.1', 'publish', '', 'COM_VIRTUEMART_FIELDMANAGER_REQUIRE');
         JToolBarHelper::custom('toggle.required.0', 'unpublish', '', 'COM_VIRTUEMART_FIELDMANAGER_UNREQUIRE');
         JToolBarHelper::publishList();
         JToolBarHelper::unpublishList();
         JToolBarHelper::divider();
         $barText = vmText::_('COM_VIRTUEMART_FIELDMANAGER_SHOW_HIDE');
         $bar = JToolBar::getInstance('toolbar');
         $bar->appendButton('Separator', '"><span class="bartext">' . $barText . '</span><hr style="display: none;');
         //$bar->appendButton( 'publish', 'upload', $alt, '', 550, 400 );
         JToolBarHelper::custom('toggle.registration.1', 'publish', '', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_REGISTRATION');
         JToolBarHelper::custom('toggle.registration.0', 'unpublish', '', 'COM_VIRTUEMART_FIELDMANAGER_HIDE_REGISTRATION');
         JToolBarHelper::custom('toggle.shipment.1', 'publish', '', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_SHIPPING');
         JToolBarHelper::custom('toggle.shipment.0', 'unpublish', '', 'COM_VIRTUEMART_FIELDMANAGER_HIDE_SHIPPING');
         JToolBarHelper::custom('toggle.account.1', 'publish', '', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_ACCOUNT');
         JToolBarHelper::custom('toggle.account.0', 'unpublish', '', 'COM_VIRTUEMART_FIELDMANAGER_HIDE_ACCOUNT');
         JToolBarHelper::divider();
         JToolBarHelper::deleteList();
         $this->addStandardDefaultViewLists($model, 'ordering', 'ASC');
         $this->userfieldsList = $model->getUserfieldsList();
         $this->pagination = $model->getPagination();
         // search filter
         $search = $mainframe->getUserStateFromRequest($option . 'search', 'search', '', 'string');
         $search = JString::strtolower($search);
         $this->lists['search'] = $search;
     }
     $this->lists['coreFields'] = $lists['coreFields'];
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     //Load helpers
     if (!class_exists('CurrencyDisplay')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
     }
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     if (!class_exists('vmPSPlugin')) {
         require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
     }
     $orderStatusModel = VmModel::getModel('orderstatus');
     $orderStates = $orderStatusModel->getOrderStatusList();
     $shippingModel = VmModel::getModel('mds');
     $curTask = JRequest::getWord('task');
     if ($curTask == 'edit') {
         $this->setLayout('order');
         VmConfig::loadJLang('com_virtuemart_shoppers', true);
         VmConfig::loadJLang('com_virtuemart_orders', true);
         // Load addl models
         $userFieldsModel = VmModel::getModel('userfields');
         $productModel = VmModel::getModel('product');
         // Get the data
         $virtuemart_order_id = JRequest::getInt('virtuemart_order_id');
         $order = $shippingModel->getOrder($virtuemart_order_id);
         $tot_parcel = 0;
         $total_weight = 0;
         $total_vol_weight = 0;
         foreach ($order['items'] as $item) {
             $quantity = 1;
             $product = $productModel->getProduct($item->virtuemart_product_id);
             while ($quantity <= $item->product_quantity) {
                 // Length coversion, mds collivery only acceps CM
                 if (strtolower($product->product_lwh_uom) != 'çm') {
                     $length = $this->converter->convert($product->product_length, strtolower($product->product_lwh_uom), 'cm', 6);
                     $width = $this->converter->convert($product->product_width, strtolower($product->product_lwh_uom), 'cm', 6);
                     $height = $this->converter->convert($product->product_height, strtolower($product->product_lwh_uom), 'cm', 6);
                 } else {
                     $length = $product->product_length;
                     $width = $product->product_width;
                     $height = $product->product_height;
                 }
                 // Weight coversion, mds collivery only acceps KG'S
                 if (strtolower($product->product_weight_uom) != 'kg') {
                     $weight = $this->converter->convert($product->product_weight, strtolower($product->product_weight_uom), 'kg', 6);
                 } else {
                     $weight = $product->product_weight;
                 }
                 $parcels[] = array("length" => str_replace(",", "", $length), "width" => str_replace(",", "", $width), "height" => str_replace(",", "", $height), "weight" => str_replace(",", "", $weight));
                 $tot_parcel += 1;
                 $quantity++;
             }
             $total_weight += $product->product_weight * $item->product_quantity;
             $total_vol_weight += $product->product_length * $item->product_quantity * ($product->product_width * $item->product_quantity) * ($product->product_height * $item->product_quantity);
         }
         $total_vweight = $total_vol_weight / 4000;
         $deliver_info = array('vol_weight' => $total_vol_weight, 'weight' => $total_weight, 'parcels' => $parcels);
         $_orderID = $order['details']['BT']->virtuemart_order_id;
         $orderbt = $order['details']['BT'];
         $orderst = array_key_exists('ST', $order['details']) ? $order['details']['ST'] : $orderbt;
         $orderbt->invoiceNumber = $shippingModel->getInvoiceNumber($orderbt->virtuemart_order_id);
         $currency = CurrencyDisplay::getInstance('', $order['details']['BT']->virtuemart_vendor_id);
         $this->assignRef('currency', $currency);
         // Create an array to allow orderlinestatuses to be translated
         // We'll probably want to put this somewhere in ShopFunctions...
         $_orderStatusList = array();
         foreach ($orderStates as $orderState) {
             //$_orderStatusList[$orderState->virtuemart_orderstate_id] = $orderState->order_status_name;
             //When I use update, I have to use this?
             $_orderStatusList[$orderState->order_status_code] = JText::_($orderState->order_status_name);
         }
         $_itemStatusUpdateFields = array();
         $_itemAttributesUpdateFields = array();
         foreach ($order['items'] as $_item) {
             $_itemStatusUpdateFields[$_item->virtuemart_order_item_id] = JHTML::_('select.genericlist', $orderStates, "item_id[" . $_item->virtuemart_order_item_id . "][order_status]", 'class="selectItemStatusCode"', 'order_status_code', 'order_status_name', $_item->order_status, 'order_item_status' . $_item->virtuemart_order_item_id, true);
         }
         if (!isset($_orderStatusList[$orderbt->order_status])) {
             if (empty($orderbt->order_status)) {
                 $orderbt->order_status = 'unknown';
             }
             $_orderStatusList[$orderbt->order_status] = JText::_('COM_VIRTUEMART_UNKNOWN_ORDER_STATUS');
         }
         /* Assign the data */
         $this->assignRef('orderdetails', $order);
         $this->assignRef('orderID', $_orderID);
         $this->assignRef('userfields', $userfields);
         $this->assignRef('shipmentfields', $shipmentfields);
         $this->assignRef('orderstatuslist', $_orderStatusList);
         $this->assignRef('itemstatusupdatefields', $_itemStatusUpdateFields);
         $this->assignRef('itemattributesupdatefields', $_itemAttributesUpdateFields);
         $this->assignRef('orderbt', $orderbt);
         $this->assignRef('orderst', $orderst);
         $this->assignRef('virtuemart_shipmentmethod_id', $orderbt->virtuemart_shipmentmethod_id);
         /* Data for the Edit Status form popup */
         $_currentOrderStat = $order['details']['BT']->order_status;
         // used to update all item status in one time
         $_orderStatusSelect = JHTML::_('select.genericlist', $orderStates, 'order_status', '', 'order_status_code', 'order_status_name', $_currentOrderStat, 'order_items_status', true);
         $this->assignRef('orderStatSelect', $_orderStatusSelect);
         $this->assignRef('currentOrderStat', $_currentOrderStat);
         $this->SetViewTitle('MDS Confirm Collivery', 'Edit or accept order #' . $_orderID);
         $state_name = $shippingModel->getState($orderst->virtuemart_state_id);
         $this->assignRef('state_name', $state_name);
         $this->assignRef('mds_service', $shippingModel->getService($orderst->virtuemart_shipmentmethod_id));
         $this->assignRef('package_info', $deliver_info);
         $this->assignRef('towns', $this->towns);
         $this->assignRef('addresses', $this->addresses);
         $this->assignRef('location_types', $this->location_types);
         $this->assignRef('default_address_id', $this->default_address_id);
         $this->assignRef('default_contacts', $this->default_contacts);
         $this->assignRef('mds_services', $this->mds_services);
         $this->assignRef('risk_cover', $this->risk_cover);
         $destination_towns = $this->towns;
         $selected_town = array_search($state_name, $destination_towns);
         unset($destination_towns[$selected_town]);
         $destination_suburbs = $this->collivery->getSuburbs($selected_town);
         $this->assignRef('destination_towns', $destination_towns);
         if ($orderst->mds_suburb_id != "") {
             $destination_suburb_key = $orderst->mds_suburb_id;
         } else {
             list($destination_suburb_key) = array_keys($destination_suburbs);
         }
         $this->assignRef('destination_suburb_key', $destination_suburb_key);
         $this->assignRef('first_destination_suburb', $destination_suburbs[$destination_suburb_key]);
         unset($destination_suburbs[$destination_suburb_key]);
         $this->assignRef('destination_suburbs', $destination_suburbs);
         $destination_location_types = $this->location_types;
         $this->assignRef('first_destination_location_type', $destination_location_types[$orderst->mds_location_type]);
         unset($destination_location_types[$orderst->mds_location_type]);
         $this->assignRef('destination_location_types', $destination_location_types);
     } elseif ($curTask == 'awaiting_dispatch') {
         $this->setLayout('index_dispatch');
         // Older version check
         if (preg_replace('/[^0-9]/', "", $this->vm_version) >= preg_replace('/[^0-9]/', "", '2.0.26d')) {
             $model = VmModel::getModel();
             $this->addStandardDefaultViewLists($model, 'created_on');
             $orderslist = $model->getOrdersList();
             $this->assignRef('orderstatuses', $orderStates);
             if (!class_exists('CurrencyDisplay')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
             }
             /* Apply currency This must be done per order since it's vendor specific */
             $_currencies = array();
             // Save the currency data during this loop for performance reasons
             if ($orderslist) {
                 foreach ($orderslist as $virtuemart_order_id => $order) {
                     //This is really interesting for multi-X, but I avoid to support it now already, lets stay it in the code
                     if (!array_key_exists('v' . $order->virtuemart_vendor_id, $_currencies)) {
                         $_currencies['v' . $order->virtuemart_vendor_id] = CurrencyDisplay::getInstance('', $order->virtuemart_vendor_id);
                     }
                     $order->order_total = $_currencies['v' . $order->virtuemart_vendor_id]->priceDisplay($order->order_total);
                     $order->invoiceNumber = $model->getInvoiceNumber($order->virtuemart_order_id);
                 }
             }
             /* Assign the data */
             $this->assignRef('orderslist', $orderslist);
             $this->assignRef('services', $this->services);
             $pagination = $model->getPagination();
             $this->assignRef('pagination', $pagination);
             $this->SetViewTitle('MDS Confirm Collivery', 'MDS shipping awaiting confirmation');
         } else {
             // old version!
             $model = VmModel::getModel();
             $this->addStandardDefaultViewLists($model, 'created_on');
             $orderStatusModel = VmModel::getModel('orderstatus');
             $orderstates = JRequest::getWord('order_status_code', '');
             $orderslist = $model->getOrdersList();
             $this->assignRef('orderstatuses', $orderStates);
             if (!class_exists('CurrencyDisplay')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
             }
             /* Apply currency This must be done per order since it's vendor specific */
             $_currencies = array();
             // Save the currency data during this loop for performance reasons
             if ($orderslist) {
                 foreach ($orderslist as $virtuemart_order_id => $order) {
                     if (!empty($order->order_currency)) {
                         $currency = $order->order_currency;
                     } elseif ($order->virtuemart_vendor_id) {
                         if (!class_exists('VirtueMartModelVendor')) {
                             require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
                         }
                         $currObj = VirtueMartModelVendor::getVendorCurrency($order->virtuemart_vendor_id);
                         $currency = $currObj->virtuemart_currency_id;
                     }
                     //This is really interesting for multi-X, but I avoid to support it now already, lets stay it in the code
                     if (!array_key_exists('curr' . $currency, $_currencies)) {
                         $_currencies['curr' . $currency] = CurrencyDisplay::getInstance($currency, $order->virtuemart_vendor_id);
                     }
                     $order->order_total = $_currencies['curr' . $currency]->priceDisplay($order->order_total);
                     $order->invoiceNumber = $model->getInvoiceNumber($order->virtuemart_order_id);
                 }
             }
             /* Assign the data */
             $this->assignRef('orderslist', $orderslist);
             $this->assignRef('services', $this->services);
             $pagination = $model->getPagination();
             $this->assignRef('pagination', $pagination);
             $this->SetViewTitle('MDS Confirm Collivery', 'MDS shipping awaiting confirmation');
         }
     } elseif ($curTask == 'config') {
         $shippingModel = VmModel::getModel();
         $post = JRequest::get('post');
         if (!empty($post)) {
             // change our password
             $this->db->setQuery("UPDATE `#__mds_collivery_config` SET `password` = '" . $post['password'] . "', `username` = '" . $post['username'] . "', `risk_cover` = '" . $post['risk_cover'] . "' WHERE `id` = 1;");
             $this->db->query();
         }
         $this->setLayout('config');
         $config = $shippingModel->getConfig();
         $this->assignRef('config', $config);
         $this->SetViewTitle('MDS Collivery Config', 'Account settings & Update option');
     } elseif ($curTask == 'view') {
         $model = VmModel::getModel();
         $waybill = JRequest::getInt('waybill');
         $order = $model->getAccepted($waybill);
         $this->setLayout('view');
         $this->SetViewTitle('MDS Confirmed', 'Waybill #' . $waybill);
         $directory = preg_replace('|administrator/|i', "", JPATH_COMPONENT) . '/views/mds/tmpl/waybills/' . $waybill;
         // Do we have images of the parcels
         if ($pod = $this->collivery->getPod($waybill)) {
             if (!is_dir($directory)) {
                 mkdir($directory, 0777, true);
             }
             file_put_contents($directory . '/' . $pod['filename'], base64_decode($pod['file']));
         }
         // Do we have proof of delivery
         if ($parcels = $this->collivery->getParcelImageList($waybill)) {
             if (!is_dir($directory)) {
                 mkdir($directory, 0777, true);
             }
             foreach ($parcels as $parcel) {
                 $size = $parcel['size'];
                 $mime = $parcel['mime'];
                 $filename = $parcel['filename'];
                 $parcel_id = $parcel['parcel_id'];
                 if ($image = $this->collivery->getParcelImage($parcel_id)) {
                     file_put_contents($directory . '/' . $filename, base64_decode($image['file']));
                 }
             }
         }
         // Get our tracking information
         $tracking = $this->collivery->getStatus($waybill);
         $validation_results = json_decode($order->validation_results);
         $this->assignRef('order', $order);
         $this->assignRef('collection_address', $this->collivery->getAddress($validation_results->collivery_from));
         $this->assignRef('destination_address', $this->collivery->getAddress($validation_results->collivery_to));
         $this->assignRef('collection_contacts', $this->collivery->getContacts($validation_results->collivery_from));
         $this->assignRef('destination_contacts', $this->collivery->getContacts($validation_results->collivery_to));
         // Set our status
         if ($tracking['status_id'] == 6) {
             // change our status
             $this->db->setQuery("UPDATE `#__mds_collivery_processed` SET `status` = 0 WHERE `waybill` = " . $waybill . ";");
             $this->db->query();
         }
         $this->assignRef('tracking', $tracking);
         $this->assignRef('pod', glob($directory . "/*.{pdf,PDF}", GLOB_BRACE));
         $this->assignRef('image_list', glob($directory . "/*.{jpg,JPG,jpeg,JPEG,gif,GIF,png,PNG}", GLOB_BRACE));
         $view_waybill = 'https://quote.collivery.co.za/waybillpdf.php?wb=' . base64_encode($waybill) . '&output=I';
         $this->assignRef('view_waybill', $view_waybill);
     } elseif ($curTask == 'index') {
         $this->setLayout('index');
         $post = JRequest::get('post');
         $status = isset($post['status']) && $post['status'] != "" ? $post['status'] : 1;
         $waybill = isset($post['waybill']) && $post['waybill'] != "" ? $post['waybill'] : false;
         $model = VmModel::getModel();
         $orderslist = $model->getAcceptedList($status, $waybill);
         /* Assign the data */
         $this->assignRef('orderslist', $orderslist);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
         $this->SetViewTitle('MDS Confirmed', 'Orders already passed to MDS Collivery');
     }
     parent::display($tpl);
 }
Exemple #27
0
    function display($tpl = null)
    {
        // Load the helper(s)
        if (!class_exists('VmHTML')) {
            require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
        }
        if (!class_exists('vmCustomPlugin')) {
            require VMPATH_PLUGINLIBS . DS . 'vmcustomplugin.php';
        }
        $model = VmModel::getModel('custom');
        // TODO Make an Icon for custom
        $this->SetViewTitle('PRODUCT_CUSTOM_FIELD');
        $layoutName = vRequest::getCmd('layout', 'default');
        if ($layoutName == 'edit') {
            $this->addStandardEditViewCommands();
            $this->customPlugin = '';
            $this->custom = $model->getCustom();
            $this->fieldTypes = VirtueMartModelCustom::getCustomTypes();
            $this->customfields = VmModel::getModel('customfields');
            //vmdebug('VirtuemartViewCustom',$this->custom);
            JPluginHelper::importPlugin('vmcustom');
            $dispatcher = JDispatcher::getInstance();
            $retValue = $dispatcher->trigger('plgVmOnDisplayEdit', array($this->custom->virtuemart_custom_id, &$this->customPlugin));
            $this->SetViewTitle('PRODUCT_CUSTOM_FIELD', $this->custom->custom_title);
            $selected = 0;
            $this->custom->form = false;
            if (!empty($this->custom->custom_jplugin_id)) {
                VmConfig::loadJLang('plg_vmpsplugin', false);
                JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields');
                $selected = $this->custom->custom_jplugin_id;
                // Get the payment XML.
                $formFile = vRequest::filterPath(VMPATH_ROOT . DS . 'plugins' . DS . 'vmcustom' . DS . $this->custom->custom_element . DS . $this->custom->custom_element . '.xml');
                if (file_exists($formFile)) {
                    $this->custom->form = JForm::getInstance($this->custom->custom_element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]');
                    $this->custom->params = new stdClass();
                    $varsToPush = vmPlugin::getVarsToPushFromForm($this->custom->form);
                    VmTable::bindParameterableToSubField($this->custom, $varsToPush);
                    $this->custom->form->bind($this->custom->getProperties());
                }
            } else {
                $varsToPush = VirtueMartModelCustom::getVarsToPush($this->custom->field_type);
                if (!empty($varsToPush)) {
                    $formString = '<vmconfig>' . chr(10) . '<fields name="params">' . chr(10) . '<fieldset name="extraParams">' . chr(10);
                    //vmdebug('$varsToPush',$varsToPush);
                    foreach ($varsToPush as $key => $push) {
                        if ('_' == substr($key, 0, 1)) {
                            continue;
                        }
                        //$default = 0;
                        $formString .= '<field
						name="' . $key . '"
        				id="' . $key . 'Field"
        				label="COM_VIRTUEMART_CUSTOM_PARAM_' . strtoupper($key) . '"
        				description="COM_VIRTUEMART_CUSTOM_PARAM_' . strtoupper($key) . '_DESC"
        				default="' . $push[0] . '"
						';
                        if ($push[1] == 'int') {
                            $formString .= 'type="radio" >
    											<option value="0">JNO</option>
    											<option value="1">JYES</option>';
                        } else {
                            if ($push[1] == 'string') {
                                $formString .= 'type="text" >' . chr(10);
                            }
                        }
                        $formString .= chr(10) . '</field>' . chr(10);
                    }
                    $formString .= '</fieldset>' . chr(10) . '</fields>' . chr(10) . '</vmconfig>';
                    $this->custom->form = JForm::getInstance($this->custom->field_type, $formString, array(), false, '//vmconfig | //config[not(//vmconfig)]');
                    $this->custom->params = new stdClass();
                    VmTable::bindParameterableToSubField($this->custom, $varsToPush);
                    $this->custom->form->bind($this->custom->getProperties());
                }
            }
            if (!empty($this->custom->custom_parent_id)) {
                $list = ShopFunctions::renderOrderingList('customs', 'custom_title', $this->custom->ordering, 'WHERE custom_parent_id ="' . (int) $this->custom->custom_parent_id . '" ');
                $this->ordering = VmHTML::row('raw', 'COM_VIRTUEMART_ORDERING', $list);
            } else {
                $this->ordering = '';
                $this->addHidden('ordering', $this->custom->ordering);
            }
            $this->pluginList = self::renderInstalledCustomPlugins($selected);
        } else {
            JToolBarHelper::custom('createClone', 'copy', 'copy', vmText::_('COM_VIRTUEMART_CLONE'), true);
            JToolBarHelper::custom('toggle.admin_only.1', 'publish', '', vmText::_('COM_VIRTUEMART_TOGGLE_ADMIN'), true);
            JToolBarHelper::custom('toggle.admin_only.0', 'unpublish', '', vmText::_('COM_VIRTUEMART_TOGGLE_ADMIN'), true);
            JToolBarHelper::custom('toggle.is_hidden.1', 'publish', '', vmText::_('COM_VIRTUEMART_TOGGLE_HIDDEN'), true);
            JToolBarHelper::custom('toggle.is_hidden.0', 'unpublish', '', vmText::_('COM_VIRTUEMART_TOGGLE_HIDDEN'), true);
            $this->addStandardDefaultViewCommands();
            $this->addStandardDefaultViewLists($model);
            $this->custom_parent_id = vRequest::getInt('custom_parent_id', false);
            $this->customs = $model->getCustoms($this->custom_parent_id, vRequest::getCmd('keyword'));
            $this->pagination = $model->getPagination();
        }
        parent::display($tpl);
    }
 function display($tpl = null)
 {
     //Load helpers
     if (!class_exists('CurrencyDisplay')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
     }
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     if (!class_exists('vmPSPlugin')) {
         require VMPATH_PLUGINLIBS . DS . 'vmpsplugin.php';
     }
     // Load addl models
     $orderModel = VmModel::getModel();
     $userFieldsModel = VmModel::getModel('userfields');
     $productModel = VmModel::getModel('product');
     /* Get the data */
     $virtuemart_order_id = vRequest::getvar('virtuemart_order_id');
     $order = $orderModel->getOrder($virtuemart_order_id);
     //$order = $this->get('Order');
     $orderNumber = $order['details']['BT']->virtuemart_order_number;
     $orderbt = $order['details']['BT'];
     $orderst = array_key_exists('ST', $order['details']) ? $order['details']['ST'] : $orderbt;
     $currency = CurrencyDisplay::getInstance('', $order['details']['BT']->virtuemart_vendor_id);
     $this->assignRef('currency', $currency);
     $_userFields = $userFieldsModel->getUserFields('account', array('captcha' => true, 'delimiters' => true), array('delimiter_userinfo', 'user_is_vendor', 'username', 'email', 'password', 'password2', 'agreed', 'address_type'));
     $userfields = $userFieldsModel->getUserFieldsFilled($_userFields, $orderbt);
     $_userFields = $userFieldsModel->getUserFields('shipment', array(), array('delimiter_userinfo', 'username', 'email', 'password', 'password2', 'agreed', 'address_type'));
     $shipmentfields = $userFieldsModel->getUserFieldsFilled($_userFields, $orderst);
     // Create an array to allow orderlinestatuses to be translated
     // We'll probably want to put this somewhere in ShopFunctions...
     $_orderStats = $this->get('OrderStatusList');
     $_orderStatusList = array();
     foreach ($_orderStats as $orderState) {
         $_orderStatusList[$orderState->order_status_code] = vmText::_($orderState->order_status_name);
     }
     /*foreach($order['items'] as $_item) {
     			if (!empty($_item->product_attribute)) {
     				$_attribs = preg_split('/\s?<br\s*\/?>\s?/i', $_item->product_attribute);
     
     				$product = $productModel->getProduct($_item->virtuemart_product_id);
     				$_productAttributes = array();
     				$_prodAttribs = explode(';', $product->attribute);
     				foreach ($_prodAttribs as $_pAttr) {
     					$_list = explode(',', $_pAttr);
     					$_name = array_shift($_list);
     					$_productAttributes[$_item->virtuemart_order_item_id][$_name] = array();
     					foreach ($_list as $_opt) {
     						$_optObj = new stdClass();
     						$_optObj->option = $_opt;
     						$_productAttributes[$_item->virtuemart_order_item_id][$_name][] = $_optObj;
     					}
     				}
     			}
     		}*/
     //$_shipmentInfo = ShopFunctions::getShipmentRateDetails($orderbt->virtuemart_shipmentmethod_id);
     /* Assign the data */
     $this->assignRef('orderdetails', $order);
     $this->assignRef('orderNumber', $orderNumber);
     $this->assignRef('userfields', $userfields);
     $this->assignRef('shipmentfields', $shipmentfields);
     $this->assignRef('orderstatuslist', $_orderStatusList);
     $this->assignRef('orderbt', $orderbt);
     $this->assignRef('orderst', $orderst);
     $this->assignRef('virtuemart_shipmentmethod_id', $orderbt->virtuemart_shipmentmethod_id);
     error_reporting(0);
     parent::display($tpl);
 }
Exemple #29
0
	/**
	 * Render the view
	 */
	function display($tpl = null){

		if (!class_exists('VmHTML'))
			require(VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php');
		if (!class_exists('CurrencyDisplay'))
			require(VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php');


		$model		= VmModel::getModel();

		vRequest::setvar('task','');

		$this->SetViewTitle('REPORT');

		$myCurrencyDisplay = CurrencyDisplay::getInstance();

		//update order items button
		/*$q = 'SELECT * FROM #__virtuemart_order_items WHERE `product_discountedPriceWithoutTax` IS NULL ';
		$db = JFactory::getDBO();
		$db->setQuery($q);
		$res = $db->loadRow();
		if($res) {
			JToolBarHelper::custom('updateOrderItems', 'new', 'new', vmText::_('COM_VIRTUEMART_REPORT_UPDATEORDERITEMS'),false);
			vmError('COM_VIRTUEMART_REPORT_UPDATEORDERITEMS_WARN');
		}*/

		$this->addStandardDefaultViewLists($model);
		$revenueBasic = $model->getRevenue();

		if($revenueBasic){
			$totalReport['revenueTotal_brutto']= $totalReport['revenueTotal_netto']= $totalReport['number_of_ordersTotal'] = $totalReport['itemsSoldTotal'] = 0 ;
			foreach($revenueBasic as &$j){
				vmdebug('VirtuemartViewReport revenue',$j);
				$totalReport['revenueTotal_netto'] += $j['order_subtotal_netto'];
				$totalReport['revenueTotal_brutto'] += $j['order_subtotal_brutto'];
				$totalReport['number_of_ordersTotal'] += $j['count_order_id'];
				$j['order_subtotal_netto'] = $myCurrencyDisplay->priceDisplay($j['order_subtotal_netto']);
				$j['order_subtotal_brutto'] = $myCurrencyDisplay->priceDisplay($j['order_subtotal_brutto']);
				//$j['product_quantity'] = $model->getItemsByRevenue($j);
				$totalReport['itemsSoldTotal'] +=$j['product_quantity'];
			}
			$totalReport['revenueTotal_netto'] = $myCurrencyDisplay->priceDisplay($totalReport['revenueTotal_netto']);
			$totalReport['revenueTotal_brutto'] = $myCurrencyDisplay->priceDisplay($totalReport['revenueTotal_brutto']);
			// if ( 'product_quantity'==vRequest::getCmd('filter_order')) {
				// foreach ($revenueBasic as $key => $row) {
					// $created_on[] =$row['created_on'];
					// $intervals[] =$row['intervals'];
					// $itemsSold[] =$row['product_quantity'];
					// $number_of_orders[] =$row['count_order_id'];
					// $revenue[] =$row['revenue'];

				// }
				// if (vRequest::getCmd('filter_order_Dir') == 'desc') array_multisort($itemsSold, SORT_DESC,$revenueBasic);
				// else array_multisort($itemsSold, SORT_ASC,$revenueBasic);
			// }
		}
		$this->assignRef('report', $revenueBasic);
		$this->assignRef('totalReport', $totalReport);

		//$itemsSold = $model->getItemsSold($revenueBasic);
		//$this->assignRef('itemsSold', $itemsSold);
		// I tihnk is to use in a different layout such as product solds
		// PATRICK K.
		// $productList = $model->getOrderItems();
		// $this->assignRef('productList', $productList);

		$orderstatusM =VmModel::getModel('orderstatus');
		$this->lists['select_date'] = $model->renderDateSelectList();
		$orderstates = vRequest::getVar ('order_status_code', array('C','S'));
		$this->lists['state_list'] = $orderstatusM->renderOSList($orderstates,'order_status_code',TRUE);
		$this->lists['intervals'] = $model->renderIntervalsList();
		$this->assignRef('from_period', $model->from_period);
		$this->assignRef('until_period', $model->until_period);

		$pagination = $model->getPagination();
		$this->assignRef('pagination', $pagination);

		parent::display($tpl);
	}
Exemple #30
0
	function display($tpl = null) {

		if (!class_exists('VmImage'))
			require(VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php');
		VmConfig::loadJLang('com_virtuemart_orders',TRUE);

		$model = VmModel::getModel('virtuemart');

		$nbrCustomers = $model->getTotalCustomers();
		$this->nbrCustomers=$nbrCustomers;

		$nbrActiveProducts = $model->getTotalActiveProducts();
		$this->nbrActiveProducts= $nbrActiveProducts;
		$nbrInActiveProducts = $model->getTotalInActiveProducts();
		$this->nbrInActiveProducts= $nbrInActiveProducts;
		$nbrFeaturedProducts = $model->getTotalFeaturedProducts();
		$this->nbrFeaturedProducts= $nbrFeaturedProducts;

		$ordersByStatus = $model->getTotalOrdersByStatus();
		$this->ordersByStatus= $ordersByStatus;

		$recentOrders = $model->getRecentOrders();
			if(!class_exists('CurrencyDisplay'))require(VMPATH_ADMIN.DS.'helpers'.DS.'currencydisplay.php');

			/* Apply currency This must be done per order since it's vendor specific */
			$_currencies = array(); // Save the currency data during this loop for performance reasons
			foreach ($recentOrders as $virtuemart_order_id => $order) {

				//This is really interesting for multi-X, but I avoid to support it now already, lets stay it in the code
				if (!array_key_exists('v'.$order->virtuemart_vendor_id, $_currencies)) {
					$_currencies['v'.$order->virtuemart_vendor_id] = CurrencyDisplay::getInstance('',$order->virtuemart_vendor_id);
				}
				$order->order_total = $_currencies['v'.$order->virtuemart_vendor_id]->priceDisplay($order->order_total);
			}
		$this->recentOrders= $recentOrders;
		$recentCustomers = $model->getRecentCustomers();
		$this->recentCustomers=$recentCustomers;

		if (!class_exists('vmRSS')) require(VMPATH_ADMIN.'/helpers/vmrss.php');

		$this->extensionsFeed = vmRSS::getExtensionsRssFeed();

		$virtuemartFeed = vmRSS::getVirtueMartRssFeed();
		$this->virtuemartFeed=$virtuemartFeed;

		if(JFactory::getApplication()->isSite()){
			$bar = JToolBar::getInstance('toolbar');
			$bar->appendButton('Link', 'back', 'COM_VIRTUEMART_LEAVE', 'index.php?option=com_virtuemart&manage=0');
		}

		if($this->manager('report')){
			vmSetStartTime('report');
			$reportModel		= VmModel::getModel('report');
			vRequest::setvar('task','');
			$myCurrencyDisplay = CurrencyDisplay::getInstance();
			$revenueBasic = $reportModel->getRevenue(60,true);
			$this->report = $revenueBasic['report'];

			vmJsApi::addJScript( "jsapi","//google.com/jsapi",false,false,'' );
			vmJsApi::addJScript('vm.stats_chart',$revenueBasic['js'],false);
			vmTime('Created report','report');
		}

		parent::display($tpl);
	}