function display($tpl = null) { $document = JFactory::getDocument(); $mainframe = JFactory::getApplication(); $pathway = $mainframe->getPathway(); JLoader::register('VmImage', JPATH_VM_ADMINISTRATOR . '/helpers/image.php'); $virtuemart_manufacturer_id = JRequest::getInt('virtuemart_manufacturer_id', 0); $mf_category_id = JRequest::getInt('mf_category_id', 0); // get necessary models $model = VmModel::getModel('manufacturer'); if ($virtuemart_manufacturer_id != 0) { $manufacturer = $model->getManufacturer(); $model->addImages($manufacturer, 1); $manufacturerImage = $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"', false); $document->setTitle(JText::_('COM_VIRTUEMART_MANUFACTURER_DETAILS') . ' ' . strip_tags($manufacturer->mf_name)); $this->assignRef('manufacturerImage', $manufacturerImage); // $this->assignRef('manufacturerProductsURL', $manufacturerProductsURL); $this->assignRef('manufacturer', $manufacturer); $pathway->addItem(strip_tags($manufacturer->mf_name)); $this->setLayout('details'); // vmdebug('$manufacturer',$manufacturer); } else { $document->setTitle(JText::_('COM_VIRTUEMART_MANUFACTURER_PAGE')); $manufacturers = $model->getManufacturers(true, true, true); $model->addImages($manufacturers, 1); $this->assignRef('manufacturers', $manufacturers); $this->setLayout('default'); } parent::display($tpl); }
function display($tpl = null) { $document = JFactory::getDocument(); $document->setMimeEncoding('application/json'); if ($virtuemart_media_id = vRequest::getInt('virtuemart_media_id')) { //JResponse::setHeader( 'Content-Disposition', 'attachment; filename="media'.$virtuemart_media_id.'.json"' ); $model = VmModel::getModel('Media'); $image = $model->createMediaByIds($virtuemart_media_id); // echo '<pre>'.print_r($image,1).'</pre>'; $this->json = $image[0]; //echo json_encode($this->json); if (isset($this->json->file_url)) { $this->json->file_root = JURI::root(true) . '/'; $this->json->msg = 'OK'; echo @json_encode($this->json); } else { $this->json->msg = '<b>' . vmText::_('COM_VIRTUEMART_NO_IMAGE_SET') . '</b>'; echo @json_encode($this->json); } } else { if (!class_exists('VmMediaHandler')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'mediahandler.php'; } $start = vRequest::getInt('start', 0); $type = vRequest::getCmd('mediatype', 0); $list = VmMediaHandler::displayImages($type, $start); echo @json_encode($list); } jExit(); }
/** * constructs a VmModel * setMainTable defines the maintable of the model * @author Max Milbers */ function __construct() { parent::__construct('virtuemart_manufacturercategories_id'); $this->setMainTable('manufacturercategories'); $this->addvalidOrderingFieldName(array('mf_category_name')); $config = JFactory::getConfig(); }
/** * constructs a VmModel * setMainTable defines the maintable of the model * @author Max Milbers */ function __construct() { parent::__construct('virtuemart_media_id'); $this->setMainTable('medias'); $this->addvalidOrderingFieldName(array('ordering')); $this->_selectedOrdering = 'created_on'; }
function updateOrderItems() { vRequest::vmCheckToken(); $model = VmModel::getModel('report'); $model->updateOrderItems(); $this->setRedirect($this->redirectPath, 'Order Items updated'); }
function display($tpl = null) { //Load helpers $this->loadHelper('currencydisplay'); $this->loadHelper('html'); // Get the data $model = VmModel::getModel('product'); // Create filter $this->addStandardDefaultViewLists($model); $inventorylist = $model->getProductListing(false, false); $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 $product->product_instock_value = $currencydisplay->priceDisplay($product->product_price, '', $product->product_in_stock, false); $product->product_price_display = $currencydisplay->priceDisplay($product->product_price, '', 1, false); $product->weigth_unit_display = ShopFunctions::renderWeightUnit($product->product_weight_uom); } $this->assignRef('inventorylist', $inventorylist); $options = array(); $options[] = JHTML::_('select.option', '', JText::_('COM_VIRTUEMART_DISPLAY_STOCK') . ':'); $options[] = JHTML::_('select.option', 'stocklow', JText::_('COM_VIRTUEMART_STOCK_LEVEL_LOW')); $options[] = JHTML::_('select.option', 'stockout', JText::_('COM_VIRTUEMART_STOCK_LEVEL_OUT')); $this->lists['stockfilter'] = JHTML::_('select.genericlist', $options, 'search_type', 'onChange="document.adminForm.submit(); return false;"', 'value', 'text', JRequest::getVar('search_type')); $this->lists['filter_product'] = JRequest::getVar('filter_product'); // $this->assignRef('lists', $lists); /* Toolbar */ $this->SetViewTitle('PRODUCT_INVENTORY'); JToolBarHelper::publish(); JToolBarHelper::unpublish(); parent::display($tpl); }
function display($tpl = null) { // Load the helper(s) if (!class_exists('VmHTML')) { require JPATH_VM_ADMINISTRATOR . 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); $currency = $model->getCurrency(); $this->SetViewTitle('', $currency->currency_name); $this->assignRef('currency', $currency); $this->addStandardEditViewCommands(); } else { $this->SetViewTitle(); $this->addStandardDefaultViewCommands(); $this->addStandardDefaultViewLists($model, 0, 'ASC'); $currencies = $model->getCurrenciesList(vRequest::getCmd('search', false)); $this->assignRef('currencies', $currencies); $pagination = $model->getPagination(); $this->assignRef('pagination', $pagination); } parent::display($tpl); }
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) { // Load the helper(s) $this->loadHelper('html'); $model = VmModel::getModel(); $config = JFactory::getConfig(); $layoutName = JRequest::getWord('layout', 'default'); if ($layoutName == 'edit') { $cid = JRequest::getVar('cid'); $task = JRequest::getWord('task', 'add'); //JArrayHelper::toInteger($cid); if ($task != 'add' && !empty($cid) && !empty($cid[0])) { $cid = (int) $cid[0]; } else { $cid = 0; } $model->setId($cid); $currency = $model->getCurrency(); $this->SetViewTitle('', $currency->currency_name); $this->assignRef('currency', $currency); $this->addStandardEditViewCommands(); } else { $this->SetViewTitle(); $this->addStandardDefaultViewCommands(); $this->addStandardDefaultViewLists($model, 0, 'ASC'); $currencies = $model->getCurrenciesList(JRequest::getWord('search', false)); $this->assignRef('currencies', $currencies); $pagination = $model->getPagination(); $this->assignRef('pagination', $pagination); } parent::display($tpl); }
function display($tpl = null) { // Load the helper(s) $this->loadHelper('html'); // get necessary model $model = VmModel::getModel(); $layoutName = JRequest::getWord('layout', 'default'); if ($layoutName == 'edit') { $manufacturerCategory = $model->getData(); $this->manufacturerCategory = $manufacturerCategory; $this->SetViewTitle('MANUFACTURER_CATEGORY', $manufacturerCategory->mf_category_name); $this->addStandardEditViewCommands($manufacturerCategory->virtuemart_manufacturercategories_id); } else { if (JRequest::getWord('format', '') === 'raw') { $tpl = 'results'; } else { $this->SetViewTitle('MANUFACTURER_CATEGORY'); $this->addStandardDefaultViewCommands(); } $this->addStandardDefaultViewLists($model); $this->manufacturerCategories = $model->getManufacturerCategories(); $this->pagination = $model->getPagination(); } parent::display($tpl); if ($tpl === 'results') { echo $this->AjaxScripts(); } }
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); }
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); }
function fetchElement($name, $value, &$node, $control_name) { JPlugin::loadLanguage('com_virtuemart', JPATH_ADMINISTRATOR); $model = VmModel::getModel('Manufacturer'); $manufacturers = $model->getManufacturers(true, true, false); return JHTML::_('select.genericlist', $manufacturers, $control_name . '[' . $name . ']', '', $name, 'mf_name', $value, $control_name . $name); }
function display($tpl = null) { // Load the helper(s) $this->loadHelper('html'); $model = VmModel::getModel(); $layoutName = JRequest::getWord('layout', 'default'); if ($layoutName == 'edit') { $this->currency = $model->getData(); $this->SetViewTitle('', $this->currency->currency_name); $this->addStandardEditViewCommands(); } else { if (JRequest::getWord('format', '') === 'raw') { $tpl = 'results'; } else { $this->SetViewTitle(); $this->addStandardDefaultViewCommands(); } $this->addStandardDefaultViewLists($model, 0, 'ASC'); $this->currencies = $model->getCurrenciesList(JRequest::getWord('search', false)); $this->pagination = $model->getPagination(); } parent::display($tpl); if ($tpl === 'results') { echo $this->AjaxScripts(); } }
/** * constructs a VmModel * setMainTable defines the maintable of the model * @author Max Milbers */ function __construct() { parent::__construct('virtuemart_custom_id'); $this->setMainTable('customs'); $this->setToggleName('admin_only'); $this->setToggleName('is_hidden'); }
/** * constructs a VmModel * setMainTable defines the maintable of the model * @author Max Milbers */ function __construct() { parent::__construct(); $this->setMainTable('states'); $this->_selectedOrdering = 'state_name'; $this->_selectedOrderingDir = 'DESC'; }
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); }
function display($tpl = null) { // Load the helper(s) if (!class_exists('VmHTML')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php'; } // $this->assignRef('perms', Permissions::getInstance()); $model = VmModel::getModel(); $layoutName = JRequest::getWord('layout', 'default'); if ($layoutName == 'edit') { $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(); JToolBarHelper::makeDefault(); $this->loadHelper('permissions'); $showVendors = Permissions::getInstance()->check('admin'); $this->assignRef('showVendors', $showVendors); $this->addStandardDefaultViewCommands(); $this->addStandardDefaultViewLists($model); $shoppergroups = $model->getShopperGroups(false, true); $this->assignRef('shoppergroups', $shoppergroups); $pagination = $model->getPagination(); $this->assignRef('pagination', $pagination); } parent::display($tpl); }
JLoader::import('product', JPATH_ADMINISTRATOR . '/components/com_virtuemart/models'); } if (!class_exists('VmModel')) { require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/vmmodel.php'; } abstract class modNSSP2VMHelper { public static function getList($params, $count) { $productModel = VmModel::getModel('Product'); $products = $productModel->getProductListing($params->get('vmordering', 'latest'), $count, true, true, false, true, $params->get('vmcat', NULL)); $productModel->addImages($products); $currency = CurrencyDisplay::getInstance(); if (count($products)) { foreach ($products as $item) { $author =& JFactory::getUser($item->created_by); $item->created = $item->created_on; $item->author = $author->name; $item->hits = $item->hits; $item->category = $item->category_name; $item->cat_link = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $item->virtuemart_category_id); $item->image = $item->images[0]->file_url; $item->title = $item->product_name; $item->introtext = $item->product_s_desc; $item->price = round($item->prices['salesPrice'], 2) . $currency->getSymbol(); $item->addtocart = self::addtocart($item);
function display($tpl = null) { // Load the helper(s) if (!class_exists('VmConfig')) { require JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'config.php'; } VmConfig::loadConfig(); VmConfig::loadJLang('com_virtuemart_countries'); if (!class_exists('VmHTML')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php'; } $model = VmModel::getModel('country'); $zoneModel = VmModel::getModel('worldzones'); $this->SetViewTitle(); $layoutName = JRequest::getWord('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 = JRequest::getWord('filter_country', false); $countries = $model->getCountries(false, false, $filter_country); $this->assignRef('countries', $countries); $pagination = $model->getPagination(); $this->assignRef('pagination', $pagination); } parent::display($tpl); }
function save($data = 0) { $fileModel = VmModel::getModel('media'); //Now we try to determine to which this media should be long to $data = JRequest::get('post'); //$data['file_title'] = JRequest::getVar('file_title','','post','STRING',JREQUEST_ALLOWHTML); $data['file_description'] = JRequest::getVar('file_description', '', 'post', 'STRING', JREQUEST_ALLOWHTML); $data['media_attributes'] = JRequest::getWord('media_attributes'); $data['file_type'] = JRequest::getWord('file_type'); if (empty($data['file_type'])) { $data['file_type'] = $data['media_attributes']; } if ($id = $fileModel->store($data, $data['file_type'])) { $msg = JText::_('COM_VIRTUEMART_FILE_SAVED_SUCCESS'); } else { $msg = $fileModel->getError(); } $cmd = JRequest::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); }
function __construct () { parent::__construct (); $this->setMainTable ('orders'); // set default values always used $config = JFactory::getConfig (); $this->tzoffset = $config->getValue ('config.offset'); $this->setDatePresets (); $app = JFactory::getApplication (); $this->period = $app->getUserStateFromRequest ('com_virtuemart.revenue.period', 'period', 'last30', 'string'); $post = JRequest::get ('post'); vmdebug ('$post ', $post); if (empty($this->period) or $this->period != 'none') { $this->setPeriodByPreset (); } else { $this->setPeriod (); } $this->removevalidOrderingFieldName ('virtuemart_order_id'); $this->addvalidOrderingFieldName (array('product_quantity', 'o.virtuemart_order_id')); $this->_selectedOrdering = 'created_on'; }
function fetchElement($name, $value, &$node, $control_name) { VmConfig::loadJLang('com_virtuemart'); $model = VmModel::getModel('Vendor'); $vendors = $model->getVendors(true, true, false); return JHTML::_('select.genericlist', $vendors, $control_name . '[' . $name . ']', '', $name, 'vendor_name', $value, $control_name . $name); }
/** * * Task for disabling dangerous database tools, used after install * @author Max Milbers */ public function disableDangerousTools(){ $data = vRequest::getRequest(); $config = VmModel::getInstance('config', 'VirtueMartModel'); $config->setDangerousToolsOff(); $this->display(); }
/** * Handle the save task * * @author RickG */ function save($data = 0){ JRequest::checkToken() or jexit( 'Invalid Token' ); $model = VmModel::getModel('config'); $data = JRequest::get('post'); $data['offline_message'] = JRequest::getVar('offline_message','','post','STRING',JREQUEST_ALLOWHTML); if(strpos($data['offline_message'],'|')!==false){ $data['offline_message'] = str_replace('|','',$data['offline_message']); } if ($model->store($data)) { $msg = JText::_('COM_VIRTUEMART_CONFIG_SAVED'); // Load the newly saved values into the session. VmConfig::loadConfig(); } else { $msg = $model->getError(); } $redir = 'index.php?option=com_virtuemart'; if(JRequest::getCmd('task') == 'apply'){ $redir = $this->redirectPath; } $this->setRedirect($redir, $msg); }
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); }
/** * constructs a VmModel * setMainTable defines the maintable of the model * @author Max Milbers */ function __construct() { parent::__construct(); $this->setMainTable('shipmentmethods'); $this->_selectedOrdering = 'ordering'; $this->setToggleName('shared'); }
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); }
/** * Render the view */ function display($tpl = null) { // Load the helper(s) $this->loadHelper('html'); $this->loadHelper('html'); $this->loadHelper('currencydisplay'); $this->loadHelper('reportFunctions'); $model = VmModel::getModel(); // $config = JFactory::getConfig(); // $tzoffset = $config->getValue('config.offset'); JRequest::setvar('task', ''); // set period //$date_presets = $model->getDatePresets(); $this->SetViewTitle('REPORT'); $myCurrencyDisplay = CurrencyDisplay::getInstance(); $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'==JRequest::getWord('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 (JRequest::getWord('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); $this->lists['select_date'] = $model->renderDateSelectList(); $this->lists['state_list'] = $model->renderOrderstatesList(); $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); }
/** * Get a category tree string with defined separators in order to create an useful array * * @author Florian Voutzinos (adapted from v2) * @param int $cid virtuemart category id * @param int $level category level * @return formated string with separator containing categories_name and categoires id */ function getCategoryTree($cid = 0, $level = 0) { static $categoryTree = ''; static $catsId = ''; $level++; $categoryModel = VmModel::getModel('category'); $records = $categoryModel->getCategories(true, $cid); if (!empty($records)) { foreach ($records as $category) { $childId = $category->category_child_id; if ($childId != $cid) { $prefix = str_repeat(' - ', $level - 1); } // using an array for $categorytree can pose index problems // so I use 2 strings and define a category name & category id separator ',' $categoryTree .= $prefix . $category->category_name . ','; $catsId .= $category->virtuemart_category_id . ','; if ($categoryModel->hasChildren($childId)) { self::getCategoryTree($childId, $level); } } } // separe category name and cat id with : return $categoryTree . ':' . $catsId; }