function getInput() { $db = JFactory::getDbo(); if (!is_dir(JPATH_ADMINISTRATOR . '/components/com_redshop')) { return JText::_('COM_REDSHOP_REDSHOP_IS_NOT_INSTALLED'); } if (!is_array($this->value)) { $this->value = array('' => '1'); } else { foreach ($this->value as $_k => $tmpV) { $this->value[$tmpV] = $tmpV; } } $option = JRequest::getInt('option'); if ($option != 'com_redshop') { require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redshop.cfg.php'; require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/configuration.php'; $Redconfiguration = new Redconfiguration(); $Redconfiguration->defineDynamicVars(); } require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/category.php'; $product_category = new product_category(); ob_start(); $output = $product_category->list_all('' . $this->name . '[]', '', $this->value, 10, true, true); ob_end_clean(); return $output; }
public function display($tpl = null) { $context = 'newsletter_preview'; $cid = JRequest::getVar('cid', array(0), 'post', 'array'); $selected_product = JRequest::getVar('product', ''); $n = $cid[0]; $model = $this->getModel('newsletter'); $subscribers = $model->listallsubscribers($n); $db = JFactory::getDbo(); $product_category = new product_category(); $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_REDSHOP_NEWSLETTER')); JToolBarHelper::title(JText::_('COM_REDSHOP_NEWSLETTER_MANAGEMENT'), 'redshop_newsletter48'); JToolBarHelper::custom('send_newsletter', 'send.png', 'send.png', 'Send Newsletter'); JToolBarHelper::cancel('close', JText::_('JTOOLBAR_CLOSE')); $uri = JFactory::getURI(); $app = JFactory::getApplication(); $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'newsletter_id'); $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', ''); $lists['order'] = $filter_order; $lists['order_Dir'] = $filter_order_Dir; $newsletters = $this->get('Data'); $total = $this->get('Total'); $pagination = $this->get('Pagination'); $oprand = JRequest::getVar('oprand', '>'); $optionoprand = array(); $optionoprand[] = JHTML::_('select.option', 'select', JText::_('COM_REDSHOP_SELECT')); $optionoprand[] = JHTML::_('select.option', '>=', JText::_('COM_REDSHOP_GTOREQUEL')); $optionoprand[] = JHTML::_('select.option', '<=', JText::_('COM_REDSHOP_LTOREQUEL')); $optionoprand[] = JHTML::_('select.option', '=', JText::_('COM_REDSHOP_EQUAL_SIGN')); $lists['oprand'] = JHTML::_('select.genericlist', $optionoprand, 'oprand', 'class="inputbox" size="1" ', 'value', 'text', $oprand); $country_option = array(); $country_option[] = JHTML::_('select.option', '', JText::_('COM_REDSHOP_SELECT_COUNTRY')); $country = $model->getContry(); $country_data = array_merge($country_option, $country); $country_value = JRequest::getVar('country', ''); $lists['country'] = JHTML::_('select.genericlist', $country_data, 'country[]', 'class="inputbox" multiple="multiple" size="4" ', 'value', 'text', $country_value); $categories = array(); $categories = $product_category->list_all("product_category[]", 0, '', 10, true, true); $lists['categories'] = $categories; $product_data = array(); $product_data = $model->getProduct(); $lists['product'] = JHTML::_('select.genericlist', $product_data, 'product[]', 'class="inputbox" multiple="multiple" size="8" ', 'value', 'text', $selected_product); $shopper_option = array(); $shopper_option[] = JHTML::_('select.option', '', JText::_('COM_REDSHOP_SELECT')); $shoppergroup = JRequest::getVar('shoppergroups', ''); $ShopperGrup = $model->getShopperGroup(); $ShopperGroups = array_merge($shopper_option, $ShopperGrup); $lists['shoppergroups'] = JHTML::_('select.genericlist', $ShopperGroups, 'shoppergroups[]', 'class="inputbox" multiple="multiple" size="8" ', 'value', 'text', $shoppergroup); $this->subscribers = $subscribers; $this->lists = $lists; $this->newsletters = $newsletters; $this->pagination = $pagination; $this->request_url = $uri->toString(); $this->setLayout('preview'); parent::display($tpl); }
public function display($tpl = null) { JToolBarHelper::title(JText::_('COM_REDSHOP_DISCOUNT_MANAGEMENT_DETAIL'), 'redshop_discountmanagmenet48'); $uri = JFactory::getURI(); $this->setLayout('default'); $lists = array(); $detail = $this->get('data'); $product_category = new product_category(); $option = JRequest::getVar('option'); $isNew = $detail->mass_discount_id < 1; $document = JFactory::getDocument(); $document->addScript('components/' . $option . '/assets/js/select_sort.js'); $document->addStyleSheet('components/' . $option . '/assets/css/search.css'); $document->addScript('components/' . $option . '/assets/js/search.js'); $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT'); JToolBarHelper::title(JText::_('COM_REDSHOP_DISCOUNT') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_discountmanagmenet48'); JToolBarHelper::apply(); JToolBarHelper::save(); if ($isNew) { JToolBarHelper::cancel(); } else { JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE')); } $model = $this->getModel('mass_discount_detail'); $manufacturers = $model->getmanufacturers(); $productData = $model->GetProductList(); $category_id = explode(',', $detail->category_id); $tmp = new stdClass(); $tmp = @array_merge($tmp, $category_id); $discount_type = array(JHTML::_('select.option', 'no', JText::_('COM_REDSHOP_SELECT')), JHTML::_('select.option', 0, JText::_('COM_REDSHOP_TOTAL')), JHTML::_('select.option', 1, JText::_('COM_REDSHOP_PERCENTAGE'))); $lists['discount_type'] = JHTML::_('select.genericlist', $discount_type, 'discount_type', 'class="inputbox" size="1"', 'value', 'text', $detail->discount_type); $categories = $product_category->list_all("category_id[]", 0, $category_id, 10, true, true); $lists['categories'] = $categories; $manufacturer_id = explode(',', $detail->manufacturer_id); $tmp = new stdClass(); $tmp = @array_merge($tmp, $manufacturer_id); $lists['manufacturers'] = JHTML::_('select.genericlist', $manufacturers, 'manufacturer_id[]', 'class="inputbox" multiple="multiple" ', 'value', 'text', $manufacturer_id); $discountproductData = $model->GetProductListshippingrate($detail->discount_product); if (count($discountproductData) > 0) { $result_container = $discountproductData; } else { $result_container = array(); } $detail->discount_product = explode(',', $detail->discount_product); $tmp = new stdClass(); $tmp = @array_merge($tmp, $detail->discount_product); $lists['discount_product'] = JHTML::_('select.genericlist', $result_container, 'container_product[]', 'class="inputbox" onmousewheel="mousewheel(this);" ondblclick="selectnone(this);" multiple="multiple" size="15" style="width:200px;" ', 'value', 'text', 0); $lists['product_all'] = JHTML::_('select.genericlist', array(), 'product_all[]', 'class="inputbox" multiple="multiple" ', 'value', 'text', $detail->discount_product); $this->lists = $lists; $this->detail = $detail; $this->request_url = $uri->toString(); parent::display($tpl); }
public function display($tpl = null) { JToolBarHelper::title(JText::_('COM_REDSHOP_DISCOUNT_MANAGEMENT_DETAIL'), 'redshop_discountmanagmenet48'); $uri = JFactory::getURI(); $this->setLayout('default'); $lists = array(); $detail = $this->get('data'); $layout = JRequest::getVar('layout'); if ($layout == 'product') { $this->setLayout('product'); $isNew = $detail->discount_product_id < 1; } else { $isNew = $detail->discount_id < 1; } $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT'); JToolBarHelper::title(JText::_('COM_REDSHOP_DISCOUNT') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_discountmanagmenet48'); JToolBarHelper::apply(); JToolBarHelper::save(); if ($isNew) { JToolBarHelper::cancel(); } else { JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE')); } $model = $this->getModel('discount_detail'); $selectedShoppers = $model->selectedShoppers(); $shoppers = $this->get('shoppers'); $lists['shopper_group_id'] = JHTML::_('select.genericlist', $shoppers, 'shopper_group_id[]', 'class="inputbox" multiple="multiple" size="10"', 'value', 'text', $selectedShoppers); $discount_type = array(JHTML::_('select.option', 'no', JText::_('COM_REDSHOP_SELECT')), JHTML::_('select.option', 0, JText::_('COM_REDSHOP_TOTAL')), JHTML::_('select.option', 1, JText::_('COM_REDSHOP_PERCENTAGE'))); $lists['discount_type'] = JHTML::_('select.genericlist', $discount_type, 'discount_type', 'class="inputbox" size="1"', 'value', 'text', $detail->discount_type); if (isset($detail->category_ids) === true) { $detail->category_ids = explode(',', $detail->category_ids); } else { $detail->category_ids = array(); } $product_category = new product_category(); $lists['category_ids'] = $product_category->list_all("category_ids[]", 0, $detail->category_ids, 10, false, true); $discount_condition = array(JHTML::_('select.option', '0', JText::_('COM_REDSHOP_SELECT')), JHTML::_('select.option', 1, JText::_('COM_REDSHOP_LOWER')), JHTML::_('select.option', 2, JText::_('COM_REDSHOP_EQUAL')), JHTML::_('select.option', 3, JText::_('COM_REDSHOP_HIGHER'))); $lists['discount_condition'] = JHTML::_('select.genericlist', $discount_condition, 'condition', 'class="inputbox" size="1"', 'value', 'text', $detail->condition); $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->published); $this->lists = $lists; $this->detail = $detail; $this->request_url = $uri->toString(); parent::display($tpl); }
/** * Method to display export view * * @param string $tpl Template name * * @return void */ public function display($tpl = null) { $task = JRequest::getVar('task'); $product_category = new product_category(); $model = $this->getModel('export'); if ($task == 'exportfile') { $this->get('Data'); } $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_REDSHOP_EXPORT')); JToolBarHelper::title(JText::_('COM_REDSHOP_EXPORT_MANAGEMENT'), 'redshop_export48'); JToolBarHelper::custom('exportfile', 'redshop_export_export32.png', JText::_('COM_REDSHOP_EXPORT'), JText::_('COM_REDSHOP_EXPORT'), false, false); $categories = $product_category->list_all("product_category[]", 0, array(), 10, true, true); $lists['categories'] = $categories; $manufacturers = $model->getmanufacturers(); $lists['manufacturers'] = JHTML::_('select.genericlist', $manufacturers, 'manufacturer_id[]', 'class="inputbox" multiple="multiple" size="10" style="width: 250px;"> ', 'value', 'text', 0); $this->lists = $lists; parent::display($tpl); }
public function display($tpl = null) { require_once JPATH_COMPONENT . '/helpers/extra_field.php'; JToolBarHelper::title(JText::_('COM_REDSHOP_MANUFACTURER_MANAGEMENT_DETAIL'), 'redshop_manufact48'); $uri = JFactory::getURI(); $document = JFactory::getDocument(); $option = JRequest::getVar('option'); $document->addScript('components/' . $option . '/assets/js/validation.js'); $this->setLayout('default'); $lists = array(); $detail = $this->get('data'); $model = $this->getModel('manufacturer_detail'); $template_data = $model->TemplateData(); $isNew = $detail->manufacturer_id < 1; $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT'); JToolBarHelper::title(JText::_('COM_REDSHOP_MANUFACTURER') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_manufact48'); JToolBarHelper::apply(); JToolBarHelper::save(); if ($isNew) { JToolBarHelper::cancel(); } else { JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE')); } $optiontemplet = array(); $optiontemplet[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_Select')); $result = array_merge($optiontemplet, $template_data); $lists['template'] = JHTML::_('select.genericlist', $result, 'template_id', 'class="inputbox" size="1" ', 'value', 'text', $detail->template_id); $detail->excluding_category_list = explode(',', $detail->excluding_category_list); $product_category = new product_category(); $lists['excluding_category_list'] = $product_category->list_all("excluding_category_list[]", 0, $detail->excluding_category_list, 10, false, true); $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->published); $field = new extra_field(); $list_field = $field->list_all_field(10, $detail->manufacturer_id); $lists['extra_field'] = $list_field; $this->lists = $lists; $this->detail = $detail; $this->request_url = $uri->toString(); parent::display($tpl); }
public function display($tpl = null) { JToolBarHelper::title(JText::_('COM_REDSHOP_SHOPPER_GROUP_MANAGEMENT_DETAIL'), 'redshop_manufact48'); $shoppergroup = new shoppergroup(); $redhelper = new redhelper(); $option = JRequest::getVar('option', '', 'request', 'string'); $document = JFactory::getDocument(); $document->addScript('components/' . $option . '/assets/js/json.js'); $document->addScript('components/' . $option . '/assets/js/validation.js'); $uri = JFactory::getURI(); $this->setLayout('default'); $lists = array(); $detail = $this->get('data'); $isNew = $detail->shopper_group_id < 1; $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT'); JToolBarHelper::title(JText::_('COM_REDSHOP_SHOPPER_GROUP') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_manufact48'); JToolBarHelper::apply(); JToolBarHelper::save(); if ($isNew) { JToolBarHelper::cancel(); } else { JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE')); } $groups = $shoppergroup->list_all("parent_id", $detail->shopper_group_id); $lists['groups'] = $groups; $model = $this->getModel('shopper_group_detail'); $optioncustomer = array(); $optioncustomer[] = JHTML::_('select.option', '-1', JText::_('COM_REDSHOP_SELECT')); $optioncustomer[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_COMPANY')); $optioncustomer[] = JHTML::_('select.option', '1', JText::_('COM_REDSHOP_PRIVATE')); $lists['customertype'] = JHTML::_('select.genericlist', $optioncustomer, 'shopper_group_customer_type', 'class="inputbox" size="1" ', 'value', 'text', $detail->shopper_group_customer_type); $lists['portal'] = JHTML::_('select.booleanlist', 'shopper_group_portal', 'class="inputbox"', $detail->shopper_group_portal); $lists['default_shipping'] = JHTML::_('select.booleanlist', 'default_shipping', 'class="inputbox"', $detail->default_shipping); $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->published); $lists['show_price_without_vat'] = JHTML::_('select.booleanlist', 'show_price_without_vat', 'class="inputbox"', $detail->show_price_without_vat); $lists['shopper_group_quotation_mode'] = JHTML::_('select.booleanlist', 'shopper_group_quotation_mode', 'class="inputbox"', $detail->shopper_group_quotation_mode); // For individual show_price and catalog $show_price_data = $redhelper->getPreOrderByList(); $lists['show_price'] = JHTML::_('select.genericlist', $show_price_data, 'show_price', 'class="inputbox" size="1" ', 'value', 'text', $detail->show_price); $lists['use_as_catalog'] = JHTML::_('select.genericlist', $show_price_data, 'use_as_catalog', 'class="inputbox" size="1" ', 'value', 'text', $detail->use_as_catalog); $shopper_group_categories = $detail->shopper_group_categories; $shopper_group_categories = explode(",", $shopper_group_categories); $shoppergroup_category = new product_category(); $categories = $shoppergroup_category->list_all("shopper_group_categories[]", 0, $shopper_group_categories, 20, true, true, array(), 250); $lists['categories'] = $categories; $shopper_group_manufactures = ''; if (isset($detail->shopper_group_manufactures)) { $shopper_group_manufactures = $detail->shopper_group_manufactures; } $shopper_group_manufactures = explode(",", $shopper_group_manufactures); $manufacturers = $model->getmanufacturers(); $lists['manufacturers'] = JHTML::_('select.genericlist', $manufacturers, 'shopper_group_manufactures[]', 'class="inputbox" multiple="multiple" size="10" style="width: 250px;"> ', 'value', 'text', $shopper_group_manufactures); $vatgroup = $model->getVatGroup(); $tmp = array(); $tmp[] = JHTML::_('select.option', 0, JText::_('COM_REDSHOP_SELECT')); $vatgroup = @array_merge($tmp, $vatgroup); $lists['tax_group_id'] = JHTML::_('select.genericlist', $vatgroup, 'tax_group_id', 'class="inputbox" size="1"', 'value', 'text', $detail->tax_group_id); $this->lists = $lists; $this->detail = $detail; $this->request_url = $uri->toString(); parent::display($tpl); }
public function display($tpl = null) { $app = JFactory::getApplication(); $context = 'shipping_rate'; $shippinghelper = new shipping(); $userhelper = new rsUserhelper(); $uri = JFactory::getURI(); $model = $this->getModel(); $db = JFactory::getDbo(); $id = $app->getUserStateFromRequest($context . 'extension_id', 'extension_id', '0'); $shipping = $shippinghelper->getShippingMethodById($id); $option = JRequest::getVar('option'); $document = JFactory::getDocument(); $document->addScript('components/' . $option . '/assets/js/select_sort.js'); $document->addStyleSheet('components/' . $option . '/assets/css/search.css'); $document->addScript('components/' . $option . '/assets/js/search.js'); $document->addScript('components/' . $option . '/assets/js/common.js'); $shippingpath = JPATH_ROOT . '/plugins/' . $shipping->folder . '/' . $shipping->element . '.xml'; $myparams = new JRegistry($shipping->params, $shippingpath); $is_shipper = $myparams->get('is_shipper'); $shipper_location = $myparams->get('shipper_location'); $jtitle = $shipper_location ? JText::_('COM_REDSHOP_SHIPPING_LOCATION') : JText::_('COM_REDSHOP_SHIPPING_RATE'); $this->setLayout('default'); $lists = array(); $detail = $this->get('data'); $isNew = $detail->shipping_rate_id < 1; $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT'); JToolBarHelper::title($jtitle . ': <small><small>[ ' . $shipping->name . ' : ' . $text . ' ]</small></small>', 'redshop_shipping_rates48'); JToolBarHelper::save(); JToolBarHelper::apply(); if ($isNew) { JToolBarHelper::cancel(); } else { JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE')); } $q = "SELECT country_3_code as value,country_name as text from #__" . TABLE_PREFIX . "_country ORDER BY country_name ASC"; $db->setQuery($q); $countries[] = JHTML::_('select.option', '0', '- ' . JText::_('COM_REDSHOP_SELECT_COUNTRY') . ' -', 'value', 'text'); $countries = array_merge($countries, $db->loadObjectList()); $shipping_rate_state = array(); if ($detail->shipping_rate_country) { $shipping_rate_state = $model->GetStateList($detail->shipping_rate_country); } $detail->shipping_rate_state = explode(',', $detail->shipping_rate_state); $tmp = new stdClass(); $tmp = @array_merge($tmp, $detail->shipping_rate_state); $lists['shipping_rate_state'] = JHTML::_('select.genericlist', $shipping_rate_state, 'shipping_rate_state[]', 'class="inputbox" multiple="multiple"', 'value', 'text', $detail->shipping_rate_state); $detail->shipping_rate_country = explode(',', $detail->shipping_rate_country); $tmp = new stdClass(); $tmp = @array_merge($tmp, $detail->shipping_rate_country); $lists['shipping_rate_country'] = JHTML::_('select.genericlist', $countries, 'shipping_rate_country[]', 'class="inputbox" multiple="multiple" onchange="getStateList()" ', 'value', 'text', $detail->shipping_rate_country); $detail->shipping_rate_on_category = explode(',', $detail->shipping_rate_on_category); $product_category = new product_category(); $lists['shipping_rate_on_category'] = $product_category->list_all("shipping_rate_on_category[]", 0, $detail->shipping_rate_on_category, 10, false, true); $shoppergroup = $userhelper->getShopperGroupList(); $detail->shipping_rate_on_shopper_group = explode(',', $detail->shipping_rate_on_shopper_group); $lists['shipping_rate_on_shopper_group'] = JHTML::_('select.genericlist', $shoppergroup, 'shipping_rate_on_shopper_group[]', 'class="inputbox" multiple="multiple" ', 'value', 'text', $detail->shipping_rate_on_shopper_group); $lists['deliver_type'] = JHTML::_('select.booleanlist', 'deliver_type', 'class="inputbox"', $detail->deliver_type, 'COM_REDSHOP_HOME', 'COM_REDSHOP_POSTOFFICE'); $productData = array(); $result_container = array(); if ($detail->shipping_rate_on_product) { $result_container = $model->GetProductListshippingrate($detail->shipping_rate_on_product); } $lists['product_all'] = JHTML::_('select.genericlist', $productData, 'product_all[]', 'class="inputbox" multiple="multiple" ', 'value', 'text', $detail->shipping_rate_on_product); $lists['shipping_product'] = JHTML::_('select.genericlist', $result_container, 'container_product[]', 'class="inputbox" onmousewheel="mousewheel(this);" ondblclick="selectnone(this);" multiple="multiple" size="15" style="width:200px;" ', 'value', 'text', 0); $field = new extra_field(); // Extra field $list_field = $field->list_all_field(11, $detail->shipping_rate_id); $lists['extra_field'] = $list_field; $shippingVatGroup = $model->getVatGroup(); $temps = array((object) array('value' => '', 'text' => JText::_('COM_REDSHOP_SELECT'))); $shippingVatGroup = array_merge($temps, $shippingVatGroup); $shippingfor = array((object) array('value' => 0, 'text' => JText::_('COM_REDSHOP_BOTH')), (object) array('value' => 1, 'text' => JText::_('COM_REDSHOP_COMPANY_ONLY')), (object) array('value' => 2, 'text' => JText::_('COM_REDSHOP_PRIVATE'))); $lists['company_only'] = JHTML::_('select.genericlist', $shippingfor, 'company_only', 'class="inputbox" size="1" ', 'value', 'text', $detail->company_only); $lists['shipping_tax_group_id'] = JHTML::_('select.genericlist', $shippingVatGroup, 'shipping_tax_group_id', 'class="inputbox" size="1" ', 'value', 'text', $detail->shipping_tax_group_id); $this->is_shipper = $is_shipper; $this->shipper_location = $shipper_location; $this->lists = $lists; $this->detail = $detail; $this->shipping = $shipping; $this->request_url = $uri->toString(); parent::display($tpl); }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a JError object. * * @see fetch() * @since 11.1 */ public function display($tpl = null) { JHtml::_('behavior.tooltip'); $app = JFactory::getApplication(); $this->input = $app->input; $user = JFactory::getUser(); JPluginHelper::importPlugin('redshop_product_type'); $this->dispatcher = JDispatcher::getInstance(); $redTemplate = new Redtemplate(); $redhelper = new redhelper(); $this->producthelper = new producthelper(); $this->option = $this->input->getString('option', 'com_redshop'); $db = JFactory::getDBO(); $dbPrefix = $app->getCfg('dbprefix'); $lists = array(); $model = $this->getModel('product_detail'); $detail = $this->get('data'); $isNew = $detail->product_id < 1; // Load new product default values if ($isNew) { $detail->append_to_global_seo = ''; $detail->canonical_url = ''; } // Fail if checked out not by 'me' if ($model->isCheckedOut($user->get('id'))) { $msg = JText::_('COM_REDSHOP_PRODUCT_BEING_EDITED'); $app->redirect('index.php?option=com_redshop', $msg); } // Check redproductfinder is installed $CheckRedProductFinder = $model->CheckRedProductFinder(); $this->CheckRedProductFinder = $CheckRedProductFinder; // Get association id $getAssociation = $model->getAssociation(); $this->getassociation = $getAssociation; // ToDo: Move SQL from here. SQL shouldn't be in view files! $sql = "SHOW TABLE STATUS LIKE '" . $dbPrefix . "redshop_product'"; $db->setQuery($sql); $row = $db->loadObject(); $next_product = $row->Auto_increment; /* Get the tag names */ $tags = $model->Tags(); $associationtags = array(); if (isset($getAssociation) && count($getAssociation) > 0) { $associationtags = $model->AssociationTags($getAssociation->id); } if (count($tags) > 0) { $lists['tags'] = JHtml::_('select.genericlist', $tags, 'tag_id[]', 'multiple', 'id', 'tag_name', $associationtags); } $types = $model->TypeTagList(); /* Get the Quality Score data */ $qs = $this->get('QualityScores', 'product_detail'); // ToDo: Don't echo HTML but use tmpl files. /* Create the select list as checkboxes */ $html = '<div id="select_box">'; if (count($types) > 0) { foreach ($types as $typeid => $type) { $counttags = count($type['tags']); $rand = rand(); /* Add the type */ $html .= '<div class="select_box_parent" onClick="showBox(' . $rand . ')">' . JText::_('COM_REDSHOP_TYPE_LIST') . ' ' . $type['type_name'] . '</div>'; $html .= '<div id="' . $rand . '" class="select_box_child'; $html .= '">'; /* Add the tags */ if ($counttags > 0) { foreach ($type['tags'] as $tagid => $tag) { /* Check if the tag is selected */ if (in_array($tagid, $associationtags)) { $selected = 'checked="checked"'; } else { $selected = ''; } $html .= '<table><tr><td colspan="2"><input type="checkbox" class="select_box" ' . $selected . ' name="tag_id[]" value="' . $typeid . '.' . $tagid . '" />' . JText::_('COM_REDSHOP_TAG_LIST') . ' ' . $tag['tag_name']; $html .= '</td></tr>'; $qs_value = ''; if (is_array($qs)) { if (array_key_exists($typeid . '.' . $tagid, $qs)) { $qs_value = $qs[$typeid . '.' . $tagid]['quality_score']; } } $html .= '<tr><td><span class="quality_score">' . JText::_('COM_REDSHOP_QUALITY_SCORE') . '</span></td><td><input type="text" class="quality_score_input" name="qs_id[' . $typeid . '.' . $tagid . ']" value="' . $qs_value . '" />'; $html .= '</td></tr>'; $html .= '<tr ><td colspan="2"><select name="sel_dep' . $typeid . '_' . $tagid . '[]" id="sel_dep' . $typeid . '_' . $tagid . '" multiple="multiple" size="10" >'; foreach ($types as $sel_typeid => $sel_type) { if ($typeid == $sel_typeid) { continue; } $dependent_tag = $model->getDependenttag($detail->product_id, $typeid, $tagid); $html .= '<optgroup label="' . $sel_type['type_name'] . '">'; foreach ($sel_type['tags'] as $sel_tagid => $sel_tag) { $selected = in_array($sel_tagid, $dependent_tag) ? "selected" : ""; $html .= '<option value="' . $sel_tagid . '" ' . $selected . ' >' . $sel_tag['tag_name'] . '</option>'; } $html .= '</optgroup>'; } $html .= '</select> <a href="#" onClick="javascript:add_dependency(' . $typeid . ',' . $tagid . ',' . $detail->product_id . ');" >' . JText::_('COM_REDSHOP_ADD_DEPENDENCY') . '</a></td></tr></table>'; } } $html .= '</div>'; } } $html .= '</div>'; $lists['tags'] = $html; $templates = $redTemplate->getTemplate("product"); $manufacturers = $model->getmanufacturers(); $supplier = $model->getsupplier(); $product_categories = $this->input->post->get('product_category', array(), 'array'); if (!empty($product_categories)) { $productcats = $product_categories; } else { $productcats = $model->getproductcats(); } $attributes = $model->getattributes(); $attributesSet = $model->getAttributeSetList(); $product_category = new product_category(); // Merging select option in the select box $temps = array(); $temps[0] = new stdClass(); $temps[0]->template_id = "0"; $temps[0]->template_name = JText::_('COM_REDSHOP_SELECT'); if (is_array($templates)) { $templates = array_merge($temps, $templates); } // Merging select option in the select box $supps = array(); $supps[0] = new stdClass(); $supps[0]->value = "0"; $supps[0]->text = JText::_('COM_REDSHOP_SELECT'); if (is_array($manufacturers)) { $manufacturers = array_merge($supps, $manufacturers); } // Merging select option in the select box $supps = array(); $supps[0] = new stdClass(); $supps[0]->value = "0"; $supps[0]->text = JText::_('COM_REDSHOP_SELECT'); if (is_array($supplier)) { $supplier = array_merge($supps, $supplier); } JToolBarHelper::title(JText::_('COM_REDSHOP_PRODUCT_MANAGEMENT_DETAIL'), 'redshop_products48'); $document = JFactory::getDocument(); $document->addScriptDeclaration("var WANT_TO_DELETE = '" . JText::_('COM_REDSHOP_DO_WANT_TO_DELETE') . "';"); /** * Override field.js file. * With this trigger the file can be loaded from a plugin. This can be used * to display different JS generated interface for attributes depending on a product type. * So, product type plugins should be used for this event. Be aware that this file should * be loaded only once. */ $loadedFromAPlugin = $this->dispatcher->trigger('loadFieldsJSFromPlugin', array($detail)); if (in_array(1, $loadedFromAPlugin)) { $loadedFromAPlugin = true; } else { $loadedFromAPlugin = false; } if (!$loadedFromAPlugin) { $document->addScript('components/' . $this->option . '/assets/js/fields.js'); } $document->addScript('components/' . $this->option . '/assets/js/select_sort.js'); $document->addScript('components/' . $this->option . '/assets/js/json.js'); $document->addScript('components/' . $this->option . '/assets/js/validation.js'); $document->addStyleSheet('components/com_redshop/assets/css/search.css'); if (file_exists(JPATH_SITE . '/components/com_redproductfinder/helpers/redproductfinder.css')) { $document->addStyleSheet('components/com_redproductfinder/helpers/redproductfinder.css'); } $document->addScript('components/com_redshop/assets/js/search.js'); $document->addScript('components/com_redshop/assets/js/related.js'); $uri = JFactory::getURI(); $layout = $this->input->getString('layout', ''); if ($layout == 'property_images') { $this->setLayout('property_images'); } elseif ($layout == 'attribute_color') { $this->setLayout('attribute_color'); } elseif ($layout == 'productstockroom') { $this->setLayout('productstockroom'); } else { $this->setLayout('default'); } $text = $isNew ? JText::_('COM_REDSHOP_NEW') : $detail->product_name . " - " . JText::_('COM_REDSHOP_EDIT'); JToolBarHelper::title(JText::_('COM_REDSHOP_PRODUCT') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_products48'); if ($detail->product_id > 0) { JToolBarHelper::addNew('prices', JText::_('COM_REDSHOP_ADD_PRICE_LBL')); } JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::save2new(); if ($isNew) { JToolBarHelper::cancel(); } else { $model->checkout($user->get('id')); JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE')); } $model = $this->getModel('product_detail'); $accessory_product = array(); if ($detail->product_id) { $accessory_product = $this->producthelper->getProductAccessory(0, $detail->product_id); } $lists['accessory_product'] = $accessory_product; $navigator_product = array(); if ($detail->product_id) { $navigator_product = $this->producthelper->getProductNavigator(0, $detail->product_id); } $lists['navigator_product'] = $navigator_product; $lists['QUANTITY_SELECTBOX_VALUE'] = $detail->quantity_selectbox_value; $result = array(); $lists['product_all'] = JHtml::_('select.genericlist', $result, 'product_all[]', 'class="inputbox" ondblclick="selectnone(this);" multiple="multiple" size="15" style="width:200px;" ', 'value', 'text', 0); $related_product_data = $model->related_product_data($detail->product_id); $relatedProductCssClass = 'class="inputbox" multiple="multiple" size="15" style="width:200px;" '; $relatedProductCssClass .= ' onmousewheel="mousewheel_related(this);" ondblclick="selectnone_related(this);" '; $lists['related_product'] = JHtml::_('select.genericlist', $related_product_data, 'related_product[]', $relatedProductCssClass, 'value', 'text', 0); $lists['product_all_related'] = JHtml::_('select.genericlist', $result, 'product_all_related[]', 'class="inputbox" ondblclick="selectnone_related(this);" multiple="multiple" size="15" style="width:200px;" ', 'value', 'text', 0); // For preselected. if ($detail->product_template == "") { $default_preselected = PRODUCT_TEMPLATE; $detail->product_template = $default_preselected; } $lists['product_template'] = JHtml::_('select.genericlist', $templates, 'product_template', 'class="inputbox" size="1" onchange="set_dynamic_field(this.value,\'' . $detail->product_id . '\',\'1,12,17\');" ', 'template_id', 'template_name', $detail->product_template); $product_tax = $model->gettax(); $temps = array(); $temps[0] = new stdClass(); $temps[0]->value = "0"; $temps[0]->text = JText::_('COM_REDSHOP_SELECT'); if (is_array($product_tax)) { $product_tax = array_merge($temps, $product_tax); } $lists['product_tax'] = JHtml::_('select.genericlist', $product_tax, 'product_tax_id', 'class="inputbox" size="1" ', 'value', 'text', $detail->product_tax_id); $categories = $product_category->list_all("product_category[]", 0, $productcats, 10, true, true); $lists['categories'] = $categories; $detail->first_selected_category_id = isset($productcats[0]) ? $productcats[0] : null; $lists['manufacturers'] = JHtml::_('select.genericlist', $manufacturers, 'manufacturer_id', 'class="inputbox" size="1" ', 'value', 'text', $detail->manufacturer_id); $lists['supplier'] = JHtml::_('select.genericlist', $supplier, 'supplier_id', 'class="inputbox" size="1" ', 'value', 'text', $detail->supplier_id); $lists['published'] = JHtml::_('select.booleanlist', 'published', 'class="inputbox"', $detail->published); $lists['product_on_sale'] = JHtml::_('select.booleanlist', 'product_on_sale', 'class="inputbox"', $detail->product_on_sale); $lists['copy_attribute'] = JHtml::_('select.booleanlist', 'copy_attribute', 'class="inputbox"', 0); $lists['product_special'] = JHtml::_('select.booleanlist', 'product_special', 'class="inputbox"', $detail->product_special); $lists['product_download'] = JHtml::_('select.booleanlist', 'product_download', 'class="inputbox"', $detail->product_download); $lists['not_for_sale'] = JHtml::_('select.booleanlist', 'not_for_sale', 'class="inputbox"', $detail->not_for_sale); $lists['expired'] = JHtml::_('select.booleanlist', 'expired', 'class="inputbox"', $detail->expired); // For individual pre-order $preorder_data = $redhelper->getPreOrderByList(); $lists['preorder'] = JHtml::_('select.genericlist', $preorder_data, 'preorder', 'class="inputbox" size="1" ', 'value', 'text', $detail->preorder); // Discount calculator $lists['use_discount_calc'] = JHtml::_('select.booleanlist', 'use_discount_calc', 'class="inputbox"', $detail->use_discount_calc); $selectOption = array(); $selectOption[] = JHtml::_('select.option', '1', JText::_('COM_REDSHOP_RANGE')); $selectOption[] = JHtml::_('select.option', '0', JText::_('COM_REDSHOP_PRICE_PER_PIECE')); $lists['use_range'] = JHtml::_('select.genericlist', $selectOption, 'use_range', 'class="inputbox" size="1" ', 'value', 'text', $detail->use_range); unset($selectOption); // Calculation method $selectOption[] = JHtml::_('select.option', '0', JText::_('COM_REDSHOP_SELECT')); $selectOption[] = JHtml::_('select.option', 'volume', JText::_('COM_REDSHOP_VOLUME')); $selectOption[] = JHtml::_('select.option', 'area', JText::_('COM_REDSHOP_AREA')); $selectOption[] = JHtml::_('select.option', 'circumference', JText::_('COM_REDSHOP_CIRCUMFERENCE')); $lists['discount_calc_method'] = JHtml::_('select.genericlist', $selectOption, 'discount_calc_method', 'class="inputbox" size="1" ', 'value', 'text', $detail->discount_calc_method); unset($selectOption); // Calculation UNIT $remove_format = JHtml::$formatOptions; $selectOption[] = JHtml::_('select.option', 'mm', JText::_('COM_REDSHOP_MILLIMETER')); $selectOption[] = JHtml::_('select.option', 'cm', JText::_('COM_REDSHOP_CENTIMETER')); $selectOption[] = JHtml::_('select.option', 'm', JText::_('COM_REDSHOP_METER')); $lists['discount_calc_unit'] = JHtml::_('select.genericlist', $selectOption, 'discount_calc_unit[]', 'class="inputbox" size="1" ', 'value', 'text', DEFAULT_VOLUME_UNIT); $lists['discount_calc_unit'] = str_replace($remove_format['format.indent'], "", $lists['discount_calc_unit']); $lists['discount_calc_unit'] = str_replace($remove_format['format.eol'], "", $lists['discount_calc_unit']); unset($selectOption); $productVatGroup = $model->getVatGroup(); $temps = array(); $temps[0] = new stdClass(); $temps[0]->value = ""; $temps[0]->text = JText::_('COM_REDSHOP_SELECT'); if (is_array($productVatGroup)) { $productVatGroup = array_merge($temps, $productVatGroup); } if (DEFAULT_VAT_GROUP && !$detail->product_tax_group_id) { $detail->product_tax_group_id = DEFAULT_VAT_GROUP; } $append_to_global_seo = array(); $append_to_global_seo[] = JHtml::_('select.option', 'append', JText::_('COM_REDSHOP_APPEND_TO_GLOBAL_SEO')); $append_to_global_seo[] = JHtml::_('select.option', 'prepend', JText::_('COM_REDSHOP_PREPEND_TO_GLOBAL_SEO')); $append_to_global_seo[] = JHtml::_('select.option', 'replace', JText::_('COM_REDSHOP_REPLACE_TO_GLOBAL_SEO')); $lists['append_to_global_seo'] = JHtml::_('select.genericlist', $append_to_global_seo, 'append_to_global_seo', 'class="inputbox" size="1" ', 'value', 'text', $detail->append_to_global_seo); $lists['product_tax_group_id'] = JHtml::_('select.genericlist', $productVatGroup, 'product_tax_group_id', 'class="inputbox" size="1" ', 'value', 'text', $detail->product_tax_group_id); $prop_oprand = array(); $prop_oprand[] = JHtml::_('select.option', 'select', JText::_('COM_REDSHOP_SELECT')); $prop_oprand[] = JHtml::_('select.option', '+', JText::_('COM_REDSHOP_PLUS')); $prop_oprand[] = JHtml::_('select.option', '=', JText::_('COM_REDSHOP_EQUAL')); $prop_oprand[] = JHtml::_('select.option', '-', JText::_('COM_REDSHOP_MINUS')); $cat_in_sefurl = $model->catin_sefurl($detail->product_id); $lists['cat_in_sefurl'] = JHtml::_('select.genericlist', $cat_in_sefurl, 'cat_in_sefurl', 'class="inputbox" size="1" ', 'value', 'text', $detail->cat_in_sefurl); $lists['attributes'] = $attributes; $temps = array(); $temps[0] = new stdClass(); $temps[0]->value = ""; $temps[0]->text = JText::_('COM_REDSHOP_SELECT'); if (is_array($attributesSet)) { $attributesSet = array_merge($temps, $attributesSet); } $lists['attributesSet'] = JHtml::_('select.genericlist', $attributesSet, 'attribute_set_id', 'class="inputbox" size="1" ', 'value', 'text', $detail->attribute_set_id); // Product type selection $productTypeOptions = array(); $productTypeOptions[] = JHtml::_('select.option', 'product', JText::_('COM_REDSHOP_PRODUCT')); $productTypeOptions[] = JHtml::_('select.option', 'file', JText::_('COM_REDSHOP_FILE')); $productTypeOptions[] = JHtml::_('select.option', 'subscription', JText::_('COM_REDSHOP_SUBSCRIPTION')); /* * Trigger event which can update list of product types. * Example of a returned value: * return array('value' => 'redDESIGN', 'text' => JText::_('PLG_REDSHOP_PRODUCT_TYPE_REDDESIGN_REDDESIGN_PRODUCT_TYPE')); */ $productTypePluginOptions = $this->dispatcher->trigger('onListProductTypes'); foreach ($productTypePluginOptions as $productTypePluginOption) { $productTypeOptions[] = JHtml::_('select.option', $productTypePluginOption['value'], $productTypePluginOption['text']); } if ($detail->product_download == 1) { $detail->product_type = 'file'; } $lists["product_type"] = JHtml::_('select.genericlist', $productTypeOptions, 'product_type', 'class="inputbox" size="1" ', 'value', 'text', $detail->product_type); $accountgroup = $redhelper->getEconomicAccountGroup(); $op = array(); $op[] = JHtml::_('select.option', '0', JText::_('COM_REDSHOP_SELECT')); $accountgroup = array_merge($op, $accountgroup); $lists["accountgroup_id"] = JHtml::_('select.genericlist', $accountgroup, 'accountgroup_id', 'class="inputbox" size="1" ', 'value', 'text', $detail->accountgroup_id); // For downloadable products $productSerialDetail = $model->getProdcutSerialNumbers(); $this->model = $model; $this->lists = $lists; $this->detail = $detail; $this->productSerialDetail = $productSerialDetail; $this->next_product = $next_product; $this->request_url = $uri->toString(); parent::display($tpl); }
public function display($tpl = null) { $redTemplate = new Redtemplate(); $product_category = new product_category(); $producthelper = new producthelper(); $option = JRequest::getVar('option'); $this->setLayout('default'); $uri = JFactory::getURI(); $model = $this->getModel('category_detail'); $categories = $model->getcategories(); JToolBarHelper::title(JText::_('COM_REDSHOP_CATEGORY_MANAGEMENT_DETAIL'), 'redshop_categories48'); $document = JFactory::getDocument(); $document->addScript('components/' . $option . '/assets/js/validation.js'); $document->addScript('components/' . $option . '/assets/js/fields.js'); $document->addScript('components/' . $option . '/assets/js/select_sort.js'); $document->addScript('components/' . $option . '/assets/js/json.js'); $document->addStyleSheet('components/com_redshop/assets/css/search.css'); $document->addScript('components/com_redshop/assets/js/search.js'); $document->addScript('components/com_redshop/assets/js/related.js'); $detail = $this->get('data'); $isNew = $detail->category_id < 1; // Assign default values for new categories if ($isNew) { $detail->append_to_global_seo = 'append'; $detail->canonical_url = ''; } $text = $isNew ? JText::_('COM_REDSHOP_NEW') : $detail->category_name . " - " . JText::_('COM_REDSHOP_EDIT'); JToolBarHelper::title(JText::_('COM_REDSHOP_CATEGORY') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_categories48'); JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::save2new(); if ($isNew) { JToolBarHelper::cancel(); } else { JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE')); } $lists = array(); /* * get total Template from configuration helper */ $templates = $redTemplate->getTemplate('category'); /* * multiple select box for * Front-End category Template Selector */ if (strstr($detail->category_more_template, ",")) { $category_more_template = explode(",", $detail->category_more_template); } else { $category_more_template = $detail->category_more_template; } $lists['category_more_template'] = JHTML::_('select.genericlist', $templates, 'category_more_template[]', 'class="inputbox" multiple="multiple" size="10" ', 'template_id', 'template_name', $category_more_template); $append_to_global_seo = array(); $append_to_global_seo[] = JHTML::_('select.option', 'append', JText::_('COM_REDSHOP_APPEND_TO_GLOBAL_SEO')); $append_to_global_seo[] = JHTML::_('select.option', 'prepend', JText::_('COM_REDSHOP_PREPEND_TO_GLOBAL_SEO')); $append_to_global_seo[] = JHTML::_('select.option', 'replace', JText::_('COM_REDSHOP_REPLACE_TO_GLOBAL_SEO')); $lists['append_to_global_seo'] = JHTML::_('select.genericlist', $append_to_global_seo, 'append_to_global_seo', 'class="inputbox" size="1" ', 'value', 'text', $detail->append_to_global_seo); // Merging select option in the select box $temps = array(); $temps[0] = new stdClass(); $temps[0]->template_id = 0; $temps[0]->template_name = JText::_('COM_REDSHOP_SELECT'); $templates = @array_merge($temps, $templates); $lists['category_template'] = JHTML::_('select.genericlist', $templates, 'category_template', 'class="inputbox" size="1" onchange="select_dynamic_field(this.value,\'' . $detail->category_id . '\',\'2\');" ', 'template_id', 'template_name', $detail->category_template); /* * class name product_category * from helper/category.php * get select box for select category parent Id */ $categories = $product_category->list_all("category_parent_id", $detail->category_id); $lists['categories'] = $categories; // Select box for ProductCompareTemplate $comparetemplate = $redTemplate->getTemplate('compare_product'); $temp = array(); $temp[0] = new stdClass(); $temp[0]->template_id = 0; $temp[0]->template_name = JText::_('COM_REDSHOP_SELECT'); $comparetemplate = @array_merge($temp, $comparetemplate); $lists['compare_template_id'] = JHTML::_('select.genericlist', $comparetemplate, 'compare_template_id', 'class="inputbox" size="1" ', 'template_id', 'template_name', $detail->compare_template_id); $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->published); // Accessory of Category $categroy_accessory_product = array(); if ($detail->category_id) { $categroy_accessory_product = $producthelper->getProductAccessory(0, 0, 0, $detail->category_id); } $lists['categroy_accessory_product'] = $categroy_accessory_product; $this->lists = $lists; $this->detail = $detail; $this->request_url = $uri->toString(); parent::display($tpl); }