Example #1
0
 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);
 }
Example #2
0
 function display($tpl = null)
 {
     // Load the helper(s)
     $this->addHelperPath(JPATH_VM_ADMINISTRATOR . DS . 'helpers');
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     if (!class_exists('vmPlugin')) {
         require JPATH_VM_PLUGINS . DS . 'vmplugin.php';
     }
     $this->assignRef('perms', Permissions::getInstance());
     $model = VmModel::getModel('paymentmethod');
     //@todo should be depended by loggedVendor
     //		$vendorId=1;
     //		$this->assignRef('vendorId', $vendorId);
     // TODO logo
     $this->SetViewTitle();
     $layoutName = JRequest::getWord('layout', 'default');
     $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') {
         // Load the helper(s)
         if (!class_exists('VmImage')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
         }
         if (!class_exists('vmParameters')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'parameterparser.php';
         }
         $payment = $model->getPayment();
         $this->assignRef('payment', $payment);
         $this->assignRef('vmPPaymentList', self::renderInstalledPaymentPlugins($payment->payment_jplugin_id));
         //			$this->assignRef('PaymentTypeList',self::renderPaymentRadioList($paym->payment_type));
         //			$this->assignRef('creditCardList',self::renderCreditCardRadioList($paym->payment_creditcards));
         //			echo 'humpf <pre>'.print_r($paym).'</pre>' ;
         //$this->assignRef('creditCardList',ShopFunctions::renderCreditCardList($paym->payment_creditcards,true));
         $this->assignRef('shopperGroupList', ShopFunctions::renderShopperGroupList($payment->virtuemart_shoppergroup_ids, true));
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $vendorList = ShopFunctions::renderVendorList($payment->virtuemart_vendor_id);
             $this->assignRef('vendorList', $vendorList);
         }
         $this->addStandardEditViewCommands($payment->virtuemart_paymentmethod_id);
     } else {
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $payments = $model->getPayments();
         $this->assignRef('payments', $payments);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     // Load the helper(s)
     $this->loadHelper('permissions');
     $this->loadHelper('html');
     if (!class_exists('vmPlugin')) {
         require JPATH_VM_PLUGINS . DS . 'vmplugin.php';
     }
     $this->perms = Permissions::getInstance();
     $model = VmModel::getModel('paymentmethod');
     //@todo should be depended by loggedVendor
     //		$vendorId=1;
     //		$this->assignRef('vendorId', $vendorId);
     $vendorModel = VmModel::getModel('vendor');
     $vendorModel->setId(1);
     $vendor = $vendorModel->getVendor();
     $currencyModel = VmModel::getModel('currency');
     $currencyModel->setId($vendor->vendor_currency);
     $currency = $currencyModel->getData();
     $this->vendor_currency = $currency->currency_symbol;
     $layoutName = JRequest::getWord('layout', 'default');
     if ($layoutName == 'edit') {
         // Load the helper(s)
         $this->loadHelper('image');
         // jimport('joomla.html.pane');
         $this->payment = $model->getPayment();
         // $this->vmPPaymentList = self::InstalledPaymentPlgSelectList($payment->payment_jplugin_id);
         //			$this->assignRef('PaymentTypeList',self::renderPaymentRadioList($paym->payment_type));
         //			$this->assignRef('creditCardList',self::renderCreditCardRadioList($paym->payment_creditcards));
         //			echo 'humpf <pre>'.print_r($paym).'</pre>' ;
         //$this->assignRef('creditCardList',ShopFunctions::renderCreditCardList($paym->payment_creditcards,true));
         $this->shopperGroupList = ShopFunctions::renderShopperGroupList($this->payment->virtuemart_shoppergroup_ids, true);
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $this->vendorList = ShopFunctions::renderVendorList($this->payment->virtuemart_vendor_id);
         }
         // TODO logo
         $this->SetViewTitle('', $this->payment->payment_name);
         $this->addStandardEditViewCommands($this->payment->virtuemart_paymentmethod_id);
     } else {
         if (JRequest::getWord('format', '') === 'raw') {
             $tpl = 'results';
         } else {
             $this->SetViewTitle();
             $this->addStandardDefaultViewCommands();
             // know payment list
             $this->installedPayments = $this->PaymentPlgList();
         }
         $this->addStandardDefaultViewLists($model);
         $this->payments = $model->getPayments();
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
     if ($tpl === 'results') {
         echo $this->AjaxScripts();
     }
 }
Example #4
0
 function display($tpl = null)
 {
     // Load the helper(s)
     $this->addHelperPath(JPATH_VM_ADMINISTRATOR . DS . 'helpers');
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     if (!class_exists('vmPSPlugin')) {
         require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
     }
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel();
     $layoutName = JRequest::getWord('layout', 'default');
     $this->SetViewTitle();
     $layoutName = JRequest::getWord('layout', 'default');
     if ($layoutName == 'edit') {
         $shipment = $model->getShipment();
         if (!class_exists('VmImage')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
         }
         if (!class_exists('vmParameters')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'parameterparser.php';
         }
         if (!class_exists('VirtueMartModelVendor')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
         }
         $vendor_id = 1;
         $currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
         $this->assignRef('vendor_currency', $currency->currency_symbol);
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $vendorList = ShopFunctions::renderVendorList($shipment->virtuemart_vendor_id);
             $this->assignRef('vendorList', $vendorList);
         }
         $this->assignRef('pluginList', self::renderInstalledShipmentPlugins($shipment->shipment_jplugin_id));
         $this->assignRef('shipment', $shipment);
         $this->assignRef('shopperGroupList', ShopFunctions::renderShopperGroupList($shipment->virtuemart_shoppergroup_ids, true));
         $this->addStandardEditViewCommands($shipment->virtuemart_shipmentmethod_id);
     } else {
         JToolBarHelper::custom('cloneshipment', 'copy', 'copy', JText::_('COM_VIRTUEMART_SHIPMENT_CLONE'), true);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $shipments = $model->getShipments();
         $this->assignRef('shipments', $shipments);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     // Load the helper(s)
     $this->addHelperPath(JPATH_VM_ADMINISTRATOR . '/helpers');
     $this->loadHelper('permissions');
     $this->loadHelper('vmpsplugin');
     $this->loadHelper('html');
     $model = VmModel::getModel();
     $layoutName = JRequest::getWord('layout', 'default');
     $layoutName = JRequest::getWord('layout', 'default');
     if ($layoutName == 'edit') {
         $shipment = $model->getShipment();
         $this->loadHelper('image');
         // $this->loadHelper('html');
         // $this->loadHelper('parameterparser');
         // jimport('joomla.html.pane');
         if (!class_exists('VirtueMartModelVendor')) {
             require JPATH_VM_ADMINISTRATOR . '/models' . DS . 'vendor.php';
         }
         $vendor_id = 1;
         $currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
         $this->vendor_currency = $currency->currency_symbol;
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $this->vendorList = ShopFunctions::renderVendorList($shipment->virtuemart_vendor_id);
         }
         $this->pluginList = self::renderInstalledShipmentPlugins($shipment->shipment_jplugin_id);
         $this->shipment = $shipment;
         $this->shopperGroupList = ShopFunctions::renderShopperGroupList($shipment->virtuemart_shoppergroup_ids, true);
         $this->SetViewTitle('', $shipment->shipment_name);
         $this->addStandardEditViewCommands($shipment->virtuemart_shipmentmethod_id);
     } else {
         if (JRequest::getWord('format', '') === 'raw') {
             $tpl = 'results';
         } else {
             $this->SetViewTitle();
             JToolBarHelper::custom('cloneshipment', 'copy', 'copy', JText::_('COM_VIRTUEMART_SHIPMENT_CLONE'), true);
             $this->addStandardDefaultViewCommands();
             $this->installedShipments = $this->shipmentsPlgList();
         }
         $this->addStandardDefaultViewLists($model);
         $this->shipments = $model->getShipments();
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
     if ($tpl === 'results') {
         echo $this->AjaxScripts();
     }
 }
 function display($tpl = null)
 {
     // Load the helper(s)
     $this->addHelperPath(JPATH_VM_ADMINISTRATOR . DS . 'helpers');
     $this->loadHelper('permissions');
     $this->loadHelper('vmpsplugin');
     $this->loadHelper('html');
     $model = VmModel::getModel();
     $layoutName = JRequest::getWord('layout', 'default');
     $this->SetViewTitle();
     $layoutName = JRequest::getWord('layout', 'default');
     if ($layoutName == 'edit') {
         $shipment = $model->getShipment();
         $this->loadHelper('image');
         // $this->loadHelper('html');
         $this->loadHelper('parameterparser');
         // jimport('joomla.html.pane');
         if (!class_exists('VirtueMartModelVendor')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
         }
         $vendor_id = 1;
         $currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
         $this->assignRef('vendor_currency', $currency->currency_symbol);
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $vendorList = ShopFunctions::renderVendorList($shipment->virtuemart_vendor_id);
             $this->assignRef('vendorList', $vendorList);
         }
         $this->assignRef('pluginList', self::renderInstalledShipmentPlugins($shipment->shipment_jplugin_id));
         $this->assignRef('shipment', $shipment);
         $this->assignRef('shopperGroupList', ShopFunctions::renderShopperGroupList($shipment->virtuemart_shoppergroup_ids, true));
         $this->addStandardEditViewCommands($shipment->virtuemart_shipmentmethod_id);
     } else {
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $shipments = $model->getShipments();
         $this->assignRef('shipments', $shipments);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
Example #7
0
 function display($tpl = null)
 {
     // Load the helper(s)
     $this->addHelperPath(JPATH_VM_ADMINISTRATOR . DS . 'helpers');
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     if (!class_exists('vmPSPlugin')) {
         require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
     }
     $this->user = JFactory::getUser();
     $model = VmModel::getModel('paymentmethod');
     // TODO logo
     $this->SetViewTitle();
     $layoutName = vRequest::getCmd('layout', 'default');
     $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') {
         // Load the helper(s)
         if (!class_exists('VmImage')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
         }
         VmConfig::loadJLang('plg_vmpsplugin', false);
         JForm::addFieldPath(JPATH_VM_ADMINISTRATOR . DS . 'fields');
         $payment = $model->getPayment();
         // Get the payment XML.
         $formFile = JPath::clean(JPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . $payment->payment_element . DS . $payment->payment_element . '.xml');
         if (file_exists($formFile)) {
             $payment->form = JForm::getInstance($payment->payment_element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]');
             $payment->params = new stdClass();
             $varsToPush = vmPlugin::getVarsToPushByXML($formFile, 'paymentForm');
             $payment->params->payment_params = $payment->payment_params;
             VmTable::bindParameterable($payment->params, 'payment_params', $varsToPush);
             $payment->form->bind($payment);
         } else {
             $payment->form = null;
         }
         $this->assignRef('payment', $payment);
         $this->assignRef('vmPPaymentList', self::renderInstalledPaymentPlugins($payment->payment_jplugin_id));
         $this->assignRef('shopperGroupList', ShopFunctions::renderShopperGroupList($payment->virtuemart_shoppergroup_ids, true));
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $vendorList = ShopFunctions::renderVendorList($payment->virtuemart_vendor_id);
             $this->assignRef('vendorList', $vendorList);
         }
         $this->addStandardEditViewCommands($payment->virtuemart_paymentmethod_id);
     } else {
         JToolBarHelper::custom('clonepayment', 'copy', 'copy', vmText::_('COM_VIRTUEMART_PAYMENT_CLONE'), true);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $this->payments = $model->getPayments();
         foreach ($this->payments as &$data) {
             // Write the first 5 shoppergroups in the list
             $data->paymShoppersList = shopfunctions::renderGuiList($data->virtuemart_shoppergroup_ids, 'shoppergroups', 'shopper_group_name', 'payment');
         }
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
Example #8
0
 function display($tpl = null)
 {
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel('calc');
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     $perms = Permissions::getInstance();
     $this->assignRef('perms', $perms);
     //@todo should be depended by loggedVendor
     $vendorId = 1;
     $this->assignRef('vendorId', $vendorId);
     $db = JFactory::getDBO();
     $this->SetViewTitle();
     $layoutName = JRequest::getWord('layout', 'default');
     if ($layoutName == 'edit') {
         $calc = $model->getCalc();
         $this->assignRef('calc', $calc);
         $isNew = $calc->virtuemart_calc_id < 1;
         if ($isNew) {
             $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` = "' . $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;
             }
         }
         $entryPointsList = self::renderEntryPointsList($calc->calc_kind);
         $this->assignRef('entryPointsList', $entryPointsList);
         $mathOpList = self::renderMathOpList($calc->calc_value_mathop);
         $this->assignRef('mathOpList', $mathOpList);
         /* Get the category tree */
         $categoryTree = null;
         if (isset($calc->calc_categories)) {
             $calc_categories = $calc->calc_categories;
             $categoryTree = ShopFunctions::categoryListTree($calc_categories);
         } else {
             $categoryTree = ShopFunctions::categoryListTree();
         }
         $this->assignRef('categoryTree', $categoryTree);
         $currencyModel = VmModel::getModel('currency');
         $_currencies = $currencyModel->getCurrencies();
         $this->assignRef('currencies', $_currencies);
         /* Get the shoppergroup tree */
         $shopperGroupList = ShopFunctions::renderShopperGroupList($calc->virtuemart_shoppergroup_ids, True);
         $this->assignRef('shopperGroupList', $shopperGroupList);
         $countriesList = ShopFunctions::renderCountryList($calc->calc_countries, True);
         $this->assignRef('countriesList', $countriesList);
         $statesList = ShopFunctions::renderStateList($calc->virtuemart_state_ids, '', True);
         $this->assignRef('statesList', $statesList);
         $manufacturerList = ShopFunctions::renderManufacturerList($calc->virtuemart_manufacturers, true);
         $this->assignRef('manufacturerList', $manufacturerList);
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $vendorList = ShopFunctions::renderVendorList($calc->virtuemart_vendor_id, false);
             $this->assignRef('vendorList', $vendorList);
         }
         $this->addStandardEditViewCommands();
     } else {
         JToolBarHelper::custom('toggle.calc_shopper_published.0', 'unpublish', 'no', JText::_('COM_VIRTUEMART_CALC_SHOPPER_PUBLISH_TOGGLE_OFF'), true);
         JToolBarHelper::custom('toggle.calc_shopper_published.1', 'publish', 'yes', JText::_('COM_VIRTUEMART_CALC_SHOPPER_PUBLISH_TOGGLE_ON'), true);
         JToolBarHelper::custom('toggle.calc_vendor_published.0', 'unpublish', 'no', JText::_('COM_VIRTUEMART_CALC_VENDOR_PUBLISH_TOGGLE_OFF'), true);
         JToolBarHelper::custom('toggle.calc_vendor_published.1', 'publish', 'yes', JText::_('COM_VIRTUEMART_CALC_VENDOR_PUBLISH_TOGGLE_ON'), true);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $search = JRequest::getWord('search', false);
         $calcs = $model->getCalcs(false, false, $search);
         $this->assignRef('calcs', $calcs);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
        $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++;
    }
    ?>
	</div>
    <div class="button2-left">
        <div class="blank">
Example #10
0
 function display($tpl = null)
 {
     // Get the task
     $task = vRequest::getCmd('task', $this->getLayout());
     $this->assignRef('task', $task);
     // 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('VmImage')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
     }
     $model = tmsModel::getModel();
     // Handle any publish/unpublish
     switch ($task) {
         case 'add':
         case 'edit':
             //this was in the controller for the edit tasks, we need this for the access by FE
             //$this->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views'.DS.'product'.DS.'tmpl');
             tsmConfig::loadJLang('com_tsmart_orders', TRUE);
             tsmConfig::loadJLang('com_tsmart_shoppers', TRUE);
             $model_country = tmsModel::getModel('country');
             $this->countries = $model_country->getItemList();
             $tsmart_product_id = vRequest::getInt('tsmart_product_id');
             if (is_array($tsmart_product_id) && count($tsmart_product_id) > 0) {
                 $tsmart_product_id = (int) $tsmart_product_id[0];
             } else {
                 $tsmart_product_id = (int) $tsmart_product_id;
             }
             $product = $model->getItem($tsmart_product_id);
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
             $product->tsmart_service_class_ids = tsmserviceclass::get_list_service_class_ids_by_tour_id($tsmart_product_id);
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmgroupsize.php';
             $product->tsmart_group_size_ids = tsmGroupSize::get_list_group_size_ids_by_tour_id($tsmart_product_id);
             //$user = JFactory::getUser();
             $superVendor = vmAccess::isSuperVendor();
             if ($superVendor != 1 and $superVendor != $product->tsmart_vendor_id) {
                 vmdebug('Product view.html.php ' . $superVendor, $product->tsmart_vendor_id);
                 JFactory::getApplication()->redirect('index.php?option=com_tsmart&view=tsmart', tsmText::_('com_tsmart_ALERTNOTAUTHOR'), 'error');
             }
             if (!empty($product->product_parent_id)) {
                 $product_parent = $model->getProductSingle($product->product_parent_id, false);
             }
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
             $this->tour_service_class = tsmserviceclass::get_list_tour_service_class();
             $customfields = tmsModel::getModel('Customfields');
             $product->allIds[] = $product->tsmart_product_id;
             if (!empty($product->product_parent_id)) {
                 $product->allIds[] = $product->product_parent_id;
             }
             $product->customfields = $customfields->getCustomEmbeddedProductCustomFields($product->allIds);
             // Get the category tree
             if (isset($product->categories)) {
                 $this->category_tree = ShopFunctions::categoryListTree($product->categories);
             } else {
                 $this->category_tree = ShopFunctions::categoryListTree();
             }
             //Fallback for categories inherited by parent to correctly calculate the prices
             if (empty($product->categories) and !empty($product_parent->categories)) {
                 $product->categories = $product_parent->categories;
             }
             //Get the shoppergoup list - Cleanshooter Custom Shopper Visibility
             if (!isset($product->shoppergroups)) {
                 $product->shoppergroups = 0;
             }
             $this->shoppergroupList = ShopFunctions::renderShopperGroupList($product->shoppergroups);
             // Load the product price
             if (!class_exists('calculationHelper')) {
                 require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
             }
             //Do we need the children? If there is a C customfield, we dont want them
             $isCustomVariant = false;
             foreach ($product->customfields as $custom) {
                 if ($custom->field_type == 'C' and $custom->tsmart_product_id == $tsmart_product_id) {
                     $isCustomVariant = true;
                     break;
                 }
             }
             if (!class_exists('tsmartModelConfig')) {
                 require VMPATH_ADMIN . '/models/config.php';
             }
             $productLayouts = tsmartModelConfig::getLayoutList('productdetails');
             $this->productLayouts = $productLayouts;
             // Load Images
             $model->addImages($product);
             if (!class_exists('VmTemplate')) {
                 require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
             }
             $vmtemplate = VmTemplate::loadVmTemplateStyle();
             $this->imagePath = shopFunctions::getAvailabilityIconUrl($vmtemplate);
             // Load the vendors
             $vendor_model = tmsModel::getModel('vendor');
             $lists['vendors'] = '';
             if ($this->showVendors()) {
                 $lists['vendors'] = Shopfunctions::renderVendorList($product->tsmart_vendor_id);
             }
             // Load the currencies
             $currency_model = tmsModel::getModel('currency');
             $vendor_model->setId(vmAccess::isSuperVendor());
             $this->vendor = $vendor_model->getVendor();
             $currency = $currency_model->getItemList();
             $this->vendor_currency_symb = $currency->currency_symbol;
             $lists['manufacturers'] = shopFunctions::renderManufacturerList($product->tsmart_manufacturer_id, true);
             if (!empty($product->product_weight_uom)) {
                 $product_weight_uom = $product->product_weight_uom;
             } else {
                 if (!empty($product_parent)) {
                     $product_weight_uom = $product_parent->product_weight_uom;
                 } else {
                     $product_weight_uom = tsmConfig::get('weight_unit_default');
                 }
             }
             if (!empty($product->product_lwh_uom)) {
                 $product_lwh_uom = $product->product_lwh_uom;
             } else {
                 if (!empty($product_parent)) {
                     $product_lwh_uom = $product_parent->product_lwh_uom;
                 } else {
                     $product_lwh_uom = tsmConfig::get('lwh_unit_default');
                 }
             }
             if (!empty($product->product_unit)) {
                 $product_unit = $product->product_unit;
             } else {
                 if (!empty($product_parent)) {
                     $product_unit = $product_parent->product_unit;
                 } else {
                     $product_unit = tsmConfig::get('product_unit_default', 'KG');
                 }
             }
             $lists['product_weight_uom'] = ShopFunctions::renderWeightUnitList('product_weight_uom', $product_weight_uom);
             $lists['product_iso_uom'] = ShopFunctions::renderUnitIsoList('product_unit', $product_unit);
             $lists['product_lwh_uom'] = ShopFunctions::renderLWHUnitList('product_lwh_uom', $product_lwh_uom);
             if (empty($product->product_available_date)) {
                 $product->product_available_date = date("Y-m-d");
             }
             $waitinglistmodel = tmsModel::getModel('waitinglist');
             /* Load waiting list */
             if ($product->tsmart_product_id) {
                 //$waitinglist = $this->get('waitingusers', 'waitinglist');
                 $waitinglist = $waitinglistmodel->getWaitingusers($product->tsmart_product_id);
                 $this->assignRef('waitinglist', $waitinglist);
             }
             $orderstatusModel = tmsModel::getModel('orderstatus');
             $lists['OrderStatus'] = $orderstatusModel->renderOSList(array(), 'order_status', TRUE);
             // Add the tsmart_shoppergroup_ids
             $cid = JFactory::getUser()->id;
             $this->activeShoppergroups = shopfunctions::renderGuiList($cid, 'shoppergroups', 'shopper_group_name', 'category', 'vmuser_shoppergroups', 'tsmart_user_id');
             if (!empty($this->activeShoppergroups)) {
                 $shoppergroupModel = tmsModel::getModel('shoppergroup');
                 $this->activeShoppergroups = tsmText::_($shoppergroupModel->getDefault(0)->shopper_group_name);
             }
             // Load protocustom lists
             $customModel = tmsModel::getModel('custom');
             $this->fieldTypes = tsmartModelCustom::getCustomTypes();
             $customsList = $customModel->getCustomsList();
             $attribs = 'style= "width: 300px;"';
             $customlist = JHtml::_('select.genericlist', $customsList, 'customlist', $attribs, 'value', 'text', null, false, true);
             $this->assignRef('customsList', $customlist);
             if ($product->product_parent_id > 0) {
                 // Set up labels
                 $info_label = tsmText::_('com_tsmart_PRODUCT_FORM_ITEM_INFO_LBL');
                 $status_label = tsmText::_('com_tsmart_PRODUCT_FORM_ITEM_STATUS_LBL');
                 $dim_weight_label = tsmText::_('com_tsmart_PRODUCT_FORM_ITEM_DIM_WEIGHT_LBL');
                 $images_label = tsmText::_('com_tsmart_PRODUCT_FORM_ITEM_IMAGES_LBL');
                 $delete_message = tsmText::_('com_tsmart_PRODUCT_FORM_DELETE_ITEM_MSG');
             } else {
                 if ($task == 'add') {
                     $action = tsmText::_('com_tsmart_PRODUCT_FORM_NEW_PRODUCT_LBL');
                 } else {
                     $action = tsmText::_('com_tsmart_PRODUCT_FORM_UPDATE_ITEM_LBL');
                 }
                 $info_label = tsmText::_('com_tsmart_PRODUCT_FORM_PRODUCT_INFO_LBL');
                 $status_label = tsmText::_('com_tsmart_PRODUCT_FORM_PRODUCT_STATUS_LBL');
                 $dim_weight_label = tsmText::_('com_tsmart_PRODUCT_FORM_PRODUCT_DIM_WEIGHT_LBL');
                 $images_label = tsmText::_('com_tsmart_PRODUCT_FORM_PRODUCT_IMAGES_LBL');
                 $delete_message = tsmText::_('com_tsmart_PRODUCT_FORM_DELETE_PRODUCT_MSG');
             }
             //get countries
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmcountries.php';
             $countries = tsmcountries::get_countries();
             $this->assignRef('countries', $countries);
             //end get countries
             //get cities
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmcities.php';
             $cities = tsmcities::get_cities();
             $this->assignRef('cities', $cities);
             //end get cities
             //get tour style
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmtourstyle.php';
             $list_tour_style = tsmtourstyle::get_list_tour_style();
             $this->assignRef('list_tour_style', $list_tour_style);
             //end get toursyle
             //get tour section
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmtoursection.php';
             $list_tour_section = tsmtoursection::get_list_tour_section();
             $this->assignRef('list_tour_section', $list_tour_section);
             //end get toursyle
             //get tour physicalgrade
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmphysicalgrade.php';
             $list_physical_grade = vmphysicalgrade::get_physical_grade();
             $this->assignRef('list_physical_grade', $list_physical_grade);
             //end get physicalgrade
             //get tour_type
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmtourtype.php';
             $list_tour_type = tsmtourtype::get_list_tour_type();
             $this->assignRef('list_tour_type', $list_tour_type);
             //end get tour_type
             //get tour_type
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
             $list_tour_service_class = tsmserviceclass::get_list_tour_service_class();
             $product->list_tour_service_class_id = tsmserviceclass::get_list_service_class_ids_by_tour_id($product->tsmart_product_id);
             $this->assignRef('list_tour_service_class', $list_tour_service_class);
             //end get tour_type
             //get activities
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmactivities.php';
             $product->list_activity_id = tsmactivities::get_list_activity_id_by_tour_id($product->tsmart_product_id);
             $activities = tsmactivities::get_activities();
             $this->assignRef('activities', $activities);
             //end get activities
             //get list group size
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmgroupsize.php';
             $list_group_size = tsmGroupSize::get_list_group_size();
             $product->list_group_size_id = tsmGroupSize::get_list_group_size_ids_by_tour_id($product->tsmart_product_id);
             $this->assignRef('list_group_size', $list_group_size);
             //end get list group size
             //get list country
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmcountries.php';
             $product->list_tsmart_country_id = tsmcountries::get_list_tsmart_country_id_by_tour_id($product->tsmart_product_id);
             //end get list group size
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmprice.php';
             $this->list_price_type = vmprice::get_list_price_type();
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmproduct.php';
             $this->list_tour_method = vmproduct::get_list_tour_method();
             $this->assignRef('product', $product);
             $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
             if ($product->product_sku) {
                 $sku = ' (' . $product->product_sku . ')';
             } else {
                 $sku = "";
             }
             //if (!empty($product->canonCatLink)) $canonLink = '&tsmart_category_id=' . $product->canonCatLink; else $canonLink = '';
             if (!empty($product->tsmart_product_id)) {
                 if (!class_exists('shopFunctionsF')) {
                     require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
                 }
                 $menuItemID = shopFunctionsF::getMenuItemId(JFactory::getLanguage()->getTag());
                 $canonLink = '';
                 if ($product->canonCatId) {
                     $canonLink = '&tsmart_category_id=' . $product->canonCatId;
                 }
                 $text = '<a href="' . juri::root() . 'index.php?option=com_tsmart&view=productdetails&tsmart_product_id=' . $product->tsmart_product_id . $canonLink . '&Itemid=' . $menuItemID . '" target="_blank" >' . $product->product_name . $sku . '<span class="vm2-modallink"></span></a>';
                 if (JFactory::getApplication()->isSite()) {
                     $bar = JToolBar::getInstance('toolbar');
                     $bar->appendButton('Link', 'back', 'com_tsmart_LEAVE_TO_PRODUCT', juri::root() . 'index.php?option=com_tsmart&view=productdetails&tsmart_product_id=' . $product->tsmart_product_id . $canonLink . '&Itemid=' . $menuItemID);
                 }
             } else {
                 $text = $product->product_name . $sku;
             }
             $this->SetViewTitle('PRODUCT', $text);
             $this->addStandardEditViewCommandsNoValidate($product->tsmart_product_id);
             break;
         case 'massxref_cats':
         case 'massxref_cats_exe':
             $this->SetViewTitle('PRODUCT_MASSXREF');
             $showVendors = $this->showVendors();
             $this->assignRef('showVendors', $showVendors);
             $keyWord = '';
             $catmodel = tmsModel::getModel('category');
             $this->assignRef('catmodel', $catmodel);
             $this->addStandardDefaultViewCommandsNoValidate();
             $this->addStandardDefaultViewLists($catmodel, 'category_name');
             $session = JFactory::getSession();
             $reset = $session->get('reset_pag', false, 'vm');
             $limit = '';
             if ($reset) {
                 $limit = 0;
                 $session->set('reset_pag', false, 'vm');
             }
             $this->categories = $catmodel->getCategoryTree(0, 0, false, $this->lists['search'], $limit);
             $catpagination = $catmodel->getPagination();
             $this->assignRef('catpagination', $catpagination);
             $this->setLayout('massxref');
             JToolBarHelper::custom('massxref_cats_exe', 'new', 'new', tsmText::_('com_tsmart_PRODUCT_XREF_CAT_EXE'), false);
             break;
         case 'massxref_sgrps':
         case 'massxref_sgrps_exe':
             $sgrpmodel = tmsModel::getModel('shoppergroup');
             $this->addStandardDefaultViewLists($sgrpmodel);
             $shoppergroups = $sgrpmodel->getShopperGroups(false, true);
             $this->assignRef('shoppergroups', $shoppergroups);
             $sgrppagination = $sgrpmodel->getPagination();
             $this->assignRef('sgrppagination', $sgrppagination);
             $this->setLayout('massxref');
             JToolBarHelper::custom('massxref_sgrps_exe', 'new', 'new', tsmText::_('com_tsmart_PRODUCT_XREF_SGRPS_EXE'), false);
             break;
         default:
             if ($product_parent_id = vRequest::getInt('product_parent_id', false)) {
                 $product_parent = $model->getProductSingle($product_parent_id, false);
                 if ($product_parent) {
                     $title = 'PRODUCT_CHILDREN_LIST';
                     $link_to_parent = JHtml::_('link', JRoute::_('index.php?view=product&task=edit&tsmart_product_id=' . $product_parent->tsmart_product_id . '&option=com_tsmart'), $product_parent->product_name, array('title' => tsmText::_('com_tsmart_EDIT_PARENT') . ' ' . $product_parent->product_name));
                     $msg = tsmText::_('com_tsmart_PRODUCT_OF') . " " . $link_to_parent;
                 } else {
                     $title = 'PRODUCT_CHILDREN_LIST';
                     $msg = 'Parent with product_parent_id ' . $product_parent_id . ' not found';
                 }
             } else {
                 $title = 'PRODUCT';
                 $msg = "";
             }
             $this->SetViewTitle($title, $msg);
             $this->addStandardDefaultViewLists($model, 'created_on');
             if ($cI = vRequest::getInt('tsmart_category_id', false)) {
                 $app = JFactory::getApplication();
                 //$old_state = $app->getUserState('tsmart_category_id');
                 $old_state = $app->getUserState('tsmart_category_id');
                 if (empty($old_state) or $old_state != $cI) {
                     vRequest::setVar('com_tsmart.product.filter_order', 'pc.ordering');
                     $model->filter_order = 'pc.ordering';
                     $old_state = $app->setUserState('tsmart_category_id', $cI);
                 }
             }
             //Get the list of products
             $productlist = $model->getItemList();
             //The pagination must now always set AFTER the model load the listing
             $this->pagination = $model->getPagination();
             //Get the category tree
             $categoryId = $model->tsmart_category_id;
             //OSP switched to filter in model, was vRequest::getInt('tsmart_category_id');
             $category_tree = ShopFunctions::categoryListTree(array($categoryId));
             $this->assignRef('category_tree', $category_tree);
             //load service class
             //Load the product price
             if (!class_exists('calculationHelper')) {
                 require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
             }
             $vendor_model = tmsModel::getModel('vendor');
             $productreviews = tmsModel::getModel('ratings');
             $this->mfTable = $model->getTable('manufacturers');
             $this->catTable = $model->getTable('categories');
             $this->lists['vendors'] = '';
             if ($this->showVendors()) {
                 $this->lists['vendors'] = Shopfunctions::renderVendorList(vmAccess::getVendorId());
             }
             foreach ($productlist as $tsmart_product_id => $product) {
                 $product->mediaitems = count($product->tsmart_media_id);
                 $product->reviews = $productreviews->countReviewsForProduct($product->tsmart_product_id);
                 $vendor_model->setId($product->tsmart_vendor_id);
                 $vendor = $vendor_model->getVendor();
                 $currencyDisplay = CurrencyDisplay::getInstance($vendor->vendor_currency, $vendor->tsmart_vendor_id);
                 if (!empty($product->allPrices[$product->selectedPrice]['product_price']) && !empty($product->allPrices[$product->selectedPrice]['product_currency'])) {
                     $product->product_price_display = $currencyDisplay->priceDisplay($product->allPrices[$product->selectedPrice]['product_price'], (int) $product->allPrices[$product->selectedPrice]['product_currency'], 1, true);
                 } else {
                     if (!empty($product->allPrices) and count($product->allPrices) > 1) {
                         $product->product_price_display = tsmText::_('com_tsmart_MULTIPLE_PRICES');
                     } else {
                         $product->product_price_display = tsmText::_('com_tsmart_NO_PRICE_SET');
                     }
                 }
                 // Write the first 5 categories in the list
                 $product->categoriesList = '';
                 if (!empty($product->categories[0])) {
                     $product->categoriesList = shopfunctions::renderGuiList($product->categories, 'categories', 'category_name', 'category');
                 }
                 // Write the first 5 manufacturers in the list
                 $product->manuList = '';
                 if (!empty($product->tsmart_manufacturer_id[0])) {
                     $product->manuList = shopfunctions::renderGuiList($product->tsmart_manufacturer_id, 'manufacturers', 'mf_name', 'manufacturer');
                 }
             }
             $mf_model = tmsModel::getModel('manufacturer');
             $manufacturers = $mf_model->getManufacturerDropdown();
             $this->assignRef('manufacturers', $manufacturers);
             /* add Search filter in lists*/
             /* Search type */
             $options = array('' => tsmText::_('com_tsmart_LIST_EMPTY_OPTION'), 'parent' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_PARENT_PRODUCT'), 'product' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRODUCT'), 'price' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRICE'), 'withoutprice' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_WITHOUTPRICE'));
             $this->lists['search_type'] = VmHTML::selectList('search_type', vRequest::getVar('search_type'), $options);
             /* Search order */
             $options = array('bf' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_BEFORE'), 'af' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_AFTER'));
             $this->lists['search_order'] = VmHTML::selectList('search_order', vRequest::getVar('search_order'), $options);
             // Toolbar
             /*if (vmAccess::manager('product.edit')) {
                   JToolBarHelper::custom('massxref_cats', 'new', 'new', vmText::_('com_tsmart_PRODUCT_XREF_CAT'), true);
                   JToolBarHelper::custom('massxref_sgrps', 'new', 'new', vmText::_('com_tsmart_PRODUCT_XREF_SGRPS'), true);
               }
               if (vmAccess::manager('product.create')) {
                   JToolBarHelper::custom('createchild', 'new', 'new', vmText::_('com_tsmart_PRODUCT_CHILD'), true);
                   JToolBarHelper::custom('cloneproduct', 'copy', 'copy', vmText::_('com_tsmart_PRODUCT_CLONE'), true);
               }*/
             // JToolBarHelper::custom('addrating', 'default', '', vmText::_('com_tsmart_ADD_RATING'), true);
             $view = vRequest::getCmd('view', vRequest::getCmd('controller', 'tsmart'));
             JToolBarHelper::divider();
             if (vmAccess::manager($view . '.edit.state')) {
                 JToolBarHelper::publishList();
                 JToolBarHelper::unpublishList();
             }
             if (vmAccess::manager($view . '.delete')) {
                 JToolBarHelper::spacer('10');
                 JToolBarHelper::deleteList();
             }
             $this->assignRef('productlist', $productlist);
             $this->assignRef('tsmart_category_id', $categoryId);
             $this->assignRef('model', $model);
             break;
     }
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     // Get the task
     $task = JRequest::getWord('task', $this->getLayout());
     vmdebug('VirtuemartViewProduct ' . $task);
     $this->task = $task;
     // Load helpers
     $this->loadHelper('currencydisplay');
     $this->loadHelper('html');
     $this->loadHelper('image');
     $model = VmModel::getModel();
     // Handle any publish/unpublish
     switch ($task) {
         case 'add':
         case 'edit':
             VmConfig::loadJLang('com_virtuemart_orders', TRUE);
             VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
             $this->jsonPath = JFactory::getApplication()->isSite() ? juri::root() : '';
             $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->manufacturers = $manufacturers;
             // set category in front edit link
             if ($task == 'add') {
                 if ($category_id = jRequest::getInt('virtuemart_category_id', 0)) {
                     $product->categories = array($category_id);
                 }
             }
             // Get the category tree
             if (isset($product->categories)) {
                 $this->category_tree = ShopFunctions::categoryListTree($product->categories);
             } else {
                 $this->category_tree = ShopFunctions::categoryListTree();
             }
             //Get the shoppergoup list - Cleanshooter Custom Shopper Visibility
             if (isset($product->shoppergroups)) {
                 $this->shoppergroupList = ShopFunctions::renderShopperGroupList($product->shoppergroups);
             } else {
                 $this->shoppergroupList = '';
             }
             // Load the product price
             $this->loadHelper('calculationh');
             $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);
             JLoader::register('VirtueMartModelConfig', JPATH_VM_ADMINISTRATOR . '/models/config.php');
             $this->productLayouts = VirtueMartModelConfig::getLayoutList('productdetails', $product->layout);
             // 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->imagePath = $imagePath;
             // Load the vendors
             $vendor_model = VmModel::getModel('vendor');
             if (Vmconfig::get('multix', 'none') !== 'none') {
                 if ($task == 'add') {
                     $vendor_id = $this->adminVendor;
                 } else {
                     $vendor_id = $product->virtuemart_vendor_id;
                 }
                 $lists['vendors'] = Shopfunctions::renderVendorList($vendor_id);
             }
             // Load the currencies
             $currency_model = VmModel::getModel('currency');
             $this->loadHelper('permissions');
             $vendor_model->setId(Permissions::getInstance()->isSuperVendor());
             $vendor = $vendor_model->getVendor();
             if (empty($product->product_currency)) {
                 $product->product_currency = $vendor->vendor_currency;
             }
             //STUDIO42  fix for currency, old method set 2 time same currency symbol
             // TODO verify all others
             $currencyModel = VmModel::getModel('currency');
             $currencyModel->setId($vendor->vendor_currency);
             $currency = $currencyModel->getData();
             $this->vendor_currency = $currency->currency_symbol;
             $currencyModel->setId($product->product_currency);
             $currency = $currencyModel->getData();
             $this->product_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_iso_uom'] = ShopFunctions::renderUnitIsoList('product_unit', $task == 'add' ? VmConfig::get('weight_unit_default') : $product->product_unit);
             $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);
             }
             $productShoppers = $model->getProductShoppersByStatus($product->virtuemart_product_id, array('S'));
             $this->assignRef('productShoppers', $productShoppers);
             $orderstatusModel = VmModel::getModel('orderstatus');
             $lists['OrderStatus'] = $orderstatusModel->renderOSList(array(), 'order_status', TRUE);
             $field_model = VmModel::getModel('customfields');
             $fieldTypes = $field_model->getField_types();
             $this->assignRef('fieldTypes', $fieldTypes);
             /* Load product types lists */
             if ($customsList = $field_model->getCustomsList()) {
                 $emptyOption = JHTML::_('select.option', '', '- ' . JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION') . ' :', 'value', 'text');
                 array_unshift($customsList, $emptyOption);
                 $customlist = JHTML::_('select.genericlist', $customsList, 'customlist');
                 if ($task == "add") {
                     if ($customfieldsDefault = $this->getBLankCustomfields()) {
                         $product->customfields = $customfieldsDefault;
                         // var_dump( $customfieldsDefault);jexit();
                     }
                 }
             }
             $this->assignRef('customsList', $customlist);
             $ChildCustomRelation = $field_model->getProductChildCustomRelation();
             $this->assignRef('ChildCustomRelation', $ChildCustomRelation);
             if ($product->product_parent_id > 0) {
                 $parentRelation = $field_model->getProductParentRelation($product->virtuemart_product_id);
                 $this->assignRef('parentRelation', $parentRelation);
                 // Set up labels
                 $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');
             }
             $this->assignRef('product', $product);
             $product_empty_price = array('virtuemart_product_price_id' => 0, 'virtuemart_product_id' => $virtuemart_product_id, 'virtuemart_shoppergroup_id' => NULL, 'product_price' => NULL, 'override' => NULL, 'product_override_price' => NULL, 'product_tax_id' => NULL, 'product_discount_id' => NULL, 'product_currency' => $vendor->vendor_currency, 'product_price_publish_up' => NULL, 'product_price_publish_down' => NULL, 'price_quantity_start' => NULL, 'price_quantity_end' => NULL);
             $this->assignRef('product_empty_price', $product_empty_price);
             $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
             if ($product->product_sku) {
                 $sku = ' (' . $product->product_sku . ')';
             } else {
                 $sku = "";
             }
             if (!empty($product->canonCatLink)) {
                 $canonLink = '&virtuemart_category_id=' . $product->canonCatLink;
             } else {
                 $canonLink = '';
             }
             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 . $canonLink . '" 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;
         case 'massxref_cats':
         case 'massxref_cats_exe':
             //TODO test if path is ok addpath is now in the constructor
             $this->addTemplatePath(JPATH_VM_ADMINISTRATOR . '/views' . DS . 'category' . DS . 'tmpl');
             $this->SetViewTitle('PRODUCT_MASSXREF');
             // $this->setLayout('massxref');
             $this->loadHelper('permissions');
             $this->perms = Permissions::getInstance();
             $this->showVendors = $this->perms->check('admin');
             $keyWord = '';
             $catmodel = VmModel::getModel('category');
             $this->catmodel = $catmodel;
             //$this->addStandardDefaultViewCommands();
             $this->addStandardDefaultViewLists($catmodel, 'category_name');
             $this->categories = $catmodel->getCategoryTree(0, 0, false, $this->lists['search']);
             $this->pagination = $catmodel->getPagination();
             // restore icon is good but not the word
             JToolBarHelper::custom('display', 'restore', 'restore', JText::_('JTOOLBAR_BACK'), false);
             JToolBarHelper::custom('massxref_cats_exe', 'assign', 'assign', JText::_('COM_VIRTUEMART_MASS_REPLACE'), false);
             JToolBarHelper::custom('massxref_cats_add', 'new', 'new', JText::_('COM_VIRTUEMART_MASS_ADD'), true);
             break;
         case 'massxref_sgrps':
         case 'massxref_sgrps_exe':
             $this->SetViewTitle('PRODUCT_MASSXREF');
             //TODO test if path is ok addpath is now in the constructor
             $this->addTemplatePath(JPATH_VM_ADMINISTRATOR . '/views' . DS . 'shoppergroup' . DS . 'tmpl');
             $this->loadHelper('permissions');
             $this->perms = Permissions::getInstance();
             $this->showVendors = $this->perms->check('admin');
             $sgrpmodel = VmModel::getModel('shoppergroup');
             $this->addStandardDefaultViewLists($sgrpmodel);
             $this->shoppergroups = $sgrpmodel->getShopperGroups(false, true);
             $this->pagination = $sgrpmodel->getPagination();
             JToolBarHelper::custom('massxref_sgrps_exe', 'groups-add', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_SGRPS_EXE'), false);
             break;
         default:
             if ($product_parent_id = JRequest::getInt('product_parent_id', false)) {
                 $product_parent = $model->getProductSingle($product_parent_id, false);
                 if ($product_parent) {
                     $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('class' => 'hasTooltip', 'title' => JText::_('COM_VIRTUEMART_EDIT_PARENT') . ' ' . $product_parent->product_name));
                     $msg = JText::_('COM_VIRTUEMART_PRODUCT_OF') . " " . $link_to_parent;
                 } else {
                     $title = 'PRODUCT_CHILDREN_LIST';
                     $msg = 'Parent with product_parent_id ' . $product_parent_id . ' not found';
                 }
             } else {
                 $title = 'PRODUCT';
                 $msg = "";
             }
             $this->db = JFactory::getDBO();
             $this->loadHelper('permissions');
             $this->SetViewTitle($title, $msg);
             $this->addStandardDefaultViewLists($model, 'created_on', 'DESC', 'filter_product');
             $vendor_id = $this->adminVendor;
             if ($vendor_id == 1) {
                 $vendor_id = null;
             }
             // fix ???
             $catid = JRequest::getInt('uctlist = ', 0);
             /* Get the list of products */
             $productlist = $model->getProductListing(false, false, false, false, true, true, $catid, $vendor_id);
             //The pagination must now always set AFTER the model load the listing
             $this->pagination = $model->getPagination();
             /* Get the category tree */
             $categoryId = $model->virtuemart_category_id;
             //OSP switched to filter in model, was JRequest::getInt('virtuemart_category_id');
             $this->category_tree = ShopFunctions::categoryListTree(array($categoryId));
             /* Load the product price */
             $this->loadHelper('calculationh');
             $vendor_model = VmModel::getModel('vendor');
             $productreviews = VmModel::getModel('ratings');
             foreach ($productlist as $virtuemart_product_id => $product) {
                 if (isset($product->virtuemart_media_id)) {
                     $product->mediaitems = count($product->virtuemart_media_id);
                 } else {
                     $product->mediaitems = 'none';
                 }
                 $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');
             $this->manufacturers = $mf_model->getManufacturerDropdown();
             /* 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, 1, '', 'onchange="Joomla.ajaxSearch(this); return false;"', 'input-medium');
             /* 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, 1, '', '', 'input-small');
             // Toolbar
             //JToolBarHelper::save('sentproductemailtoshoppers', JText::_('COM_VIRTUEMART_PRODUCT_EMAILTOSHOPPERS'));
             JToolBarHelper::custom('massxref_cats', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_CAT'), true);
             JToolBarHelper::custom('massxref_sgrps', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_SGRPS'), true);
             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', 'star-2', '', JText::_('COM_VIRTUEMART_ADD_RATING'), true);
             $this->addStandardDefaultViewCommands();
             $this->productlist = $productlist;
             $this->virtuemart_category_id = $categoryId;
             $this->model = $model;
             break;
     }
     parent::display($tpl);
 }
Example #12
0
 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);
 }
Example #13
0
 function display($tpl = null)
 {
     // Load the helper(s)
     $this->addHelperPath(JPATH_VM_ADMINISTRATOR . DS . 'helpers');
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     if (!class_exists('vmPlugin')) {
         require JPATH_VM_PLUGINS . DS . 'vmplugin.php';
     }
     if (!class_exists('vmPSPlugin')) {
         require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
     }
     $perms = Permissions::getInstance();
     $this->assignRef('perms', $perms);
     $model = VmModel::getModel('paymentmethod');
     //@todo should be depended by loggedVendor
     //		$vendorId=1;
     //		$this->assignRef('vendorId', $vendorId);
     // TODO logo
     $this->SetViewTitle();
     $layoutName = JRequest::getWord('layout', 'default');
     $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') {
         // Load the helper(s)
         if (!class_exists('VmImage')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
         }
         if (!class_exists('vmParameters')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'parameterparser.php';
         }
         $payment = $model->getPayment();
         $this->assignRef('payment', $payment);
         $rInsPayPlug = self::renderInstalledPaymentPlugins($payment->payment_jplugin_id);
         $this->assignRef('vmPPaymentList', $rInsPayPlug);
         $rShGrpList = ShopFunctions::renderShopperGroupList($payment->virtuemart_shoppergroup_ids, true);
         $this->assignRef('shopperGroupList', $rShGrpList);
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $vendorList = ShopFunctions::renderVendorList($payment->virtuemart_vendor_id);
             $this->assignRef('vendorList', $vendorList);
         }
         $this->addStandardEditViewCommands($payment->virtuemart_paymentmethod_id);
     } else {
         JToolBarHelper::custom('clonepayment', 'copy', 'copy', JText::_('COM_VIRTUEMART_PAYMENT_CLONE'), true);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $payments = $model->getPayments();
         $this->assignRef('payments', $payments);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
    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;
    }
    if (!isset($this->product->allPrices[$k]['product_tax_id'])) {
        $this->product->allPrices[$k]['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]['tsmart_shoppergroup_id'], false, 'mprices[tsmart_shoppergroup_id][' . $this->priceCounter . ']');
    if ($this->priceCounter == $nbPrice) {
        $tmpl = "productPriceRowTmpl";
        $this->product->allPrices[$k]['tsmart_product_price_id'] = '';
    } else {
        $tmpl = "productPriceRowTmpl_" . $this->priceCounter;
    }
    ?>
            <tr id="<?php 
    echo $tmpl;
    ?>
" class="removable row<?php 
    echo $rowColor;
    ?>
">
                <td width="100%">
Example #15
0
 function shopper($userFields)
 {
     // Shopper info
     if (!class_exists('VirtueMartModelShopperGroup')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'shoppergroup.php';
     }
     $_shoppergroup = VirtueMartModelShopperGroup::getShoppergroupById($this->_model->getId());
     $user = JFactory::getUser();
     if ($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart')) {
         $shoppergrps = array();
         foreach ($_shoppergroup as $group) {
             $shoppergrps[] = $group['virtuemart_shoppergroup_id'];
         }
         $this->_lists['shoppergroups'] = ShopFunctions::renderShopperGroupList($shoppergrps);
         $this->_lists['vendors'] = ShopFunctions::renderVendorList($this->userDetails->virtuemart_vendor_id);
     } else {
         $this->_lists['shoppergroups'] = '';
         foreach ($_shoppergroup as $group) {
             $this->_lists['shoppergroups'] .= $group['shopper_group_name'] . ', ';
         }
         $this->_lists['shoppergroups'] = substr($this->_lists['shoppergroups'], 0, -2);
         if (!empty($this->userDetails->virtuemart_vendor_id)) {
             $this->_lists['vendors'] = $this->userDetails->virtuemart_vendor_id;
         }
         if (empty($this->_lists['vendors'])) {
             $this->_lists['vendors'] = vmText::_('COM_VIRTUEMART_USER_NOT_A_VENDOR');
             // . $_setVendor;
         }
     }
     //todo here is something broken we use $userDetailsList->perms and $this->userDetailsList->perms and perms seems not longer to exist
     //todo we should list here the joomla ACL groups
     // Load the required scripts
     if (count($userFields['scripts']) > 0) {
         foreach ($userFields['scripts'] as $_script => $_path) {
             JHtml::script($_script, $_path);
         }
     }
     // Load the required styresheets
     if (count($userFields['links']) > 0) {
         foreach ($userFields['links'] as $_link => $_path) {
             JHtml::stylesheet($_link, $_path);
         }
     }
 }
Example #16
0
 function shopper($userFields)
 {
     // Shopper info
     if (!class_exists('VirtueMartModelShopperGroup')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'shoppergroup.php';
     }
     $_shoppergroup = VirtueMartModelShopperGroup::getShoppergroupById($this->_model->getId());
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     if (Permissions::getInstance()->check('admin,storeadmin')) {
         $shoppergrps = array();
         foreach ($_shoppergroup as $group) {
             $shoppergrps[] = $group['virtuemart_shoppergroup_id'];
         }
         $this->_lists['shoppergroups'] = ShopFunctions::renderShopperGroupList($shoppergrps);
         $this->_lists['vendors'] = ShopFunctions::renderVendorList($this->_userDetails->virtuemart_vendor_id);
     } else {
         $this->_lists['shoppergroups'] = '';
         foreach ($_shoppergroup as $group) {
             $this->_lists['shoppergroups'] .= $group['shopper_group_name'] . ', ';
         }
         $this->_lists['shoppergroups'] = substr($this->_lists['shoppergroups'], 0, -2);
         if (!empty($this->_userDetails->virtuemart_vendor_id)) {
             $this->_lists['vendors'] = $this->_userDetails->virtuemart_vendor_id;
         }
         if (empty($this->_lists['vendors'])) {
             $this->_lists['vendors'] = JText::_('COM_VIRTUEMART_USER_NOT_A_VENDOR');
             // . $_setVendor;
         }
     }
     //todo here is something broken we use $_userDetailsList->perms and $this->_userDetailsList->perms and perms seems not longer to exist
     if (Permissions::getInstance()->check("admin,storeadmin")) {
         $this->_lists['perms'] = JHTML::_('select.genericlist', Permissions::getUserGroups(), 'perms', '', 'group_name', 'group_name', $this->_userDetails->perms);
     } else {
         if (!empty($this->_userDetails->perms)) {
             $this->_lists['perms'] = $this->_userDetails->perms;
             $_hiddenInfo = '<input type="hidden" name="perms" value = "' . $this->_lists['perms'] . '" />';
             $this->_lists['perms'] .= $_hiddenInfo;
         }
     }
     // Load the required scripts
     if (count($userFields['scripts']) > 0) {
         foreach ($userFields['scripts'] as $_script => $_path) {
             JHTML::script($_script, $_path);
         }
     }
     // Load the required styresheets
     if (count($userFields['links']) > 0) {
         foreach ($userFields['links'] as $_link => $_path) {
             JHTML::stylesheet($_link, $_path);
         }
     }
 }
Example #17
0
 function shopper($userFields)
 {
     // Shopper info
     if (!class_exists('VirtueMartModelShopperGroup')) {
         require VMPATH_ADMIN . DS . 'models' . DS . 'shoppergroup.php';
     }
     $_shoppergroup = VirtueMartModelShopperGroup::getShoppergroupById($this->_model->getId());
     $this->_lists['shoppergroups'] = '';
     if (vmAccess::manager('user.edit')) {
         $shoppergrps = array();
         foreach ($_shoppergroup as $group) {
             $shoppergrps[] = $group['virtuemart_shoppergroup_id'];
         }
         if (!class_exists('ShopFunctions')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php';
         }
         $this->_lists['shoppergroups'] = ShopFunctions::renderShopperGroupList($shoppergrps);
     } else {
         foreach ($_shoppergroup as $group) {
             $this->_lists['shoppergroups'] .= tsmText::_($group['shopper_group_name']) . ', ';
         }
         $this->_lists['shoppergroups'] = substr($this->_lists['shoppergroups'], 0, -2);
     }
     if (!empty($this->userDetails->virtuemart_vendor_id)) {
         if (!class_exists('ShopFunctions')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php';
         }
         $this->_lists['vendors'] = ShopFunctions::renderVendorList($this->userDetails->virtuemart_vendor_id);
     } else {
         $this->_lists['vendors'] = tsmText::_('COM_VIRTUEMART_USER_NOT_A_VENDOR');
     }
     //todo here is something broken we use $userDetailsList->perms and $this->userDetailsList->perms and perms seems not longer to exist
     //todo we should list here the joomla ACL groups
     // Load the required scripts
     if (count($userFields['scripts']) > 0) {
         foreach ($userFields['scripts'] as $_script => $_path) {
             JHtml::script($_script, $_path);
         }
     }
     // Load the required styresheets
     if (count($userFields['links']) > 0) {
         foreach ($userFields['links'] as $_link => $_path) {
             JHtml::stylesheet($_link, $_path);
         }
     }
 }
Example #18
0
 function shopper($userFields)
 {
     // Shopper info
     if (!class_exists('VirtueMartModelShopperGroup')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'shoppergroup.php';
     }
     $_shoppergroup = VirtueMartModelShopperGroup::getShoppergroupById($this->_model->getId());
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     if (Permissions::getInstance()->check('admin,storeadmin')) {
         $shoppergrps = array();
         foreach ($_shoppergroup as $group) {
             $shoppergrps[] = $group['virtuemart_shoppergroup_id'];
         }
         $this->_lists['shoppergroups'] = ShopFunctions::renderShopperGroupList($shoppergrps);
         $this->_lists['vendors'] = ShopFunctions::renderVendorList($this->_userDetails->virtuemart_vendor_id);
     } else {
         $this->_lists['shoppergroups'] = '';
         foreach ($_shoppergroup as $group) {
             $this->_lists['shoppergroups'] .= $group['shopper_group_name'] . ', ';
         }
         $this->_lists['shoppergroups'] = substr($this->_lists['shoppergroups'], 0, -2);
         if (!empty($this->_userDetails->virtuemart_vendor_id)) {
             $this->_lists['vendors'] = $this->_userDetails->virtuemart_vendor_id;
         }
         if (empty($this->_lists['vendors'])) {
             $this->_lists['vendors'] = JText::_('COM_VIRTUEMART_USER_NOT_A_VENDOR');
             // . $_setVendor;
         }
     }
     // Load the required scripts
     if (count($userFields['scripts']) > 0) {
         foreach ($userFields['scripts'] as $_script => $_path) {
             JHTML::script($_script, $_path);
         }
     }
     // Load the required styresheets
     if (count($userFields['links']) > 0) {
         foreach ($userFields['links'] as $_link => $_path) {
             JHTML::stylesheet($_link, $_path);
         }
     }
 }
Example #19
0
 function display($tpl = null)
 {
     // Load the helper(s)
     $this->loadHelper('html');
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     $perm = Permissions::getInstance();
     $this->assignRef('perm', $perm);
     $model = VmModel::getModel();
     $currentUser = JFactory::getUser();
     $task = JRequest::getWord('task', 'edit');
     if ($task == 'editshop') {
         if (Vmconfig::get('multix', 'none') !== 'none') {
             //Maybe we must check here if the user is vendor and if he has an own id and else map to mainvendor.
             $userId = 0;
         } else {
             if (!class_exists('VirtueMartModelVendor')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php';
             }
             $userId = VirtueMartModelVendor::getUserIdByVendorId(1);
         }
         $this->SetViewTitle('STORE');
     } else {
         if ($task == 'add') {
             $userId = 0;
         } else {
             $userId = JRequest::getVar('virtuemart_user_id', 0);
             if (is_array($userId)) {
                 $userId = $userId[0];
             }
             $this->SetViewTitle('USER');
         }
     }
     $userId = $model->setId($userId);
     $layoutName = JRequest::getWord('layout', 'default');
     $layoutName = $this->getLayout();
     if ($layoutName == 'edit' || $layoutName == 'edit_shipto') {
         $editor = JFactory::getEditor();
         // Get the required helpers
         $this->loadHelper('shoppergroup');
         $this->loadHelper('image');
         //$userFieldsModel = VmModel::getModel('userfields');
         $userDetails = $model->getUser();
         if ($task == 'editshop' && $userDetails->user_is_vendor) {
             // 				$model->setCurrent();
             if (!empty($userDetails->vendor->vendor_store_name)) {
                 $this->SetViewTitle('STORE', $userDetails->vendor->vendor_store_name);
             } else {
                 $this->SetViewTitle('STORE', JText::_('COM_VIRTUEMART_NEW_VENDOR'));
             }
             $vendorid = $userDetails->virtuemart_vendor_id;
         } else {
             $vendorid = 0;
             $this->SetViewTitle('USER', $userDetails->JUser->get('name'));
         }
         $_new = $userDetails->JUser->get('id') < 1;
         $this->addStandardEditViewCommands($vendorid);
         // User details
         $_contactDetails = $model->getContactDetails();
         $_groupList = $model->getGroupList();
         if (!is_array($_groupList)) {
             $this->lists['gid'] = '<input type="hidden" name="gid" value="' . $userDetails->JUser->get('gid') . '" /><strong>' . JText::_($_groupList) . '</strong>';
         } else {
             $this->lists['gid'] = JHTML::_('select.genericlist', $_groupList, 'gid', 'size="10"', 'value', 'text', $userDetails->JUser->get('gid'));
         }
         $this->lists['canBlock'] = $currentUser->authorize('com_users', 'block user') && $userDetails->JUser->get('id') != $currentUser->get('id');
         // Can't block myself
         $this->lists['canSetMailopt'] = $currentUser->authorize('workflow', 'email_events');
         $this->lists['block'] = JHTML::_('select.booleanlist', 'block', 'class="inputbox"', $userDetails->JUser->get('block'), 'COM_VIRTUEMART_YES', 'COM_VIRTUEMART_NO');
         $this->lists['sendEmail'] = JHTML::_('select.booleanlist', 'sendEmail', 'class="inputbox"', $userDetails->JUser->get('sendEmail'), 'COM_VIRTUEMART_YES', 'COM_VIRTUEMART_NO');
         $this->lists['params'] = $userDetails->JUser->getParameters(true);
         // Shopper info
         $this->lists['shoppergroups'] = ShopFunctions::renderShopperGroupList($userDetails->shopper_groups, true);
         $this->lists['vendors'] = ShopFunctions::renderVendorList($userDetails->virtuemart_vendor_id);
         $this->lists['custnumber'] = $model->getCustomerNumberById($userDetails->JUser->get('id'));
         // Shipment address(es)
         $this->lists['shipTo'] = ShopFunctions::generateStAddressList($this, $model, 'addST');
         $new = false;
         if (JRequest::getInt('new', '0') === 1) {
             $new = true;
         }
         $virtuemart_userinfo_id_BT = $model->getBTuserinfo_id($userId);
         $userFieldsArray = $model->getUserInfoInUserFields($layoutName, 'BT', $virtuemart_userinfo_id_BT, false);
         $userFieldsBT = $userFieldsArray[$virtuemart_userinfo_id_BT];
         //$this->lists['perms'] = JHTML::_('select.genericlist', Permissions::getUserGroups(), 'perms', '', 'group_name', 'group_name', $userDetails->perms);
         // Load the required scripts
         if (count($userFieldsBT['scripts']) > 0) {
             foreach ($userFieldsBT['scripts'] as $_script => $_path) {
                 JHTML::script($_script, $_path);
             }
         }
         // Load the required stylesheets
         if (count($userFieldsBT['links']) > 0) {
             foreach ($userFieldsBT['links'] as $_link => $_path) {
                 JHTML::stylesheet($_link, $_path);
             }
         }
         $this->assignRef('userFieldsBT', $userFieldsBT);
         $this->assignRef('userInfoID', $virtuemart_userinfo_id_BT);
         $virtuemart_userinfo_id = JRequest::getString('virtuemart_userinfo_id', '0', '');
         $userFieldsArray = $model->getUserInfoInUserFields($layoutName, 'ST', $virtuemart_userinfo_id, false);
         if ($new) {
             $virtuemart_userinfo_id = 0;
             // 				$userFieldsST = $userFieldsArray[$virtuemart_userinfo_id];
         } else {
             // 				$userFieldsST = $userFieldsArray[$virtuemart_userinfo_id];
             // 				if(empty($virtuemart_userinfo_id)){
             // 					$virtuemart_userinfo_id = $model->getBTuserinfo_id();
             // 				}
         }
         $userFieldsST = $userFieldsArray[$virtuemart_userinfo_id];
         $this->assignRef('shipToFields', $userFieldsST);
         $this->assignRef('shipToId', $virtuemart_userinfo_id);
         $this->assignRef('new', $new);
         if (!$_new) {
             // Check for existing orders for this user
             $orders = VmModel::getModel('orders');
             $orderList = $orders->getOrdersList($userDetails->JUser->get('id'), true);
         } else {
             $orderList = null;
         }
         if (count($orderList) > 0 || !empty($userDetails->user_is_vendor)) {
             if (!class_exists('CurrencyDisplay')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
             }
             $currency = CurrencyDisplay::getInstance();
             $this->assignRef('currency', $currency);
         }
         // 			vmdebug('user $userDetails ',	$userDetails 	);
         if (!empty($userDetails->user_is_vendor)) {
             $vendorModel = VmModel::getModel('vendor');
             $vendorModel->setId($userDetails->virtuemart_vendor_id);
             $vendorModel->addImages($userDetails->vendor);
             $this->assignRef('vendor', $userDetails->vendor);
             $currencyModel = VmModel::getModel('currency');
             $_currencies = $currencyModel->getCurrencies();
             $this->assignRef('currencies', $_currencies);
         }
         $this->assignRef('userDetails', $userDetails);
         $this->assignRef('orderlist', $orderList);
         $this->assignRef('contactDetails', $_contactDetails);
         $this->assignRef('editor', $editor);
     } else {
         JToolBarHelper::divider();
         JToolBarHelper::custom('toggle.user_is_vendor.1', 'publish', '', 'COM_VIRTUEMART_USER_ISVENDOR');
         JToolBarHelper::custom('toggle.user_is_vendor.0', 'unpublish', '', 'COM_VIRTUEMART_USER_ISNOTVENDOR');
         JToolBarHelper::divider();
         JToolBarHelper::deleteList();
         JToolBarHelper::editListX();
         //This is intentionally, creating new user via BE is buggy and can be done by joomla
         //JToolBarHelper::addNewX();
         $this->addStandardDefaultViewLists($model, 'ju.id');
         $userList = $model->getUserList();
         $this->assignRef('userList', $userList);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
         $shoppergroupmodel = VmModel::getModel('shopperGroup');
         $defaultShopperGroup = $shoppergroupmodel->getDefault(0)->shopper_group_name;
         $this->assignRef('defaultShopperGroup', $defaultShopperGroup);
     }
     parent::display($tpl);
 }
Example #20
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);
 }
Example #21
0
 function display($tpl = null)
 {
     // Get the task
     $task = JRequest::getWord('task', $this->getLayout());
     $this->assignRef('task', $task);
     // 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('VmImage')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
     }
     $model = VmModel::getModel();
     // Handle any publish/unpublish
     switch ($task) {
         case 'add':
         case 'edit':
             //this was in the controller for the edit tasks, we need this for the access by FE
             $this->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'product' . DS . 'tmpl');
             VmConfig::loadJLang('com_virtuemart_orders', TRUE);
             VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
             $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);
             $product_parent = false;
             if (!empty($product->product_parent_id)) {
                 $product_parent = $model->getProductSingle($product->product_parent_id, false);
             }
             $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);
             //Fallback for categories inherited by parent to correctly calculate the prices
             if (empty($product->categories) and !empty($product_parent->categories)) {
                 $product->categories = $product_parent->categories;
             }
             //Get the shoppergoup list - Cleanshooter Custom Shopper Visibility
             if (isset($product->shoppergroups)) {
                 $shoppergroupList = ShopFunctions::renderShopperGroupList($product->shoppergroups);
             }
             $this->assignRef('shoppergroupList', $shoppergroupList);
             // Load the product price
             if (!class_exists('calculationHelper')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
             }
             $product_childIds = $model->getProductChildIds($virtuemart_product_id);
             $product_childs = array();
             $childs = 0;
             $maxChilds = 30;
             foreach ($product_childIds as $id) {
                 if ($childs++ > $maxChilds) {
                     break;
                 }
                 $product_childs[] = $model->getProductSingle($id, false);
             }
             $this->assignRef('product_childs', $product_childs);
             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 (!class_exists('shopFunctionsF')) {
                 require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
             }
             $vmtemplate = shopFunctionsF::loadVmTemplateStyle();
             if (is_Dir(JPATH_ROOT . DS . 'templates' . DS . $vmtemplate . DS . 'images' . DS . 'availability' . DS)) {
                 $imagePath = '/templates/' . $vmtemplate . '/images/availability/';
             } else {
                 $imagePath = '/components/com_virtuemart/assets/images/availability/';
             }
             $this->assignRef('imagePath', $imagePath);
             // Load the vendors
             $vendor_model = VmModel::getModel('vendor');
             if (Vmconfig::get('multix', 'none') !== 'none') {
                 $lists['vendors'] = Shopfunctions::renderVendorList($product->virtuemart_vendor_id);
             }
             // Load the currencies
             $currency_model = VmModel::getModel('currency');
             if (!class_exists('Permissions')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
             }
             $vendor_model->setId(Permissions::getInstance()->isSuperVendor());
             $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);
             }
             if (!empty($product->product_weight_uom)) {
                 $product_weight_uom = $product->product_weight_uom;
             } else {
                 if (!empty($product_parent)) {
                     $product_weight_uom = $product_parent->product_weight_uom;
                 } else {
                     $product_weight_uom = VmConfig::get('weight_unit_default');
                 }
             }
             if (!empty($product->product_lwh_uom)) {
                 $product_lwh_uom = $product->product_lwh_uom;
             } else {
                 if (!empty($product_parent)) {
                     $product_lwh_uom = $product_parent->product_lwh_uom;
                 } else {
                     $product_lwh_uom = VmConfig::get('lwh_unit_default');
                 }
             }
             if (!empty($product->product_unit)) {
                 $product_unit = $product->product_unit;
             } else {
                 if (!empty($product_parent)) {
                     $product_unit = $product_parent->product_unit;
                 } else {
                     $product_unit = VmConfig::get('product_unit_default', 'KG');
                 }
             }
             $lists['product_weight_uom'] = ShopFunctions::renderWeightUnitList('product_weight_uom', $product_weight_uom);
             $lists['product_iso_uom'] = ShopFunctions::renderUnitIsoList('product_unit', $product_unit);
             $lists['product_lwh_uom'] = ShopFunctions::renderLWHUnitList('product_lwh_uom', $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);
             }
             $productShoppers = $model->getProductShoppersByStatus($product->virtuemart_product_id, array('S'));
             $this->assignRef('productShoppers', $productShoppers);
             $orderstatusModel = VmModel::getModel('orderstatus');
             $lists['OrderStatus'] = $orderstatusModel->renderOSList(array(), 'order_status', TRUE);
             $field_model = VmModel::getModel('customfields');
             $fieldTypes = $field_model->getField_types();
             $this->assignRef('fieldTypes', $fieldTypes);
             // Add the virtuemart_shoppergroup_ids
             $cid = JFactory::getUser()->id;
             $this->activeShoppergroups = shopfunctions::renderGuiList('virtuemart_shoppergroup_id', '#__virtuemart_vmuser_shoppergroups', 'virtuemart_user_id', $cid, 'shopper_group_name', '#__virtuemart_shoppergroups', 'virtuemart_shoppergroup_id', 'category', 4, 0);
             if (!$this->activeShoppergroups or is_array($this->activeShoppergroups) and count($this->activeShoppergroups) == 0) {
                 //vmdebug('$this->activeShoppergroups',$this->activeShoppergroups);
                 $shoppergroupModel = VmModel::getModel('shoppergroup');
                 $this->activeShoppergroups = vmText::_($shoppergroupModel->getDefault(0)->shopper_group_name);
             }
             /* Load protocustom lists */
             $customsList = $field_model->getCustomsList();
             $attribs = 'style= "width: 300px;"';
             $customlist = JHTML::_('select.genericlist', $customsList, 'customlist', $attribs);
             $this->assignRef('customsList', $customlist);
             $ChildCustomRelation = $field_model->getProductChildCustomRelation();
             $this->assignRef('ChildCustomRelation', $ChildCustomRelation);
             if ($product->product_parent_id > 0) {
                 $parentRelation = $field_model->getProductParentRelation($product->virtuemart_product_id);
                 $this->assignRef('parentRelation', $parentRelation);
                 // Set up labels
                 $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');
             }
             $this->assignRef('product', $product);
             $product_empty_price = array('virtuemart_product_price_id' => 0, 'virtuemart_product_id' => $virtuemart_product_id, 'virtuemart_shoppergroup_id' => NULL, 'product_price' => NULL, 'override' => NULL, 'product_override_price' => NULL, 'product_tax_id' => NULL, 'product_discount_id' => NULL, 'product_currency' => $vendor->vendor_currency, 'product_price_publish_up' => NULL, 'product_price_publish_down' => NULL, 'price_quantity_start' => NULL, 'price_quantity_end' => NULL);
             $this->assignRef('product_empty_price', $product_empty_price);
             $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
             if ($product->product_sku) {
                 $sku = ' (' . $product->product_sku . ')';
             } else {
                 $sku = "";
             }
             if (!empty($product->canonCatLink)) {
                 $canonLink = '&virtuemart_category_id=' . $product->canonCatLink;
             } else {
                 $canonLink = '';
             }
             if (!empty($product->virtuemart_product_id)) {
                 if (!class_exists('shopFunctionsF')) {
                     require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
                 }
                 $menuItemID = shopFunctionsF::getMenuItemId(JFactory::getLanguage()->getTag());
                 $text = '<a href="' . juri::root() . 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . $canonLink . '&Itemid=' . $menuItemID . '" target="_blank" >' . $product->product_name . $sku . '<span class="vm2-modallink"></span></a>';
             } else {
                 $text = $product->product_name . $sku;
             }
             $this->SetViewTitle('PRODUCT', $text);
             $this->addStandardEditViewCommands($product->virtuemart_product_id);
             break;
         case 'massxref_cats':
         case 'massxref_cats_exe':
             $this->SetViewTitle('PRODUCT_MASSXREF');
             if (!class_exists('Permissions')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
             }
             $showVendors = Permissions::getInstance()->check('admin');
             $this->assignRef('showVendors', $showVendors);
             $keyWord = '';
             $catmodel = VmModel::getModel('category');
             $this->assignRef('catmodel', $catmodel);
             //$this->addStandardDefaultViewCommands();
             $this->addStandardDefaultViewLists($catmodel, 'category_name');
             $categories = $catmodel->getCategoryTree(0, 0, false, $this->lists['search']);
             $this->assignRef('categories', $categories);
             $catpagination = $catmodel->getPagination();
             $this->assignRef('catpagination', $catpagination);
             //$this->addStandardDefaultViewCommands();
             $this->setLayout('massxref');
             JToolBarHelper::custom('massxref_cats_exe', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_CAT_EXE'), false);
             break;
         case 'massxref_sgrps':
         case 'massxref_sgrps_exe':
             $sgrpmodel = VmModel::getModel('shoppergroup');
             $this->addStandardDefaultViewLists($sgrpmodel);
             $shoppergroups = $sgrpmodel->getShopperGroups(false, true);
             $this->assignRef('shoppergroups', $shoppergroups);
             $sgrppagination = $sgrpmodel->getPagination();
             $this->assignRef('sgrppagination', $sgrppagination);
             $this->setLayout('massxref');
             JToolBarHelper::custom('massxref_sgrps_exe', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_SGRPS_EXE'), false);
             break;
         default:
             if ($product_parent_id = JRequest::getInt('product_parent_id', false)) {
                 $product_parent = $model->getProductSingle($product_parent_id, false);
                 if ($product_parent) {
                     $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_CHILDREN_LIST';
                     $msg = 'Parent with product_parent_id ' . $product_parent_id . ' not found';
                 }
             } 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);
             /* Load the product price */
             if (!class_exists('calculationHelper')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
             }
             $vendor_model = VmModel::getModel('vendor');
             $productreviews = VmModel::getModel('ratings');
             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::custom('massxref_cats', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_CAT'), true);
             JToolBarHelper::custom('massxref_sgrps', 'new', 'new', JText::_('COM_VIRTUEMART_PRODUCT_XREF_SGRPS'), true);
             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);
 }
Example #22
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel();
     $currentUser = JFactory::getUser();
     VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
     $task = vRequest::getCmd('task', 'edit');
     if ($task == 'editshop') {
         $isSuperOrVendor = VmConfig::isSuperVendor();
         if (empty($isSuperOrVendor)) {
             JFactory::getApplication()->redirect('index.php?option=com_virtuemart', vmText::_('JERROR_ALERTNOAUTHOR'), 'error');
         } else {
             if (!class_exists('VirtueMartModelVendor')) {
                 require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
             }
             $userId = VirtueMartModelVendor::getUserIdByVendorId($isSuperOrVendor);
         }
         $this->SetViewTitle('STORE');
     } else {
         if ($task == 'add') {
             $userId = 0;
         } else {
             $userId = vRequest::getVar('virtuemart_user_id', 0);
             if (is_array($userId)) {
                 $userId = $userId[0];
             }
             $this->SetViewTitle('USER');
         }
     }
     $userId = $model->setId($userId);
     //$layoutName = vRequest::getCmd('layout', 'default');
     $layoutName = $this->getLayout();
     if ($layoutName == 'edit' || $layoutName == 'edit_shipto') {
         $editor = JFactory::getEditor();
         if (!class_exists('VmImage')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
         }
         $userDetails = $model->getUser();
         if ($task == 'editshop' && $userDetails->user_is_vendor) {
             // 				$model->setCurrent();
             if (!empty($userDetails->vendor->vendor_store_name)) {
                 $this->SetViewTitle('STORE', $userDetails->vendor->vendor_store_name, 'shop_mart');
             } else {
                 $this->SetViewTitle('STORE', vmText::_('COM_VIRTUEMART_NEW_VENDOR'), 'shop_mart');
             }
             $vendorid = $userDetails->virtuemart_vendor_id;
             if ($vendorid == 1) {
                 $this->checkTCPDFinstalled();
             }
         } else {
             $vendorid = 0;
             $this->SetViewTitle('USER', $userDetails->JUser->get('name'));
         }
         $_new = $userDetails->JUser->get('id') < 1;
         $this->addStandardEditViewCommands($vendorid);
         // User details
         $_contactDetails = $model->getContactDetails();
         $this->lists['canBlock'] = $currentUser->authorise('com_users', 'block user') && $userDetails->JUser->get('id') != $currentUser->get('id');
         // Can't block myself
         $this->lists['canSetMailopt'] = $currentUser->authorise('workflow', 'email_events');
         $this->lists['block'] = JHtml::_('select.booleanlist', 'block', 'class="inputbox"', $userDetails->JUser->get('block'), 'COM_VIRTUEMART_YES', 'COM_VIRTUEMART_NO');
         $this->lists['sendEmail'] = JHtml::_('select.booleanlist', 'sendEmail', 'class="inputbox"', $userDetails->JUser->get('sendEmail'), 'COM_VIRTUEMART_YES', 'COM_VIRTUEMART_NO');
         $this->lists['params'] = $userDetails->JUser->getParameters(true);
         // Shopper info
         $this->lists['shoppergroups'] = ShopFunctions::renderShopperGroupList($userDetails->shopper_groups, true, 'virtuemart_shoppergroup_id');
         $this->lists['vendors'] = ShopFunctions::renderVendorList($userDetails->virtuemart_vendor_id);
         $model->setId($userDetails->JUser->get('id'));
         $this->lists['custnumber'] = $model->getCustomerNumberById();
         // Shipment address(es)
         $this->lists['shipTo'] = ShopFunctions::generateStAddressList($this, $model, 'addST');
         $new = false;
         if (vRequest::getInt('new', '0') === 1) {
             $new = true;
         }
         $virtuemart_userinfo_id_BT = $model->getBTuserinfo_id($userId);
         $userFieldsArray = $model->getUserInfoInUserFields($layoutName, 'BT', $virtuemart_userinfo_id_BT, false);
         $userFieldsBT = $userFieldsArray[$virtuemart_userinfo_id_BT];
         // Load the required scripts
         if (count($userFieldsBT['scripts']) > 0) {
             foreach ($userFieldsBT['scripts'] as $_script => $_path) {
                 JHtml::script($_script, $_path);
             }
         }
         // Load the required stylesheets
         if (count($userFieldsBT['links']) > 0) {
             foreach ($userFieldsBT['links'] as $_link => $_path) {
                 JHtml::stylesheet($_link, $_path);
             }
         }
         $this->assignRef('userFieldsBT', $userFieldsBT);
         $this->assignRef('userInfoID', $virtuemart_userinfo_id_BT);
         $addrtype = vRequest::getCmd('addrtype');
         $virtuemart_userinfo_id = 0;
         if ($layoutName == 'edit_shipto' or $task == 'addST' or $addrtype == 'ST') {
             $virtuemart_userinfo_id = vRequest::getString('virtuemart_userinfo_id', '0', '');
             $userFieldsArray = $model->getUserInfoInUserFields($layoutName, 'ST', $virtuemart_userinfo_id, false);
             if ($new) {
                 $virtuemart_userinfo_id = 0;
             } else {
             }
             $userFieldsST = $userFieldsArray[$virtuemart_userinfo_id];
             $this->assignRef('shipToFields', $userFieldsST);
             vmdebug('hm ST $virtuemart_userinfo_id', $virtuemart_userinfo_id);
         }
         $this->assignRef('shipToId', $virtuemart_userinfo_id);
         $this->assignRef('new', $new);
         if (!$_new) {
             // Check for existing orders for this user
             $orders = VmModel::getModel('orders');
             $orderList = $orders->getOrdersList($userDetails->JUser->get('id'), true);
         } else {
             $orderList = null;
         }
         if (count($orderList) > 0 || !empty($userDetails->user_is_vendor)) {
             if (!class_exists('CurrencyDisplay')) {
                 require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
             }
             $currency = CurrencyDisplay::getInstance();
             $this->assignRef('currency', $currency);
         }
         if (!empty($userDetails->user_is_vendor)) {
             $vendorM = VmModel::getModel('vendor');
             //if(empty($userDetails->vendor->vendor_currency)){
             $vendorCurrency = $vendorM->getVendorCurrency(1);
             if ($vendorCurrency) {
                 $userDetails->vendor->vendor_currency = $vendorCurrency->vendor_currency;
                 vmdebug('No vendor currency given, fallback to main vendor', $userDetails->vendor->vendor_currency);
             }
             //}
             $vendorM->setId($userDetails->virtuemart_vendor_id);
             $vendorM->addImages($userDetails->vendor);
             $this->assignRef('vendor', $userDetails->vendor);
             $currencyModel = VmModel::getModel('currency');
             $_currencies = $currencyModel->getCurrencies();
             $this->assignRef('currencies', $_currencies);
             $configModel = VmModel::getModel('config');
             $TCPDFFontsList = $configModel->getTCPDFFontsList();
             $this->assignRef('pdfFonts', $TCPDFFontsList);
         }
         $this->assignRef('userDetails', $userDetails);
         $this->assignRef('orderlist', $orderList);
         $this->assignRef('contactDetails', $_contactDetails);
         $this->assignRef('editor', $editor);
     } else {
         JToolBarHelper::divider();
         JToolBarHelper::custom('toggle.user_is_vendor.1', 'publish', '', 'COM_VIRTUEMART_USER_ISVENDOR');
         JToolBarHelper::custom('toggle.user_is_vendor.0', 'unpublish', '', 'COM_VIRTUEMART_USER_ISNOTVENDOR');
         JToolBarHelper::divider();
         JToolBarHelper::deleteList();
         JToolBarHelper::editList();
         self::showACLPref('user');
         //This is intentionally, creating new user via BE is buggy and can be done by joomla
         //JToolBarHelper::addNewX();
         $this->addStandardDefaultViewLists($model, 'ju.id');
         $userList = $model->getUserList();
         $this->assignRef('userList', $userList);
         $this->pagination = $model->getPagination();
         $shoppergroupmodel = VmModel::getModel('shopperGroup');
         $this->defaultShopperGroup = $shoppergroupmodel->getDefault(0)->shopper_group_name;
     }
     if (!empty($this->orderlist)) {
         VmConfig::loadJLang('com_virtuemart_orders', TRUE);
     }
     parent::display($tpl);
 }
    $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 
    echo $rowColor;
    ?>
">
				            <td width="100%">
					        <span class="vmicon vmicon-16-move price_ordering"></span>
Example #24
0
 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;
 }