public function display($tpl = null) { global $context; $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_REDSHOP_PRODUCT')); $task = JRequest::getVar('task'); JToolBarHelper::title(JText::_('COM_REDSHOP_PRODUCT_MANAGEMENT'), 'redshop_products48'); if ($task == 'assignCategory') { JToolBarHelper::custom('saveProduct_Category', 'save.png', 'save_f2.png', JText::_('COM_REDSHOP_ASSIGN_CATEGORY'), false); } else { JToolBarHelper::custom('removeProduct_Category', 'delete.png', 'delete.png', JText::_('COM_REDSHOP_REMOVE_CATEGORY'), false); } JToolBarHelper::back(); $model = $this->getModel("product_category"); $products = $model->getProductlist(); $product_category = new product_category(); $categories = $product_category->getCategoryListArray(); $temps = array(); $temps[0]->category_id = "0"; $temps[0]->category_name = JText::_('COM_REDSHOP_SELECT'); $categories = @array_merge($temps, $categories); $lists['category'] = JHTML::_('select.genericlist', $categories, 'category_id[]', 'class="inputbox" multiple="multiple"', 'category_id', 'category_name'); $this->products = $products; $this->lists = $lists; parent::display($tpl); }
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) { $app = JFactory::getApplication(); $context = 'category_id'; $redTemplate = new Redtemplate(); $product_category = new product_category(); $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_REDSHOP_CATEGORY')); JToolBarHelper::title(JText::_('COM_REDSHOP_CATEGORY_MANAGEMENT'), 'redshop_categories48'); JToolBarHelper::addNewX(); JToolBarHelper::editListX(); JToolBarHelper::customX('copy', 'copy.png', 'copy_f2.png', JText::_('COM_REDSHOP_TOOLBAR_COPY'), true); JToolBarHelper::deleteList(); JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); $uri = JFactory::getURI(); $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'c.ordering'); $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', ''); $limitstart = $app->getUserStateFromRequest($context . 'limitstart', 'limitstart', '0'); $limit = $app->getUserStateFromRequest($context . 'limit', 'limit', '10'); $lists['order'] = $filter_order; $lists['order_Dir'] = $filter_order_Dir; $GLOBALS['catlist'] = array(); $catid = JRequest::getVar('category_id', 0, ''); $categories = $this->get('Data'); $pagination = $this->get('Pagination'); $category_main_filter = $app->getUserStateFromRequest($context . 'category_main_filter', 'category_main_filter', ''); $optionsection = array(); $optionsection[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_SELECT')); $category_id = $app->getUserStateFromRequest($context . 'category_id', 'category_id', ''); $category_name = $app->getUserStateFromRequest($context . 'category_name', 'category_name', 0); $category = new product_category(); $categories_parent = $category->getParentCategories(); $temps = array(); $temps[0] = new stdClass(); $temps[0]->category_id = "0"; $temps[0]->category_name = JText::_('COM_REDSHOP_SELECT'); $categories_parent = @array_merge($temps, $categories_parent); $lists['category'] = JHTML::_('select.genericlist', $categories_parent, 'category_id', 'class="inputbox" onchange="document.adminForm.submit();" ', 'category_id', 'category_name', $category_id); /* * assign template */ $templates = $redTemplate->getTemplate('category'); $temps = array(); $temps[0] = new stdClass(); $temps[0]->template_id = "0"; $temps[0]->template_name = JText::_('COM_REDSHOP_ASSIGN_TEMPLATE'); $templates = @array_merge($temps, $templates); $lists['category_template'] = JHTML::_('select.genericlist', $templates, 'category_template', 'class="inputbox" size="1" onchange="return AssignTemplate()" ', 'template_id', 'template_name', 0); $this->category_main_filter = $category_main_filter; $this->user = JFactory::getUser(); $this->lists = $lists; $this->categories = $categories; $this->pagination = $pagination; $this->request_url = $uri->toString(); parent::display($tpl); }
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) { $context2 = 'p.product_id'; $uri = JFactory::getURI(); $app = JFactory::getApplication(); $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_REDSHOP_STOCKROOM_LISTING')); JToolBarHelper::title(JText::_('COM_REDSHOP_STOCKROOM_LISTING_MANAGEMENT'), 'redshop_stockroom48'); JToolBarHelper::custom('export_data', 'save.png', 'save_f2.png', 'Export Data', false); JToolBarHelper::custom('print_data', 'save.png', 'save_f2.png', 'Print Data', false); $stockroom_type = $app->getUserStateFromRequest($context2 . 'stockroom_type', 'stockroom_type', 'product'); $filter_order = $app->getUserStateFromRequest($context2 . 'filter_order', 'filter_order', 'p.product_id'); $filter_order_Dir = $app->getUserStateFromRequest($context2 . 'filter_order_Dir', 'filter_order_Dir', ''); $search_field = $app->getUserStateFromRequest($context2 . 'search_field', 'search_field', ''); $keyword = $app->getUserStateFromRequest($context2 . 'keyword', 'keyword', ''); $category_id = $app->getUserStateFromRequest($context2 . 'category_id', 'category_id', ''); // Stockroom type and attribute type $optiontype = array(); $optiontype[] = JHTML::_('select.option', 'product', JText::_('COM_REDSHOP_PRODUCT')); $optiontype[] = JHTML::_('select.option', 'property', JText::_('COM_REDSHOP_PROPERTY')); $optiontype[] = JHTML::_('select.option', 'subproperty', JText::_('COM_REDSHOP_SUBPROPERTY')); $lists['stockroom_type'] = JHTML::_('select.genericlist', $optiontype, 'stockroom_type', 'class="inputbox" size="1" onchange="document.adminForm.submit();" ', 'value', 'text', $stockroom_type); $product_category = new product_category(); $categories = $product_category->getCategoryListArray(); $temps = array(); $temps[0] = new stdClass(); $temps[0]->category_id = "0"; $temps[0]->category_name = JText::_('COM_REDSHOP_SELECT'); $categories = @array_merge($temps, $categories); $lists['category'] = JHTML::_('select.genericlist', $categories, 'category_id', 'class="inputbox" onchange="getTaskChange();document.adminForm.submit();" ', 'category_id', 'category_name', $category_id); $lists['order'] = $filter_order; $lists['order_Dir'] = $filter_order_Dir; $resultlisting = $this->get('Data'); $stockroom = $this->get('Stockroom'); $pagination = $this->get('Pagination'); $this->lists = $lists; $this->keyword = $keyword; $this->search_field = $search_field; $this->resultlisting = $resultlisting; $this->stockroom = $stockroom; $this->stockroom_type = $stockroom_type; $this->pagination = $pagination; $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) { global $context; $app = JFactory::getApplication(); $redTemplate = new Redtemplate(); $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_REDSHOP_PRODUCT')); $uri = JFactory::getURI(); $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'product_id'); $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', ''); $limitstart = $app->getUserStateFromRequest($context . 'limitstart', 'limitstart', '0'); $limit = $app->getUserStateFromRequest($context . 'limit', 'limit', '10'); $search_field = $app->getUserStateFromRequest($context . 'search_field', 'search_field', ''); $keyword = $app->getUserStateFromRequest($context . 'keyword', 'keyword', ''); $category_id = $app->getUserStateFromRequest($context . 'category_id', 'category_id', ''); $product_category = new product_category(); $categories = $product_category->getCategoryListArray(); $temps = array(); $temps[0]->category_id = "0"; $temps[0]->category_name = JText::_('COM_REDSHOP_SELECT'); $categories = @array_merge($temps, $categories); $lists['category'] = JHTML::_('select.genericlist', $categories, 'category_id', 'class="inputbox" onchange="document.adminForm2.submit();" ', 'category_id', 'category_name', $category_id); $lists['order'] = $filter_order; $lists['order_Dir'] = $filter_order_Dir; $total = $this->get('Total'); $products = $this->get('Data'); $pagination = $this->get('Pagination'); $this->keyword = $keyword; $this->search_field = $search_field; $this->user = JFactory::getUser(); $this->lists = $lists; $this->products = $products; $this->pagination = $pagination; $this->request_url = $uri->toString(); parent::display($tpl); }
$shLangName = ''; $shLangIso = ''; $title = array(); $shItemidString = ''; $dosef = shInitializePlugin($lang, $shLangName, $shLangIso, 'com_redshop'); if ($dosef == false) { return; } // ------------------ load language file - adjust as needed ---------------------------------------- $shLangIso = shLoadPluginLanguage('com_redshop', $shLangIso, '_COM_SEF_SH_REDSHOP'); // Getting the configuration if (!defined('TABLE_PREFIX')) { require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redshop.cfg.php'; } include_once "administrator/components/com_redshop/helpers/category.php"; $product_category = new product_category(); shRemoveFromGETVarsList('option'); if (!empty($lang)) { shRemoveFromGETVarsList('lang'); } shRemoveFromGETVarsList('Itemid'); shRemoveFromGETVarsList('task'); $limitstart = isset($limitstart) ? @$limitstart : 0; if (isset($limit)) { // V 1.2.4.r shRemoveFromGETVarsList('limit'); } if (isset($limitstart)) { // V 1.2.4.r // limitstart can be zero shRemoveFromGETVarsList('limitstart');
public function store($data) { $row =& $this->getTable(); if (!$row->bind($data)) { $this->setError($this->_db->getErrorMsg()); return false; } // Storing image name in the database $option = JRequest::getVar('option'); $filename = ""; // Get File name, tmp_name $file = JRequest::getVar('category_full_image', array(), 'files', 'array'); if (count($file) > 0) { // Make the filename unique $filename = JPath::clean(time() . '_' . $file['name']); $filename = str_replace(" ", "_", $filename); } if (isset($data['image_delete'])) { unlink(REDSHOP_FRONT_IMAGES_RELPATH . 'category/thumb/' . $data['old_image']); unlink(REDSHOP_FRONT_IMAGES_RELPATH . 'category/' . $data['old_image']); $query = "UPDATE " . $this->_table_prefix . "category set category_thumb_image = '',category_full_image = '' where category_id =" . $row->category_id; $this->_db->setQuery($query); $this->_db->query(); } if (count($_FILES) > 0 && $_FILES['category_full_image']['name'] != "") { $newwidth = THUMB_WIDTH; $newheight = THUMB_HEIGHT; $row->category_full_image = $filename; $row->category_thumb_image = $filename; // Get extension of the file $filetype = JFile::getExt($file['name']); $src = $file['tmp_name']; // Specific path of the file $dest = REDSHOP_FRONT_IMAGES_RELPATH . 'category/' . $filename; JFile::upload($src, $dest); } else { if (isset($data['category_image']) && $data['category_image'] != null) { $image_split = explode('/', $data['category_image']); // Make the filename unique $filename = JPath::clean(time() . '_' . $image_split[count($image_split) - 1]); $row->category_full_image = $filename; $row->category_thumb_image = $filename; // Image Upload $newwidth = THUMB_WIDTH; $newheight = THUMB_HEIGHT; $src = JPATH_ROOT . '/' . $data['category_image']; $dest = REDSHOP_FRONT_IMAGES_RELPATH . 'category/' . $filename; copy($src, $dest); } } // Get File name, tmp_name $backfile = JRequest::getVar('category_back_full_image', '', 'files', 'array'); if (isset($data['image_back_delete'])) { unlink(REDSHOP_FRONT_IMAGES_RELPATH . 'category/thumb/' . $data['old_back_image']); unlink(REDSHOP_FRONT_IMAGES_RELPATH . 'category/' . $data['old_back_image']); $query = "UPDATE " . $this->_table_prefix . "category set category_back_full_image = '' where category_id =" . $row->category_id; $this->_db->setQuery($query); $this->_db->query(); } if (count($backfile) > 0 && $backfile['name'] != "") { // Make the filename unique $filename = JPath::clean(time() . '_' . $backfile['name']); $row->category_back_full_image = $filename; // Get extension of the file $filetype = JFile::getExt($backfile['name']); $src = $backfile['tmp_name']; // Specific path of the file $dest = REDSHOP_FRONT_IMAGES_RELPATH . 'category/' . $filename; JFile::upload($src, $dest); } // Upload back image end if (!$row->store()) { $this->setError($this->_db->getErrorMsg()); return false; } if (!$data['category_id']) { $newcatid = $this->_db->insertid(); if (isset($_POST['category_parent_id'])) { $parentcat = $_POST['category_parent_id']; } else { $parentcat = $data['category_parent_id']; } $query = 'INSERT INTO ' . $this->_table_prefix . 'category_xref(category_parent_id,category_child_id) VALUES ("' . $parentcat . '","' . $newcatid . '");'; $this->_db->setQuery($query); $this->_db->query(); } else { $newcatid = $data['category_id']; if (isset($_POST['category_parent_id'])) { $parentcat = $_POST['category_parent_id']; } else { $parentcat = $data['category_parent_id']; } $query = 'UPDATE ' . $this->_table_prefix . 'category_xref SET category_parent_id= "' . $parentcat . '" WHERE category_child_id = "' . $newcatid . '" '; $this->_db->setQuery($query); $this->_db->query(); // Sheking for the image at the updation time if ($_FILES['category_full_image']['name'] != "") { @unlink(REDSHOP_FRONT_IMAGES_RELPATH . 'category/thumb/' . $_POST['old_image']); @unlink(REDSHOP_FRONT_IMAGES_RELPATH . 'category/' . $_POST['old_image']); } } // Extra Field Data Saved $field = new extra_field(); $field->extra_field_save($data, 2, $newcatid); // Start Accessory Product if (count($data['product_accessory']) > 0 && is_array($data['product_accessory'])) { $data['product_accessory'] = array_merge(array(), $data['product_accessory']); $product_category = new product_category(); $product_list = $product_category->getCategoryProductList($newcatid); for ($p = 0; $p < count($product_list); $p++) { $product_id = $product_list[$p]->id; for ($a = 0; $a < count($data['product_accessory']); $a++) { $acc = $data['product_accessory'][$a]; $accessory_id = $product_category->CheckAccessoryExists($product_id, $acc['child_product_id']); if ($product_id != $acc['child_product_id']) { $accdetail =& $this->getTable('accessory_detail'); $accdetail->accessory_id = $accessory_id; $accdetail->category_id = $newcatid; $accdetail->product_id = $product_id; $accdetail->child_product_id = $acc['child_product_id']; $accdetail->accessory_price = $acc['accessory_price']; $accdetail->oprand = $acc['oprand']; $accdetail->ordering = $acc['ordering']; $accdetail->setdefault_selected = isset($acc['setdefault_selected']) && $acc['setdefault_selected'] == 1 ? 1 : 0; if (!$accdetail->store()) { $this->setError($this->_db->getErrorMsg()); return false; } } } } } // End Accessory Product insert return $row; }
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); }
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); }
/** * Build URL routes for redSHOP * * @param array &$query request variables * * @return array */ function redshopBuildRoute(&$query) { $view = ''; $layout = ''; $pid = 0; $cid = 0; $oid = ''; $order_id = ''; $manufacturer_id = ''; $segments = array(); $db = JFactory::getDbo(); $app = JFactory::getApplication(); $menu = $app->getMenu(); $item = $menu->getActive(); $Itemid = 101; if (isset($item->id) === true) { $Itemid = $item->id; } require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redshop.cfg.php'; require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/category.php'; $product_category = new product_category(); $infoid = ''; $task = ''; $view = null; if (isset($query['view'])) { $view = $query['view']; unset($query['view']); } $pid = null; if (isset($query['pid'])) { $pid = $query['pid']; unset($query['pid']); } $cid = null; if (isset($query['cid'])) { $cid = $query['cid']; unset($query['cid']); } $limit = null; if (isset($query['limit'])) { $limit = $query['limit']; } $limitstart = null; if (isset($query['limitstart'])) { $limitstart = $query['limitstart']; } $start = null; if (isset($query['start'])) { $start = $query['start']; } $order_by = null; if (isset($query['order_by'])) { $order_by = $query['order_by']; unset($query['order_by']); } $texpricemin = null; if (isset($query['texpricemin'])) { $texpricemin = $query['texpricemin']; unset($query['texpricemin']); } $texpricemax = null; if (isset($query['texpricemax'])) { $texpricemax = $query['texpricemax']; unset($query['texpricemax']); } $manufacturer_id = null; if (isset($query['manufacturer_id'])) { $manufacturer_id = $query['manufacturer_id']; unset($query['manufacturer_id']); } $manufacture_id = null; if (isset($query['manufacture_id'])) { $manufacture_id = $query['manufacture_id']; unset($query['manufacture_id']); } $category_id = null; if (isset($query['category_id'])) { $category_id = $query['category_id']; unset($query['category_id']); } $category_template = null; if (isset($query['category_template'])) { $category_template = $query['category_template']; unset($query['category_template']); } $gid = null; if (isset($query['gid'])) { $gid = $query['gid']; unset($query['gid']); } $layout = null; if (isset($query['layout'])) { $layout = $query['layout']; unset($query['layout']); } $mid = null; if (isset($query['mid'])) { $mid = $query['mid']; unset($query['mid']); } $task = null; if (isset($query['task'])) { $task = $query['task']; unset($query['task']); } $infoid = null; if (isset($query['infoid'])) { $infoid = $query['infoid']; unset($query['infoid']); } $oid = null; if (isset($query['oid'])) { $oid = $query['oid']; unset($query['oid']); } $order_id = null; if (isset($query['order_id'])) { $order_id = $query['order_id']; unset($query['order_id']); } $quoid = null; if (isset($query['quoid'])) { $quoid = $query['quoid']; unset($query['quoid']); } $Itemid = null; if (isset($query['Itemid'])) { $Itemid = $query['Itemid']; } // Tag id $tagid = null; if (isset($query['tagid'])) { $tagid = $query['tagid']; unset($query['tagid']); } $edit = null; if (isset($query['edit'])) { $edit = $query['edit']; unset($query['edit']); } // Remove flag $remove = null; if (isset($query['remove'])) { $remove = $query['remove']; unset($query['remove']); } $wishlist_id = null; if (isset($query['wishlist_id'])) { $wishlist_id = $query['wishlist_id']; unset($query['wishlist_id']); } $sql = "SELECT * FROM #__menu WHERE id = '{$Itemid}' " . "AND link like '%option=com_redshop%' AND link like '%view={$view}%' "; $db->setQuery($sql); $menu = $db->loadObject(); if (count($menu) == 0) { $menu = new stdClass(); $menu->params = ''; $menu->title = ''; } $myparams = new JRegistry($menu->params); // Special char for replace $special_char = array(".", " "); switch ($view) { case 'wishlist': $segments[] = 'wishlist'; if ($task == 'viewwishlist') { $segments[] = $task; } if ($task == 'delwishlist') { $segments[] = $task; if (isset($wishlist_id)) { $segments[] = $wishlist_id; } } if ($task == 'mysessdelwishlist') { $segments[] = $task; if (isset($wishlist_id)) { $segments[] = $wishlist_id; } } else { if ($task != '') { $segments[] = $task; } } break; case 'cart': $segments[] = 'cart'; break; case 'search': $segments[] = 'search'; if ($layout != '') { $segments[] = $layout; } if (!empty($category_id)) { $segments[] = $category_id; } break; case 'password': $segments[] = 'password'; break; case 'registration': $segments[] = 'registration'; break; case 'login': $segments[] = 'login'; break; case 'checkout': $segments[] = 'checkout'; break; case 'account_billto': $segments[] = 'account_billto'; break; case 'giftcard': $segments[] = 'giftcard'; if (isset($gid)) { $segments[] = $gid; $sql = "SELECT giftcard_name FROM #__redshop_giftcard WHERE giftcard_id = '{$gid}'"; $db->setQuery($sql); $giftcardname = $db->loadResult(); } $segments[] = $giftcardname; break; case 'account_shipto': $segments[] = 'account_shipto'; switch ($task) { case "addshipping": $segments[] = $task; if ($infoid > 0) { $segments[] = $infoid; } break; default: $segments[] = 'account_shipto'; break; } break; case 'orders': $segments[] = 'orders'; break; case 'order_detail': $segments[] = 'order_detail'; if ($oid != '') { $segments[] = $oid; } elseif ($order_id != '') { $segments[] = $order_id; } if ($layout != '') { $segments[] = $layout; } if ($task == 'reorder') { $segments[] = $task; } break; case 'category': if (!ENABLE_SEF_NUMBER_NAME) { if ($cid > 0) { $segments[] = $cid; } $segments[] = $Itemid; $segments[] = $manufacturer_id; } if ($cid) { $sql = "SELECT sef_url,category_name FROM #__redshop_category WHERE category_id = '{$cid}'"; $db->setQuery($sql); $url = $db->loadObject(); if ($url->sef_url == "") { $GLOBALS['catlist_reverse'] = array(); $cats = $product_category->getCategoryListReverceArray($cid); if (count($cats) > 0) { $cats = array_reverse($cats); for ($x = 0; $x < count($cats); $x++) { $cat = $cats[$x]; $segments[] = JFilterOutput::stringURLSafe($cat->category_name); } } if (ENABLE_SEF_NUMBER_NAME) { $segments[] = $cid . '-' . JFilterOutput::stringURLSafe($url->category_name); } else { $segments[] = JFilterOutput::stringURLSafe($url->category_name); } } else { if (ENABLE_SEF_NUMBER_NAME) { $segments[] = $cid . '-' . JFilterOutput::stringURLSafe($url->sef_url); } else { $segments[] = JFilterOutput::stringURLSafe($url->sef_url); } } } else { if ($menu->title != '') { $segments[] = JFilterOutput::stringURLSafe($menu->title); } } if ($layout != 'detail' && $layout != '') { $segments[] = $layout; } break; case 'product': if (ENABLE_SEF_NUMBER_NAME) { if ($layout != "") { $segments[] = $layout; } } else { if ($layout != "") { $segments[] = $layout; } elseif ($pid) { $segments[] = $pid; } $segments[] = $Itemid; } $segments[] = $task; if ($pid) { $sql = "SELECT sef_url,product_name,cat_in_sefurl,product_number FROM #__redshop_product WHERE product_id = '{$pid}'"; $db->setQuery($sql); $product = $db->loadObject(); $url = $product->sef_url; $cat_in_sefurl = $product->cat_in_sefurl; if ($url == "") { $GLOBALS['catlist_reverse'] = array(); $where = ''; if ($cat_in_sefurl > 0) { $where = " AND c.category_id = '{$cat_in_sefurl}'"; } // Get cid from request for consistency $category_id = $cat_in_sefurl; // If cid is not set than find cid if (!$category_id) { $sql = "SELECT c.category_id FROM #__redshop_category c,#__redshop_product_category_xref pc WHERE pc.product_id = '{$pid}' AND pc.category_id = c.category_id {$where}"; $db->setQuery($sql); $category_id = $db->loadResult(); } $cats = $product_category->getCategoryListReverceArray($category_id); if (count($cats) > 0) { $cats = array_reverse($cats); for ($x = 0; $x < count($cats); $x++) { $cat = $cats[$x]; $segments[] = JFilterOutput::stringURLSafe($cat->category_name); } } $sql = "SELECT category_name FROM #__redshop_category WHERE category_id = '{$category_id}'"; $db->setQuery($sql); $catname = $db->loadResult(); // Attach category id with name for consistency if (ENABLE_SEF_NUMBER_NAME) { $segments[] = $category_id . '-' . JFilterOutput::stringURLSafe($catname); } else { $segments[] = JFilterOutput::stringURLSafe($catname); } // Add product number if config is enabled if (ENABLE_SEF_PRODUCT_NUMBER) { $segments[] = JFilterOutput::stringURLSafe($product->product_number); } // Config option to generate sef using name : add product id to get parse in parseroute function if (ENABLE_SEF_NUMBER_NAME) { $segments[] = 'P' . $pid . '-' . JFilterOutput::stringURLSafe($product->product_name); } else { $segments[] = 'P-' . JFilterOutput::stringURLSafe($product->product_name); } } else { // Config option to generate sef using name : add product id to get parse in parseroute function if (ENABLE_SEF_NUMBER_NAME) { $segments[] = 'P' . $pid . '-' . JFilterOutput::stringURLSafe($url); } else { $segments[] = 'P-' . JFilterOutput::stringURLSafe($url); } } } break; case 'manufacturers': if (!$mid) { $mid = $myparams->get('manufacturer'); } $segments[] = 'manufacturers'; if ($mid) { $segments[] = $mid; $sql = "SELECT sef_url,manufacturer_name FROM #__redshop_manufacturer WHERE manufacturer_id = '{$mid}'"; $db->setQuery($sql); $url = $db->loadObject(); if ($url) { if ($url->sef_url == "") { $segments[] = str_replace($special_char, "-", $url->manufacturer_name); } else { $segments[] = str_replace($special_char, "-", $url->sef_url); } } } if (!$mid) { if ($menu->title != '') { $segments[] = str_replace($special_char, "-", $menu->title); } else { $segments[] = 'manufactures'; } } if ($layout != 'detail' && $layout != '') { $segments[] = $layout; } break; case 'account': $segments[] = 'account'; if ($layout == 'mytags') { $segments[] = $layout; if ($tagid) { $segments[] = $tagid; $sql = "SELECT tags_name FROM `#__redshop_product_tags` WHERE `tags_id` = " . $tagid; $db->setQuery($sql); $tagname = $db->loadResult(); $segments[] = str_replace($special_char, "-", $tagname); if ($tagid && isset($edit)) { $segments[] = 'edit'; } if ($tagid && isset($remove)) { $segments[] = 'remove'; } } } elseif ($layout == 'mywishlist') { $segments[] = $layout; if (isset($wishlist_id)) { $segments[] = $wishlist_id; } if (isset($remove) && isset($pid)) { $segments[] = $pid; $segments[] = 'delete'; } } elseif ($layout == 'compare') { $segments[] = $layout; if (isset($remove) && isset($pid)) { $segments[] = $pid; $segments[] = 'delete'; } } break; case 'quotation': $segments[] = 'quotation'; break; case 'quotation_detail': $segments[] = 'quotation_detail'; $segments[] = $quoid; break; } return $segments; }
public function _buildQuery($manudata = 0) { $app = JFactory::getApplication(); $context = 'search'; $db = JFactory::getDbo(); $keyword = $app->getUserStateFromRequest($context . 'keyword', 'keyword', ''); $defaultSearchType = ''; if (!empty($manudata['search_type'])) { $defaultSearchType = $manudata['search_type']; $defaultSearchType_tmp = $manudata['search_type']; } if ($defaultSearchType == "") { $defaultSearchType = 'product_name'; } if ($defaultSearchType == "name_number") { $defaultSearchField = "name_number"; $defaultSearchType = '(p.product_name LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_number LIKE ' . $db->quote('%' . $keyword . '%') . ')'; } elseif ($defaultSearchType == "name_desc") { $defaultSearchField = "name_desc"; $defaultSearchType = '(p.product_name LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_desc LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_s_desc LIKE ' . $db->quote('%' . $keyword . '%') . ')'; } elseif ($defaultSearchType == "virtual_product_num") { $defaultSearchField = "virtual_product_num"; $defaultSearchType = '(pa.property_number LIKE ' . $db->quote('%' . $keyword . '%') . ' OR ps.subattribute_color_number LIKE ' . $db->quote('%' . $keyword . '%') . ')'; } elseif ($defaultSearchType == "name_number_desc") { $defaultSearchType = '(p.product_name LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_number LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_desc LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_s_desc LIKE ' . $db->quote('%' . $keyword . '%') . ' OR pa.property_number LIKE ' . $db->quote('%' . $keyword . '%') . ' OR ps.subattribute_color_number LIKE ' . $db->quote('%' . $keyword . '%') . ')'; } elseif ($defaultSearchType == "product_desc") { $defaultSearchField = $defaultSearchType; $defaultSearchType = '(p.' . $defaultSearchType . ' LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_s_desc LIKE ' . $db->quote('%' . $keyword . '%') . ' )'; } elseif ($defaultSearchType == "product_name") { $main_sp_name = explode(" ", $keyword); $defaultSearchField = $defaultSearchType; for ($f = 0; $f < count($main_sp_name); $f++) { $defaultSearchType1[] = " p.product_name LIKE " . $db->quote('%' . $main_sp_name[$f] . '%'); } $defaultSearchType = "(" . implode("AND", $defaultSearchType1) . ")"; } elseif ($defaultSearchType == "product_number") { $defaultSearchField = $defaultSearchType; $defaultSearchType = '(p.product_number LIKE ' . $db->quote('%' . $keyword . '%') . ')'; } $redconfig = $app->getParams(); $getorderby = urldecode(JRequest::getCmd('order_by', '')); if (in_array($getorderby, $this->filter_fields)) { $order_by = $getorderby; } else { $order_by = $redconfig->get('order_by', DEFAULT_PRODUCT_ORDERING_METHOD); } if ($order_by == 'pc.ordering ASC' || $order_by == 'c.ordering ASC') { $order_by = 'p.product_id DESC'; } $layout = JRequest::getVar('layout', 'default'); $category_helper = new product_category(); $producthelper = new producthelper(); $manufacture_id = JRequest::getInt('manufacture_id', 0); $category_id = JRequest::getInt('category_id', 0); $cat = $category_helper->getCategoryListArray(0, $category_id); $cat_group = array(); for ($j = 0; $j < count($cat); $j++) { $cat_group[$j] = $cat[$j]->category_id; if ($j == count($cat) - 1) { $cat_group[$j + 1] = $category_id; } } JArrayHelper::toInteger($cat_group); if ($cat_group) { $cat_group = join(',', $cat_group); } else { $cat_group = $category_id; } $params = JComponentHelper::getParams('com_redshop'); $menu = $app->getMenu(); $item = $menu->getActive(); $days = 0; $days = isset($item->query['newproduct']) ? $item->query['newproduct'] : 0; $today = date('Y-m-d H:i:s', time()); $days_before = date('Y-m-d H:i:s', time() - $days * 60 * 60 * 24); $aclProducts = $producthelper->loadAclProducts(); $whereaclProduct = ""; // Shopper group - choose from manufactures Start $rsUserhelper = new rsUserhelper(); $shopper_group_manufactures = $rsUserhelper->getShopperGroupManufacturers(); if ($shopper_group_manufactures != "") { // Sanitize ids $manufacturerIds = explode(',', $shopper_group_manufactures); JArrayHelper::toInteger($manufacturerIds); $whereaclProduct .= " AND p.manufacturer_id IN (" . implode(',', $manufacturerIds) . ") "; } // Shopper group - choose from manufactures End if ($aclProducts != "") { // Sanitize ids $productIds = explode(',', $aclProducts); JArrayHelper::toInteger($productIds); $whereaclProduct .= " AND p.product_id IN (" . implode(',', $productIds) . ") "; } if ($layout == 'productonsale') { $categoryid = $item->params->get('categorytemplate'); $cat_array = ""; $left_join = ""; if ($categoryid) { $cat_main = $category_helper->getCategoryTree($categoryid); $cat_group_main = array(); for ($j = 0; $j < count($cat_main); $j++) { $cat_group_main[$j] = $cat_main[$j]->category_id; } $cat_group_main[] = $categoryid; JArrayHelper::toInteger($cat_group_main); $cat_array = " AND pcx.category_id IN (" . implode(',', $cat_group_main) . ") AND pcx.product_id=p.product_id "; $left_join = " LEFT JOIN " . $this->_table_prefix . "product_category_xref pcx ON pcx.product_id=p.product_id "; } $query = " SELECT * FROM " . $this->_table_prefix . "product AS p " . $left_join . "WHERE p.published = 1 " . "AND p.product_on_sale=1 " . "AND p.expired=0 " . "AND p.product_parent_id=0 " . $whereaclProduct . $cat_array . " ORDER BY " . $db->escape($order_by); } elseif ($layout == 'featuredproduct') { $query = " SELECT * FROM " . $this->_table_prefix . "product AS p " . "WHERE p.published = 1 " . "AND p.product_special=1 " . $whereaclProduct . " ORDER BY " . $db->escape($order_by); } elseif ($layout == 'newproduct') { $catid = $item->query['categorytemplate']; $cat_main = $category_helper->getCategoryTree($catid); $cat_group_main = array(); for ($j = 0; $j < count($cat_main); $j++) { $cat_group_main[$j] = $cat_main[$j]->category_id; } $cat_group_main[] = $catid; JArrayHelper::toInteger($cat_group_main); $extracond = ""; if ($catid) { $extracond = " AND pcx.category_id in (" . implode(',', $cat_group_main) . ") AND pcx.product_id=p.product_id "; } $query = " SELECT distinct p.* " . " FROM " . $this->_table_prefix . "product p " . "LEFT JOIN " . $this->_table_prefix . "product_category_xref pcx ON pcx.product_id = p.product_id " . "WHERE p.published = 1 " . "and p.publish_date BETWEEN " . $db->quote($days_before) . " AND " . $db->quote($today) . " AND p.expired = 0 AND p.product_parent_id = 0 " . $whereaclProduct . $extracond . " ORDER BY " . $db->escape($order_by); } elseif ($layout == 'redfilter') { // Get products for filtering $products = $this->getRedFilterProduct(); $query = " SELECT * " . " FROM " . $this->_table_prefix . "product as p " . "WHERE p.published = 1 AND p.expired = 0 " . $whereaclProduct; if ($products != "") { // Sanitize ids $productIds = explode(',', $products); JArrayHelper::toInteger($productIds); $query .= "AND p.product_id IN ( " . implode(',', $productIds) . " ) "; } $query .= " ORDER BY " . $db->escape($order_by); } else { if ($manufacture_id == 0) { if (!empty($manudata['manufacturer_id'])) { $manufacture_id = $manudata['manufacturer_id']; } } $query = "SELECT distinct p.* " . " FROM " . $this->_table_prefix . "product as p "; if ($category_id != 0) { $query .= " LEFT JOIN " . $this->_table_prefix . "product_category_xref as pcx on p.product_id = pcx.product_id "; } if ($defaultSearchType_tmp == "name_number_desc" || $defaultSearchType_tmp == "virtual_product_num") { $query .= "LEFT JOIN " . $this->_table_prefix . "product_attribute AS a ON a.product_id = p.product_id " . "LEFT JOIN " . $this->_table_prefix . "product_attribute_property AS pa ON pa.attribute_id = a.attribute_id " . "LEFT JOIN " . $this->_table_prefix . "product_subattribute_color AS ps ON ps.subattribute_id = pa.property_id "; } $query .= " WHERE 1=1 AND p.expired = 0 " . $whereaclProduct; if ($category_id != 0) { // Sanitize ids $catIds = explode(',', $cat_group); JArrayHelper::toInteger($catIds); $query .= " AND pcx.category_id in (" . $cat_group . ")"; } if ($manufacture_id != 0) { $query .= " AND p.manufacturer_id =" . (int) $manufacture_id; } $query .= " AND " . $defaultSearchType . " AND p.published = 1" . " ORDER BY " . $db->escape($order_by); } return $query; }
/** * 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); }