function fetchElement($name, $value, &$node, $control_name) { $class = $node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : ''; return ShopFunctions::renderTaxList($value, $control_name . '[' . $name . ']', $class); // $class = 'multiple="true" size="10"'; // return JHTML::_('select.genericlist', $taxrates, $control_name . '[' . $name . '][]', $class, 'value', 'text', $value, $control_name . $name); }
protected function getInput() { return ShopFunctions::renderTaxList($this->value, $this->name, ''); // $class = 'multiple="true" size="10"'; // return JHtml::_('select.genericlist', $taxrates, $control_name . '[' . $name . '][]', $class, 'value', 'text', $value, $control_name . $name); }
$tax .= $rule['calc_name'] . '<br />'; } foreach ($calculator->rules['VatTax'] as $rule) { $tax .= $rule['calc_name'] . '<br />'; } $this->taxRules = $tax; $DATax = ''; //vmText::_('COM_VIRTUEMART_RULES_EFFECTING'); foreach ($calculator->rules['DATax'] as $rule) { $DATax .= $rule['calc_name'] . '<br />'; } $this->DATaxRules = $DATax; if (!isset($this->tempProduct->product_tax_id)) { $this->tempProduct->product_tax_id = 0; } $this->lists['taxrates'] = ShopFunctions::renderTaxList($this->tempProduct->product_tax_id, 'mprices[product_tax_id][' . $this->priceCounter . ']'); if (!isset($this->tempProduct->product_discount_id)) { $this->tempProduct->product_discount_id = 0; } $this->lists['discounts'] = $this->renderDiscountList($this->tempProduct->product_discount_id, 'mprices[product_discount_id][' . $this->priceCounter . ']'); $this->lists['shoppergroups'] = ShopFunctions::renderShopperGroupList($this->tempProduct->virtuemart_shoppergroup_id, false, 'mprices[virtuemart_shoppergroup_id][' . $this->priceCounter . ']'); if ($this->priceCounter == $nbPrice) { $tmpl = "productPriceRowTmpl"; } else { $tmpl = "productPriceRowTmpl_" . $this->priceCounter; } ?> <tr id="<?php echo $tmpl; ?> " class="removable row<?php
function fetchElement($name, $value, &$node, $control_name) { //Load languages $language = JFactory::getLanguage(); $language->load('plg_k2_k2mart', JPATH_ADMINISTRATOR); $language->load('com_virtuemart', JPATH_ADMINISTRATOR); //Get params $params = JComponentHelper::getParams('com_k2mart'); $mainframe = JFactory::getApplication(); $db = JFactory::getDBO(); //Add scripts and styles $document = JFactory::getDocument(); $document->addStyleSheet(JURI::root(true) . '/plugins/k2/k2mart/tmpl/admin/css/admin.style.css'); $document->addStyleSheet(JURI::root(true) . '/administrator/components/com_k2mart/css/chosen.css'); $document->addScript(JURI::root(true) . '/plugins/k2/k2mart/includes/js/admin.k2mart.js'); $document->addScript(JURI::root(true) . '/administrator/components/com_k2mart/js/chosen.jquery.min.js'); $document->addScript(JURI::root(true) . '/components/com_virtuemart/assets/js/fancybox/jquery.fancybox-1.3.4.js'); $document->addScript(JURI::root(true) . '/administrator/components/com_virtuemart/assets/js/vm2admin.js'); $document->addScript(JURI::root(true) . '/administrator/components/com_virtuemart/assets/js/jquery.coookie.js'); //Get K2 Item $itemID = JRequest::getInt('cid'); $productID = 0; if ($itemID) { $query = "SELECT referenceID FROM #__k2mart WHERE baseID = {$itemID}"; $db->setQuery($query); $productID = $db->loadResult(); } //Include Virtuemart classes require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; $config = VmConfig::loadConfig(); require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'shopfunctions.php'; require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'html.php'; JModel::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models'); //Get product $model = JModel::getInstance('Product', 'VirtuemartModel'); $product = $model->getProductSingle($productID, false); //Get product children $product->children = method_exists($model, 'getProductChilds') ? $model->getProductChilds($productID) : $model->getProductChildIds($productID); //Get product parent JModel::addIncludePath(JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'models'); $K2Model = JModel::getInstance('Itemlist', 'K2Model'); $tree = $K2Model->getCategoryTree($params->get('catalogRoot', 0)); $query = "SELECT id AS value, title AS text FROM #__k2_items WHERE catid IN(" . implode(',', $tree) . ")"; $db->setQuery($query); $items = $db->loadObjectList(); $option = new JObject(); $option->value = 0; $option->text = JText::_('K2MART_NONE'); array_unshift($items, $option); $parent = 0; if ($product->product_parent_id) { $query = "SELECT baseID FROM #__k2mart WHERE referenceID = {$product->product_parent_id}"; $db->setQuery($query); $parent = $db->loadResult(); } $lists['product_parent_id'] = JHTML::_('select.genericlist', $items, 'product_parent_id', 'class="inputbox"', 'value', 'text', $parent); //Get category tree if (isset($product->categories)) { $lists['categories'] = ShopFunctions::categoryListTree($product->categories); } else { $lists['categories'] = ShopFunctions::categoryListTree(); } //Get vendors if (Vmconfig::get('multix', 'none') !== 'none') { $lists['vendors'] = Shopfunctions::renderVendorList($product->virtuemart_vendor_id); } //Get images $model->addImages($product); if (is_array($product->images) && isset($product->images[0])) { $product->image = $product->images[0]; } else { $product->image = new JObject(); $product->image->virtuemart_media_id = 0; $product->image->file_title = ''; $product->image->file_description = ''; $product->image->file_meta = ''; $product->image->file_url = ''; $product->image->file_url_thumb = ''; $product->image->file_title = ''; } //Get manufacturers $model = JModel::getInstance('Manufacturer', 'VirtuemartModel'); $manufacturers = $model->getManufacturerDropdown($product->virtuemart_manufacturer_id); if (count($manufacturers) > 0) { $lists['manufacturers'] = JHTML::_('select.genericlist', $manufacturers, 'virtuemart_manufacturer_id', 'class="inputbox"', 'value', 'text', $product->virtuemart_manufacturer_id); } //Get shopper groups if (isset($product->shoppergroups)) { $lists['shopperGroups'] = ShopFunctions::renderShopperGroupList($product->shoppergroups, true); } //Get product price require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'calculationh.php'; $calculator = calculationHelper::getInstance(); $product->prices = $calculator->getProductPrices($product); // Get product price override options $options = array(0 => 'Disabled', 1 => 'Overwrite final', -1 => 'Overwrite price to tax'); $lists['price_override_options'] = VmHtml::radioList('override', $product->override, $options); // Get tax rules $dbTax = ''; foreach ($calculator->rules['DBTax'] as $rule) { $dbTax .= $rule['calc_name'] . '<br />'; } $dbTaxRules = $dbTax; $tax = JText::_('COM_VIRTUEMART_TAX_EFFECTING'); foreach ($calculator->rules['Tax'] as $rule) { $tax .= $rule['calc_name'] . '<br />'; } $taxRules = $tax; $daTax = ''; foreach ($calculator->rules['DATax'] as $rule) { $daTax .= $rule['calc_name'] . '<br />'; } $daTaxRules = $daTax; // Removed in VM 2.0.4 //$override = $calculator->override; //$product_override_price = $calculator->product_override_price; if (!isset($product->product_tax_id)) { $product->product_tax_id = 0; } $lists['taxrates'] = ShopFunctions::renderTaxList($product->product_tax_id, 'product_tax_id'); // Discounts if (!isset($product->product_discount_id)) { $product->product_discount_id = 0; } require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'calc.php'; $discounts = VirtueMartModelCalc::getDiscounts(); $discountrates = array(); $discountrates[] = JHTML::_('select.option', '-1', JText::_('COM_VIRTUEMART_PRODUCT_DISCOUNT_NONE'), 'product_discount_id'); $discountrates[] = JHTML::_('select.option', '0', JText::_('COM_VIRTUEMART_PRODUCT_DISCOUNT_NO_SPECIAL'), 'product_discount_id'); foreach ($discounts as $discount) { $discountrates[] = JHTML::_('select.option', $discount->virtuemart_calc_id, $discount->calc_name, 'product_discount_id'); } $lists['discounts'] = JHTML::_('select.genericlist', $discountrates, 'product_discount_id', '', 'product_discount_id', 'text', $product->product_discount_id); //Define Virtuemart image path if (is_Dir(VmConfig::get('vmtemplate') . DS . 'images' . DS . 'availability' . DS)) { $imagePath = VmConfig::get('vmtemplate') . '/images/availability/'; } else { $imagePath = '/components/com_virtuemart/assets/images/availability/'; } // Get currencies $model = JModel::getInstance('Currency', 'VirtuemartModel'); $vendorModel = JModel::getInstance('Vendor', 'VirtuemartModel'); $vendorModel->setId(1); $vendor = $vendorModel->getVendor(); if (empty($product->product_currency)) { $product->product_currency = $vendor->vendor_currency; } $lists['currencies'] = JHTML::_('select.genericlist', $model->getCurrencies(), 'product_currency', '', 'virtuemart_currency_id', 'currency_name', $product->product_currency); $currency = $model->getCurrency($product->product_currency); $productCurrency = $currency->currency_symbol; $currency = $model->getCurrency($vendor->vendor_currency); $vendorCurrency = $currency->currency_symbol; //Get dimensions $lists['product_weight_uom'] = ShopFunctions::renderWeightUnitList('product_weight_uom', !isset($product->product_weight_uom) ? $config->get('weight_unit_default') : $product->product_weight_uom); $lists['product_lwh_uom'] = ShopFunctions::renderLWHUnitList('product_lwh_uom', !isset($product->product_lwh_uom) ? $config->get('lwh_unit_default') : $product->product_lwh_uom); //Get custom fields $model = JModel::getInstance('CustomFields', 'VirtuemartModel'); $fieldTypes = $model->getField_types(); $customsList = JHTML::_('select.genericlist', $model->getCustomsList(), 'customlist'); if (!isset($product->customfields)) { $product->customfields = array(); } //Set some script variables $document->addScriptDeclaration('var k2martVmImagePath="' . JURI::root(true) . $imagePath . '"; var tip_image="' . JURI::root(true) . '/components/com_virtuemart/assets/js/images/vtip_arrow.png"; var k2martVmCustomFieldsNum = "' . count($product->customfields) . '";'); //Edit icon $application = JFactory::getApplication('admin'); $editIcon = JURI::root(true) . '/administrator/templates/' . $application->getTemplate() . '/images/menu/icon-16-edit.png'; //Output ob_start(); include JPATH_SITE . DS . 'plugins' . DS . 'k2' . DS . 'k2mart' . DS . 'tmpl' . DS . 'admin' . DS . 'form.php'; $contents = ob_get_clean(); return $contents; }
} foreach ($calculator->rules['VatTax'] as $rule) { $tax .= $rule['calc_name'] . '<br />'; } $this->taxRules = $tax; $DATax = ''; //vmText::_('COM_VIRTUEMART_RULES_EFFECTING'); foreach ($calculator->rules['DATax'] as $rule) { $DATax .= $rule['calc_name'] . '<br />'; } $this->DATaxRules = $DATax; if (!isset($this->product->product_tax_id)) { $this->product->product_tax_id = 0; } $this->lists['taxrates'] = ShopFunctions::renderTaxList ($this->product->allPrices[$k]['product_tax_id'], 'mprices[product_tax_id][' . $this->priceCounter . ']'); if (!isset($this->product->allPrices[$k]['product_discount_id'])) { $this->product->allPrices[$k]['product_discount_id'] = 0; } $this->lists['discounts'] = $this->renderDiscountList ($this->product->allPrices[$k]['product_discount_id'], 'mprices[product_discount_id][' . $this->priceCounter . ']'); $this->lists['shoppergroups'] = ShopFunctions::renderShopperGroupList ($this->product->allPrices[$k]['virtuemart_shoppergroup_id'], false, 'mprices[virtuemart_shoppergroup_id][' . $this->priceCounter . ']'); if ($this->priceCounter == $nbPrice) { $tmpl = "productPriceRowTmpl"; $this->product->allPrices[$k]['virtuemart_product_price_id'] = ''; } else { $tmpl = "productPriceRowTmpl_" . $this->priceCounter; } ?>
function display($tpl = null) { // Get the task $task = JRequest::getWord('task'); // Load helpers $this->loadHelper('currencydisplay'); $this->loadHelper('html'); $this->loadHelper('image'); //$category_model = VmModel::getModel('category'); $model = VmModel::getModel(); // Handle any publish/unpublish switch ($task) { case 'add': case 'edit': //this was in the controller for the edit tasks, I dont know if it is still needed, $this->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'product' . DS . 'tmpl'); $virtuemart_product_id = JRequest::getVar('virtuemart_product_id', array()); 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; } $product = $model->getProductSingle($virtuemart_product_id, false); $product_parent = $model->getProductParent($product->product_parent_id); $mf_model = VmModel::getModel('manufacturer'); $manufacturers = $mf_model->getManufacturerDropdown($product->virtuemart_manufacturer_id); $this->assignRef('manufacturers', $manufacturers); // Get the category tree if (isset($product->categories)) { $category_tree = ShopFunctions::categoryListTree($product->categories); } else { $category_tree = ShopFunctions::categoryListTree(); } $this->assignRef('category_tree', $category_tree); //Get the shoppergoup list - Cleanshooter Custom Shopper Visibility if (isset($product->shoppergroups)) { $shoppergroupList = ShopFunctions::renderShopperGroupList($product->shoppergroups, true); } $this->assignRef('shoppergroupList', $shoppergroupList); // Load the product price if (!class_exists('calculationHelper')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php'; } $calculator = calculationHelper::getInstance(); $product->prices = $calculator->getProductPrices($product); $product_childIds = $model->getProductChildIds($virtuemart_product_id); $product_childs = array(); foreach ($product_childIds as $id) { $product_childs[] = $model->getProductSingle($id, false); } $this->assignRef('product_childs', $product_childs); $DBTax = ''; //JText::_('COM_VIRTUEMART_RULES_EFFECTING') ; foreach ($calculator->rules['DBTax'] as $rule) { $DBTax .= $rule['calc_name'] . '<br />'; } $this->assignRef('DBTaxRules', $DBTax); $tax = ''; //JText::_('COM_VIRTUEMART_TAX_EFFECTING').'<br />'; foreach ($calculator->rules['Tax'] as $rule) { $tax .= $rule['calc_name'] . '<br />'; } foreach ($calculator->rules['VatTax'] as $rule) { $tax .= $rule['calc_name'] . '<br />'; } $this->assignRef('taxRules', $tax); $DATax = ''; //JText::_('COM_VIRTUEMART_RULES_EFFECTING'); foreach ($calculator->rules['DATax'] as $rule) { $DATax .= $rule['calc_name'] . '<br />'; } $this->assignRef('DATaxRules', $DATax); // $this->assignRef('override', $calculator->override); // $this->assignRef('product_override_price', $calculator->product_override_price); if (!isset($product->product_tax_id)) { $product->product_tax_id = 0; } $lists['taxrates'] = ShopFunctions::renderTaxList($product->product_tax_id, 'product_tax_id'); if (!isset($product->product_discount_id)) { $product->product_discount_id = 0; } $lists['discounts'] = $this->renderDiscountList($product->product_discount_id); if (!class_exists('VirtueMartModelConfig')) { require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'config.php'; } $productLayouts = VirtueMartModelConfig::getLayoutList('productdetails'); $this->assignRef('productLayouts', $productLayouts); // Load Images $model->addImages($product); if (is_Dir(VmConfig::get('vmtemplate') . DS . 'images' . DS . 'availability' . DS)) { $imagePath = VmConfig::get('vmtemplate') . '/images/availability/'; } else { $imagePath = '/components/com_virtuemart/assets/images/availability/'; } $this->assignRef('imagePath', $imagePath); // Load the vendors $vendor_model = VmModel::getModel('vendor'); // $vendors = $vendor_model->getVendors(); // $lists['vendors'] = JHTML::_('select.genericlist', $vendors, 'virtuemart_vendor_id', '', 'virtuemart_vendor_id', 'vendor_name', $product->virtuemart_vendor_id); if (Vmconfig::get('multix', 'none') !== 'none') { $lists['vendors'] = Shopfunctions::renderVendorList($product->virtuemart_vendor_id); } // Load the currencies $currency_model = VmModel::getModel('currency'); $vendor_model->setId(1); $vendor = $vendor_model->getVendor(); if (empty($product->product_currency)) { $product->product_currency = $vendor->vendor_currency; } $currencies = JHTML::_('select.genericlist', $currency_model->getCurrencies(), 'product_currency', '', 'virtuemart_currency_id', 'currency_name', $product->product_currency); $currency = $currency_model->getCurrency($product->product_currency); $this->assignRef('product_currency', $currency->currency_symbol); $currency = $currency_model->getCurrency($vendor->vendor_currency); $this->assignRef('vendor_currency', $currency->currency_symbol); if (count($manufacturers) > 0) { $lists['manufacturers'] = JHTML::_('select.genericlist', $manufacturers, 'virtuemart_manufacturer_id', 'class="inputbox"', 'value', 'text', $product->virtuemart_manufacturer_id); } $lists['product_weight_uom'] = ShopFunctions::renderWeightUnitList('product_weight_uom', $task == 'add' ? VmConfig::get('weight_unit_default') : $product->product_weight_uom); $lists['product_lwh_uom'] = ShopFunctions::renderLWHUnitList('product_lwh_uom', $task == 'add' ? VmConfig::get('lwh_unit_default') : $product->product_lwh_uom); if (empty($product->product_available_date)) { $product->product_available_date = date("Y-m-d"); } $waitinglistmodel = VmModel::getModel('waitinglist'); /* Load waiting list */ if ($product->virtuemart_product_id) { //$waitinglist = $this->get('waitingusers', 'waitinglist'); $waitinglist = $waitinglistmodel->getWaitingusers($product->virtuemart_product_id); $this->assignRef('waitinglist', $waitinglist); } $bookedUsers = $waitinglistmodel->getProductShoppersByStatus($product->virtuemart_product_id, array('S')); $this->assignRef('customers', $bookedUsers); $orderstatusModel = VmModel::getModel('orderstatus'); $lists['OrderStatus'] = $orderstatusModel->renderOrderStatusList(true, array('S')); $field_model = VmModel::getModel('customfields'); $fieldTypes = $field_model->getField_types(); $this->assignRef('fieldTypes', $fieldTypes); /* Load product types lists */ $customsList = $field_model->getCustomsList(); $this->assignRef('customsList', JHTML::_('select.genericlist', $customsList, 'customlist')); $ChildCustomRelation = $field_model->getProductChildCustomRelation(); $this->assignRef('ChildCustomRelation', $ChildCustomRelation); /* Set up labels */ if ($product->product_parent_id > 0) { $info_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_INFO_LBL'); $status_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_STATUS_LBL'); $dim_weight_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_DIM_WEIGHT_LBL'); $images_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_ITEM_IMAGES_LBL'); $delete_message = JText::_('COM_VIRTUEMART_PRODUCT_FORM_DELETE_ITEM_MSG'); } else { if ($task == 'add') { $action = JText::_('COM_VIRTUEMART_PRODUCT_FORM_NEW_PRODUCT_LBL'); } else { $action = JText::_('COM_VIRTUEMART_PRODUCT_FORM_UPDATE_ITEM_LBL'); } $info_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_INFO_LBL'); $status_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_STATUS_LBL'); $dim_weight_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_DIM_WEIGHT_LBL'); $images_label = JText::_('COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_IMAGES_LBL'); $delete_message = JText::_('COM_VIRTUEMART_PRODUCT_FORM_DELETE_PRODUCT_MSG'); } $config = JFactory::getConfig(); $tzoffset = $config->getValue('config.offset'); $this->assignRef('tzoffset', $tzoffset); // Assign the values $this->assignRef('pane', $pane); $this->assignRef('editor', $editor); $this->assignRef('product', $product); $this->assignRef('currencies', $currencies); //no need moved to top $this->assignRef('manufacturers', $manufacturers); $this->assignRef('related_products', $related_products); $this->assignRef('product_parent', $product_parent); /* Assign label values */ $this->assignRef('action', $action); $this->assignRef('info_label', $info_label); $this->assignRef('status_label', $status_label); $this->assignRef('dim_weight_label', $dim_weight_label); $this->assignRef('images_label', $images_label); $this->assignRef('delete_message', $delete_message); $this->assignRef('lists', $lists); // Toolbar $text = ""; if ($task == 'edit') { if ($product->product_sku) { $sku = ' (' . $product->product_sku . ')'; } else { $sku = ""; } if (!empty($product->virtuemart_product_id)) { $text = '<a href="' . juri::root() . 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . '" target="_blank" >' . $product->product_name . $sku . '<span class="vm2-modallink"></span></a>'; } else { $text = $product->product_name . $sku; } } $this->SetViewTitle('PRODUCT', $text); //JToolBarHelper::custom('sentproductemailtocustomer', 'email_32', 'email_32', 'COM_VIRTUEMART_PRODUCT_EMAILTOSHOPPER' ,false); $this->addStandardEditViewCommands($product->virtuemart_product_id); break; default: if ($product_parent_id = JRequest::getInt('product_parent_id', false)) { $product_parent = $model->getProduct($product_parent_id); $title = 'PRODUCT_CHILDREN_LIST'; $link_to_parent = JHTML::_('link', JRoute::_('index.php?view=product&task=edit&virtuemart_product_id=' . $product_parent->virtuemart_product_id . '&option=com_virtuemart'), $product_parent->product_name, array('title' => JText::_('COM_VIRTUEMART_EDIT_PARENT') . ' ' . $product_parent->product_name)); $msg = JText::_('COM_VIRTUEMART_PRODUCT_OF') . " " . $link_to_parent; } else { $title = 'PRODUCT'; $msg = ""; } $this->db = JFactory::getDBO(); $this->SetViewTitle($title, $msg); $this->addStandardDefaultViewLists($model, 'created_on'); /* Get the list of products */ $productlist = $model->getProductListing(false, false, false, false, true); //The pagination must now always set AFTER the model load the listing $pagination = $model->getPagination(); $this->assignRef('pagination', $pagination); /* Get the category tree */ $categoryId = $model->virtuemart_category_id; //OSP switched to filter in model, was JRequest::getInt('virtuemart_category_id'); $category_tree = ShopFunctions::categoryListTree(array($categoryId)); $this->assignRef('category_tree', $category_tree); // Check for Media Items and Reviews, set the price $media = VmModel::getModel('media'); $productreviews = VmModel::getModel('ratings'); /* Load the product price */ if (!class_exists('calculationHelper')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php'; } $vendor_model = VmModel::getModel('vendor'); foreach ($productlist as $virtuemart_product_id => $product) { $product->mediaitems = count($product->virtuemart_media_id); $product->reviews = $productreviews->countReviewsForProduct($product->virtuemart_product_id); $vendor_model->setId($product->virtuemart_vendor_id); $vendor = $vendor_model->getVendor(); $currencyDisplay = CurrencyDisplay::getInstance($vendor->vendor_currency, $vendor->virtuemart_vendor_id); if (!empty($product->product_price) && !empty($product->product_currency)) { $product->product_price_display = $currencyDisplay->priceDisplay($product->product_price, (int) $product->product_currency, 1, true); } /* Write the first 5 categories in the list */ $product->categoriesList = shopfunctions::renderGuiList('virtuemart_category_id', '#__virtuemart_product_categories', 'virtuemart_product_id', $product->virtuemart_product_id, 'category_name', '#__virtuemart_categories', 'virtuemart_category_id', 'category'); } $mf_model = VmModel::getModel('manufacturer'); $manufacturers = $mf_model->getManufacturerDropdown(); $this->assignRef('manufacturers', $manufacturers); /* add Search filter in lists*/ /* Search type */ $options = array('' => JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'), 'parent' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_PARENT_PRODUCT'), 'product' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRODUCT'), 'price' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRICE'), 'withoutprice' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_WITHOUTPRICE')); $this->lists['search_type'] = VmHTML::selectList('search_type', JRequest::getVar('search_type'), $options); /* Search order */ $options = array('bf' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_BEFORE'), 'af' => JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE_AFTER')); $this->lists['search_order'] = VmHTML::selectList('search_order', JRequest::getVar('search_order'), $options); // Toolbar JToolBarHelper::save('sentproductemailtoshoppers', JText::_('COM_VIRTUEMART_PRODUCT_EMAILTOSHOPPERS')); JToolBarHelper::custom('createchild', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_CHILD'), true); JToolBarHelper::custom('cloneproduct', 'copy', 'copy', JText::_('COM_VIRTUEMART_PRODUCT_CLONE'), true); JToolBarHelper::custom('addrating', 'default', '', JText::_('COM_VIRTUEMART_ADD_RATING'), true); $this->addStandardDefaultViewCommands(); $this->assignRef('productlist', $productlist); $this->assignRef('virtuemart_category_id', $categoryId); $this->assignRef('model', $model); break; } parent::display($tpl); }
$tax .= $rule['calc_name'] . '<br />'; } foreach ($calculator->rules['VatTax'] as $rule) { $tax .= $rule['calc_name'] . '<br />'; } $this->taxRules = $tax; $DATax = ''; //JText::_('COM_VIRTUEMART_RULES_EFFECTING'); foreach ($calculator->rules['DATax'] as $rule) { $DATax .= $rule['calc_name'] . '<br />'; } $this->DATaxRules = $DATax; if (!isset($this->tempProduct->product_tax_id)) { $this->tempProduct->product_tax_id = 0; } $this->lists['taxrates'] = ShopFunctions::renderTaxList($this->tempProduct->product_tax_id, 'product_tax_id[]', '', 'product_tax_id' . $sPrices['virtuemart_product_price_id']); if (!isset($this->tempProduct->product_discount_id)) { $this->tempProduct->product_discount_id = 0; } $this->lists['discounts'] = $this->renderDiscountList($this->tempProduct->product_discount_id, 'product_discount_id[]', 'product_discount_id' . $sPrices['virtuemart_product_price_id']); $this->lists['shoppergroups'] = ShopFunctions::renderShopperGroupList($this->tempProduct->virtuemart_shoppergroup_id, false, 'price_shoppergroup_id[]', 'price_shoppergroup_id' . $sPrices['virtuemart_product_price_id']); ?> <div class="price-container removable"> <span class="icon-move price_ordering label"> </span> <span class="icon-remove price-remove label pull-right"> </span> <?php //echo JText::_ ('COM_VIRTUEMART_PRODUCT_PRICE_ORDER'); echo $this->loadTemplate('price'); ?> </div> <?php $this->priceCounter++;