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 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); $this->inventorylist = $model->getProductListing(); $this->pagination = $model->getPagination(); // Apply currency $currencydisplay = CurrencyDisplay::getInstance(); foreach ($this->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); } $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'); /* Toolbar */ $this->SetViewTitle('PRODUCT_INVENTORY'); JToolBarHelper::publish(); JToolBarHelper::unpublish(); parent::display($tpl); }
/** * @param $virtuemart_order_id * @return string */ function getOrderShipmentHtml ($virtuemart_order_id) { $db = JFactory::getDBO (); $q = 'SELECT * FROM `' . $this->_tablename . '` ' . 'WHERE `virtuemart_order_id` = ' . $virtuemart_order_id; $db->setQuery ($q); if (!($shipinfo = $db->loadObject ())) { vmWarn (500, $q . " " . $db->getErrorMsg ()); return ''; } if (!class_exists ('CurrencyDisplay')) { require(JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php'); } $currency = CurrencyDisplay::getInstance (); $tax = ShopFunctions::getTaxByID ($shipinfo->tax_id); $taxDisplay = is_array ($tax) ? $tax['calc_value'] . ' ' . $tax['calc_value_mathop'] : $shipinfo->tax_id; $taxDisplay = ($taxDisplay == -1) ? vmText::_ ('COM_VIRTUEMART_PRODUCT_TAX_NONE') : $taxDisplay; $html = '<table class="adminlist table">' . "\n"; $html .= $this->getHtmlHeaderBE (); $html .= $this->getHtmlRowBE ('WEIGHT_COUNTRIES_SHIPPING_NAME', $shipinfo->shipment_name); $html .= $this->getHtmlRowBE ('WEIGHT_COUNTRIES_WEIGHT', $shipinfo->order_weight . ' ' . ShopFunctions::renderWeightUnit ($shipinfo->shipment_weight_unit)); $html .= $this->getHtmlRowBE ('WEIGHT_COUNTRIES_COST', $currency->priceDisplay ($shipinfo->shipment_cost)); $html .= $this->getHtmlRowBE ('WEIGHT_COUNTRIES_PACKAGE_FEE', $currency->priceDisplay ($shipinfo->shipment_package_fee)); $html .= $this->getHtmlRowBE ('WEIGHT_COUNTRIES_TAX', $taxDisplay); $html .= '</table>' . "\n"; return $html; }