Пример #1
0
 public function display($tpl = null)
 {
     $context = 'template_id';
     $uri = JFactory::getURI();
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSHOP_TEMPLATES'));
     JToolBarHelper::title(JText::_('COM_REDSHOP_TEMPLATES_MANAGEMENT'), 'redshop_templates48');
     JToolBarHelper::addNewX();
     JToolBarHelper::editListX();
     JToolBarHelper::customX('copy', 'copy.png', 'copy_f2.png', JText::_('COM_REDSHOP_TOOLBAR_COPY'), true);
     JToolBarHelper::deleteList();
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     $context = 'template';
     $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'template_id');
     $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
     $template_section = $app->getUserStateFromRequest($context . 'template_section', 'template_section', 0);
     $lists['order'] = $filter_order;
     $lists['order_Dir'] = $filter_order_Dir;
     $templates = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     $redtemplate = new Redtemplate();
     $optionsection = $redtemplate->getTemplateSections();
     $lists['section'] = JHTML::_('select.genericlist', $optionsection, 'template_section', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $template_section);
     $this->user = JFactory::getUser();
     $this->lists = $lists;
     $this->templates = $templates;
     $this->pagination = $pagination;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
Пример #2
0
 public function display($tpl = null)
 {
     $context = 'field_id';
     $uri = JFactory::getURI();
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSHOP_FIELDS'));
     JToolBarHelper::title(JText::_('COM_REDSHOP_FIELDS_MANAGEMENT'), 'redshop_fields48');
     JToolBarHelper::addNewX();
     JToolBarHelper::editListX();
     JToolBarHelper::deleteList();
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     $fields = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     $redtemplate = new Redtemplate();
     $optiontype = $redtemplate->getFieldTypeSections();
     $optionsection = $redtemplate->getFieldSections();
     $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'field_id');
     $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
     $filtertypes = $app->getUserStateFromRequest($context . 'filtertypes', 'filtertypes', 0);
     $filtersection = $app->getUserStateFromRequest($context . 'filtertypes', 'filtersection', 0);
     $lists['order'] = $filter_order;
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['type'] = JHTML::_('select.genericlist', $optiontype, 'filtertypes', 'class="inputbox" size="1" onchange="document.adminForm.submit();" ', 'value', 'text', $filtertypes);
     $lists['section'] = JHTML::_('select.genericlist', $optionsection, 'filtersection', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $filtersection);
     $this->lists = $lists;
     $this->fields = $fields;
     $this->pagination = $pagination;
     parent::display($tpl);
 }
Пример #3
0
 public function display($tpl = null)
 {
     $context = 'mail_id';
     $uri = JFactory::getURI();
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSHOP_MAIL'));
     jimport('joomla.html.pagination');
     JToolBarHelper::title(JText::_('COM_REDSHOP_MAIL_MANAGEMENT'), 'redshop_mailcenter48');
     JToolBarHelper::addNewX();
     JToolBarHelper::editListX();
     JToolBarHelper::deleteList();
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'm.mail_id');
     $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
     $filter_section = $app->getUserStateFromRequest($context . 'filter_section', 'filter_section', 0);
     $lists['order'] = $filter_order;
     $lists['order_Dir'] = $filter_order_Dir;
     $redtemplate = new Redtemplate();
     $optionsection = $redtemplate->getMailSections();
     $lists['mailsection'] = JHTML::_('select.genericlist', $optionsection, 'filter_section', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $filter_section);
     $total = $this->get('Total');
     $media = $this->get('Data');
     $pagination = $this->get('Pagination');
     $this->user = JFactory::getUser();
     $this->lists = $lists;
     $this->media = $media;
     $this->pagination = $pagination;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
Пример #4
0
 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);
 }
Пример #5
0
 public function getProductTemplate()
 {
     $redTemplate = new Redtemplate();
     if (empty($this->_template)) {
         $this->_template = $redTemplate->getTemplate("product", $this->_data->product_template);
         $this->_template = $this->_template[0];
     }
     return $this->_template;
 }
Пример #6
0
 public function getGiftcardTemplate()
 {
     $redTemplate = new Redtemplate();
     if (!$this->_id) {
         $carttemplate = $redTemplate->getTemplate("giftcard_list");
     } else {
         $carttemplate = $redTemplate->getTemplate("giftcard");
     }
     return $carttemplate;
 }
Пример #7
0
 public function display($tpl = null)
 {
     $extra_field = new extra_field();
     $option = JRequest::getVar('option', '', 'request', 'string');
     JToolBarHelper::title(JText::_('COM_REDSHOP_FIELDS_MANAGEMENT_DETAIL'), 'redshop_fields48');
     $document = JFactory::getDocument();
     $document->addScript('components/' . $option . '/assets/js/fields.js');
     $uri = JFactory::getURI();
     $this->setLayout('default');
     $lists = array();
     $detail = $this->get('data');
     $filed_data = $extra_field->getFieldValue($detail->field_id);
     $isNew = $detail->field_id < 1;
     $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT');
     JToolBarHelper::title(JText::_('COM_REDSHOP_FIELDS') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_fields48');
     JToolBarHelper::apply();
     JToolBarHelper::save();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE'));
     }
     $redtemplate = new Redtemplate();
     $optiontype = $redtemplate->getFieldTypeSections();
     $optionsection = $redtemplate->getFieldSections();
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->published);
     $lists['show_in_front'] = JHTML::_('select.booleanlist', 'field_show_in_front', 'class="inputbox"', $detail->field_show_in_front);
     $lists['display_in_product'] = JHTML::_('select.booleanlist', 'display_in_product', 'class="inputbox"', $detail->display_in_product);
     $lists['display_in_checkout'] = JHTML::_('select.booleanlist', 'display_in_checkout', 'class="inputbox"', $detail->display_in_checkout);
     $lists['required'] = JHTML::_('select.booleanlist', 'required', 'class="inputbox"', $detail->required);
     $lists['type'] = JHTML::_('select.genericlist', $optiontype, 'field_type', 'class="inputbox" size="1" onchange="field_select(this.value)" ', 'value', 'text', $detail->field_type);
     $disable = "";
     if ($detail->field_type == 15) {
         $disable = "disabled='disabled' ";
     }
     $lists['section'] = JHTML::_('select.genericlist', $optionsection, 'field_section', 'class="inputbox" size="1" ' . $disable . ' onchange="sectionValidation(this.value)"', 'value', 'text', $detail->field_section);
     $lists['extra_data'] = $filed_data;
     $this->lists = $lists;
     $this->detail = $detail;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
Пример #8
0
 public function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('COM_REDSHOP_MAIL_MANAGEMENT_DETAIL'), 'redshop_mailcenter48');
     $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->mail_id < 1;
     $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT');
     JToolBarHelper::title(JText::_('COM_REDSHOP_MAIL') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_mailcenter48');
     JToolBarHelper::apply();
     JToolBarHelper::save();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE'));
     }
     $model = $this->getModel('mail_detail');
     if ($detail->mail_section == 'order_status' && $detail->mail_section != '0') {
         $order_status = $model->mail_section();
         $select = array();
         $select[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_Select'));
         $merge = array_merge($select, $order_status);
         $lists['order_status'] = JHTML::_('select.genericlist', $merge, 'mail_order_status', 'class="inputbox" size="1" title="" ', 'value', 'text', $detail->mail_order_status);
     }
     $redtemplate = new Redtemplate();
     $optiontype = $redtemplate->getMailSections();
     $lists['type'] = JHTML::_('select.genericlist', $optiontype, 'mail_section', 'class="inputbox" size="1" onchange="mail_select(this)" ', 'value', 'text', $detail->mail_section);
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->published);
     $pane = JPane::getInstance('sliders');
     $this->pane = $pane;
     $this->lists = $lists;
     $this->detail = $detail;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
Пример #9
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     // Request variables
     $redTemplate = new Redtemplate();
     $user = JFactory::getUser();
     $session = JFactory::getSession();
     $cart = $session->get('cart');
     $layout = JRequest::getCmd('layout');
     if (!$cart) {
         $cart = array();
     }
     $Itemid = JRequest::getInt('Itemid');
     if (JRequest::getString('quotemsg') != "") {
         $app->Redirect('index.php?option=com_redshop&view=cart&Itemid=' . $Itemid, JRequest::getString('quotemsg'));
     }
     JHTML::Script('common.js', 'components/com_redshop/assets/js/', false);
     if (!array_key_exists("idx", $cart) || array_key_exists("idx", $cart) && $cart['idx'] < 1) {
         $cart_data = $redTemplate->getTemplate("empty_cart");
         if (count($cart_data) > 0 && $cart_data[0]->template_desc != "") {
             $cart_template = $cart_data[0]->template_desc;
         } else {
             $cart_template = JText::_("COM_REDSHOP_EMPTY_CART");
         }
         echo eval("?>" . $cart_template . "<?php ");
         return false;
     }
     $Discount = $this->get('DiscountId');
     $data = $this->get('data');
     if ($layout == 'change_attribute') {
         $this->setLayout('change_attribute');
     }
     $this->Discount = $Discount;
     $this->cart = $cart;
     $this->data = $data;
     parent::display($tpl);
 }
Пример #10
0
 /**
  * Generate product search output
  */
 public function onRSProductSearch()
 {
     if (count($this->search) > 0) {
         $app = JFactory::getApplication();
         require_once JPATH_COMPONENT . '/helpers/product.php';
         require_once JPATH_COMPONENT . '/helpers/pagination.php';
         require_once JPATH_COMPONENT . '/helpers/extra_field.php';
         require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/text_library.php';
         $dispatcher = JDispatcher::getInstance();
         $redTemplate = new Redtemplate();
         $Redconfiguration = new Redconfiguration();
         $producthelper = new producthelper();
         $extraField = new extraField();
         $texts = new text_library();
         $stockroomhelper = new rsstockroomhelper();
         $Itemid = JRequest::getInt('Itemid');
         $search_type = JRequest::getCmd('search_type');
         $cid = JRequest::getInt('category_id');
         $manisrch = $this->search;
         $manufacture_id = $manisrch[0]->manufacturer_id;
         $templateid = JRequest::getInt('templateid');
         // Cmd removes space between to words
         $keyword = JRequest::getWord('keyword');
         $layout = JRequest::getCmd('layout', 'default');
         $db = JFactory::getDbo();
         $query = 'SELECT category_name' . ' FROM #__redshop_category  ' . 'WHERE category_id=' . JRequest::getInt('cid');
         $db->setQuery($query);
         $cat_name = null;
         if ($catname_array = $db->loadObjectList()) {
             $cat_name = $catname_array[0]->category_name;
         }
         $session = JFactory::getSession();
         $model = $this->getModel('search');
         $limit = $this->limit;
         $limitstart = JRequest::getInt('limitstart', 0);
         $total = $model->_total;
         JHTML::_('behavior.tooltip');
         JHTMLBehavior::modal();
         $url = JURI::base();
         if ($this->params->get('page_title') != "") {
             $pagetitle = $this->params->get('page_title');
         } else {
             $pagetitle = JText::_('COM_REDSHOP_SEARCH');
         }
         if ($this->params->get('show_page_heading', 1)) {
             echo '<h1 class="componentheading' . $this->escape($this->params->get('pageclass_sfx')) . '">';
             echo $pagetitle;
             echo '</h1>';
         }
         echo '<div style="clear:both"></div>';
         $category_tmpl = "";
         if (count($this->templatedata) > 0 && $this->templatedata[0]->template_desc != "") {
             $template_desc = $this->templatedata[0]->template_desc;
         } else {
             $template_desc = "<div class=\"category_print\">{print}</div>\r\n<div style=\"clear: both;\"></div>\r\n<div class=\"category_main_description\">{category_main_description}</div>\r\n<p>{if subcats} {category_loop_start}</p>\r\n<div id=\"categories\">\r\n<div style=\"float: left; width: 200px;\">\r\n<div class=\"category_image\">{category_thumb_image}</div>\r\n<div class=\"category_description\">\r\n<h2 class=\"category_title\">{category_name}</h2>\r\n{category_description}</div>\r\n</div>\r\n</div>\r\n<p>{category_loop_end} {subcats end if}</p>\r\n<div style=\"clear: both;\"></div>\r\n<div id=\"category_header\">\r\n<div class=\"category_order_by\">{order_by}</div>\r\n</div>\r\n<div class=\"category_box_wrapper\">{product_loop_start}\r\n<div class=\"category_box_outside\">\r\n<div class=\"category_box_inside\">\r\n<div class=\"category_product_image\">{product_thumb_image}</div>\r\n<div class=\"category_product_title\">\r\n<h3>{product_name}</h3>\r\n</div>\r\n<div class=\"category_product_price\">{product_price}</div>\r\n<div class=\"category_product_readmore\">{read_more}</div>\r\n<div>{product_rating_summary}</div>\r\n<div class=\"category_product_addtocart\">{form_addtocart:add_to_cart1}</div>\r\n</div>\r\n</div>\r\n{product_loop_end}\r\n<div class=\"category_product_bottom\" style=\"clear: both;\"></div>\r\n</div>\r\n<div class=\"category_pagination\">{pagination}</div>";
         }
         if (strstr($template_desc, "{product_display_limit}")) {
             $endlimit = $model->getProductPerPage();
             $limit = JRequest::getInt('limit', $endlimit, '', 'int');
         }
         $template_org = $template_desc;
         $template_d1 = explode("{category_loop_start}", $template_org);
         if (count($template_d1) > 1) {
             $template_d2 = explode("{category_loop_end}", $template_d1[1]);
             if (count($template_d2) > 0) {
                 $category_tmpl = $template_d2[0];
             }
         }
         $template_org = str_replace($category_tmpl, "", $template_org);
         $template_org = str_replace("{category_loop_start}", "", $template_org);
         $template_org = str_replace("{category_loop_end}", "", $template_org);
         $print = JRequest::getInt('print');
         $p_url = @explode('?', $_SERVER['REQUEST_URI']);
         $print_tag = '';
         if ($print) {
             $print_tag = "<a onclick='window.print();' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' ><img src=" . JSYSTEM_IMAGES_PATH . "printButton.png  alt='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' /></a>";
         } else {
             $print_url = $url . "index.php?option=com_redshop&view=search&print=1&tmpl=component";
             $print_tag = "<a href='#' onclick='window.open(\"{$print_url}\",\"mywindow\",\"scrollbars=1\",\"location=1\")' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' ><img src=" . JSYSTEM_IMAGES_PATH . "printButton.png  alt='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' /></a>";
         }
         $template_org = str_replace("{total_product}", count($this->search), $template_org);
         $template_org = str_replace("{total_product_lbl}", JText::_('COM_REDSHOP_TOTAL_PRODUCT'), $template_org);
         if (strstr($template_org, "{compare_product_div}")) {
             $compare_product_div = "";
             if (PRODUCT_COMPARISON_TYPE != "") {
                 $comparediv = $producthelper->makeCompareProductDiv();
                 $compareUrl = JRoute::_('index.php?option=com_redshop&view=product&layout=compare&Itemid=' . $Itemid);
                 $compare_product_div = "<form name='frmCompare' method='post' action='" . $compareUrl . "' >";
                 $compare_product_div .= "<a href='javascript:compare();' >" . JText::_('COM_REDSHOP_COMPARE') . "</a>";
                 $compare_product_div .= "<div id='divCompareProduct'>" . $comparediv . "</div>";
                 $compare_product_div .= "</form>";
             }
             $template_org = str_replace("{compare_product_div}", $compare_product_div, $template_org);
         }
         // Skip html if nosubcategory
         if (strstr($template_org, "{if subcats}")) {
             $template_d1 = explode("{if subcats}", $template_org);
             $template_d2 = explode("{subcats end if}", $template_d1[1]);
             $template_org = $template_d1[0] . $template_d2[1];
         }
         // End skip html if nosubcategory
         $template_org = str_replace("{print}", $print_tag, $template_org);
         $template_org = str_replace("{product_price_slider}", '', $template_org);
         $template_org = str_replace("{filter_by}", '', $template_org);
         $template_org = str_replace("{template_selector_category_lbl}", '', $template_org);
         $template_org = str_replace("{template_selector_category}", '', $template_org);
         $template_org = str_replace("{category_main_description}", '', $template_org);
         $template_org = str_replace("{category_main_name}", $cat_name, $template_org);
         $template_org = str_replace("{category_description}", '', $template_org);
         $template_org = str_replace("{category_short_desc}", '', $template_org);
         $template_org = str_replace("{category_name}", '', $template_org);
         $template_org = str_replace("{if subcats}", '', $template_org);
         $template_org = str_replace("{subcats end if}", '', $template_org);
         $template_org = str_replace("{category_main_thumb_image_3}", '', $template_org);
         $template_org = str_replace("{category_main_short_desc}", '', $template_org);
         $template_org = str_replace("{category_main_thumb_image_2}", '', $template_org);
         $template_org = str_replace("{category_main_thumb_image_1}", '', $template_org);
         $template_org = str_replace("{category_main_thumb_image}", '', $template_org);
         $template_org = str_replace("{attribute_price_without_vat}", '', $template_org);
         $template_org = str_replace("{redproductfinderfilter_formstart}", '', $template_org);
         $template_org = str_replace("{redproductfinderfilter:rp_myfilter}", '', $template_org);
         $template_org = str_replace("{redproductfinderfilter_formend}", '', $template_org);
         // Replace redproductfilder filter tag
         if (strstr($template_org, "{redproductfinderfilter:")) {
             $redProductFinerHelper = JPATH_SITE . "/components/com_redproductfinder/helpers/redproductfinder_helper.php";
             if (file_exists($redProductFinerHelper)) {
                 include_once $redProductFinerHelper;
                 $redproductfinder_helper = new redproductfinder_helper();
                 $hdnFields = array('texpricemin' => '0', 'texpricemax' => '0', 'manufacturer_id' => $filter_by, 'category_template' => $templateid);
                 $hide_filter_flag = false;
                 if ($this->_id) {
                     $prodctofcat = $producthelper->getProductCategory($this->_id);
                     if (empty($prodctofcat)) {
                         $hide_filter_flag = true;
                     }
                 }
                 $template_org = $redproductfinder_helper->replaceProductfinder_tag($template_org, $hdnFields, $hide_filter_flag);
             }
         }
         // Replace redproductfilder filter tag end here
         $template_d1 = explode("{product_loop_start}", $template_org);
         $template_d2 = explode("{product_loop_end}", $template_d1[1]);
         $template_tmp_desc = $template_d2[0];
         $template_desc = $template_d2[0];
         // Order By
         $order_by = "";
         $orderby_form = "<form name='orderby_form' action='' method='post' >";
         $orderby_form .= $this->lists['order_select'];
         $orderby_form .= "<input type='hidden' name='view' value='search'>\n\t\t\t<input type='hidden' name='layout' value='{$layout}'>\n\t\t\t<input type='hidden' name='keyword' value='{$keyword}'>\n\t\t\t<input type='hidden' name='category_id' value='{$cid}'>\n\t\t\t<input type='hidden' name='manufacture_id' value='{$manufacture_id}'>\n\t\t\t<input type='hidden' name='templateid' value='{$templateid}'></form>";
         if (strstr($template_desc, '{order_by}')) {
             $order_by = $orderby_form;
         }
         $extraFieldName = $extraField->getSectionFieldNameArray(1, 1, 1);
         $attribute_template = $producthelper->getAttributeTemplate($template_desc);
         $total_product = $model->_total;
         $endlimit = $this->limit;
         $start = JRequest::getInt('limitstart', 0, '', 'int');
         if (strstr($template_org, "{pagination}")) {
             if (strstr($template_org, "{product_display_limit}")) {
                 $endlimit = JRequest::getInt('limit', $endlimit, '', 'int');
             }
         } else {
             $endlimit = $model->getData();
         }
         if ($endlimit == 0) {
             $final_endlimit = $total_product;
         } else {
             $final_endlimit = $endlimit;
         }
         $tagarray = $texts->getTextLibraryTagArray();
         $data = "";
         $count_no_user_field = 0;
         for ($i = 0; $i < count($this->search); $i++) {
             $data_add = "";
             $thum_image = "";
             $pname = $Redconfiguration->maxchar($this->search[$i]->product_name, CATEGORY_PRODUCT_TITLE_MAX_CHARS, CATEGORY_PRODUCT_TITLE_END_SUFFIX);
             if ($search_type == 'product_number') {
                 $product_number = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $this->search[$i]->product_number);
                 $pro_s_desc = $this->search[$i]->product_s_desc;
                 $pro_desc = $this->search[$i]->product_desc;
             } else {
                 $product_number = $this->search[$i]->product_number;
                 $pro_s_desc = $this->search[$i]->product_s_desc;
                 $pro_desc = $this->search[$i]->product_desc;
                 if (!in_array($keyword, $tagarray)) {
                     $pname = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $pname);
                     $pro_s_desc = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $pro_s_desc);
                     $pro_desc = str_ireplace($keyword, "<b class='search_hightlight'>" . $keyword . "</b>", $pro_desc);
                 }
             }
             $pro_s_desc = $Redconfiguration->maxchar($pro_s_desc, CATEGORY_PRODUCT_DESC_MAX_CHARS, CATEGORY_PRODUCT_DESC_END_SUFFIX);
             $link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $this->search[$i]->product_id . '&Itemid=' . $Itemid);
             if (strstr($template_desc, '{product_name}')) {
                 $pname = "<a href='" . $link . "'>" . $pname . "</a>";
                 $data_add = str_replace("{product_name}", $pname, $template_desc);
             }
             if (strstr($template_desc, '{product_name_nolink}')) {
                 $data_add = str_replace("{product_name_nolink}", $pname, $template_desc);
             }
             $readmore = "<a href='" . $link . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>";
             $data_add = str_replace("{read_more}", $readmore, $data_add);
             $data_add = str_replace("{read_more_link}", $link, $data_add);
             // RedSHOP Product Plugin
             JPluginHelper::importPlugin('redshop_product');
             $results = $dispatcher->trigger('onPrepareProduct', array(&$data_add, &$params, $this->search[$i]));
             // End
             if (strstr($data_add, "{product_delivery_time}")) {
                 $product_delivery_time = $producthelper->getProductMinDeliveryTime($this->search[$i]->product_id);
                 if ($product_delivery_time != "") {
                     $data_add = str_replace("{delivery_time_lbl}", JText::_('DELIVERY_TIME'), $data_add);
                     $data_add = str_replace("{product_delivery_time}", $product_delivery_time, $data_add);
                 } else {
                     $data_add = str_replace("{delivery_time_lbl}", "", $data_add);
                     $data_add = str_replace("{product_delivery_time}", "", $data_add);
                 }
             }
             // Product Review/Rating
             // Fetching reviews
             $final_avgreview_data = $producthelper->getProductRating($this->search[$i]->product_id);
             // Attribute ajax chage
             $data_add = str_replace("{product_rating_summary}", $final_avgreview_data, $data_add);
             $data_add = $producthelper->getJcommentEditor($this->search[$i], $data_add);
             $data_add = $producthelper->getExtraSectionTag($extraFieldName, $this->search[$i]->product_id, "1", $data_add, 1);
             $data_add = str_replace("{product_s_desc}", $pro_s_desc, $data_add);
             $data_add = str_replace("{product_desc}", $pro_desc, $data_add);
             $data_add = str_replace("{product_id_lbl}", JText::_('COM_REDSHOP_PRODUCT_ID_LBL'), $data_add);
             $data_add = str_replace("{product_id}", $this->search[$i]->product_id, $data_add);
             $data_add = str_replace("{product_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER_LBL'), $data_add);
             $data_add = str_replace("{product_number}", $product_number, $data_add);
             /**
              * related Product List in Lightbox
              * Tag Format = {related_product_lightbox:<related_product_name>[:width][:height]}
              */
             if (strstr($data_add, '{related_product_lightbox:')) {
                 $related_product = $producthelper->getRelatedProduct($this->search[$i]->product_id);
                 $rtlnone = explode("{related_product_lightbox:", $data_add);
                 $rtlntwo = explode("}", $rtlnone[1]);
                 $rtlnthree = explode(":", $rtlntwo[0]);
                 $rtln = $rtlnthree[0];
                 $rtlnfwidth = isset($rtlnthree[1]) ? $rtlnthree[1] : "900";
                 $rtlnwidthtag = isset($rtlnthree[1]) ? ":" . $rtlnthree[1] : "";
                 $rtlnfheight = isset($rtlnthree[2]) ? $rtlnthree[2] : "600";
                 $rtlnheighttag = isset($rtlnthree[2]) ? ":" . $rtlnthree[2] : "";
                 $rtlntag = "{related_product_lightbox:{$rtln}{$rtlnwidthtag}{$rtlnheighttag}}";
                 if (count($related_product) > 0) {
                     $linktortln = JUri::root() . "index.php?option=com_redshop&view=product&pid=" . $this->search[$i]->product_id . "&tmpl=component&template=" . $rtln . "&for=rtln";
                     $rtlna = '<a class="modal" href="' . $linktortln . '" rel="{handler:\'iframe\',size:{x:' . $rtlnfwidth . ',y:' . $rtlnfheight . '}}" >' . JText::_('COM_REDSHOP_RELATED_PRODUCT_LIST_IN_LIGHTBOX') . '</a>';
                 } else {
                     $rtlna = "";
                 }
                 $data_add = str_replace($rtlntag, $rtlna, $data_add);
             }
             $data_add = $producthelper->replaceVatinfo($data_add);
             /************************************
              *  Conditional tag
              *  if product on discount : Yes
              *  {if product_on_sale} This product is on sale {product_on_sale end if} // OUTPUT : This product is on sale
              *  NO : // OUTPUT : Display blank
              ************************************/
             $data_add = $producthelper->getProductOnSaleComment($this->search[$i], $data_add);
             $data_add = $stockroomhelper->replaceStockroomAmountDetail($data_add, $this->search[$i]->product_id);
             if (strstr($data_add, "{product_thumb_image_3}")) {
                 $cimg_tag = '{product_thumb_image_3}';
                 $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT_3;
                 $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH_3;
             } elseif (strstr($data_add, "{product_thumb_image_2}")) {
                 $cimg_tag = '{product_thumb_image_2}';
                 $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT_2;
                 $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH_2;
             } elseif (strstr($data_add, "{product_thumb_image_1}")) {
                 $cimg_tag = '{product_thumb_image_1}';
                 $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT;
                 $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH;
             } else {
                 $cimg_tag = '{product_thumb_image}';
                 $ch_thumb = CATEGORY_PRODUCT_THUMB_HEIGHT;
                 $cw_thumb = CATEGORY_PRODUCT_THUMB_WIDTH;
             }
             $hidden_thumb_image = "<input type='hidden' name='prd_main_imgwidth' id='prd_main_imgwidth' value='" . $cw_thumb . "'><input type='hidden' name='prd_main_imgheight' id='prd_main_imgheight' value='" . $ch_thumb . "'>";
             $thum_image = $producthelper->getProductImage($this->search[$i]->product_id, $link, $cw_thumb, $ch_thumb);
             $data_add = str_replace($cimg_tag, $thum_image . $hidden_thumb_image, $data_add);
             // More documents
             if (strstr($data_add, "{more_documents}")) {
                 $media_documents = $producthelper->getAdditionMediaImage($this->search[$i]->product_id, "product", "document");
                 $more_doc = '';
                 for ($m = 0; $m < count($media_documents); $m++) {
                     $alttext = $producthelper->getAltText("product", $media_documents[$m]->section_id, "", $media_documents[$m]->media_id, "document");
                     if (!$alttext) {
                         $alttext = $media_documents[$m]->media_name;
                     }
                     if (is_file(REDSHOP_FRONT_DOCUMENT_RELPATH . "product/" . $media_documents[$m]->media_name)) {
                         $downlink = JUri::root() . 'index.php?tmpl=component&option=com_redshop&view=product&pid=' . $this->search[$i]->product_id . '&task=downloadDocument&fname=' . $media_documents[$m]->media_name . '&Itemid=' . $Itemid;
                         $more_doc .= "<div><a href='" . $downlink . "' title='" . $alttext . "'>";
                         $more_doc .= $alttext;
                         $more_doc .= "</a></div>";
                     }
                 }
                 $data_add = str_replace("{more_documents}", "<span id='additional_docs" . $this->search[$i]->product_id . "'>" . $more_doc . "</span>", $data_add);
             }
             // More documents end
             /************************************************ user fields*******************************************************/
             $hidden_userfield = "";
             $returnArr = $producthelper->getProductUserfieldFromTemplate($data_add);
             $template_userfield = $returnArr[0];
             $userfieldArr = $returnArr[1];
             $count_no_user_field = 0;
             if ($template_userfield != "") {
                 $ufield = "";
                 for ($ui = 0; $ui < count($userfieldArr); $ui++) {
                     $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', '', 0, $this->search[$i]->product_id);
                     $ufield .= $product_userfileds[1];
                     if ($product_userfileds[1] != "") {
                         $count_no_user_field++;
                     }
                     $data_add = str_replace('{' . $userfieldArr[$ui] . '_lbl}', $product_userfileds[0], $data_add);
                     $data_add = str_replace('{' . $userfieldArr[$ui] . '}', $product_userfileds[1], $data_add);
                 }
                 $product_userfileds_form = "<form method='post' action='' id='user_fields_form_" . $this->search[$i]->product_id . "' name='user_fields_form_" . $this->search[$i]->product_id . "'>";
                 if ($ufield != "") {
                     $data_add = str_replace("{if product_userfield}", $product_userfileds_form, $data_add);
                     $data_add = str_replace("{product_userfield end if}", "</form>", $data_add);
                 } else {
                     $data_add = str_replace("{if product_userfield}", "", $data_add);
                     $data_add = str_replace("{product_userfield end if}", "", $data_add);
                 }
             } elseif (AJAX_CART_BOX) {
                 $ajax_detail_template_desc = "";
                 $ajax_detail_template = $producthelper->getAjaxDetailboxTemplate($this->search[$i]);
                 if (count($ajax_detail_template) > 0) {
                     $ajax_detail_template_desc = $ajax_detail_template->template_desc;
                 }
                 $returnArr = $producthelper->getProductUserfieldFromTemplate($ajax_detail_template_desc);
                 $template_userfield = $returnArr[0];
                 $userfieldArr = $returnArr[1];
                 if ($template_userfield != "") {
                     $ufield = "";
                     for ($ui = 0; $ui < count($userfieldArr); $ui++) {
                         $product_userfileds = $extraField->list_all_user_fields($userfieldArr[$ui], 12, '', '', 0, $this->search[$i]->product_id);
                         $ufield .= $product_userfileds[1];
                         if ($product_userfileds[1] != "") {
                             $count_no_user_field++;
                         }
                         $template_userfield = str_replace('{' . $userfieldArr[$ui] . '_lbl}', $product_userfileds[0], $template_userfield);
                         $template_userfield = str_replace('{' . $userfieldArr[$ui] . '}', $product_userfileds[1], $template_userfield);
                     }
                     if ($ufield != "") {
                         $hidden_userfield = "<div style='display:none;'><form method='post' action='' id='user_fields_form_" . $this->search[$i]->product_id . "' name='user_fields_form_" . $this->search[$i]->product_id . "'>" . $template_userfield . "</form></div>";
                     }
                 }
             }
             $data_add = $data_add . $hidden_userfield;
             /*************** end user fields ***************/
             // ProductFinderDatepicker Extra Field Start
             $fieldArray = $extraField->getSectionFieldList(17, 0, 0);
             $data_add = $producthelper->getProductFinderDatepickerValue($data_add, $this->search[$i]->product_id, $fieldArray);
             // ProductFinderDatepicker Extra Field End
             /*
              * manufacturer data
              */
             $manufacturer_id = $this->search[$i]->manufacturer_id;
             if ($manufacturer_id != 0) {
                 $manufacturer_data = $producthelper->getSection("manufacturer", $manufacturer_id);
                 $manufacturer_link_href = JRoute::_('index.php?option=com_redshop&view=manufacturers&layout=detail&mid=' . $manufacturer_id . '&Itemid=' . $Itemid);
                 $manufacturer_name = "";
                 if (count($manufacturer_data) > 0) {
                     $manufacturer_name = $manufacturer_data->manufacturer_name;
                 }
                 $manufacturer_link = '<a href="' . $manufacturer_link_href . '" title="' . $manufacturer_name . '">' . $manufacturer_name . '</a>';
                 if (strstr($data_add, "{manufacturer_link}")) {
                     $data_add = str_replace("{manufacturer_name}", "", $data_add);
                 } else {
                     $data_add = str_replace("{manufacturer_name}", $manufacturer_name, $data_add);
                 }
                 $data_add = str_replace("{manufacturer_link}", $manufacturer_link, $data_add);
             } else {
                 $data_add = str_replace("{manufacturer_link}", "", $data_add);
                 $data_add = str_replace("{manufacturer_name}", "", $data_add);
             }
             // End
             // Replace wishlistbutton
             $data_add = $producthelper->replaceWishlistButton($this->search[$i]->product_id, $data_add);
             // Replace compare product button
             $data_add = $producthelper->replaceCompareProductsButton($this->search[$i]->product_id, 0, $data_add);
             // Checking for child products
             $childproduct = $producthelper->getChildProduct($this->search[$i]->product_id);
             if (count($childproduct) > 0) {
                 $isChilds = true;
                 $attributes = array();
             } else {
                 $isChilds = false;
                 // Get attributes
                 $attributes_set = array();
                 if ($this->search[$i]->attribute_set_id > 0) {
                     $attributes_set = $producthelper->getProductAttribute(0, $this->search[$i]->attribute_set_id, 0, 1);
                 }
                 $attributes = $producthelper->getProductAttribute($this->search[$i]->product_id);
                 $attributes = array_merge($attributes, $attributes_set);
             }
             // Product attribute  Start
             $totalatt = count($attributes);
             // Check product for not for sale
             $data_add = $producthelper->getProductNotForSaleComment($this->search[$i], $data_add, $attributes);
             $data_add = $producthelper->replaceProductInStock($this->search[$i]->product_id, $data_add, $attributes, $attribute_template);
             $data_add = $producthelper->replaceAttributeData($this->search[$i]->product_id, 0, 0, $attributes, $data_add, $attribute_template, $isChilds);
             // Cart Template
             $data_add = $producthelper->replaceCartTemplate($this->search[$i]->product_id, 0, 0, 0, $data_add, $isChilds, $userfieldArr, $totalatt, 0, $count_no_user_field, "");
             $data .= $data_add;
         }
         $app = JFactory::getApplication();
         $router = $app->getRouter();
         $getorderby = JRequest::getVar('order_by', DEFAULT_PRODUCT_ORDERING_METHOD);
         $vars = array('option' => 'com_redshop', 'view' => 'search', 'layout' => $layout, 'keyword' => $keyword, 'manufacture_id' => $manufacture_id, 'order_by' => $getorderby, 'category_id' => $cid, 'Itemid' => $Itemid, 'limit' => $limit);
         $router->setVars($vars);
         unset($vars);
         if (strstr($template_org, "{pagination}")) {
             $pagination = new redPagination($total_product, $start, $endlimit);
             $slidertag = $pagination->getPagesLinks();
             if (strstr($template_org, "{product_display_limit}")) {
                 $slidertag = "<form action='' method='post'><input type='hidden' name='keyword' value='{$keyword}'>\n\t\t\t<input type='hidden' name='category_id' value='{$cid}'>\n\t\t\t<input type='hidden' name='manufacture_id' value='{$manufacture_id}'>\n\t\t\t<input type='hidden' name='templateid' value='{$templateid}'> " . $pagination->getListFooter() . "</form>";
                 $template_org = str_replace("{product_display_limit}", $slidertag, $template_org);
                 $template_org = str_replace("{pagination}", '', $template_org);
             }
             $template_org = str_replace("{pagination}", $slidertag, $template_org);
         }
         $template_org = str_replace("{product_display_limit}", "", $template_org);
         if (strstr($template_org, "perpagelimit:")) {
             $perpage = explode('{perpagelimit:', $template_org);
             $perpage = explode('}', $perpage[1]);
             $template_org = str_replace("{perpagelimit:" . intval($perpage[0]) . "}", "", $template_org);
         }
         $template_org = str_replace("{order_by}", $orderby_form, $template_org);
         $template_org = str_replace("{order_by_lbl}", JText::_('COM_REDSHOP_SELECT_ORDER_BY'), $template_org);
         $template_org = str_replace("{filter_by_lbl}", JText::_('COM_REDSHOP_SELECT_FILTER_BY'), $template_org);
         $template_org = str_replace("{attribute_price_with_vat}", "", $template_org);
         $template_org = str_replace("{attribute_price_without_vat}", "", $template_org);
         $template_org = str_replace("{product_loop_start}", "", $template_org);
         $template_org = str_replace("{product_loop_end}", "", $template_org);
         $template_org = str_replace($template_tmp_desc, $data, $template_org);
         $template_org = str_replace("{with_vat}", "", $template_org);
         $template_org = str_replace("{without_vat}", "", $template_org);
         $template_org = $redTemplate->parseredSHOPplugin($template_org);
         $template_org = $texts->replace_texts($template_org);
         eval("?>" . $template_org . "<?php ");
     } else {
         echo "<br><h3>" . JText::_('COM_REDSHOP_MSG_SORRY_NO_RESULT_FOUND') . "</h3>";
     }
 }
Пример #11
0
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
$uri = JURI::getInstance();
$url = JURI::base();
$redconfig = new Redconfiguration();
$extra_field = new extra_field();
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/shipping.php';
require_once JPATH_COMPONENT . '/helpers/product.php';
require_once JPATH_COMPONENT . '/helpers/helper.php';
require_once JPATH_COMPONENT . '/helpers/cart.php';
$producthelper = new producthelper();
$redhelper = new redhelper();
$order_functions = new order_functions();
$redTemplate = new Redtemplate();
$shippinghelper = new shipping();
$carthelper = new rsCarthelper();
$Itemid = JRequest::getInt('Itemid');
$oid = JRequest::getInt('oid');
$print = JRequest::getInt('print');
$getshm = $uri->getScheme();
$config = JFactory::getConfig();
$force_ssl = $config->getValue('force_ssl');
if ($getshm == 'https' && $force_ssl > 2) {
    $uri->setScheme('http');
}
?>
	<script type="text/javascript">
		function submitReorder() {
			if (!confirm("<?php 
Пример #12
0
/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
JHTMLBehavior::modal();
$objhelper = new redhelper();
$config = new Redconfiguration();
$producthelper = new producthelper();
$extraField = new extraField();
$redTemplate = new Redtemplate();
$stockroomhelper = new rsstockroomhelper();
$url = JURI::base();
$model = $this->getModel('category');
$loadCategorytemplate = $redTemplate->getTemplate('categoryproduct');
if (count($loadCategorytemplate) > 0 && $loadCategorytemplate[0]->template_desc != "") {
    $template_desc = $loadCategorytemplate[0]->template_desc;
} else {
    $template_desc = "<div><div>{print}</div>";
    $template_desc .= "<div>{filter_by_lbl}{filter_by}</div>";
    $template_desc .= "<div>{order_by_lbl}{order_by}</div>";
    $template_desc .= "<p>{category_loop_start}</p>";
    $template_desc .= "<div style='border: 1px solid;'><div id='categories'><div style='width: 200px;'>";
    $template_desc .= "<div class='category_image'>{category_thumb_image}</div><div class='category_description'>";
    $template_desc .= "<h4 class='category_title'>{category_name}</h4>{category_description}</div></div></div>";
    $template_desc .= "<div class='category_box_wrapper clearfix'>{product_loop_start}<div class='category_product_box_outside'>";
Пример #13
0
 public function product_template($template_id, $product_id, $section)
 {
     $redTemplate = new Redtemplate();
     if ($section == 1 || $section == 12) {
         $template_desc = $redTemplate->getTemplate("product", $template_id);
     } else {
         $template_desc = $redTemplate->getTemplate("category", $template_id);
     }
     if (count($template_desc) == 0) {
         return;
     }
     $template = $template_desc[0]->template_desc;
     $str = array();
     $sec = explode(',', $section);
     for ($t = 0; $t < count($sec); $t++) {
         $inArr[] = "'" . $sec[$t] . "'";
     }
     $in = implode(',', $inArr);
     $q = "SELECT field_name,field_type,field_section from " . $this->_table_prefix . "fields where field_section in (" . $in . ") ";
     $this->_db->setQuery($q);
     $fields = $this->_db->loadObjectlist();
     for ($i = 0; $i < count($fields); $i++) {
         if (strstr($template, "{" . $fields[$i]->field_name . "}")) {
             if ($fields[$i]->field_section == 12) {
                 if ($fields[$i]->field_type == 15) {
                     $str[] = $fields[$i]->field_name;
                 }
             } else {
                 $str[] = $fields[$i]->field_name;
             }
         }
     }
     $list_field = array();
     if (count($str) > 0) {
         $dbname = "'" . implode("','", $str) . "'";
         $field = new extra_field();
         for ($t = 0; $t < count($sec); $t++) {
             $list_field[] = $field->list_all_field($sec[$t], $product_id, $dbname);
         }
     }
     if (count($list_field) > 0) {
         return $list_field;
     } else {
         return "";
     }
 }
Пример #14
0
 public function displayQuotationUserfield($quotation_item_id = 0, $section_id = 12)
 {
     $redTemplate = new Redtemplate();
     $producthelper = new producthelper();
     $resultArr = array();
     $db = JFactory::getDbo();
     $sql = "SELECT fd.*,f.field_title,f.field_type,f.field_name " . "FROM " . $this->_table_prefix . "quotation_fields_data AS fd " . "LEFT JOIN " . $this->_table_prefix . "fields AS f ON f.field_id=fd.fieldid " . "WHERE fd.quotation_item_id= " . (int) $quotation_item_id . " AND fd.section = " . $db->quote($section_id);
     $db->setQuery($sql);
     $userfield = $db->loadObjectlist();
     if (count($userfield) > 0) {
         $quotationItem = $this->getQuotationProduct(0, $quotation_item_id);
         $product_id = $quotationItem[0]->product_id;
         $productdetail = $producthelper->getProductById($product_id);
         $productTemplate = $redTemplate->getTemplate("product", $productdetail->product_template);
         $returnArr = $producthelper->getProductUserfieldFromTemplate($productTemplate[0]->template_desc);
         $userFieldTag = $returnArr[1];
         for ($i = 0; $i < count($userFieldTag); $i++) {
             for ($j = 0; $j < count($userfield); $j++) {
                 if ($userfield[$j]->field_name == $userFieldTag[$i]) {
                     if ($userfield[$j]->field_type == 10) {
                         $files = explode(",", $userfield[$j]->data_txt);
                         $data_txt = "";
                         for ($f = 0; $f < count($files); $f++) {
                             $u_link = REDSHOP_FRONT_DOCUMENT_ABSPATH . "product/" . $files[$f];
                             $data_txt .= "<a href='" . $u_link . "'>" . $files[$f] . "</a> ";
                         }
                         $resultArr[] = $userfield[$j]->field_title . " : " . $data_txt;
                     } else {
                         $resultArr[] = $userfield[$j]->field_title . " : " . $userfield[$j]->data_txt;
                     }
                 }
             }
         }
     }
     $resultstr = "";
     if (count($resultArr) > 0) {
         $resultstr .= "<br/>" . implode("<br/>", $resultArr);
     }
     return $resultstr;
 }
Пример #15
0
/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
JHTMLBehavior::modal();
$url = JURI::base();
$extraField = new extraField();
$extra_field = new extra_field();
$producthelper = new producthelper();
$redTemplate = new Redtemplate();
$redhelper = new redhelper();
$Itemid = JRequest::getInt('Itemid');
$model = $this->getModel('manufacturers');
// Page Title Start
$pagetitle = JText::_('COM_REDSHOP_MANUFACTURER_DETAIL');
if ($this->pageheadingtag != '') {
    $pagetitle = $this->pageheadingtag;
}
if ($this->params->get('show_page_heading', 1)) {
    ?>
	<h1 class="componentheading<?php 
    echo $this->escape($this->params->get('pageclass_sfx'));
    ?>
">
		<?php 
Пример #16
0
<?php

/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
$redTemplate = new Redtemplate();
$extra_field = new extra_field();
$Itemid = JRequest::getInt('Itemid');
$layout = JRequest::getCmd('layout', 'default');
$model = $this->getModel('catalog');
$template = $redTemplate->getTemplate("product_sample");
if (count($template) > 0 && $template[0]->template_desc != "") {
    $template_desc = $template[0]->template_desc;
} else {
    $template_desc = '<div id="katalog_wrapper"><div id="bestil_katalog_wrapper"><div id="katalog_hojre_wrapper"></div></div><div id="bestil_farveproeve_wrapper"><div id="farveproeve_overskrift"><h2>Bestil Farveprver</h2></div><div id="farveproeve_venstre"><div id="farveproever_tekst">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris eget nisi orci, vel vehicula massa. Phasellus ipsum est, egestas a consequat eget, placerat vitae ipsum. Proin ac purus risus. Quisque nec nisi lacus, vitae iaculis eros. Donec ipsum diam, dictum ac euismod molestie, ultrices eget arcu. Vestibulum lacinia nisl et odio sagittis fermentum. Aliquam tristique volutpat faucibus. Sed id orci ut metus condimentum bibendum. Ut gravida scelerisque magna et pharetra. Ut vel turpis in orci molestie scelerisque. Proin nisl elit, ullamcorper id blandit nec, congue eget augue. Nullam gravida ligula nisi.</div><div id="farveproever"><p style="text-align: left;">{product_samples}</p></div></div><div id="farveproeve_hojre_wrapper"><div id="farveproeve_addressefelt"><p style="text-align: left;">{address_fields}</p></div><div id="farveproeve_sendknap"><p style="text-align: left;">{submit_button_sample}</p></div></div></div></div>';
}
if ($this->params->get('show_page_heading', 1)) {
    if ($this->params->get('page_title')) {
        ?>
	<h1 class="componentheading<?php 
        echo $this->escape($this->params->get('pageclass_sfx'));
        ?>
">
		<?php 
        echo $this->escape($this->params->get('page_title'));
Пример #17
0
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
$url = JURI::base();
include_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/quotation.php';
include_once JPATH_COMPONENT . '/helpers/product.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/extra_field.php';
require_once JPATH_COMPONENT . '/helpers/extra_field.php';
$producthelper = new producthelper();
$quotationHelper = new quotationHelper();
$order_functions = new order_functions();
$configobj = new Redconfiguration();
$redTemplate = new Redtemplate();
$extra_field = new extra_field();
$extraField = new extraField();
$carthelper = new rsCarthelper();
$user = JFactory::getUser();
$Itemid = JRequest::getInt('Itemid');
$app = JFactory::getApplication();
$params = $app->getParams('com_redshop');
$returnitemid = $params->get('logout', $Itemid);
$accountbillto_link = JRoute::_("index.php?option=com_redshop&view=account_billto&Itemid=" . $Itemid);
$accountshipto_link = JRoute::_("index.php?option=com_redshop&view=account_shipto&Itemid=" . $Itemid);
$logout_link = JRoute::_("index.php?option=com_redshop&view=login&task=logout&logout=" . $returnitemid . "&Itemid=" . $Itemid);
$compare_link = JRoute::_("index.php?option=com_redshop&view=product&layout=compare&Itemid=" . $Itemid);
$mytags_link = JRoute::_("index.php?option=com_redshop&view=account&layout=mytags&Itemid=" . $Itemid);
$wishlist_link = JRoute::_("index.php?option=com_redshop&view=wishlist&task=viewwishlist&Itemid=" . $Itemid);
$model = $this->getModel('account');
Пример #18
0
<?php

/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
$redTemplate = new Redtemplate();
$carthelper = new rsCarthelper();
$Itemid = JRequest::getInt('Itemid');
$return = JRequest::getString('return');
$session = JFactory::getSession();
$cart = $session->get('cart');
$detail = $this->detail;
$user = JFactory::getUser();
$extra_field = new extra_field();
$quotation_template = $redTemplate->getTemplate("quotation_request");
if (count($quotation_template) > 0 && $quotation_template[0]->template_desc != "") {
    $template_desc = $quotation_template[0]->template_desc;
} else {
    $template_desc = "<fieldset class=\"adminform\"><legend>{order_detail_lbl}</legend> \r\n<table class=\"admintable\">\r\n<tbody>\r\n<tr>\r\n<td>{product_name_lbl}</td>\r\n<td>{quantity_lbl}</td>\r\n</tr>\r\n{product_loop_start}\r\n<tr>\r\n<td>{product_name}<br />{product_attribute}<br />{product_accessory}<br />{product_userfields}</td>\r\n<td>{update_cart}</td>\r\n</tr>\r\n{product_loop_end}\r\n</tbody>\r\n</table>\r\n</fieldset>\r\n<p>{customer_note_lbl}:{customer_note}</p>\r\n<fieldset class=\"adminform\"><legend>{billing_address_information_lbl}</legend> {billing_address}{quotation_custom_field_list} </fieldset> \r\n<table border=\"0\">\r\n<tbody>\r\n<tr>\r\n<td align=\"center\">{cancel_btn}{request_quotation_btn}</td>\r\n</tr>\r\n</tbody>\r\n</table>";
}
?>
<script type="text/javascript">
	function validateInfo() {
		var frm = document.adminForm;
Пример #19
0
 public function addProductToCart($data = array())
 {
     JPluginHelper::importPlugin('redshop_product');
     $dispatcher = JDispatcher::getInstance();
     $rsUserhelper = new rsUserhelper();
     $redTemplate = new Redtemplate();
     $user = JFactory::getUser();
     $cart = $this->_session->get('cart');
     if (!$cart || !array_key_exists("idx", $cart) || array_key_exists("quotation_id", $cart)) {
         $cart = array();
         $cart['idx'] = 0;
     }
     $idx = (int) $cart['idx'];
     $section = isset($data['giftcard_id']) && $data['giftcard_id'] != 0 ? 13 : 12;
     $row_data = $this->_extraFieldFront->getSectionFieldList($section);
     // Set session for giftcard
     if (isset($data['giftcard_id']) && $data['giftcard_id']) {
         $cart[$idx]['reciver_email'] = $data['reciver_email'];
         $cart[$idx]['reciver_name'] = $data['reciver_name'];
         $cart[$idx]['customer_amount'] = $data['customer_amount'];
         for ($g = 0; $g < count($idx); $g++) {
             if ($cart[$g]['giftcard_id'] == $data['giftcard_id']) {
                 $cart[$idx]['quantity'] += 1;
                 $this->_session->set('cart', $cart);
                 return true;
             }
         }
         $cart[$idx]['quantity'] = 1;
         $giftcardData = $this->_producthelper->getGiftcardData($data['giftcard_id']);
         if ($giftcardData->customer_amount) {
             $giftcard_price = $data['customer_amount'];
         } else {
             $giftcard_price = $giftcardData->giftcard_price;
         }
         $cart[$idx]['product_price'] = $giftcard_price;
         $cart[$idx]['product_price_excl_vat'] = $giftcard_price;
         $cart[$idx]['product_vat'] = 0;
         $cart[$idx]['product_id'] = '';
         if (!$cart['discount_type']) {
             $cart['discount_type'] = 0;
         }
         if (!$cart['discount']) {
             $cart['discount'] = 0;
         }
         $cart[$idx]['giftcard_id'] = $data['giftcard_id'];
         for ($i = 0; $i < count($row_data); $i++) {
             $data_txt = isset($data[$row_data[$i]->field_name]) ? $data[$row_data[$i]->field_name] : '';
             $tmpstr = strpbrk($data_txt, '`');
             if ($tmpstr) {
                 $tmparray = explode('`', $data_txt);
                 $tmp = new stdClass();
                 $tmp = @array_merge($tmp, $tmparray);
                 if (is_array($tmparray)) {
                     $data_txt = implode(",", $tmparray);
                 }
             }
             $cart[$idx][$row_data[$i]->field_name] = $data_txt;
         }
         $cart['idx'] = $idx + 1;
         $this->_session->set('cart', $cart);
         return true;
     }
     if (isset($data['hidden_attribute_cartimage'])) {
         $cart[$idx]['hidden_attribute_cartimage'] = $data['hidden_attribute_cartimage'];
     }
     $product_id = $data['product_id'];
     $quantity = $data['quantity'];
     $product_data = $this->_producthelper->getProductById($product_id);
     if (isset($data['parent_accessory_product_id']) && $data['parent_accessory_product_id'] != 0) {
         $tempdata = $this->_producthelper->getProductById($data['parent_accessory_product_id']);
         $producttemplate = $redTemplate->getTemplate("product", $tempdata->product_template);
         $accessory_template = $this->_producthelper->getAccessoryTemplate($producttemplate[0]->template_desc);
         $data_add = $accessory_template->template_desc;
     } else {
         $producttemplate = $redTemplate->getTemplate("product", $product_data->product_template);
         $data_add = $producttemplate[0]->template_desc;
     }
     /*
      * Check if required userfield are filled or not if not than redirect to product detail page...
      * get product userfield from selected product template...
      */
     if (!AJAX_CART_BOX) {
         $fieldreq = $this->userfieldValidation($data, $data_add, $section);
         if ($fieldreq != "") {
             return $fieldreq;
         }
     }
     // Get product price
     $data['product_price'] = 0;
     // Attribute price added
     $generateAttributeCart = isset($data['cart_attribute']) ? $data['cart_attribute'] : $this->generateAttributeArray($data);
     $retAttArr = $this->_producthelper->makeAttributeCart($generateAttributeCart, $product_data->product_id, 0, $data['product_price'], $quantity);
     $selectProp = $this->_producthelper->getSelectedAttributeArray($data);
     $data['product_old_price'] = $retAttArr[5] + $retAttArr[6];
     $data['product_old_price_excl_vat'] = $retAttArr[5];
     $data['product_price'] = $retAttArr[1];
     $product_vat_price = $retAttArr[2];
     $cart[$idx]['product_price_excl_vat'] = $retAttArr[1];
     $data['product_price'] += $product_vat_price;
     if (!empty($selectProp[0])) {
         $attributeImage = $product_id;
         if (count($selectProp[0]) == 1) {
             $attributeImage .= '_p' . $selectProp[0][0];
         } else {
             $pattributeImage = implode('_p', $selectProp[0]);
             $attributeImage .= '_p' . $pattributeImage;
         }
         if (count($selectProp[1]) == 1) {
             $attributeImage .= '_sp' . $selectProp[1][0];
         } else {
             $sattributeImage = implode('_sp', $selectProp[1]);
             if ($sattributeImage) {
                 $attributeImage .= '_sp' . $sattributeImage;
             }
         }
         $cart[$idx]['attributeImage'] = $attributeImage . '.png';
     }
     if (!empty($data['reorder']) && !empty($data['attributeImage'])) {
         $cart[$idx]['attributeImage'] = $data['attributeImage'];
     }
     $selectedAttrId = $retAttArr[3];
     $isStock = $retAttArr[4];
     $selectedPropId = $selectProp[0];
     $notselectedSubpropId = $retAttArr[8];
     $product_preorder = $product_data->preorder;
     $isPreorderStock = $retAttArr[7];
     if (!$isStock) {
         if ($product_preorder == "global" && !ALLOW_PRE_ORDER || $product_preorder == "no" || $product_preorder == "" && !ALLOW_PRE_ORDER) {
             $msg = urldecode(JText::_('COM_REDSHOP_PRODUCT_OUTOFSTOCK_MESSAGE'));
             return $msg;
         } elseif (!$isPreorderStock) {
             $msg = urldecode(JText::_('COM_REDSHOP_PREORDER_PRODUCT_OUTOFSTOCK_MESSAGE'));
             return $msg;
         }
     }
     // Attribute End
     // Discount calculator procedure start
     $discountArr = array();
     $discountArr = $this->discountCalculatorData($product_data, $data);
     $calc_output = "";
     $calc_output_array = array();
     $product_price_tax = 0;
     if (!empty($discountArr)) {
         $calc_output = $discountArr[0];
         $calc_output_array = $discountArr[1];
         // Calculate price without VAT
         $data['product_price'] += $discountArr[2] + $discountArr[3];
         $cart[$idx]['product_price_excl_vat'] += $discountArr[2];
         $product_vat_price += $discountArr[3];
         $cart[$idx]['discount_calc_price'] = $discountArr[2];
     }
     $cart[$idx]['subscription_id'] = 0;
     if ($product_data->product_type == 'subscription') {
         if (isset($data['subscription_id']) && $data['subscription_id'] != "") {
             $subscription_detail = $this->_producthelper->getProductSubscriptionDetail($data['product_id'], $data['subscription_id']);
             $subscription_price = $subscription_detail->subscription_price;
             if ($subscription_price) {
                 $subscription_vat = $this->_producthelper->getProductTax($data['product_id'], $subscription_price);
             }
             $product_vat_price += $subscription_vat;
             $data['product_price'] = $data['product_price'] + $subscription_price + $subscription_vat;
             $data['product_old_price'] = $data['product_old_price'] + $subscription_price + $subscription_vat;
             $data['product_old_price_excl_vat'] += $subscription_price;
             $cart[$idx]['product_price_excl_vat'] += $subscription_price;
             $cart[$idx]['subscription_id'] = $data['subscription_id'];
         } else {
             $msg = urldecode(JText::_('COM_REDSHOP_PLEASE_SELECT_YOUR_SUBSCRIPTION_PLAN'));
             return $msg;
         }
     }
     // Accessory price
     if (ACCESSORY_AS_PRODUCT_IN_CART_ENABLE) {
         if (isset($data['accessory_data'])) {
             $cart['AccessoryAsProduct'] = array($data['accessory_data'], $data['acc_quantity_data'], $data['acc_attribute_data'], $data['acc_property_data'], $data['acc_subproperty_data']);
         }
         $generateAccessoryCart = array();
         $data['accessory_data'] = "";
         $data['acc_quantity_data'] = "";
         $data['acc_attribute_data'] = "";
         $data['acc_property_data'] = "";
         $data['acc_subproperty_data'] = "";
     } else {
         $generateAccessoryCart = isset($data['cart_accessory']) ? $data['cart_accessory'] : $this->generateAccessoryArray($data);
         if (isset($data['accessory_data']) && ($data['accessory_data'] != "" && $data['accessory_data'] != 0)) {
             if (!$generateAccessoryCart) {
                 $document = JFactory::getDocument();
                 return $document->getError();
             }
         }
     }
     $retAccArr = $this->_producthelper->makeAccessoryCart($generateAccessoryCart, $product_data->product_id);
     $accessory_total_price = $retAccArr[1];
     $accessory_vat_price = $retAccArr[2];
     $cart[$idx]['product_price_excl_vat'] += $accessory_total_price;
     $data['product_price'] += $accessory_total_price + $accessory_vat_price;
     $data['product_old_price'] += $accessory_total_price + $accessory_vat_price;
     $data['product_old_price_excl_vat'] += $accessory_total_price;
     $cart[$idx]['product_vat'] = $product_vat_price + $accessory_vat_price;
     if (!INDIVIDUAL_ADD_TO_CART_ENABLE) {
         /*
          * Check if required attribute is filled or not ...
          */
         $attribute_template = $this->_producthelper->getAttributeTemplate($data_add);
         if (count($attribute_template) > 0) {
             $selectedAttributId = 0;
             if (count($selectedAttrId) > 0) {
                 $selectedAttributId = implode(",", $selectedAttrId);
             }
             $req_attribute = $this->_producthelper->getProductAttribute($data['product_id'], 0, 0, 0, 1, $selectedAttributId);
             if (count($req_attribute) > 0) {
                 $requied_attributeArr = array();
                 for ($re = 0; $re < count($req_attribute); $re++) {
                     $requied_attributeArr[$re] = urldecode($req_attribute[$re]->attribute_name);
                 }
                 $requied_attribute_name = implode(", ", $requied_attributeArr);
                 // Throw an error as first attribute is required
                 $msg = urldecode($requied_attribute_name) . " " . JText::_('COM_REDSHOP_IS_REQUIRED');
                 return $msg;
             }
             $selectedPropertyId = 0;
             if (count($selectedPropId) > 0) {
                 $selectedPropertyId = implode(",", $selectedPropId);
             }
             $notselectedSubpropertyId = 0;
             if (count($notselectedSubpropId) > 0) {
                 $notselectedSubpropertyId = implode(",", $notselectedSubpropId);
             }
             $req_property = $this->_producthelper->getAttibuteProperty($selectedPropertyId, $selectedAttributId, $data['product_id'], 0, 1, $notselectedSubpropertyId);
             if (count($req_property) > 0) {
                 $requied_subattributeArr = array();
                 for ($re1 = 0; $re1 < count($req_property); $re1++) {
                     $requied_subattributeArr[$re1] = urldecode($req_property[$re1]->property_name);
                 }
                 $requied_subattribute_name = implode(",", $requied_subattributeArr);
                 // Give error as second attribute is required
                 $msg = urldecode($requied_subattribute_name) . " " . JText::_('COM_REDSHOP_SUBATTRIBUTE_IS_REQUIRED');
                 if ($data['reorder'] != 1) {
                     return $msg;
                 }
             }
         }
     }
     // ADD WRAPPER PRICE
     $wrapper_price = 0;
     $wrapper_vat = 0;
     if (isset($data['sel_wrapper_id']) && $data['sel_wrapper_id']) {
         $wrapperArr = $this->getWrapperPriceArr(array('product_id' => $data['product_id'], 'wrapper_id' => $data['sel_wrapper_id']));
         $wrapper_vat = $wrapperArr['wrapper_vat'];
         $wrapper_price = $wrapperArr['wrapper_price'];
     }
     $cart[$idx]['product_vat'] += $wrapper_vat;
     $data['product_price'] += $wrapper_price + $wrapper_vat;
     $data['product_old_price'] += $wrapper_price + $wrapper_vat;
     $data['product_old_price_excl_vat'] += $wrapper_price;
     $cart[$idx]['product_price_excl_vat'] += $wrapper_price;
     // END WRAPPER PRICE
     $att_id_total = false;
     $att_acc_total = false;
     $prodcut_id_total = false;
     // Checking For same Product and update Quantity
     $selectAcc = $this->_producthelper->getSelectedAccessoryArray($data);
     $selectAtt = $this->_producthelper->getSelectedAttributeArray($data);
     $sameProduct = false;
     for ($i = 0; $i < $idx; $i++) {
         if ($cart[$i]['product_id'] == $data['product_id']) {
             $sameProduct = true;
             if (isset($data['subscription_id']) && $cart[$i]['subscription_id'] != $data['subscription_id']) {
                 $sameProduct = false;
             }
             if ($cart[$i]['wrapper_id'] != $data['sel_wrapper_id']) {
                 $sameProduct = false;
             }
             $prevSelectAtt = $this->getSelectedCartAttributeArray($cart[$i]['cart_attribute']);
             $newdiff1 = array_diff($prevSelectAtt[0], $selectAtt[0]);
             $newdiff2 = array_diff($selectAtt[0], $prevSelectAtt[0]);
             if (count($newdiff1) > 0 || count($newdiff2) > 0) {
                 $sameProduct = false;
             }
             $newdiff1 = array_diff($prevSelectAtt[1], $selectAtt[1]);
             $newdiff2 = array_diff($selectAtt[1], $prevSelectAtt[1]);
             if (count($newdiff1) > 0 || count($newdiff2) > 0) {
                 $sameProduct = false;
             }
             $prevSelectAcc = $this->getSelectedCartAccessoryArray($cart[$i]['cart_accessory']);
             $newdiff1 = array_diff($prevSelectAcc[0], $selectAcc[0]);
             $newdiff2 = array_diff($selectAcc[0], $prevSelectAcc[0]);
             if (count($newdiff1) > 0 || count($newdiff2) > 0) {
                 $sameProduct = false;
             }
             $newdiff1 = array_diff($prevSelectAcc[1], $selectAcc[1]);
             $newdiff2 = array_diff($selectAcc[1], $prevSelectAcc[1]);
             if (count($newdiff1) > 0 || count($newdiff2) > 0) {
                 $sameProduct = false;
             }
             $newdiff1 = array_diff($prevSelectAcc[2], $selectAcc[2]);
             $newdiff2 = array_diff($selectAcc[2], $prevSelectAcc[2]);
             if (count($newdiff1) > 0 || count($newdiff2) > 0) {
                 $sameProduct = false;
             }
             // Discount calculator
             $array_diff_calc = array_diff_assoc($cart[$i]['discount_calc'], $calc_output_array);
             if (count($array_diff_calc) > 0) {
                 $sameProduct = false;
             }
             /**
              * Previous comment stated it is not used anymore.
              * Changing it for another purpose. It can intercept and decide whether added product should be added as same or new product.
              */
             $dispatcher->trigger('checkSameCartProduct', array(&$cart, $data, &$sameProduct));
             // Product userfiled
             if (!empty($row_data)) {
                 $puf = 1;
                 for ($r = 0; $r < count($row_data); $r++) {
                     $produser_field = $row_data[$r]->field_name;
                     $added_userfield = $data[$produser_field];
                     if (isset($cart[$i][$produser_field]) && $added_userfield != $cart[$i][$produser_field]) {
                         $puf = 0;
                     }
                 }
                 if ($puf != 1) {
                     $sameProduct = false;
                 }
             }
             if ($sameProduct) {
                 $newQuantity = $cart[$i]['quantity'] + $data['quantity'];
                 $newcartquantity = $this->checkQuantityInStock($cart[$i], $newQuantity);
                 if ($newQuantity > $newcartquantity) {
                     $cart['notice_message'] = $newcartquantity . " " . JTEXT::_('COM_REDSHOP_AVAILABLE_STOCK_MESSAGE');
                 } else {
                     $cart['notice_message'] = "";
                 }
                 if ($newcartquantity != $cart[$i]['quantity']) {
                     $cart[$i]['quantity'] = $newcartquantity;
                     /*
                      * trigger the event of redSHOP product plugin support on Same product is going to add into cart
                      *
                      * Usually redSHOP update quantity
                      */
                     $dispatcher->trigger('onSameCartProduct', array(&$cart, $data, $i));
                     $this->_session->set('cart', $cart);
                     $data['cart_index'] = $i;
                     $data['quantity'] = $newcartquantity;
                     $this->update($data);
                     return true;
                 } else {
                     $msg = CART_RESERVATION_MESSAGE != '' && IS_PRODUCT_RESERVE ? CART_RESERVATION_MESSAGE : urldecode(JText::_('COM_REDSHOP_PRODUCT_OUTOFSTOCK_MESSAGE'));
                     return $msg;
                 }
             }
         }
     }
     // Set product price
     if ($data['product_price'] < 0) {
         $data['product_price'] = 0;
     }
     $per_product_total = $product_data->minimum_per_product_total;
     if ($data['product_price'] < $per_product_total) {
         $msg = JText::_('COM_REDSHOP_PER_PRODUCT_TOTAL') . " " . $per_product_total;
         return $msg;
     }
     if (!$sameProduct) {
         // SET VALVUES INTO SESSION CART
         $cart[$idx]['giftcard_id'] = '';
         $cart[$idx]['product_id'] = $data['product_id'];
         $cart[$idx]['discount_calc_output'] = $calc_output;
         $cart[$idx]['discount_calc'] = $calc_output_array;
         $cart[$idx]['product_price'] = $data['product_price'];
         $cart[$idx]['product_old_price'] = $data['product_old_price'];
         $cart[$idx]['product_old_price_excl_vat'] = $data['product_old_price_excl_vat'];
         $cart[$idx]['cart_attribute'] = $generateAttributeCart;
         $cart[$idx]['cart_accessory'] = $generateAccessoryCart;
         if (isset($data['hidden_attribute_cartimage'])) {
             $cart[$idx]['hidden_attribute_cartimage'] = $data['hidden_attribute_cartimage'];
         }
         $cart[$idx]['quantity'] = 0;
         $newQuantity = $data['quantity'];
         $cart[$idx]['quantity'] = $this->checkQuantityInStock($cart[$idx], $newQuantity);
         if ($newQuantity > $cart[$idx]['quantity']) {
             $cart['notice_message'] = $cart[$idx]['quantity'] . " " . JTEXT::_('COM_REDSHOP_AVAILABLE_STOCK_MESSAGE');
         } else {
             $cart['notice_message'] = "";
         }
         if ($cart[$idx]['quantity'] <= 0) {
             $msg = CART_RESERVATION_MESSAGE != '' && IS_PRODUCT_RESERVE ? CART_RESERVATION_MESSAGE : JText::_('COM_REDSHOP_PRODUCT_OUTOFSTOCK_MESSAGE');
             return $msg;
         }
         $cart[$idx]['category_id'] = $data['category_id'];
         $cart[$idx]['wrapper_id'] = $data['sel_wrapper_id'];
         $cart[$idx]['wrapper_price'] = $wrapper_price + $wrapper_vat;
         /**
          * Implement new plugin support before session update
          * trigger the event of redSHOP product plugin support on Before cart session is set - on prepare cart session
          */
         $dispatcher->trigger('onBeforeSetCartSession', array(&$cart, $data));
         $cart['idx'] = $idx + 1;
         for ($i = 0; $i < count($row_data); $i++) {
             $field_name = $row_data[$i]->field_name;
             $data_txt = isset($data[$field_name]) ? $data[$field_name] : '';
             $tmpstr = strpbrk($data_txt, '`');
             if ($tmpstr) {
                 $data_txt = str_replace('`', ',', $data_txt);
             }
             $cart[$idx][$field_name] = $data_txt;
         }
     }
     if (!$cart['discount_type']) {
         $cart['discount_type'] = 0;
     }
     if (!$cart['discount']) {
         $cart['discount'] = 0;
     }
     if (!$cart['cart_discount']) {
         $cart['cart_discount'] = 0;
     }
     if (!isset($cart['user_shopper_group_id']) || isset($cart['user_shopper_group_id']) && $cart['user_shopper_group_id'] == 0) {
         $cart['user_shopper_group_id'] = $rsUserhelper->getShopperGroup($user->id);
     }
     $cart['free_shipping'] = 0;
     $this->_session->set('cart', $cart);
     return true;
 }
Пример #20
0
    /**
     * Main redSHOP installer Events
     *
     * @return  void
     */
    private function com_install()
    {
        $db = JFactory::getDbo();
        // The redshop.cfg.php creation or update
        $this->redshopHandleCFGFile();
        // Get the redshop_users_info
        $q = "SHOW COLUMNS FROM #__redshop_users_info";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the user_email column
            if (!array_key_exists('user_email', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_users_info ADD COLUMN `user_email` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the address column
            if (!array_key_exists('address', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_users_info ADD COLUMN `address` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the city column
            if (!array_key_exists('city', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_users_info ADD COLUMN `city` VARCHAR( 50 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the zipcode column
            if (array_key_exists('zipcode', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_users_info CHANGE `zipcode` `zipcode` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the phone column
            if (!array_key_exists('phone', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_users_info ADD COLUMN `phone` VARCHAR( 50 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the company_name column
            if (!array_key_exists('company_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_users_info ADD COLUMN `company_name` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the requesting_tax_exempt column
            if (!array_key_exists('requesting_tax_exempt', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_users_info ADD COLUMN `requesting_tax_exempt` TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the ean_number column
            if (!array_key_exists('ean_number', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_users_info ADD COLUMN `ean_number` VARCHAR( 250 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the braintree_vault_number column
            if (!array_key_exists('braintree_vault_number', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_users_info ADD COLUMN `braintree_vault_number` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the accept_terms_conditions column
            if (!array_key_exists('accept_terms_conditions', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_users_info ADD COLUMN `accept_terms_conditions` TINYINT( 4 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the veis_vat_number column
            if (!array_key_exists('veis_vat_number', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_users_info ADD COLUMN `veis_vat_number` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the veis_status column
            if (!array_key_exists('veis_status', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_users_info ADD COLUMN `veis_status` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Syncronise users
        $this->userSynchronization();
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_media";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if an upgrade is needed
            // Check if we have the media_alternate_text column
            if (!array_key_exists('media_alternate_text', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_media ADD `media_alternate_text` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the ordering column
            if (!array_key_exists('ordering', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_media ADD `ordering` int(11) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        $q = "SHOW COLUMNS FROM #__redshop_supplier";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the supplier_email column
            if (!array_key_exists('supplier_email', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_supplier ADD `supplier_email` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_economic_accountgroup";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the economic_service_nonvat_account column
            if (!array_key_exists('economic_service_nonvat_account', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_economic_accountgroup ADD `economic_service_nonvat_account` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the economic_discount_product_number column
            if (!array_key_exists('economic_discount_product_number', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_economic_accountgroup CHANGE `economic_discount_novat_account` `economic_discount_product_number` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the economic_discount_nonvat_account column
            if (!array_key_exists('economic_discount_nonvat_account', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_economic_accountgroup  CHANGE `economic_service_nonvat_account` `economic_discount_nonvat_account` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the economic_discount_vat_account column
            if (!array_key_exists('economic_discount_vat_account', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_economic_accountgroup ADD `economic_discount_vat_account` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current INDEX
        $q = "SHOW INDEX FROM #__redshop_product_category_xref";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Key_name');
        if (is_array($cols)) {
            // Check if we have the ref_category column
            if (!array_key_exists('ref_category', $cols)) {
                $q = "ALTER IGNORE TABLE `#__redshop_product_category_xref` ADD INDEX `ref_category` ( `product_id` )";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_cart";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the section column
            if (!array_key_exists('section', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_cart ADD `section` VARCHAR( 250 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_customer_question";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the telephone column
            if (!array_key_exists('telephone', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_customer_question ADD `telephone` VARCHAR( 50 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the telephone column
            if (!array_key_exists('address', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_customer_question ADD `address` VARCHAR( 250 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns Total Price excl price
        $q = "SHOW COLUMNS FROM #__redshop_stockroom_amount_image ";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if an upgrade is needed
            // Check if we have the stock_amount_image_tooltip column
            if (!array_key_exists('stock_amount_image_tooltip', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_stockroom_amount_image ADD `stock_amount_image_tooltip` TEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the stockroom_id column
            if (!array_key_exists('stockroom_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_stockroom_amount_image ADD `stockroom_id` INT(11) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_xml_export";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if an upgrade is needed
            // Check if we have the parent_name column
            if (!array_key_exists('parent_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD `parent_name` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the element_name column
            if (!array_key_exists('element_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD `element_name` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the published column
            if (!array_key_exists('published', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD published TINYINT(4) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the use_to_all_users column
            if (!array_key_exists('use_to_all_users', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD use_to_all_users TINYINT(4) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the xmlexport_billingtag column
            if (!array_key_exists('xmlexport_billingtag', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD `xmlexport_billingtag` text NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the billing_element_name column
            if (!array_key_exists('billing_element_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD `billing_element_name` VARCHAR(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the xmlexport_shippingtag column
            if (!array_key_exists('xmlexport_shippingtag', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD `xmlexport_shippingtag` text NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_element_name column
            if (!array_key_exists('shipping_element_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD `shipping_element_name` VARCHAR(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the xmlexport_orderitemtag column
            if (!array_key_exists('xmlexport_orderitemtag', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD `xmlexport_orderitemtag` text NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the orderitem_element_name column
            if (!array_key_exists('orderitem_element_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD `orderitem_element_name` VARCHAR(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the xmlexport_stocktag column
            if (!array_key_exists('xmlexport_stocktag', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD `xmlexport_stocktag` text NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the stock_element_name column
            if (!array_key_exists('stock_element_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD `stock_element_name` VARCHAR(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the xmlexport_prdextrafieldtag column
            if (!array_key_exists('xmlexport_prdextrafieldtag', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD `xmlexport_prdextrafieldtag` text NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the prdextrafield_element_name column
            if (!array_key_exists('prdextrafield_element_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD `prdextrafield_element_name` VARCHAR(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the xmlexport_on_category column
            if (!array_key_exists('xmlexport_on_category', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_export ADD `xmlexport_on_category` TEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_xml_import";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the published column
            if (!array_key_exists('published', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import ADD published TINYINT(4) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the xmlexport_billingtag column
            if (!array_key_exists('xmlexport_billingtag', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import ADD xmlexport_billingtag TEXT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the xmlexport_shippingtag column
            if (!array_key_exists('xmlexport_shippingtag', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import ADD xmlexport_shippingtag TEXT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the xmlexport_orderitemtag column
            if (!array_key_exists('xmlexport_orderitemtag', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import ADD xmlexport_orderitemtag TEXT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the xmlimport_stocktag column
            if (!array_key_exists('xmlimport_stocktag', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import ADD xmlimport_stocktag TEXT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the xmlexport_billingtag column
            if (array_key_exists('xmlexport_billingtag', $cols) && !array_key_exists('xmlimport_billingtag', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import CHANGE `xmlexport_billingtag` `xmlimport_billingtag` TEXT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the xmlexport_shippingtag column
            if (array_key_exists('xmlexport_shippingtag', $cols) && !array_key_exists('xmlimport_shippingtag', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import CHANGE `xmlexport_shippingtag` `xmlimport_shippingtag` TEXT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the xmlexport_orderitemtag column
            if (array_key_exists('xmlexport_orderitemtag', $cols) && !array_key_exists('xmlimport_orderitemtag', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import CHANGE `xmlexport_orderitemtag` `xmlimport_orderitemtag` TEXT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the xmlimport_prdextrafieldtag column
            if (!array_key_exists('xmlimport_prdextrafieldtag', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import ADD xmlimport_prdextrafieldtag TEXT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the element_name column
            if (!array_key_exists('element_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import ADD element_name varchar(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the billing_element_name column
            if (!array_key_exists('billing_element_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import ADD billing_element_name varchar(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_element_name column
            if (!array_key_exists('shipping_element_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import ADD shipping_element_name varchar(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the orderitem_element_name column
            if (!array_key_exists('orderitem_element_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import ADD orderitem_element_name varchar(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the stock_element_name column
            if (!array_key_exists('stock_element_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import ADD stock_element_name varchar(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the prdextrafield_element_name column
            if (!array_key_exists('prdextrafield_element_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_xml_import ADD prdextrafield_element_name varchar(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_product_subscribe_detail";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if an upgrade is needed
            // Check if we have the renewal_reminder column
            if (!array_key_exists('renewal_reminder', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_subscribe_detail ADD `renewal_reminder` TINYINT( 1 ) NOT NULL  DEFAULT '1'";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the order_item_id column
            if (!array_key_exists('order_item_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_subscribe_detail ADD `order_item_id` INT( 11 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_product_accessory";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if an upgrade is needed
            // Check if we have the oprand column
            if (!array_key_exists('oprand', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_accessory ADD `oprand` char(1) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the oprand column
            if (!array_key_exists('ordering', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_accessory ADD `ordering` int( 11 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the category_id column
            if (!array_key_exists('category_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_accessory ADD `category_id` int( 11 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the setdefault_selected column
            if (!array_key_exists('setdefault_selected', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_accessory ADD `setdefault_selected` TINYINT( 4 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_product_related";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if an upgrade is needed
            // Check if we have the oprand column
            if (!array_key_exists('ordering', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_related ADD `ordering` int( 11 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for category
        $q = "SHOW COLUMNS FROM #__redshop_category";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if an upgrade is needed
            // Check if we have the category_short_description column
            if (!array_key_exists('category_short_description', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_category ADD `category_short_description` longtext NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the category_more_template column
            if (!array_key_exists('category_more_template', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_category ADD `category_more_template` varchar(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the category_back_full_image column
            if (!array_key_exists('category_back_full_image', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_category ADD `category_back_full_image` varchar(250) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the compare_template_id column
            if (!array_key_exists('compare_template_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_category ADD `compare_template_id` varchar(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `append_to_global_seo` column
            if (!array_key_exists('append_to_global_seo', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_category ADD `append_to_global_seo` ENUM( 'append', 'prepend', 'replace' ) NOT NULL DEFAULT 'append'";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `canonical_url` column
            if (!array_key_exists('canonical_url', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_category ADD `canonical_url` text NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for fields_data
        $q = "SHOW COLUMNS FROM #__redshop_fields_value";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if an upgrade is needed
            // Check if we have the alt_text column
            if (!array_key_exists('alt_text', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_fields_value ADD `alt_text` varchar(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the image_link column
            if (!array_key_exists('image_link', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_fields_value ADD `image_link` text NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the alt_text column
            if (array_key_exists('alt_text', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_fields_value DROP `alt_text` ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the image_link column
            if (array_key_exists('image_link', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_fields_value DROP `image_link` ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for fields_data
        $q = "SHOW COLUMNS FROM #__redshop_fields_data";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if an upgrade is needed
            // Check if we have the alt_text column
            if (!array_key_exists('alt_text', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_fields_data ADD `alt_text` varchar(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the image_link column
            if (!array_key_exists('image_link', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_fields_data ADD `image_link` varchar(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the user_email column
            if (!array_key_exists('user_email', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_fields_data ADD `user_email` varchar(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_tax_rate";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if an upgrade is needed
            // Check if we have the tax_group_id column
            if (!array_key_exists('tax_group_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_tax_rate ADD tax_group_id INT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the is_eu_country column
            if (!array_key_exists('is_eu_country', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_tax_rate ADD is_eu_country TINYINT( 4 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_product_rating";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if an upgrade is needed
            // Check if we have the email column
            if (!array_key_exists('email', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_rating ADD email VARCHAR(200) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the username column
            if (!array_key_exists('username', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_rating ADD username VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the company_name column
            if (!array_key_exists('company_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_rating ADD company_name VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for redshop coupons
        $q = "SHOW COLUMNS FROM #__redshop_coupons";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the coupon_left column
            if (!array_key_exists('coupon_left', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_coupons ADD COLUMN coupon_left INT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the free_shipping column
            if (!array_key_exists('free_shipping', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_coupons ADD COLUMN free_shipping TINYINT( 4 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the subtotal column
            if (!array_key_exists('subtotal', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_coupons ADD COLUMN subtotal INT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the order_id column
            if (!array_key_exists('order_id', $cols)) {
                $q = "ALTER TABLE `#__redshop_coupons` ADD `order_id` INT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for redshop manufacturer
        $q = "SHOW COLUMNS FROM #__redshop_manufacturer";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the ordering column
            if (!array_key_exists('ordering', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_manufacturer ADD COLUMN ordering INT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the manufacturer_email column
            if (!array_key_exists('manufacturer_email', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_manufacturer ADD COLUMN manufacturer_email VARCHAR( 255 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the product_per_page column
            if (!array_key_exists('product_per_page', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_manufacturer ADD COLUMN product_per_page INT( 11 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the manufacturer_url column
            if (!array_key_exists('manufacturer_url', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_manufacturer ADD COLUMN manufacturer_url VARCHAR( 255 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the excluding_category_list column
            if (!array_key_exists('excluding_category_list', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_manufacturer ADD COLUMN excluding_category_list TEXT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for redshop product attribute
        $q = "SHOW COLUMNS FROM #__redshop_product_attribute";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the attribute_published column
            if (!array_key_exists('attribute_published', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute ADD COLUMN `attribute_published` INT NOT NULL DEFAULT '1'";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the attribute_required column
            if (!array_key_exists('attribute_required', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute ADD COLUMN `attribute_required` TINYINT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the ordering column
            if (!array_key_exists('ordering', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute ADD COLUMN `ordering` INT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the attribute_set_id column
            if (!array_key_exists('attribute_set_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute ADD COLUMN `attribute_set_id` INT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the allow_multiple_selection column
            if (!array_key_exists('allow_multiple_selection', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute ADD COLUMN `allow_multiple_selection` TINYINT(1) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the attribute_set_id column
            if (!array_key_exists('hide_attribute_price', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute ADD COLUMN `hide_attribute_price` TINYINT(1) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the display_type column
            if (!array_key_exists('display_type', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute ADD COLUMN `display_type` VARCHAR(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for redshop product attribute property
        $q = "SHOW COLUMNS FROM #__redshop_product_attribute_property";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the ordering column
            if (!array_key_exists('ordering', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_property ADD COLUMN `ordering` INT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Change if we have the ordering column
            if (!array_key_exists('property_number', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_property ADD COLUMN `property_number` VARCHAR( 255 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the setdefault_selected column
            if (!array_key_exists('setdefault_selected', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_property ADD COLUMN `setdefault_selected` TINYINT(4) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the setrequire_selected column
            if (!array_key_exists('setrequire_selected', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_property ADD COLUMN `setrequire_selected` TINYINT(3) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the setmulti_selected column
            if (!array_key_exists('setmulti_selected', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_property ADD COLUMN `setmulti_selected` TINYINT(4) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the setdisplay_type column
            if (!array_key_exists('setdisplay_type', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_property ADD COLUMN `setdisplay_type` VARCHAR(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the property_published column
            if (!array_key_exists('property_published', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_property ADD `property_published` TINYINT NOT NULL DEFAULT '1' ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for #__redshop_product_attribute_price
        $q = "SHOW COLUMNS FROM #__redshop_product_attribute_price";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the discount_price column
            if (!array_key_exists('discount_price', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_price ADD `discount_price` DECIMAL(12,4) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the discount_price column
            if (array_key_exists('discount_price', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_price CHANGE `discount_price` `discount_price` DOUBLE NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the product_price column
            if (array_key_exists('product_price', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_price CHANGE `product_price` `product_price` DOUBLE NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the price_quantity_end column
            if (array_key_exists('price_quantity_end', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_price CHANGE `price_quantity_end` `price_quantity_end` BIGINT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Change if we have the discount_start_date column
            if (!array_key_exists('discount_start_date', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_price ADD `discount_start_date` INT(11) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the discount_end_date column
            if (!array_key_exists('discount_end_date', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_price ADD `discount_end_date` INT(11) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for redshop product subattribute color
        $q = "SHOW COLUMNS FROM #__redshop_product_subattribute_color";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the attribute_required column
            if (array_key_exists('media_mimetype', $cols)) {
                $q = "ALTER IGNORE TABLE `#__redshop_product_subattribute_color` DROP `media_mimetype`";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the ordering column
            if (!array_key_exists('ordering', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_subattribute_color ADD COLUMN `ordering` INT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the subattribute_color_number column
            if (!array_key_exists('subattribute_color_number', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_subattribute_color ADD COLUMN `subattribute_color_number` VARCHAR( 255 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the subattribute_color_price column
            if (array_key_exists('subattribute_color_price', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_subattribute_color CHANGE `subattribute_color_price` `subattribute_color_price` DOUBLE NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the setdefault_selected column
            if (!array_key_exists('setdefault_selected', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_subattribute_color ADD COLUMN `setdefault_selected` TINYINT(4) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the subattribute_color_title column
            if (!array_key_exists('subattribute_color_title', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_subattribute_color ADD COLUMN `subattribute_color_title` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the subattribute_color_main_image column
            if (!array_key_exists('subattribute_color_main_image', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_subattribute_color ADD COLUMN `subattribute_color_main_image` VARCHAR( 255 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the subattribute_published column
            if (!array_key_exists('subattribute_published', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_subattribute_color ADD `subattribute_published` TINYINT NOT NULL DEFAULT '1' ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for redshop product_voucher
        $q = "SHOW COLUMNS FROM #__redshop_product_voucher";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the voucher_left column
            if (!array_key_exists('voucher_left', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_voucher ADD COLUMN voucher_left INT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the voucher_code column
            if (array_key_exists('voucher_code', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_voucher CHANGE `voucher_code` `voucher_code` VARCHAR( 255 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for redshop product_voucher
        $q = "SHOW COLUMNS FROM #__redshop_product_voucher_transaction";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the voucher_code column
            if (array_key_exists('voucher_code', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_voucher_transaction CHANGE `voucher_code` `voucher_code` VARCHAR( 255 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the product_id column
            if (!array_key_exists('product_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_voucher_transaction ADD `product_id` VARCHAR( 50 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for redshop product_price
        $q = "SHOW COLUMNS FROM #__redshop_product_price";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the price_quantity_start column
            if (!array_key_exists('price_quantity_start', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_price ADD COLUMN price_quantity_start INT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the price_quantity_end column
            if (!array_key_exists('price_quantity_end', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_price ADD COLUMN price_quantity_end INT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the price_quantity_end column
            if (array_key_exists('price_quantity_end', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_price CHANGE `price_quantity_end` `price_quantity_end` BIGINT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the discount_price column
            if (!array_key_exists('discount_price', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_price ADD discount_price DECIMAL( 12, 4 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the discount_start_date column
            if (!array_key_exists('discount_start_date', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_price ADD discount_start_date INT(11) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the discount_end_date column
            if (!array_key_exists('discount_end_date', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_price ADD discount_end_date INT(11) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            if (array_key_exists('product_price', $cols)) {
                $q = "ALTER TABLE `#__redshop_product_price` CHANGE `product_price` `product_price` DECIMAL( 12, 4 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_state";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the checked_out column
            if (!array_key_exists('checked_out', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_state ADD COLUMN `checked_out` INT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the checked_out_time column
            if (!array_key_exists('checked_out_time', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_state ADD COLUMN `checked_out_time` DATETIME NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the show_state column
            if (!array_key_exists('show_state', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_state ADD COLUMN `show_state` INT NOT NULL DEFAULT '2'";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_product";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the quantity_selectbox_value column
            if (!array_key_exists('quantity_selectbox_value', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN quantity_selectbox_value VARCHAR( 255 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the product_download_clock column
            if (!array_key_exists('product_download_clock', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN product_download_clock INT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the checked_out column
            if (!array_key_exists('checked_out', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `checked_out` INT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the checked_out_time column
            if (!array_key_exists('checked_out_time', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `checked_out_time` DATETIME NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the product_download_clock_min column
            if (!array_key_exists('product_download_clock_min', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN product_download_clock_min INT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the product_parent_id column
            if (!array_key_exists('product_parent_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN product_parent_id INT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the   	product_special column
            if (!array_key_exists('product_special', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN  product_special tinyint(4) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the visited column in Product Table
            if (!array_key_exists('visited', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN visited int(11) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the product_download column in Product Table
            if (!array_key_exists('product_download', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD product_download TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the weight column in Product Table
            if (!array_key_exists('weight', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD `weight` float(10,3) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the   	discount_price column
            if (!array_key_exists('discount_price', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN  discount_price double NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `expired` column
            if (!array_key_exists('expired', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN  `expired` TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `product_tax_group_id` column
            if (!array_key_exists('product_tax_group_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN  `product_tax_group_id` INT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `discount_stratdate` column
            if (!array_key_exists('discount_stratdate', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `discount_stratdate` INT(11) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `discount_enddate` column
            if (!array_key_exists('discount_enddate', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `discount_enddate` INT(11) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `not_for_sale` column
            if (!array_key_exists('not_for_sale', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `not_for_sale` TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `use_discount_calc` column
            if (!array_key_exists('use_discount_calc', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `use_discount_calc` TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `discount_calc_method` column
            if (!array_key_exists('discount_calc_method', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `discount_calc_method` VARCHAR( 255 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `discount_calc_unit` column
            if (array_key_exists('discount_calc_unit', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product DROP COLUMN `discount_calc_unit` ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `min_order_product_quantity` column
            if (!array_key_exists('min_order_product_quantity', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `min_order_product_quantity` INT( 11 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `max_order_product_quantity` column
            if (!array_key_exists('max_order_product_quantity', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `max_order_product_quantity` INT( 11 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `attribute_set_id` column
            if (!array_key_exists('attribute_set_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `attribute_set_id` INT( 11 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `product_length` column
            if (!array_key_exists('product_length', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `product_length` decimal(10,2) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `product_height` column
            if (!array_key_exists('product_height', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `product_height` decimal(10,2) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `product_width` column
            if (!array_key_exists('product_width', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `product_width` decimal(10,2) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `product_availability_date` column
            if (!array_key_exists('product_availability_date', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `product_availability_date` VARCHAR( 255 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `product_diameter` column
            if (!array_key_exists('product_diameter', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `product_diameter` DECIMAL( 10, 2 )  NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `use_range` column
            if (!array_key_exists('use_range', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `use_range` TINYINT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `product_download_days` column
            if (!array_key_exists('product_download_days', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `product_download_days` INT( 11 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `product_download_limit` column
            if (!array_key_exists('product_download_limit', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `product_download_limit` INT( 11 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `product_download_infinite` column
            if (!array_key_exists('product_download_infinite', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `product_download_infinite` TINYINT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `product_back_full_image` column
            if (!array_key_exists('product_back_full_image', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `product_back_full_image` VARCHAR( 250 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `product_back_thumb_image` column
            if (!array_key_exists('product_back_thumb_image', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `product_back_thumb_image` VARCHAR( 250 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `product_preview_image` column
            if (!array_key_exists('product_preview_image', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `product_preview_image` VARCHAR( 250 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `product_preview_back_image` column
            if (!array_key_exists('product_preview_back_image', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `product_preview_back_image` VARCHAR( 250 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `accountgroup_id` column
            if (!array_key_exists('accountgroup_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `accountgroup_id` INT( 11 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `preorder` column
            if (!array_key_exists('preorder', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD COLUMN `preorder` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `append_to_global_seo` column
            if (!array_key_exists('append_to_global_seo', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD `append_to_global_seo` ENUM( 'append', 'prepend', 'replace' ) NOT NULL DEFAULT 'append'";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `canonical_url` column
            if (!array_key_exists('canonical_url', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product ADD `canonical_url` text NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_product_discount_calc";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the area_start column
            if (array_key_exists('area_start', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_discount_calc CHANGE `area_start` `area_start` float(10,2) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the area_end column
            if (array_key_exists('area_end', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_discount_calc CHANGE `area_end` `area_end` float(10,2) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the discount_calc_unit column
            if (!array_key_exists('discount_calc_unit', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_discount_calc ADD COLUMN discount_calc_unit varchar(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the area_start_converted column
            if (!array_key_exists('area_start_converted', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_discount_calc ADD COLUMN area_start_converted float(20,8) NOT NULL";
                $db->setQuery($q);
                $db->query();
            } else {
                $q = "ALTER IGNORE TABLE #__redshop_product_discount_calc CHANGE  `area_start_converted`  `area_start_converted` FLOAT( 20, 8 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the area_end_converted column
            if (!array_key_exists('area_end_converted', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_discount_calc ADD COLUMN area_end_converted float(20,8) NOT NULL";
                $db->setQuery($q);
                $db->query();
            } else {
                $q = "ALTER IGNORE TABLE #__redshop_product_discount_calc CHANGE  `area_end_converted`  `area_end_converted` FLOAT( 20, 8 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_shipping_rate";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the shipping_rate_weight_start column
            if (!array_key_exists('shipping_rate_weight_start', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN shipping_rate_weight_start decimal(10,2) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the deliver_type column
            if (!array_key_exists('deliver_type', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN deliver_type INT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the economic_displaynumber column
            if (!array_key_exists('economic_displaynumber', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN economic_displaynumber VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_weight_end column
            if (!array_key_exists('shipping_rate_weight_end', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN shipping_rate_weight_end decimal(10,2) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the company_only column
            if (!array_key_exists('company_only', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN company_only TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the apply_vat column
            if (!array_key_exists('apply_vat', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN apply_vat TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_on_product column
            if (!array_key_exists('shipping_rate_on_product', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN shipping_rate_on_product LONGTEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_on_category column
            if (!array_key_exists('shipping_rate_on_category', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN shipping_rate_on_category LONGTEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_on_product column
            if (array_key_exists('shipping_rate_on_product', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate CHANGE `shipping_rate_on_product` `shipping_rate_on_product` LONGTEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_on_category column
            if (array_key_exists('shipping_rate_on_category', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate CHANGE `shipping_rate_on_category` `shipping_rate_on_category` LONGTEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_on_category column
            if (array_key_exists('shipping_rate_country', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate CHANGE `shipping_rate_country` `shipping_rate_country` LONGTEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_location_info column
            if (!array_key_exists('shipping_location_info', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN `shipping_location_info` LONGTEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_length_start column
            if (!array_key_exists('shipping_rate_length_start', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN `shipping_rate_length_start` decimal(10,2) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_length_end column
            if (!array_key_exists('shipping_rate_length_end', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN `shipping_rate_length_end` decimal(10,2) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_width_start column
            if (!array_key_exists('shipping_rate_width_start', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN `shipping_rate_width_start` decimal(10,2) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_width_end column
            if (!array_key_exists('shipping_rate_width_end', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN `shipping_rate_width_end` decimal(10,2) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_height_start column
            if (!array_key_exists('shipping_rate_height_start', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN `shipping_rate_height_start` decimal(10,2) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_height_end column
            if (!array_key_exists('shipping_rate_height_end', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN `shipping_rate_height_end` decimal(10,2) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_tax_group_id column
            if (!array_key_exists('shipping_tax_group_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD COLUMN `shipping_tax_group_id` INT( 11 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_zip_start column
            if (array_key_exists('shipping_rate_zip_start', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate CHANGE `shipping_rate_zip_start` `shipping_rate_zip_start` VARCHAR( 20 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_zip_end column
            if (array_key_exists('shipping_rate_zip_end', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate CHANGE `shipping_rate_zip_end` `shipping_rate_zip_end` VARCHAR( 20 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_state column
            if (!array_key_exists('shipping_rate_state', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD `shipping_rate_state` LONGTEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_on_shopper_group column
            if (!array_key_exists('shipping_rate_on_shopper_group', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD `shipping_rate_on_shopper_group` LONGTEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_rate_on_shopper_group column
            if (!array_key_exists('consignor_carrier_code', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate ADD `consignor_carrier_code` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_shopper_group";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the shopper_group_customer_type column
            if (!array_key_exists('shopper_group_customer_type', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD COLUMN shopper_group_customer_type TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shopper_group_portal column
            if (!array_key_exists('shopper_group_portal', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD COLUMN shopper_group_portal TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shopper_group_categories column
            if (!array_key_exists('shopper_group_categories', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD COLUMN shopper_group_categories LONGTEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the show_price_without_vat column
            if (!array_key_exists('show_price_without_vat', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD COLUMN show_price_without_vat TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shopper_group_categories column
            if (array_key_exists('shopper_group_categories', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group CHANGE `shopper_group_categories` `shopper_group_categories` LONGTEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shopper_group_url column
            if (!array_key_exists('shopper_group_url', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD COLUMN shopper_group_url VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shopper_group_logo column
            if (!array_key_exists('shopper_group_logo', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD COLUMN shopper_group_logo VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shopper_group_introtext column
            if (!array_key_exists('shopper_group_introtext', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD COLUMN shopper_group_introtext LONGTEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the default_shipping column
            if (!array_key_exists('default_shipping', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD COLUMN default_shipping TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the default_shipping_rate column
            if (!array_key_exists('default_shipping_rate', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD COLUMN default_shipping_rate FLOAT( 10, 2 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the apply_vat  column changed
            if (array_key_exists('apply_vat', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group CHANGE `apply_vat` `tax_exempt_on_shipping` TINYINT( 4 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            if (array_key_exists('tax_exempt_on_shipping', $cols)) {
                $q = "ALTER TABLE `#__redshop_shopper_group` DROP `tax_exempt_on_shipping`";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shopper_group_cart_checkout_itemid column
            if (!array_key_exists('shopper_group_cart_checkout_itemid', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD COLUMN shopper_group_cart_checkout_itemid INT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shopper_group_cart_itemid column
            if (!array_key_exists('shopper_group_cart_itemid', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD COLUMN shopper_group_cart_itemid INT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            /* Check if we have the apply_vat_on_show_price  column changed*/
            if (array_key_exists('apply_vat_on_show_price', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group CHANGE `apply_vat_on_show_price` `tax_exempt` TINYINT( 4 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            if (array_key_exists('tax_exempt', $cols)) {
                $q = "ALTER TABLE `#__redshop_shopper_group` DROP `tax_exempt`";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `tax_group_id` column
            if (!array_key_exists('tax_group_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD `tax_group_id` INT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `apply_product_price_vat` column
            if (!array_key_exists('apply_product_price_vat', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD `apply_product_price_vat` INT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `shopper_group_quotation_mode` column
            if (!array_key_exists('shopper_group_quotation_mode', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD `shopper_group_quotation_mode` TINYINT(4) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `show_price` column
            if (!array_key_exists('show_price', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD `show_price` VARCHAR(255) NOT NULL DEFAULT 'global'";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `use_as_catalog` column
            if (!array_key_exists('use_as_catalog', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD `use_as_catalog` VARCHAR(255) NOT NULL DEFAULT 'global'";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `is_logged_in` column
            if (!array_key_exists('is_logged_in', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD `is_logged_in` INT(11) NOT NULL DEFAULT '1'";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the `is_logged_in` column
            if (array_key_exists('is_logged_in', $cols)) {
                $q = "ALTER IGNORE TABLE `#__redshop_shopper_group` DROP `is_logged_in` ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shopper_group_introtext column
            if (!array_key_exists('shopper_group_manufactures', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shopper_group ADD COLUMN shopper_group_manufactures TEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns
        $q = "SHOW COLUMNS FROM #__redshop_discount";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the start_date column
            if (!array_key_exists('start_date', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_discount ADD COLUMN start_date double NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the end_date column
            if (!array_key_exists('end_date', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_discount ADD COLUMN end_date double NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the discount_amount column
            if (array_key_exists('discount_amount', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_discount CHANGE `discount_amount` `discount_amount` DECIMAL( 10, 4 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for newsletter subscription
        $q = "SHOW COLUMNS FROM #__redshop_newsletter_subscription";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the checkout column
            if (!array_key_exists('checkout', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_newsletter_subscription ADD COLUMN checkout TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for wrapper
        $q = "SHOW COLUMNS FROM #__redshop_wrapper";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the category_id column
            if (!array_key_exists('category_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_wrapper ADD category_id VARCHAR( 250 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for Extra Fields
        $q = "SHOW COLUMNS FROM #__redshop_fields";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the required column
            if (!array_key_exists('required', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_fields ADD COLUMN required TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the ordering column
            if (!array_key_exists('ordering', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_fields ADD `ordering` INT(11) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the display_in_product column
            if (!array_key_exists('display_in_product', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_fields ADD `display_in_product` TINYINT(4) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the display_in_checkout column
            if (!array_key_exists('display_in_checkout', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_fields ADD `display_in_checkout` TINYINT(4) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the redshop_orders
        $q = "SHOW COLUMNS FROM #__redshop_orders";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the mail1_status column
            if (!array_key_exists('mail1_status', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN mail1_status TINYINT( 1 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the referral_code column
            if (!array_key_exists('referral_code', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN referral_code varchar( 50 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the customer_message column
            if (!array_key_exists('customer_message', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN customer_message varchar( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shop_id column
            if (!array_key_exists('shop_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN shop_id VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the order_discount_vat column
            if (!array_key_exists('order_discount_vat', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN order_discount_vat DECIMAL( 10, 3 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the mail2_status column
            if (!array_key_exists('mail2_status', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN mail2_status TINYINT( 1 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the mail3_status column
            if (!array_key_exists('mail3_status', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN mail3_status TINYINT( 1 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the track_no column
            if (!array_key_exists('track_no', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD `track_no` VARCHAR( 250 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the special_discount column
            if (!array_key_exists('special_discount', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN special_discount DECIMAL( 10, 2 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the special_discount_amount column
            if (!array_key_exists('special_discount_amount', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN special_discount_amount DECIMAL( 10, 2 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the payment_discount column
            if (!array_key_exists('payment_discount', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN payment_discount DECIMAL( 10, 2 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the payment_oprand column
            if (!array_key_exists('payment_oprand', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN payment_oprand VARCHAR(50) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the discount_type column
            if (!array_key_exists('discount_type', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN discount_type VARCHAR(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the is_booked column
            if (!array_key_exists('is_booked', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN is_booked TINYINT( 1 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the order_label_create column
            if (!array_key_exists('order_label_create', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN order_label_create TINYINT( 1 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the vm_order_number column
            if (!array_key_exists('vm_order_number', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN vm_order_number VARCHAR( 32 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the analytics_status column
            if (!array_key_exists('analytics_status', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN `analytics_status` INT( 1 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the tax_after_discount column
            if (!array_key_exists('tax_after_discount', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN `tax_after_discount` DECIMAL( 10, 3 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the barcode column
            if (!array_key_exists('barcode', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN `barcode` VARCHAR(13) NOT NULL AFTER `order_number`";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the coupon_discount column
            if (!array_key_exists('coupon_discount', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN `coupon_discount` DECIMAL( 12, 2 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the order_discount column
            if (!array_key_exists('order_discount', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN `order_discount` DECIMAL( 12, 2 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the requisition_number column
            if (!array_key_exists('requisition_number', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN `requisition_number` VARCHAR(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the bookinvoice_number column
            if (!array_key_exists('bookinvoice_number', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN `bookinvoice_number` INT(11) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the bookinvoice_date column
            if (!array_key_exists('bookinvoice_date', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN `bookinvoice_date` INT(11) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the recuuring_subcription_id column
            if (!array_key_exists('recuuring_subcription_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_orders ADD COLUMN `recuuring_subcription_id` VARCHAR( 500 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the redshop_order accessory
        $q = "SHOW COLUMNS FROM #__redshop_order_acc_item";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the order_acc_price column
            if (!array_key_exists('order_acc_price', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_acc_item ADD COLUMN order_acc_price DECIMAL( 15,4 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the order_acc_vat column
            if (!array_key_exists('order_acc_vat', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_acc_item ADD COLUMN order_acc_vat DECIMAL( 15,4 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the redshop_order attribute Item
        $q = "SHOW COLUMNS FROM #__redshop_order_attribute_item";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the order_acc_price column
            if (!array_key_exists('stockroom_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_attribute_item ADD COLUMN stockroom_id VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the order_acc_vat column
            if (!array_key_exists('stockroom_quantity', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_attribute_item ADD COLUMN stockroom_quantity VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the redshop_order_item
        $q = "SHOW COLUMNS FROM #__redshop_order_item";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the stockroom_id column
            if (!array_key_exists('stockroom_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_item ADD COLUMN stockroom_id  INT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the wrapper_id column
            if (!array_key_exists('wrapper_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_item ADD wrapper_id INT( 11 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the wrapper_price column
            if (!array_key_exists('wrapper_price', $cols)) {
                $q = "ALTER IGNORE TABLE `#__redshop_order_item` ADD `wrapper_price` DECIMAL(10,2) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the is_giftcard column
            if (!array_key_exists('is_giftcard', $cols)) {
                $q = "ALTER IGNORE TABLE `#__redshop_order_item` ADD `is_giftcard` TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the giftcard_user_name column
            if (!array_key_exists('giftcard_user_name', $cols)) {
                $q = "ALTER IGNORE TABLE `#__redshop_order_item` ADD `giftcard_user_name` VARCHAR(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the giftcard_user_email column
            if (!array_key_exists('giftcard_user_email', $cols)) {
                $q = "ALTER IGNORE TABLE `#__redshop_order_item` ADD `giftcard_user_email` VARCHAR(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the product_item_price_excl_vat column
            if (!array_key_exists('product_item_price_excl_vat', $cols)) {
                $q = "ALTER IGNORE TABLE `#__redshop_order_item` ADD `product_item_price_excl_vat` DECIMAL(10,3) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the stockroom_id column
            if (array_key_exists('stockroom_id', $cols)) {
                $q = "ALTER IGNORE TABLE `#__redshop_order_item` CHANGE `stockroom_id` `stockroom_id` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the customer_note column
            if (!array_key_exists('customer_note', $cols)) {
                $q = "ALTER IGNORE TABLE `#__redshop_order_item` ADD `customer_note` TEXT NOT NULL AFTER `order_status`";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the product_item_old_price column
            if (!array_key_exists('product_item_old_price', $cols)) {
                $q = "ALTER IGNORE TABLE `#__redshop_order_item` ADD `product_item_old_price` DECIMAL( 10, 4 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the is_split column
            if (!array_key_exists('product_purchase_price', $cols)) {
                $q = "ALTER IGNORE TABLE `#__redshop_order_item` ADD `product_purchase_price` decimal(10,4) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the attribute_image column
            if (!array_key_exists('attribute_image', $cols)) {
                $q = "ALTER TABLE `#__redshop_order_item` ADD `attribute_image` TEXT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the discount_calc_data  column
            if (!array_key_exists('discount_calc_data', $cols)) {
                $q = "ALTER TABLE `#__redshop_order_item` ADD `discount_calc_data` TEXT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the order_item_name  column
            if (array_key_exists('order_item_name', $cols)) {
                $q = "ALTER TABLE `#__redshop_order_item` CHANGE `order_item_name` `order_item_name` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the stockroom_quantity  column
            if (!array_key_exists('stockroom_quantity', $cols)) {
                $q = "ALTER TABLE `#__redshop_order_item` ADD `stockroom_quantity` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the redshop_stockroom
        $q = "SHOW COLUMNS FROM #__redshop_stockroom";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the delivery_time column
            if (!array_key_exists('delivery_time', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_stockroom ADD COLUMN delivery_time VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            if (array_key_exists('stockroom_name', $cols)) {
                $q = "ALTER TABLE `#__redshop_stockroom` CHANGE `stockroom_name` `stockroom_name` VARCHAR( 250 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            if (array_key_exists('show', $cols)) {
                $q = "ALTER TABLE `#__redshop_stockroom` CHANGE `show` `show_in_front` TINYINT( 1 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            if (!array_key_exists('min_stock_amount', $cols)) {
                $q = "ALTER TABLE #__redshop_stockroom ADD  `min_stock_amount` INT( 11 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the product_stockroom_xref
        $q = "SHOW COLUMNS FROM #__redshop_product_stockroom_xref ";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the delivery_time column
            if (!array_key_exists('preorder_stock', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_stockroom_xref ADD COLUMN preorder_stock INT( 11 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            if (!array_key_exists('ordered_preorder', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_stockroom_xref ADD COLUMN ordered_preorder INT( 11 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the product_stockroom_xref
        $q = "SHOW COLUMNS FROM #__redshop_product_attribute_stockroom_xref ";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the delivery_time column
            if (!array_key_exists('preorder_stock', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_stockroom_xref ADD COLUMN preorder_stock INT( 11 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            if (!array_key_exists('ordered_preorder', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_attribute_stockroom_xref ADD COLUMN ordered_preorder INT( 11 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        $q = "SHOW COLUMNS FROM #__redshop_order_users_info";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the phone column
            if (!array_key_exists('phone', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_users_info ADD COLUMN `phone` VARCHAR( 50 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the address column
            if (!array_key_exists('address', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_users_info ADD COLUMN `address` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the zipcode column
            if (array_key_exists('zipcode', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_users_info CHANGE `zipcode` `zipcode` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the city column
            if (!array_key_exists('city', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_users_info ADD COLUMN `city` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the user_email column
            if (!array_key_exists('user_email', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_users_info ADD COLUMN `user_email` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the company_name column
            if (!array_key_exists('company_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_users_info ADD COLUMN `company_name` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the requesting_tax_exempt column
            if (!array_key_exists('requesting_tax_exempt', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_users_info ADD COLUMN `requesting_tax_exempt` TINYINT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the ean_number column
            if (!array_key_exists('ean_number', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_users_info ADD COLUMN `ean_number` VARCHAR( 250 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the thirdparty_email column
            if (!array_key_exists('thirdparty_email', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_users_info ADD COLUMN `thirdparty_email` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        $q = "SHOW COLUMNS FROM #__redshop_shipping_rate";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the phone column
            if (!array_key_exists('shipping_class', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_shipping_rate CHANGE COLUMN `shipping_id` `shipping_class` VARCHAR(255) NOT NULL";
                $db->setQuery($q);
                $db->query();
                $query = "SELECT s.shipping_class, r.shipping_rate_id FROM #__redshop_shipping_rate AS r " . "LEFT JOIN #__redshop_shipping_method AS s ON r.shipping_class = s.shipping_id ";
                $db->setQuery($query);
                $list = $db->loadObjectlist();
                for ($i = 0; $i < count($list); $i++) {
                    if ($list[$i]->shipping_class != "") {
                        $query = 'UPDATE #__redshop_shipping_rate SET shipping_class="' . $list[$i]->shipping_class . '" ' . 'WHERE shipping_rate_id="' . $list[$i]->shipping_rate_id . '" ';
                        $db->setQuery($query);
                        $db->query();
                    }
                }
            }
        }
        $ratesql = "INSERT IGNORE INTO `#__redshop_shipping_rate` (`shipping_rate_id`, `shipping_rate_name`, `shipping_class`, `shipping_rate_country`, `shipping_rate_zip_start`, `shipping_rate_zip_end`, `shipping_rate_weight_start`, `company_only`, `apply_vat`, `shipping_rate_weight_end`, `shipping_rate_volume_start`, `shipping_rate_volume_end`, `shipping_rate_ordertotal_start`, `shipping_rate_ordertotal_end`, `shipping_rate_priority`, `shipping_rate_value`, `shipping_rate_package_fee`, `shipping_location_info`, `shipping_rate_length_start`, `shipping_rate_length_end`, `shipping_rate_width_start`, `shipping_rate_width_end`, `shipping_rate_height_start`, `shipping_rate_height_end`, `shipping_rate_on_product`, `shipping_rate_on_category`, `shipping_tax_group_id`, `shipping_rate_state`) VALUES\n\t\t\t\t\t\t(1, 'Demo Rate', 'default_shipping', '', '', '', 0.00, 0, 0, 0.00, 0.00, 0.00, 0.000, 0.000, 0, 0.00, 0.00, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, '', '', 0, '')";
        $db->setQuery($ratesql);
        $db->Query();
        $boxsql = "INSERT IGNORE INTO `#__redshop_shipping_boxes` (`shipping_box_id`, `shipping_box_name`, `shipping_box_length`, `shipping_box_width`, `shipping_box_height`, `shipping_box_priority`, `published`) VALUES\n\t\t\t\t\t\t\t(1, 'Box1', 1.00, 1.00, 1.00, 1, 1)";
        $db->setQuery($boxsql);
        $db->Query();
        $q = "SHOW COLUMNS FROM #__redshop_wrapper";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the wrapper_use_to_all column
            if (!array_key_exists('wrapper_use_to_all', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_wrapper ADD COLUMN `wrapper_use_to_all` TINYINT( 4 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the published column
            if (!array_key_exists('published', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_wrapper ADD COLUMN `published` TINYINT( 4 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the createdate column
            if (!array_key_exists('createdate', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_wrapper ADD COLUMN `createdate` TINYINT( 4 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the product_id column
            if (array_key_exists('product_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_wrapper CHANGE `product_id` `product_id` VARCHAR( 255 ) NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for redshop product_category_xref
        $q = "SHOW COLUMNS FROM #__redshop_product_category_xref";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the voucher_left column
            if (!array_key_exists('ordering', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_category_xref ADD COLUMN ordering INT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for redshop quotation_item
        $q = "SHOW COLUMNS FROM #__redshop_quotation_item";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the is_giftcard column
            if (!array_key_exists('is_giftcard', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_quotation_item ADD is_giftcard TINYINT( 4 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the mycart_accessory column
            if (!array_key_exists('mycart_accessory', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_quotation_item ADD mycart_accessory TEXT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the actualitem_price column
            if (!array_key_exists('actualitem_price', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_quotation_item ADD actualitem_price DECIMAL( 15, 4 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the product_wrapperid column
            if (!array_key_exists('product_wrapperid', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_quotation_item ADD product_wrapperid INT( 11 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the wrapper_price column
            if (!array_key_exists('wrapper_price', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_quotation_item ADD wrapper_price DECIMAL( 15, 2 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the product_excl_price column
            if (!array_key_exists('product_excl_price', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_quotation_item ADD product_excl_price DECIMAL( 15, 4 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the product_final_price column
            if (!array_key_exists('product_final_price', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_quotation_item ADD product_final_price DECIMAL( 15, 4 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Get the current columns for redshop quotation
        $q = "SHOW COLUMNS FROM #__redshop_quotation";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the order_id column
            if (!array_key_exists('order_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_quotation ADD order_id INT(11) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the quotation_encrkey column
            if (!array_key_exists('quotation_encrkey', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_quotation ADD quotation_encrkey varchar(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the quotation_discount column
            if (!array_key_exists('quotation_discount', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_quotation ADD quotation_discount DECIMAL( 15, 4 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the quotation_tax column
            if (!array_key_exists('quotation_tax', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_quotation ADD quotation_tax DECIMAL( 15, 2 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the user_email column
            if (!array_key_exists('user_email', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_quotation ADD user_email VARCHAR( 255 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the user_email column
            if (!array_key_exists('quotation_special_discount', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_quotation ADD quotation_special_discount DECIMAL( 15, 4 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Check installed payment plugins
        // 	update order_payment table
        $q = "SHOW COLUMNS FROM #__redshop_order_payment";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the order_payment_cardname
            if (!array_key_exists('order_payment_cardname', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_payment ADD `order_payment_cardname` BLOB NOT NULL AFTER `order_payment_code`";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the order_payment_ccv
            if (!array_key_exists('order_payment_ccv', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_payment ADD `order_payment_ccv` BLOB NOT NULL AFTER `order_payment_cardname`";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the order_payment_ccv
            if (!array_key_exists('payment_method_class', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_payment ADD `payment_method_class`  VARCHAR( 256 ) NULL AFTER `order_payment_name`";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the order_payment_ccv
            if (!array_key_exists('authorize_status', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_payment ADD `authorize_status`  VARCHAR( 255 ) NULL AFTER `payment_method_class`";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the order_transfee
            if (!array_key_exists('order_transfee', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_order_payment ADD `order_transfee`  DOUBLE( 10, 2 ) NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Add ordering field
        $q = "SHOW COLUMNS FROM #__redshop_discount_product";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the discount_amount column
            if (array_key_exists('discount_amount', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_discount_product CHANGE `discount_amount` `discount_amount` DECIMAL( 10, 2 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the category_ids column
            if (!array_key_exists('category_ids', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_discount_product ADD `category_ids` TEXT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Add ordering field
        // Wishlist start
        $q = "SHOW COLUMNS FROM #__redshop_wishlist";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the discount_amount column
            if (array_key_exists('product_id', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_wishlist CHANGE `product_id` `wishlist_name` VARCHAR( 100 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // End
        // Mail start
        $q = "SHOW COLUMNS FROM #__redshop_mail";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the discount_amount column
            if (!array_key_exists('mail_bcc', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_mail ADD `mail_bcc` VARCHAR( 255 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // End
        // wishlist start
        $q = "SHOW COLUMNS FROM #__redshop_country";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the discount_amount column
            if (!array_key_exists('country_jtext', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_country ADD `country_jtext` VARCHAR( 255 ) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Giftcard start
        $q = "SHOW COLUMNS FROM #__redshop_giftcard";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the giftcard_value column
            if (!array_key_exists('giftcard_value', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_giftcard ADD `giftcard_value` decimal(10,3) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            if (!array_key_exists('customer_amount', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_giftcard ADD `customer_amount` INT(11) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            if (array_key_exists('customer_amount', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_giftcard CHANGE `customer_amount` `customer_amount` INT(11) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            if (!array_key_exists('accountgroup_id', $cols)) {
                $q = "ALTER TABLE `#__redshop_giftcard` ADD `accountgroup_id` INT NOT NULL  ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Mass discount start
        $q = "SHOW COLUMNS FROM #__redshop_mass_discount";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the discount_product column
            if (!array_key_exists('discount_product', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_mass_discount ADD `discount_product` LONGTEXT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the discount_name column
            if (!array_key_exists('discount_name', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_mass_discount ADD `discount_name` LONGTEXT NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Product_download
        $q = "SHOW COLUMNS FROM #__redshop_product_download";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the product_serial_number column
            if (!array_key_exists('product_serial_number', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_product_download ADD `product_serial_number` varchar(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        $q = "SHOW COLUMNS FROM #__redshop_template";
        $db->setQuery($q);
        $cols = $db->loadObjectList('Field');
        if (is_array($cols)) {
            // Check if we have the order_status column
            if (!array_key_exists('order_status', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_template ADD `order_status` varchar(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the payment_methods column
            if (!array_key_exists('payment_methods', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_template ADD `payment_methods` varchar(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the shipping_methods column
            if (!array_key_exists('shipping_methods', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_template ADD `shipping_methods` varchar(255) NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the checked_out column
            if (!array_key_exists('checked_out', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_template ADD COLUMN `checked_out` INT NOT NULL";
                $db->setQuery($q);
                $db->query();
            }
            // Check if we have the checked_out_time column
            if (!array_key_exists('checked_out_time', $cols)) {
                $q = "ALTER IGNORE TABLE #__redshop_template ADD COLUMN `checked_out_time` DATETIME NOT NULL ";
                $db->setQuery($q);
                $db->query();
            }
        }
        // Demo content insert
        $q = "INSERT IGNORE INTO `#__redshop_mail`\n\t\t\t(`mail_id`, `mail_name`, `mail_subject`, `mail_section`, `mail_order_status`, `mail_body`, `published`, `mail_bcc`)\n\t\t\tVALUES\n\t\t\t(1, 'Ask Question', 'Ask Question About Product', 'ask_question_mail', '0', '<p>To Admin,</p>\r\n<p>Product  : {product_name}</p>\r\n<p>Please check this link : {product_link}</p>\r\n<p> </p>\r\n<p>{user_question}</p>\r\n<p>{answer}</p>\r\n<p> </p>', 1, ''),\n\t\t\t(10, 'Reset Password Mail', 'Reset Password', 'status_of_password_reset', '0', '<p>Hello, request has been made to reset your {username} account password. To reset your password, you will need to submit this token in order to verify that the request was legitimate.</p>\r\n<p>The token is {reset_token}</p>\r\n<p>Click on the URL below to enter the token and proceed with resetting your password.</p>\r\n<p><a href=\"{password_complete_url}\">Reset Password</a></p>\r\n<p> </p>\r\n<p>Thank you.</p>', 1, ''),\n\t\t\t(11, 'Send to friend', 'Send to friend', 'product', '0', '<p>Hi {friend_name} ,</p>\r\n<p>New Product  : {product_name}</p>\r\n<p>{product_desc} Please check this link : {product_url}</p>\r\n<p> </p>\r\n<p> </p>', 1, ''),\n\t\t\t(12, 'Tax exempt approval mail', 'Tax exempt approval mail subject', 'tax_exempt_approval_mail', '0', '<p>Hello,</p>\r\n<p>Tax exempt has been approved</p>', 1, ''),\n\t\t\t(13, 'Tax exempt disapproval mail', 'Tax exempt disapproval mail subject', 'tax_exempt_disapproval_mail', '0', '<p>Hello,</p>\r\n<p>Tax exempt  has been disapproved.</p>', 1, ''),\n\t\t\t(14, 'Tax exempt waiting approval mail', 'Tax exempt waiting approval mail subject', 'tax_exempt_waiting_approval_mail', '0', '<p>Tax exempt waiting approval mail contents...</p>\r\n<p>Thanks.</p>', 1, ''),\n\t\t\t(15, 'Registration mail', 'Registration mail', 'register', '0', '<table style=\"border: 1px solid #ccc; background: #fff; width: 600px;\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tbody>\r\n<tr>\r\n<td>\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 20px;\"></td>\r\n<td>\r\n<table style=\"width: 100%;\">\r\n<tbody>\r\n<tr>\r\n<td width=\"400px\"><a href=\"http://redcomponent.com\" target=\"_blank\"> <img src=\"http://redcomponent.com/images/redcomponent_logo.png\" style=\"width: 340px; height: auto; padding-top: 20px;\" /> </a></td>\r\n<td style=\"font-size: 12px; color: #878787; float: right;\"></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n</td>\r\n<td style=\"width: 20px;\"></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n<table style=\"width: 100%;\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tbody>\r\n<tr>\r\n<td style=\"height: 20px; background-color: #444544;\"></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tbody>\r\n<tr>\r\n<td colspan=\"3\" style=\"height: 20px;\"></td>\r\n</tr>\r\n<tr>\r\n<td style=\"width: 20px;\"></td>\r\n<td>\r\n<p style=\"font-size: 24px; font-family: verdana; color: #616161; text-align: justify;\">Thank you for your registration!</p>\r\n<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">You are now a registered user at redCOMPONENT.</p>\r\n<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify; line-height: 20px;\">To go to your account where you can make all necessary adjustments, such as change your address book, view old orders, download your purchased products, or sign up for our newsletter please click <a href=\"http://www.redcomponent.com/account\" target=\"_blank\">here</a>.</p>\r\n<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">�</p>\r\n<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\"><strong>User information:</strong></p>\r\n<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Username: {username}</p>\r\n<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Password: {password}</p>\r\n<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">�</p>\r\n<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Regards,<br />redCOMPONENT</p>\r\n</td>\r\n<td style=\"width: 20px;\"></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n<table style=\"margin-top: 30px; width: 100%;\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tbody>\r\n<tr>\r\n<td style=\"height: 45px; background-color: #444544; display: block !important;\"></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n</td>\r\n</tr>\r\n</tbody>\r\n</table>', 1, ''),\n\t\t\t(16, 'Catlog First Reminder', 'Catlog First Reminder', 'catalog_first_reminder', '0', '<!-- \t\t@page { margin: 0.79in } \t\tP { margin-bottom: 0.08in } \t-->\r\n<p style=\"margin-left: 0.5in; margin-bottom: 0in; text-align: left;\"><strong><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\">Dear {name}. <br /></span></span></strong></p>\r\n<p style=\"margin-left: 0.5in; margin-bottom: 0in; text-align: left;\"><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\"><span> My name is xyz, in charge of customer support here at abc. We sent you our catalogue the other day, and I would just like to know if you had a chance to look at it...? In any case, I am ready by the phone / e-mail if you need any assistance whatsoever. </span></span></span></p>\r\n<p style=\"margin-left: 0.5in; margin-bottom: 0in; text-align: left;\"><strong><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\"><span>Kind regards,</span></span></span></strong></p>\r\n<p style=\"margin-left: 0.5in; margin-bottom: 0in; text-align: left;\"><strong><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\"><span>Name<br /></span></span></span></strong></p>\r\n<p style=\"margin-left: 0.5in; margin-bottom: 0in;\"> </p>', 1, ''),\n\t\t\t(17, 'Catlog Second Reminder', 'Catlog Second Reminder', 'catalog_second_reminder', '0', '<p style=\"background: #ffffff none repeat scroll 0% 0%; margin-left: 0.5in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; text-align: left;\"><strong><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\"><span>Dear {name}, </span></span></span></strong></p>\r\n<p style=\"background: #ffffff none repeat scroll 0% 0%; margin-left: 0.5in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; text-align: left;\"><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\"><span> I just wish to inform you that we are currently running a campaign for all the clients who received our catalogue earlier. This means that in the next 4 days, you get </span></span></span><span style=\"color: #ff0000;\"><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\"><span>5% </span></span></span></span><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\"><span>off everything you buy, and since our products are already competitively priced, it is a really good offer. You can use the code: XXX when you order to get the discount, but remember you have 4 days from now to decide!</span></span></span></p>\r\n<p style=\"background: #ffffff none repeat scroll 0% 0%; margin-left: 0.5in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; text-align: left;\"> </p>\r\n<p style=\"background: #ffffff none repeat scroll 0% 0%; margin-left: 0.5in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; text-align: left;\"><strong>Regards,</strong></p>\r\n<p style=\"background: #ffffff none repeat scroll 0% 0%; margin-left: 0.5in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; text-align: left;\"><strong>xyz. </strong></p>', 1, ''),\n\t\t\t(18, 'Catlog Sample First Reminder', 'Catlog Sample First Reminder', 'colour_sample_first_reminder', '0', '<!-- \t\t@page { margin: 0.79in } \t\tP { margin-bottom: 0.08in } \t-->\r\n<p style=\"margin-left: 0.5in; margin-bottom: 0in;\"><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\"><span>Dear {name}. My name is xyz, in charge of customer support here at xyz. You have requested some colour samples, and I will send them to you as soon as possible. If you have any questions, please do not hesitate to contact me. </span></span></span><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\">Kind regards, xyz</span></span></p>', 1, ''),\n\t\t\t(19, 'Catlog Sample Second Reminder', 'Catlog Sample Second Reminder', 'colour_sample_second_reminder', '0', '<!-- \t\t@page { margin: 0.79in } \t\tP { margin-bottom: 0.08in } \t-->\r\n<p style=\"margin-left: 0.5in; margin-bottom: 0in;\"><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\"><span>Dear {name}. I sent you some sample colour material the other day, and I would just like to know if you had a chance to look at it...? In any case, I am ready by the phone / e-mail if you need any assistance whatsoever. Kind regards, xyz</span></span></span></p>', 1, ''),\n\t\t\t(20, 'Catlog Sample Third Reminder', 'Catlog Sample Third Reminder', 'colour_sample_third_reminder', '0', '<!-- \t\t@page { margin: 0.79in } \t\tP { margin-bottom: 0.08in } \t-->\r\n<p style=\"margin-left: 0.5in; margin-bottom: 0in;\"><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\"><span>Dear {name}. I just wish to inform you that we are currently running a campaign for all the clients who received sample colour material from us earlier. This means that in the next 4 days, you get 5% off everything you buy, and since our products are already competitively priced, it is a really good offer. You can use the code: XXX when you order to get the discount, but remember you have 4 days from now to decide!</span></span></span></p>', 1, ''),\n\t\t\t(21, 'Order Mail', 'Order Mail for {order_id}', 'order', '0', '<table style=\"border: 1px solid #ccc; background: #fff; width: 700px;\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"line-height: 25px;\">\n<table style=\"width: 100%; background: #f7f7f7;\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td colspan=\"3\" style=\"height: 10px;\"></td>\n</tr>\n<tr>\n<td style=\"width: 20px;\"></td>\n<td style=\"line-height: 25px;\">\n<table style=\"width: 100%;\">\n<tbody>\n<tr>\n<td width=\"400px\"><a href=\"http://redcomponent.com\" target=\"_blank\"> <img src=\"images/redcomponent_logo.png\" style=\"width: 340px; height: auto; padding-top: 20px;\" /> </a></td>\n<td style=\"font-size: 12px; color: #878787; float: right; text-align: right; font-family: verdana; vertical-align: top;\">{order_date}</td>\n</tr>\n</tbody>\n</table>\n</td>\n<td style=\"width: 20px;\"></td>\n</tr>\n</tbody>\n</table>\n<table style=\"width: 100%;\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"height: 20px; background-color: #444544;\"></td>\n</tr>\n</tbody>\n</table>\n<table style=\"width: 100%;\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td colspan=\"3\" style=\"height: 20px;\"></td>\n</tr>\n<tr>\n<td style=\"width: 20px;\"></td>\n<td style=\"line-height: 25px;\">\n<p style=\"font-size: 24px; font-family: verdana; color: #666666; text-align: justify;\"><strong>Thank you for your order!</strong></p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">Thank you for ordering from redCOMPONENT!<br />To download your purchased products please follow the link in the bottom of this mail.</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify; margin-bottom: 0 !important;\">&nbsp;</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify; margin-bottom: 5px !important;\"><strong>Products ordered:</strong></p>\n<table style=\"width: 100%; line-height: 25px;\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody><!--{product_loop_start}-->\n<tr style=\"border-bottom: 1px solid #F1F1F1;\">\n<td colspan=\"3\">\n<table style=\"width: 100%;\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 32px;\"><span style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\"> {product_quantity} x </span></td>\n<td><span style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">{product_name}{without_vat}</span> <span style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">{product_accessory}</span></td>\n</tr>\n</tbody>\n</table>\n</td>\n<td align=\"right\"><span style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: right;\">{product_total_price}</span></td>\n</tr>\n<!--{product_loop_end}--> <!--{if discount}-->\n<tr>\n<td colspan=\"3\"><span style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">Discount</span></td>\n<td align=\"right\"><span style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">{discount_excl_vat}</span></td>\n</tr>\n<!--{discount end if}-->\n<tr>\n<td colspan=\"3\" style=\"padding-top: 10px;\"><span style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">VAT</span></td>\n<td align=\"right\"><span style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">{sub_total_vat}</span></td>\n</tr>\n<tr>\n<td colspan=\"3\"><span style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\"><strong>Total</strong></span></td>\n<td align=\"right\"><span style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\"><strong>{order_total}</strong></span></td>\n</tr>\n</tbody>\n</table>\n<p style=\"text-align: justify;\">&nbsp;</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify; margin-bottom: 5px !important;\"><strong>Billing information: </strong></p>\n<div style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">{billing_address}</div>\n<p>&nbsp;</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify; margin-bottom: 5px !important;\"><strong>Additional information:</strong></p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify; margin-bottom: 5px !important;\">{customer_note}</p>\n<p>&nbsp;</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify; margin-bottom: 5px !important;\"><strong>Order details:</strong></p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">To see the details of your order and download your products please {order_detail_link}.</p>\n<p>&nbsp;</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify; margin-bottom: 5px !important;\"><strong>Please Note!</strong></p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">Single sales items are available for immediate download, and until 7 days after purchase. Please ensure that you download your product within this timeframe.</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">When ordering one or more service products:</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">As this is a manual process, please allow 2-4 business days for a redCOMPONENT employee to get back to You.</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">Customizations Services is offered to Templates Customers only.</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">If you require any further assistance with customization of non-redCOMPONENT templates, or if You would prefer a quote on a uniquely designed website, template, component or plug-in - Please fill out our contact form to initiate dialogue.</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">&nbsp;</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\">Regards,<br />redCOMPONENT</p>\n</td>\n<td style=\"width: 20px; padding-bottom: 30px;\"></td>\n</tr>\n<tr style=\"height: 10px;\">\n<td colspan=\"3\"></td>\n</tr>\n</tbody>\n</table>\n<table style=\"width: 100%;\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"height: 45px; background-color: #444544; display: block !important;\"></td>\n</tr>\n</tbody>\n</table>\n</td>\n</tr>\n</tbody>\n</table>', 1, ''),\n\t\t\t(22, 'Order Status Change Shipped', 'Order Status Change Shipped', 'order_status', 'S', '<table style=\"border: 1px solid #ccc;background: #fff; width:600px;\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tr>\r\n<td>\r\n\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 100%;background: #f7f7f7;\">\r\n\t<tbody>\r\n\t<tr>\r\n\t\t<td colspan=\"3\" style=\"height: 20px;\"></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t\t<td>\r\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td width=\"400px\">\r\n\t\t\t<a href=\"http://redcomponent.com\" target=\"_blank\"> <img src=\"http://redcomponent.com/images/redcomponent_logo.png\" style=\"width: 340px; height: auto; padding-top: 20px;\" /> </a>\r\n\t\t</td>\r\n\t\t<td style=\"font-size: 12px; color: #878787; float: right;text-align: right;font-family: verdana;vertical-align:top;\">\r\n\t\t\t{order_date}\r\n\t\t</td>\r\n\t</tr>\r\n</table>\r\n\t\t</td>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t</tr>\r\n\t</tbody>\r\n</table>\r\n\r\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td style=\"height: 20px; background-color: #444544;\"></td>\r\n\t</tr>\r\n</table>\r\n\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 100%\">\r\n<tbody>\r\n\t<tr>\r\n\t\t<td colspan=\"3\" style=\"height: 20px;\"></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t\t<td>\r\n\t\t\t<p style=\"font-size: 24px; font-family: verdana; color: #616161; text-align: justify;\">Order status</p>\r\n\t\t\t<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Your order status has changed.</p>\r\n\t\t\t<p> </p>\r\n\t\t\t<p> </p>\r\n\t\t\t<p> </p>\r\n\t\t\t<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Regards,<br />redCOMPONENT</p>\r\n\t\t</td>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t</tr>\r\n<tr style=\"height: 160px\">\r\n    <td colspan=\"3\"></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n\r\n<table width=\"100%\" style=\"margin-top: 30px;\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td style=\"height: 45px; background-color: #444544; display: block !important;\"></td>\r\n\t</tr>\r\n</table>\r\n</td>\r\n</tr>\r\n</table>', 1, ''),\n\t\t\t(23, 'Order Status Change Refunded', 'Order Status Change Refunded', 'order_status', 'R', '<table style=\"border: 1px solid #ccc;background: #fff; width:600px;\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tr>\r\n<td>\r\n\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 100%;background: #f7f7f7;\">\r\n\t<tbody>\r\n\t<tr>\r\n\t\t<td colspan=\"3\" style=\"height: 20px;\"></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t\t<td>\r\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td width=\"400px\">\r\n\t\t\t<a href=\"http://redcomponent.com\" target=\"_blank\"> <img src=\"http://redcomponent.com/images/redcomponent_logo.png\" style=\"width: 340px; height: auto; padding-top: 20px;\" /> </a>\r\n\t\t</td>\r\n\t\t<td style=\"font-size: 12px; color: #878787; float: right;text-align: right;font-family: verdana;vertical-align:top;\">\r\n\t\t\t{order_date}\r\n\t\t</td>\r\n\t</tr>\r\n</table>\r\n\t\t</td>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t</tr>\r\n\t</tbody>\r\n</table>\r\n\r\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td style=\"height: 20px; background-color: #444544;\"></td>\r\n\t</tr>\r\n</table>\r\n\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 100%\">\r\n<tbody>\r\n\t<tr>\r\n\t\t<td colspan=\"3\" style=\"height: 20px;\"></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t\t<td>\r\n\t\t\t<p style=\"font-size: 24px; font-family: verdana; color: #616161; text-align: justify;\">Order status</p>\r\n\t\t\t<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Your order status has changed.</p>\r\n\t\t\t<p> </p>\r\n\t\t\t<p> </p>\r\n\t\t\t<p> </p>\r\n\t\t\t<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Regards,<br />redCOMPONENT</p>\r\n\t\t</td>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t</tr>\r\n<tr style=\"height: 160px\">\r\n    <td colspan=\"3\"></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n\r\n<table width=\"100%\" style=\"margin-top: 30px;\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td style=\"height: 45px; background-color: #444544; display: block !important;\"></td>\r\n\t</tr>\r\n</table>\r\n</td>\r\n</tr>\r\n</table>', 1, ''),\n\t\t\t(24, 'Order Status Change Pending', 'Order Status Change Pending', 'order_status', 'P', '<table style=\"border: 1px solid #ccc;background: #fff; width:600px;\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tr>\r\n<td>\r\n\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 100%;background: #f7f7f7;\">\r\n\t<tbody>\r\n\t<tr>\r\n\t\t<td colspan=\"3\" style=\"height: 20px;\"></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t\t<td>\r\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td width=\"400px\">\r\n\t\t\t<a href=\"http://redcomponent.com\" target=\"_blank\"> <img src=\"http://redcomponent.com/images/redcomponent_logo.png\" style=\"width: 340px; height: auto; padding-top: 20px;\" /> </a>\r\n\t\t</td>\r\n\t\t<td style=\"font-size: 12px; color: #878787; float: right;text-align: right;font-family: verdana;vertical-align:top;\">\r\n\t\t\t{order_date}\r\n\t\t</td>\r\n\t</tr>\r\n</table>\r\n\t\t</td>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t</tr>\r\n\t</tbody>\r\n</table>\r\n\r\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td style=\"height: 20px; background-color: #444544;\"></td>\r\n\t</tr>\r\n</table>\r\n\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 100%\">\r\n<tbody>\r\n\t<tr>\r\n\t\t<td colspan=\"3\" style=\"height: 20px;\"></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t\t<td>\r\n\t\t\t<p style=\"font-size: 24px; font-family: verdana; color: #616161; text-align: justify;\">Order status</p>\r\n\t\t\t<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Your order status has changed.</p>\r\n\t\t\t<p> </p>\r\n\t\t\t<p> </p>\r\n\t\t\t<p> </p>\r\n\t\t\t<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Regards,<br />redCOMPONENT</p>\r\n\t\t</td>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t</tr>\r\n<tr style=\"height: 160px\">\r\n    <td colspan=\"3\"></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n\r\n<table width=\"100%\" style=\"margin-top: 30px;\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td style=\"height: 45px; background-color: #444544; display: block !important;\"></td>\r\n\t</tr>\r\n</table>\r\n</td>\r\n</tr>\r\n</table>', 1, ''),\n\t\t\t(25, 'Order Status Change Confirmed', 'Order Status Change Confirmed', 'order_status', 'C', '<table style=\"border: 1px solid #ccc;background: #fff; width:600px;\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tr>\r\n<td>\r\n\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 100%;background: #f7f7f7;\">\r\n\t<tbody>\r\n\t<tr>\r\n\t\t<td colspan=\"3\" style=\"height: 20px;\"></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t\t<td>\r\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td width=\"400px\">\r\n\t\t\t<a href=\"http://redcomponent.com\" target=\"_blank\"> <img src=\"http://redcomponent.com/images/redcomponent_logo.png\" style=\"width: 340px; height: auto; padding-top: 20px;\" /> </a>\r\n\t\t</td>\r\n\t\t<td style=\"font-size: 12px; color: #878787; float: right;text-align: right;font-family: verdana;vertical-align:top;\">\r\n\t\t\t{order_date}\r\n\t\t</td>\r\n\t</tr>\r\n</table>\r\n\t\t</td>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t</tr>\r\n\t</tbody>\r\n</table>\r\n\r\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td style=\"height: 20px; background-color: #444544;\"></td>\r\n\t</tr>\r\n</table>\r\n\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 100%\">\r\n<tbody>\r\n\t<tr>\r\n\t\t<td colspan=\"3\" style=\"height: 20px;\"></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t\t<td>\r\n\t\t\t<p style=\"font-size: 24px; font-family: verdana; color: #616161; text-align: justify;\">Order status</p>\r\n\t\t\t<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Your order status has changed.</p>\r\n\t\t\t<p> </p>\r\n\t\t\t<p> </p>\r\n\t\t\t<p> </p>\r\n\t\t\t<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Regards,<br />redCOMPONENT</p>\r\n\t\t</td>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t</tr>\r\n<tr style=\"height: 160px\">\r\n    <td colspan=\"3\"></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n\r\n<table width=\"100%\" style=\"margin-top: 30px;\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td style=\"height: 45px; background-color: #444544; display: block !important;\"></td>\r\n\t</tr>\r\n</table>\r\n</td>\r\n</tr>\r\n</table>', 1, ''),\n\t\t\t(26, 'Order Status Change Cancelled', 'Order Status Change Cancelled', 'order_status', 'X', '<table style=\"border: 1px solid #ccc;background: #fff; width:600px;\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tr>\r\n<td>\r\n\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 100%;background: #f7f7f7;\">\r\n\t<tbody>\r\n\t<tr>\r\n\t\t<td colspan=\"3\" style=\"height: 20px;\"></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t\t<td>\r\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td width=\"400px\">\r\n\t\t\t<a href=\"http://redcomponent.com\" target=\"_blank\"> <img src=\"http://redcomponent.com/images/redcomponent_logo.png\" style=\"width: 340px; height: auto; padding-top: 20px;\" /> </a>\r\n\t\t</td>\r\n\t\t<td style=\"font-size: 12px; color: #878787; float: right;text-align: right;font-family: verdana;vertical-align:top;\">\r\n\t\t\t{order_date}\r\n\t\t</td>\r\n\t</tr>\r\n</table>\r\n\t\t</td>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t</tr>\r\n\t</tbody>\r\n</table>\r\n\r\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td style=\"height: 20px; background-color: #444544;\"></td>\r\n\t</tr>\r\n</table>\r\n\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 100%\">\r\n<tbody>\r\n\t<tr>\r\n\t\t<td colspan=\"3\" style=\"height: 20px;\"></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t\t<td>\r\n\t\t\t<p style=\"font-size: 24px; font-family: verdana; color: #616161; text-align: justify;\">Order status</p>\r\n\t\t\t<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Your order status has changed.</p>\r\n\t\t\t<p>�</p>\r\n\t\t\t<p>�</p>\r\n\t\t\t<p>�</p>\r\n\t\t\t<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Regards,<br />redCOMPONENT</p>\r\n\t\t</td>\r\n\t\t<td style=\"width: 20px;\"></td>\r\n\t</tr>\r\n<tr style=\"height: 160px\">\r\n    <td colspan=\"3\"></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n\r\n<table width=\"100%\" style=\"margin-top: 30px;\" cellpadding=\"0\" cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<td style=\"height: 45px; background-color: #444544; display: block !important;\"></td>\r\n\t</tr>\r\n</table>\r\n</td>\r\n</tr>\r\n</table>', 1, ''),\n\t\t\t(27, 'catalog coupon reminder', 'catalog coupon reminder', 'catalog_coupon_reminder', '0', '<!-- \t\t@page { margin: 0.79in } \t\tP { margin-bottom: 0.08in } \t-->\r\n<p style=\"background: #ffffff none repeat scroll 0% 0%; margin-left: 0.5in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial\"><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\"><span>Dear {name}. I just wish to inform you that we are currently running a campaign for all the clients who received our catalogue earlier. This means that in the next 4 days, you get </span></span></span><span style=\"color: #ff0000;\"><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\"><span>{discount} </span></span></span></span><span style=\"font-family: Verdana,sans-serif;\"><span style=\"font-size: x-small;\"><span>off everything you buy, and since our products are already competitively priced, it is a really good offer. You can use the code: {coupon_code} when you order to get the discount, but remember you have 4 days from now to decide!</span></span></span></p>', 1, ''),\n\t\t\t(30, 'First Mail After Order Purchased', 'Mail After Order Purchased', 'first_mail_after_order_purchased', '0', '<p>Hi {name}, <br />You made an order with us 7 days ago and to show our appreciation of you as a customer we send you discount code to use the next time you visit our store</p>\r\n<p>{url}</p>\r\n<p>discount amount : {coupon_amount}</p>\r\n<p>discount coupon code : {coupon_code}</p>\r\n<p>valid upto : {coupon_duration}</p>\r\n<p>Thank you.</p>', 1, ''),\n\t\t\t(32, 'Second Mail After Order Purchased', 'Second Mail After Order Purchased', 'second_mail_after_order_purchased', '0', '<p>Hi {name}, <br />You made an order with us 10 days ago and to show our appreciation of you as a customer we send you discount code to use the next time you visit our store</p>\r\n<p>{url}</p>\r\n<p>discount amount : {coupon_amount}</p>\r\n<p>discount coupon code : {coupon_code}</p>\r\n<p>valid upto : {coupon_duration}</p>\r\n<p>Thank you.</p>', 1, ''),\n\t\t\t(33, 'Third Mail After Order Purchased', 'Third Mail After Order Purchased', 'third_mail_after_order_purchased', '0', '<p>Hi {name}, <br />You made an order with us 21 days ago and to show our appreciation of you as a customer we send you discount code to use the next time you visit our store</p>\r\n<p>{url}</p>\r\n<p>discount amount : {coupon_amount}</p>\r\n<p>discount coupon code : {coupon_code}</p>\r\n<p>valid upto : {coupon_duration}</p>\r\n<p>Thank you.</p>', 1, ''),\n\t\t\t(50, 'Economic Invoice', 'Invoice', 'economic_inoice', '0', '<table style=\"border: 1px solid #ccc; background: #fff; width: 600px;\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tbody>\r\n<tr>\r\n<td>\r\n<table style=\"width: 100%; background: #f7f7f7;\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 20px;\"></td>\r\n<td style=\"line-height: 25px;\">\r\n<table style=\"width: 100%; padding-top: 10px;\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tbody>\r\n<tr>\r\n<td style=\"height: 94px;\" width=\"400px\"><a href=\"http://redcomponent.com\" target=\"_blank\"> <img src=\"http://redcomponent.com/images/redcomponent_logo.png\" style=\"width: 340px; height: auto;\" /> </a></td>\r\n<td style=\"font-size: 12px; color: #666666; float: right; text-align: right; font-family: verdana; vertical-align: top;\">{order_date}</td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n</td>\r\n<td style=\"width: 20px;\"></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n<table style=\"width: 100%;\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tbody>\r\n<tr>\r\n<td style=\"height: 20px; background-color: #444544;\"></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tbody>\r\n<tr>\r\n<td colspan=\"3\" style=\"height: 20px;\"></td>\r\n</tr>\r\n<tr>\r\n<td style=\"width: 20px;\"></td>\r\n<td style=\"padding-bottom: 30px;\">\r\n<p style=\"font-size: 14px; font-family: verdana; color: #666666; text-align: justify;\"><strong>Hi {name}</strong><br /><br />Attached is your invoice.<br /><br />Regards,<br />redCOMPONENT</p>\r\n</td>\r\n<td style=\"width: 20px;\"></td>\r\n</tr>\r\n<tr style=\"height: 160px;\">\r\n<td colspan=\"3\"></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n<table style=\"width: 100%;\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tbody>\r\n<tr>\r\n<td style=\"height: 45px; background-color: #444544; display: block !important;\"></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n</td>\r\n</tr>\r\n</tbody>\r\n</table>', 1, ''),\n\t\t\t(34, 'Catalog Send Mail', 'Catalog Request', 'catalog', '0', '<p>Dear, <strong>{name}</strong></p>\r\n<p>We get your request for catalog. Here, you can found attached catalogs.</p>\r\n<p> </p>\r\n<p>Thank you.</p>', 1, ''),\n\t\t\t(54, 'My wishlist mail', 'My wishlist', 'mywishlist_mail', '0', 'hi,{name}<!--{product_loop_start}--><table style=\"width: 100%;\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\"><tbody><tr valign=\"top\"><td width=\"40%\"><div style=\"float: left; width: 195px; height: 230px; text-align: center;\">{product_thumb_image}<div>{product_name}</div><div>{product_price}</div></div></td></tr></tbody></table><!--{product_loop_end}-->Regards,{from_name}', 1, ''),\n\t\t\t(64, 'Order Special Discount Mail', 'Admin applied discount (special offer)', 'order_special_discount', '0', 'You got {special_discount} that is {special_discount_amount}.<table style=\"width: 100%;\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\"><tbody><tr><td><br /></td><td><table style=\"width: 100%;\" align=\"right\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tbody><tr><td align=\"right\">ABC Company -- abc.com</td></tr><tr><td align=\"right\">abccompany.com</td></tr><tr><td align=\"right\">Street Address</td></tr><tr><td align=\"right\">Address line 2</td></tr><tr><td align=\"right\">County</td></tr><tr><td align=\"right\">Country</td></tr><tr><td></td></tr><tr><td align=\"right\">Telephone Number : 11325-3251</td></tr><tr><td></td></tr><tr><td align=\"right\">E-mail : abccompany@abc.om</td></tr></tbody></table></td></tr><tr><td style=\"font-weight: bold\" colspan=\"2\">Some Title</td></tr><tr><td colspan=\"2\">Some Intro text...Lorem Ipsum is simply dummy \t\t\ttext of the printing and typesetting industry. Lorem Ipsum has been \t\t\tthe industrys standard dummy text ever since the 1500s, when an \t\t\tunknown printer took a galley of type and scrambled it to make a type \t\t\tspecimen book. It has survived not only five centuries...</td></tr><tr><td colspan=\"2\"><table style=\"width: 100%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tbody><tr style=\"background-color: #cccccc\"><th align=\"left\">Order Information</th></tr><tr></tr><tr><td>Order id : {order_id}</td></tr><tr><td>Order Number : {order_number}</td></tr><tr><td>Order Date : {order_date}</td></tr><tr><td>Order Status : {order_status}</td></tr></tbody></table></td></tr><tr><td colspan=\"2\"><table style=\"width: 100%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tbody><tr style=\"background-color: #cccccc\"><th align=\"left\">Billing Address Information</th></tr><tr></tr><tr><td>{billing_address}</td></tr></tbody></table></td></tr><tr><td colspan=\"2\"><table style=\"width: 100%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tbody><tr style=\"background-color: #cccccc\"><th align=\"left\">Shipping Address Information</th></tr><tr></tr><tr><td>{shipping_address}</td></tr></tbody></table></td></tr><tr><td colspan=\"2\"><table style=\"width: 100%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tbody><tr style=\"background-color: #cccccc\"><th align=\"left\">Order Details</th></tr><tr></tr><tr><td><table style=\"width: 100%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\"><tbody><tr><td>Product Name</td><td>Note</td><td>Price</td><td>Quantity</td><td align=\"right\">Total Price</td></tr><!--{product_loop_start}--><tr><td>{product_name}        {product_sku}</td><td>{product_wrapper}</td><td>{product_price}</td><td>{product_quantity}</td><td align=\"right\">{product_total_price}</td></tr><!--{product_loop_end}--></tbody></table></td></tr><tr><td></td></tr><tr><td><table style=\"width: 100%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\"><tbody><tr align=\"left\"><td align=\"left\"><strong>Order Subtotal : </strong></td><td align=\"right\">{product_subtotal}</td></tr><tr align=\"left\"><td align=\"left\"><strong>TAX : </strong></td><td align=\"right\">{order_tax}</td></tr><tr align=\"left\"><td align=\"left\"><strong>Discount : </strong></td><td align=\"right\">{order_discount}</td></tr><tr align=\"left\"><td align=\"left\"><strong>{special_discount_lbl} </strong></td><td align=\"right\">{special_discount_amount}</td></tr><tr align=\"left\"><td align=\"left\"><strong>Shipping : </strong></td><td align=\"right\">{order_shipping}</td></tr><tr align=\"left\"><td colspan=\"2\" align=\"left\"><hr /></td></tr><tr align=\"left\"><td align=\"left\"><strong>Total :</strong></td><td align=\"right\">{order_total}</td></tr><tr align=\"left\"><td colspan=\"2\" align=\"left\"><hr /></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table>', 1, ''),\n\t\t\t(74, 'News letter ', 'News Letter confirmation', 'newsletter_confirmation', '0', '<p>hi {name},</p>\r\n<p>Confirm your News letter {link}.</p>', 1, ''),\n\t\t\t(94, 'Giftcard Mail', 'Giftcard Mail', 'giftcard_mail', '0', '<table><tr><td ><span>{giftcard_price_lbl}</span></td><td>{giftcard_price}</td></tr><tr><td ><span>{giftcard_reciver_name_lbl}</span></td><td>{giftcard_reciver_name}</td></tr><tr><td>{giftcard_reciver_email_lbl}</td><td>{giftcard_reciver_email}</td></tr><tr><td></td><td>{giftcard_desc}</td></tr><tr><td></td><td>{giftcard_price}</td></tr><tr><td>{giftcard_validity_from}{giftcard_validity_to}</td></tr><tr><td>{giftcard_image}</td></tr><tr><td>{giftcard_validity}</td></tr></table>', 1, ''),\n\t\t\t(84, 'NewsLetter cancellation ', 'NewsLetter cancellation ', 'newsletter_cancellation', '0', 'NewsLetter cancellationNewsLetter cancellation NewsLetter cancellation NewsLetter cancellationNewsLetter cancellation NewsLetter cancellation', 1, ''),\n\t\t\t(85, 'Invoice Mail', 'Invoice Mail', 'invoice_mail', '0', '<table style=\"border: 1px solid #ccc;background: #fff; width:600px;\">\n<tr>\n<td>\n\t<div style=\"padding: 10px 20px;\">\n\t\t<table width=\"100%\">\n\t<tr>\n\t\t<td width=\"400px\">\n\t\t\t<a href=\"http://redcomponent.com\" target=\"_blank\"> <img src=\"http://redcomponent.com/images/redcomponent_logo.png\" style=\"width: 340px; height: auto; padding-top: 20px;\" /> </a>\n\t\t</td>\n\t\t<td style=\"font-size: 12px; color: #878787; float: right;\">\n\t\t\t{order_date}\n\t\t</td>\n\t</tr>\n</table>\n\t</div>\n\t<table width=\"100%\">\n\t<tr>\n\t\t<td style=\"height: 20px; background-color: #444544;\"></td>\n\t</tr>\n</table>\n\t<div style=\"padding: 10px 20px;\">\n\t\t<p style=\"font-size: 24px; font-face: verdana; color: #616161; text-align: justify;\">Thank you for your order!</p>\n\t\t<p style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\">Thank you for ordering from redCOMPONENT!<br />To download your purchased products please follow the link in the bottom of this mail.</p>\n\t\t<p style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\"> </p>\n\t\t<p style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\"><strong>Products ordered:</strong></p>\n\t\t<table style=\"width: 100%;\" border=\"0\">\n\t\t<tbody>\n\t\t<!--{product_loop_start}-->\n\t\t<tr style=\"border-bottom: 1px solid #F1F1F1;\">\n\t\t<td><span style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\"><strong>{product_name}{without_vat}</strong></span></td>\n\t\t<td><span style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\">{product_price}</span></td>\n\t\t<td><span style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\">{product_quantity}</span></td>\n\t\t<td align=\"right\"><span style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: right;\">{product_total_price}</span></td>\n\t\t</tr>\n\t\t<!--{product_loop_end}-->\n\t\t<tr>\n\t\t<td colspan=\"3\"><span style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\"><strong>VAT</strong></span></td>\n\t\t<td align=\"right\"><span style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\">{sub_total_vat}</span></td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td colspan=\"3\"><span style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\"><strong>Total</strong></span></td>\n\t\t<td align=\"right\"><span style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\">{order_total}</span></td>\n\t\t</tr>\n\t\t</tbody>\n\t\t</table>\n\t\t<p style=\"text-align: justify;\"> </p>\n\t\t<p style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\"><strong>Billing information: </strong></p>\n\t\t<div style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\">{billing_address}</div>\n\t\t<p> </p>\n\t\t<p style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\"><strong>Additional information:</strong></p>\n\t\t<p style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\">{customer_note}</p>\n\t\t<p> </p>\n\t\t<p style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\"><strong>Order details:</strong></p>\n\t\t<p style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\">To see the details of your order and to download the products please click {order_detail_link}</p>\n\t\t<p style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\"> </p>\n\t\t<p style=\"font-size: 14px; font-face: verdana; color: #616161; text-align: justify;\">Regards,<br />redCOMPONENT</p>\n\t</div>\n<table width=\"100%\" style=\"margin-top: 30px;\">\n\t<tr>\n\t\t<td style=\"height: 45px; background-color: #444544; display: block !important;\"></td>\n\t</tr>\n</table>\n</td>\n</tr>\n</table>', 1, ''),\n\t\t\t(86, 'Product Subscription Mail', 'Mail for product Subscription ', 'subscription_renewal_mail', '0', '<h1>Product Subscription Renew</h1>\r\n<h3>Dear,</h3>\r\n<p><span>{firstname} {lastname}</span></p>\r\n<p>Your Subscription for <strong>{product_name}</strong> is going to expired on <span>{subsciption_enddate}</span></p>\r\n<h2>Your Subscription Detail is as below</h2>\r\n<table border=\"0\">\r\n<tbody>\r\n<tr>\r\n<td>Subscribe Product :</td>\r\n<td>{product_name}</td>\r\n</tr>\r\n<tr>\r\n<td>Subscription Period :</td>\r\n<td>{subscription_period}</td>\r\n</tr>\r\n<tr>\r\n<td>Subscription Price : </td>\r\n<td>{subscription_price}</td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n<p>Click here <em>{product_link}</em> and renew it</p>', 1, ''),\n\t\t\t(105, 'Quotation Mail', 'Quotation Mail for {quotation_id} - {quotation_status} - {quotation_total}', 'quotation_mail', '0', '<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\" width=\"100%\">\r\n<tbody>\r\n<tr>\r\n<td>\r\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">\r\n<tbody>\r\n<tr style=\"background-color: #cccccc\">\r\n<th align=\"left\">{quotation_information_lbl}</th>\r\n</tr>\r\n<tr>\r\n<td>{quotation_id_lbl} : {quotation_id}</td>\r\n</tr>\r\n<tr>\r\n<td>{quotation_number_lbl} : {quotation_number}</td>\r\n</tr>\r\n<tr>\r\n<td>{quotation_date_lbl} : {quotation_date}</td>\r\n</tr>\r\n<tr>\r\n<td>{quotation_status_lbl} : {quotation_status}</td>\r\n</tr>\r\n<tr>\r\n<td>{quotation_note_lbl} : {quotation_note}</td>\r\n</tr>\r\n<tr>\r\n<td>{quotation_detail_link}</td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n</td>\r\n</tr>\r\n<tr>\r\n<td>\r\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">\r\n<tbody>\r\n<tr style=\"background-color: #cccccc\">\r\n<th align=\"left\">{billing_address_information_lbl}</th>\r\n</tr>\r\n<tr>\r\n<td>{billing_address}</td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n</td>\r\n</tr>\r\n<tr>\r\n<td>\r\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">\r\n<tbody>\r\n<tr style=\"background-color: #cccccc\">\r\n<th align=\"left\">{quotation_detail_lbl}</th>\r\n</tr>\r\n<tr>\r\n<td>\r\n<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"100%\">\r\n<tbody>\r\n<tr>\r\n<td>{product_name_lbl}</td>\r\n<td>{note_lbl}</td>\r\n<td>{price_lbl}</td>\r\n<td>{quantity_lbl}</td>\r\n<td align=\"right\">{total_price_lbl}</td>\r\n</tr>\r\n<!--{product_loop_start}-->\r\n<tr>\r\n<td>{product_name}{product_s_desc}({product_number})<br />{product_userfields}<br />{product_attribute}<br />{product_accessory}</td>\r\n<td>{product_wrapper}<br />{product_thumb_image}</td>\r\n<td>{product_price}</td>\r\n<td>{product_quantity}</td>\r\n<td align=\"right\">{product_total_price}</td>\r\n</tr>\r\n<!--{product_loop_end}-->\r\n</tbody>\r\n</table>\r\n</td>\r\n</tr>\r\n<tr>\r\n<td></td>\r\n</tr>\r\n<tr>\r\n<td>\r\n<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"100%\">\r\n<tbody>\r\n<tr align=\"left\">\r\n<td align=\"left\"><strong>{quotation_subtotal_lbl} : </strong></td>\r\n<td align=\"right\">{quotation_subtotal}</td>\r\n</tr>\r\n<tr align=\"left\">\r\n<td colspan=\"2\" align=\"left\">\r\n<hr />\r\n</td>\r\n</tr>\r\n<tr align=\"left\">\r\n<td align=\"left\"><strong>{total_lbl} :</strong></td>\r\n<td align=\"right\">{quotation_total}</td>\r\n</tr>\r\n<tr align=\"left\">\r\n<td colspan=\"2\" align=\"left\">\r\n<hr />\r\n<br /> \r\n<hr />\r\n</td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n</td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n</td>\r\n</tr>\r\n</tbody>\r\n</table>', 1, ''),\n\t\t\t(150, 'Catalogue Order Mail', 'Catalogue Order Mail:', 'catalogue_order', '0', '<table style=\"width: 100%;\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\"><tbody><tr><td><br /></td><td><table style=\"width: 100%;\" align=\"right\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tbody><tr><td align=\"right\">ABC Company -- abc.com</td></tr><tr><td align=\"right\">abccompany.com</td></tr><tr><td align=\"right\">Street Address</td></tr><tr><td align=\"right\">Address line 2</td></tr><tr><td align=\"right\">County</td></tr><tr><td align=\"right\">Country</td></tr><tr><td></td></tr><tr><td align=\"right\">Telephone Number : 11325-3251</td></tr><tr><td></td></tr><tr><td align=\"right\">E-mail : abccompany@abc.om</td></tr></tbody></table></td></tr><tr><td style=\"font-weight: bold\" colspan=\"2\">Some Title</td></tr><tr><td colspan=\"2\">Some Intro text...Lorem Ipsum is simply dummy    text of the printing and typesetting industry. Lorem Ipsum has been    the industry\\'s standard dummy text ever since the 1500s, when an    unknown printer took a galley of type and scrambled it to make a type    specimen book. It has survived not only five centuries...</td></tr><tr><td colspan=\"2\"><table style=\"width: 100%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tbody><tr style=\"background-color: #cccccc\"><th align=\"left\">{order_information_lbl}</th></tr><tr></tr><tr><td>{order_id_lbl} : {order_id}</td></tr><tr><td>{order_number_lbl} : {order_number}</td></tr><tr><td>{order_date_lbl} : {order_date}</td></tr><tr><td>{order_status_lbl} : {order_status}</td></tr></tbody></table></td></tr><tr><td colspan=\"2\"><table style=\"width: 100%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tbody><tr style=\"background-color: #cccccc\"><th align=\"left\">{billing_address_information_lbl}</th></tr><tr></tr><tr><td>{billing_address}</td></tr></tbody></table></td></tr><tr><td colspan=\"2\"><table style=\"width: 100%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tbody><tr style=\"background-color: #cccccc\"><th align=\"left\">{shipping_address_information_lbl}</th></tr><tr></tr><tr><td>{shipping_address}</td></tr></tbody></table></td></tr><tr><td colspan=\"2\"><table style=\"width: 100%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tbody><tr style=\"background-color: #cccccc\"><th align=\"left\">{order_detail_lbl}</th></tr><tr></tr><tr><td><table style=\"width: 100%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\"><tbody><tr><td>{product_name_lbl}</td><td>{note_lbl}</td><td>{quantity_lbl}</td></tr><!--{product_loop_start}--><tr><td>{pro_name}<br /> {product_userfields}</td><td>{pro_note}</td><td>{pro_quantity}</td></tr><!--{product_loop_end}--></tbody></table></td></tr></tbody></table></td></tr><tr><td colspan=\"2\"><table style=\"width: 100%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tbody><tr style=\"background-color: #cccccc\"><th align=\"left\">Payment Status</th></tr><tr></tr><tr><td>{order_payment_status}{shipping_method_lbl}{shipping_method}</td></tr></tbody></table></td></tr><tr><td colspan=\"2\"><table style=\"width: 100%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tbody><tr style=\"background-color: #cccccc\"><th align=\"left\">Order url</th></tr><tr></tr><tr><td>{order_detail_link}</td></tr></tbody></table></td></tr></tbody></table>', 1, ''),\n\t\t\t(160, 'Quotation User Register Mail', 'Quotation User Register Mail:', 'quotation_user_register', '0', '<table><tr><td>Username</td><td> : </td><td>{username}</td></tr><tr><td>Password</td><td> : </td><td>{password}</td></tr><tr><td>Click here</td><td> : </td><td>{link}</td></tr></table>', 1, ''),\n\t\t\t(175, 'RequestTaxExemptMail', 'RequestTaxExemptMail:', 'request_tax_exempt_mail', '0', '<table style=\"width: 100%;\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\"><tbody><tr><td>Vat Number</td><td>{vat_number}</td></tr><tr><td>User Name</td><td>{username}</td></tr><tr><td>Company Name</td><td>{company_name}</td></tr><tr><td>Country</td><td>{country}</td></tr><tr><td>State</td><td>{state}</td></tr><tr><td>Phone</td><td>{phone}</td></tr><tr><td>Zipcode</td><td>{zipcode}</td></tr><tr><td>Address</td><td>{address}</td></tr><tr><td>City</td><td>{city}</td></tr></tbody></table>', 1, ''),\n\t\t\t(185, 'Downloadable Email', 'Link to download your newly purchased product(s)', 'downloadable_product_mail', '0', '<table style=\"border: 1px solid #ccc; background: #fff; width: 600px;\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"line-height: 25px;\">\n<table style=\"width: 100%; background: #f7f7f7;\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td colspan=\"3\" style=\"height: 10px;\"></td>\n</tr>\n<tr>\n<td style=\"width: 20px;\"></td>\n<td>\n<table style=\"width: 100%;\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td width=\"400px\"><a href=\"http://redcomponent.com\" target=\"_blank\"> <img src=\"http://redcomponent.com/images/redcomponent_logo.png\" style=\"width: 340px; height: auto; padding-top: 20px;\" /> </a></td>\n<td style=\"font-size: 12px; color: #878787; float: right; font-family: verdana; vertical-align: top;\">{order_date}</td>\n</tr>\n</tbody>\n</table>\n</td>\n<td style=\"width: 20px;\"></td>\n</tr>\n</tbody>\n</table>\n<table style=\"width: 100%;\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"height: 20px; background-color: #444544;\"></td>\n</tr>\n</tbody>\n</table>\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td colspan=\"3\" style=\"height: 20px;\"></td>\n</tr>\n<tr>\n<td style=\"width: 20px;\"></td>\n<td style=\"line-height: 25px;\">\n<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\"><strong>Dear {fullname}</strong></p>\n<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Thanks for your recent purchase at our store. Here are the link(s) where you can download file/product that you have purchased.</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Order Date : {order_date}<br />Order # : {order_number}<br />Download Links :</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">{product_serial_loop_start} {product_name} - {token} <br /> {product_serial_loop_end}</p>\n<p style=\"font-size: 14px; font-family: verdana; color: #616161; text-align: justify;\">Once again, thank you for shopping!</p>\n</td>\n<td style=\"width: 20px;\"></td>\n</tr>\n<tr style=\"height: 160px;\">\n<td colspan=\"3\"></td>\n</tr>\n</tbody>\n</table>\n<table style=\"margin-top: 30px; width: 100%;\" cellpadding=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"height: 45px; background-color: #444544;\"></td>\n</tr>\n</tbody>\n</table>\n</td>\n</tr>\n</tbody>\n</table>', 1, ''),\n\t\t\t(186, 'Review', 'Review About Product', 'review_mail', '0', '<p>To Admin,</p><p>Username: {username}</p><p>Product : {product_name}</p><p>Please check this link : {product_link}</p><p>Title : {title}</p><p>Comment : {comment}</p>', 1, ''),\n\t\t\t(187, 'Notify Stock', 'Stock Update Notification for {product_name}', 'notify_stock_mail', '0', '<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\" width=\"100%\"><tbody><tr><td><table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\"><tbody><tr style=\"background-color: #cccccc\"><th align=\"left\">{stocknotify_intro_text}</th></tr><tr><td>{product_detail}</td></tr></tbody></table></td></tr></tbody></table>', 1, '')";
        $db->setQuery($q);
        $db->query();
        // Start template demo content
        $redtemplate = new Redtemplate();
        $q = "INSERT IGNORE INTO `#__redshop_template` (`template_id`, `template_name`, `template_section`, `template_desc`, `published`) VALUES\n\t\t\t\t\t(8, 'grid', 'category', '" . $redtemplate->getInstallSectionTemplate('grid') . "', 1),\n\t\t\t\t\t(5, 'list', 'category', '" . $redtemplate->getInstallSectionTemplate('list') . "', 1),\n\t\t\t\t\t(26, 'product2', 'product', '" . $redtemplate->getInstallSectionTemplate('product2') . "', 1),\n\t\t\t\t\t(9, 'product', 'product', '" . $redtemplate->getInstallSectionTemplate('product') . "', 1),\n\t\t\t\t\t(29, 'newsletter1', 'newsletter', '" . $redtemplate->getInstallSectionTemplate('newsletter1') . "', 1),\n\t\t\t\t\t(10, 'cart', 'cart', '" . $redtemplate->getInstallSectionTemplate('cart') . "', 1),\n\t\t\t\t\t(11, 'review', 'review', '" . $redtemplate->getInstallSectionTemplate('review') . "', 1),\n\t\t\t\t\t(13, 'manufacturer_listings', 'manufacturer','" . $redtemplate->getInstallSectionTemplate('manufacturer_listings') . "', 1),\n\t\t\t\t\t(14, 'manufacturer_products', 'manufacturer_products','" . $redtemplate->getInstallSectionTemplate('manufacturer_products') . "', 1),\n\t\t\t\t\t(15, 'order_list', 'order_list', '" . $redtemplate->getInstallSectionTemplate('order_list') . "', 1),\n\t\t\t\t\t(16, 'order_detail', 'order_detail', '" . $redtemplate->getInstallSectionTemplate('order_detail') . "', 1),\n\t\t\t\t\t(23, 'related_products', 'related_product', '" . $redtemplate->getInstallSectionTemplate('related_products') . "', 1),\n\t\t\t\t\t(17, 'order_receipt', 'order_receipt', '" . $redtemplate->getInstallSectionTemplate('order_receipt') . "', 1),\n\t\t\t\t\t(18, 'manufacturer_detail', 'manufacturer_detail', '" . $redtemplate->getInstallSectionTemplate('manufacturer_detail') . "', 1),\n\t\t\t\t\t(22, 'frontpage_category', 'frontpage_category', '" . $redtemplate->getInstallSectionTemplate('frontpage_category') . "', 1),\n\t\t\t\t\t(24, 'add_to_cart1', 'add_to_cart', '" . $redtemplate->getInstallSectionTemplate('add_to_cart1') . "', 1),\n\t\t\t\t\t(25, 'add_to_cart2', 'add_to_cart', '" . $redtemplate->getInstallSectionTemplate('add_to_cart2') . "', 1),\n\t\t\t\t\t(27, 'accessory', 'accessory_template', '" . $redtemplate->getInstallSectionTemplate('accessory') . "', 1),\n\t\t\t\t\t(28, 'attributes', 'attribute_template', '" . $redtemplate->getInstallSectionTemplate('attributes') . "', 1),\n\t\t\t\t\t(100,'my_account_template','account_template','" . $redtemplate->getInstallSectionTemplate('my_account_template') . "',1),\n\t\t\t\t\t(101, 'catalog', 'catalog', '" . $redtemplate->getInstallSectionTemplate('catalog') . "', 1),\n\t\t\t\t\t(102, 'catalog_sample', 'product_sample', '" . $redtemplate->getInstallSectionTemplate('catalog_sample') . "', 1),\n\t\t\t\t\t(103, 'wishlist_list','wishlist_template','" . $redtemplate->getInstallSectionTemplate('wishlist_list') . "',1),\n\t\t\t\t\t(105,'wishlist_mail','wishlist_mail_template','" . $redtemplate->getInstallSectionTemplate('wishlist_mail') . "',1),\n\t\t\t\t\t(115,'wrapper','wrapper_template','" . $redtemplate->getInstallSectionTemplate('wrapper') . "',1),\n\t\t\t\t\t(125,'giftcard_listing','giftcard_list','" . $redtemplate->getInstallSectionTemplate('giftcard_listing') . "',1),\n\t\t\t\t\t(135,'giftcard','giftcard','" . $redtemplate->getInstallSectionTemplate('giftcard') . "',1),\n\t\t\t\t\t(110, 'ask_question', 'ask_question_template', '" . $redtemplate->getInstallSectionTemplate('ask_question') . "', 1),\n\t\t\t\t\t(111, 'ajax_cart_box', 'ajax_cart_box', '" . $redtemplate->getInstallSectionTemplate('ajax_cart_box') . "', 1),\n\t\t\t\t\t(112, 'ajax_cart_detail_box', 'ajax_cart_detail_box', '" . $redtemplate->getInstallSectionTemplate('ajax_cart_detail_box') . "', 1),\n\t\t\t\t\t(200, 'shipping_pdf', 'shipping_pdf', '" . $redtemplate->getInstallSectionTemplate('shipping_pdf') . "', 1),\n\t\t\t\t\t(251, 'order_print', 'order_print', '" . $redtemplate->getInstallSectionTemplate('order_print') . "', 1),\n\t\t\t\t\t(252, 'clicktell_sms_message', 'clicktell_sms_message', '" . $redtemplate->getInstallSectionTemplate('clicktell_sms_message') . "', 1),\n\t\t\t\t\t(260, 'redproductfinder', 'redproductfinder', '" . $redtemplate->getInstallSectionTemplate('redproductfinder') . "', 1),\n\t\t\t\t\t(265, 'quotation_detail', 'quotation_detail', '" . $redtemplate->getInstallSectionTemplate('quotation_detail') . "', 1),\n\t\t\t\t\t(334, 'newsletter_products', 'newsletter_product', '" . $redtemplate->getInstallSectionTemplate('newsletter_products') . "', 1),\n\t\t\t\t    (280, 'catalogue_cart', 'catalogue_cart', '" . $redtemplate->getInstallSectionTemplate('catalogue_cart') . "', 1),\n\t\t\t\t\t(281, 'catalogue_order_detail', 'catalogue_order_detail', '" . $redtemplate->getInstallSectionTemplate('catalogue_order_detail') . "', 1),\n\t\t\t\t\t(282, 'catalogue_order_receipt', 'catalogue_order_receipt', '" . $redtemplate->getInstallSectionTemplate('catalogue_order_receipt') . "', 1),\n\t\t\t\t\t(289, 'empty_cart', 'empty_cart', '" . $redtemplate->getInstallSectionTemplate('empty_cart') . "', 1),\n\t\t\t\t\t(320, 'compare_product', 'compare_product', '" . $redtemplate->getInstallSectionTemplate('compare_product') . "', 1),\n\t\t\t\t\t(353, 'payment_method', 'redshop_payment', '" . $redtemplate->getInstallSectionTemplate('payment_method') . "', 1),\n\t\t\t\t\t(354, 'shipping_method', 'redshop_shipping', '" . $redtemplate->getInstallSectionTemplate('shipping_method') . "', 1),\n\t\t\t\t\t(355, 'shipping_box', 'shippingbox', '" . $redtemplate->getInstallSectionTemplate('shippingbox') . "',1),\n\t\t\t\t\t(356, 'category_product_template', 'categoryproduct', '" . $redtemplate->getInstallSectionTemplate('category_product_template') . "', 1),\n\t\t\t\t\t(357, 'change_cart_attribute_template', 'change_cart_attribute', '" . $redtemplate->getInstallSectionTemplate('change_cart_attribute_template') . "', 1),\n\t\t\t\t\t(358, 'onestep_checkout', 'onestep_checkout', '" . $redtemplate->getInstallSectionTemplate('onestep_checkout') . "', 1),\n\t\t\t\t\t(359, 'attributes_listing1', 'attributewithcart_template', '" . $redtemplate->getInstallSectionTemplate('attributes_listing1') . "', 1),\n\t\t\t\t\t(360, 'checkout', 'checkout', '" . $redtemplate->getInstallSectionTemplate('checkout') . "',1),\n\t\t\t\t\t(371, 'product_content', 'product_content_template', '" . $redtemplate->getInstallSectionTemplate('product_content') . "',1),\n\t\t\t\t    (372, 'quotation_cart_template', 'quotation_cart', '" . $redtemplate->getInstallSectionTemplate('quotation_cart') . "',1),\n\t\t\t\t\t(370, 'quotation_request_template', 'quotation_request', '" . $redtemplate->getInstallSectionTemplate('quotation_request_template') . "',1),\n\t\t\t\t\t(450, 'billing_template', 'billing_template', '" . $redtemplate->getInstallSectionTemplate('billing_template') . "',1),\n\t\t\t\t\t(451, 'shipping_template', 'shipping_template', '" . $redtemplate->getInstallSectionTemplate('shipping_template') . "',1),\n\t\t\t\t\t(452, 'shippment_invoice_template', 'shippment_invoice_template', '" . $redtemplate->getInstallSectionTemplate('shippment_invoice_template') . "',1),\n\t\t\t\t\t(460, 'private_billing_template', 'private_billing_template', '" . $redtemplate->getInstallSectionTemplate('private_billing_template') . "',1),\n\t\t\t\t\t(461, 'company_billing_template', 'company_billing_template', '" . $redtemplate->getInstallSectionTemplate('company_billing_template') . "',1),\n\t                (550, 'stock_note', 'stock_note', '" . $redtemplate->getInstallSectionTemplate('stock_note') . "',1)";
        $db->setQuery($q);
        $db->query();
        $shopper_query = "INSERT IGNORE INTO `#__redshop_shopper_group` ( `shopper_group_id` ,`shopper_group_name` ,`shopper_group_customer_type` ,`shopper_group_portal` ,`shopper_group_categories` ,`shopper_group_url` ,`shopper_group_logo` ,`shopper_group_introtext` ,`shopper_group_desc` ,`parent_id` ,`published`)\n\t\t\t\t\t\tVALUES (1 , 'Default Private', '1', '0', '', '', '', 'This is the default private shopper group.', 'This is the default private shopper group.', '0', '1')";
        $db->setQuery($shopper_query);
        $db->query();
        $shopper_query = "INSERT IGNORE INTO `#__redshop_shopper_group` ( `shopper_group_id` ,`shopper_group_name` ,`shopper_group_customer_type` ,`shopper_group_portal` ,`shopper_group_categories` ,`shopper_group_url` ,`shopper_group_logo` ,`shopper_group_introtext` ,`shopper_group_desc` ,`parent_id` ,`published`)\n\t\t\t\t\t\tVALUES (2 , 'Default Company', '0', '0', '', '', '', 'This is the default Company shopper group.', 'This is the default Company shopper group.', '0', '1')";
        $db->setQuery($shopper_query);
        $db->query();
        $shopper_query = "INSERT IGNORE INTO `#__redshop_shopper_group` ( `shopper_group_id` ,`shopper_group_name` ,`shopper_group_customer_type` ,`shopper_group_portal` ,`shopper_group_categories` ,`shopper_group_url` ,`shopper_group_logo` ,`shopper_group_introtext` ,`shopper_group_desc` ,`parent_id`, `published`)\n\t\t\t\t\t\tVALUES (3 , 'Default Tax Exempt', '0', '0', '', '', '', 'This is the Default Tax Exempt shopper group.', 'This is the Default Tax Exempt shopper group.', '0', '1')";
        $db->setQuery($shopper_query);
        $db->query();
        $vatgroup_query = "INSERT IGNORE INTO `#__redshop_tax_group` ( `tax_group_id` ,`tax_group_name` ,`published`)\n\t\t\t\t\t\tVALUES (1 , 'Default','1')";
        $db->setQuery($vatgroup_query);
        $db->query();
        $accgrp_query = "INSERT IGNORE INTO `#__redshop_economic_accountgroup` " . "( `accountgroup_id` ,`accountgroup_name` ,`economic_vat_account` " . ",`economic_nonvat_account`, `economic_discount_vat_account`, `economic_discount_nonvat_account` " . ", `economic_shipping_vat_account` ,`economic_shipping_nonvat_account` " . ",`economic_discount_product_number` ,`published`) " . "VALUES (1 , 'default account group', '4001', '4000', '4001', '4000', '4001', '4000', '191919', '1') ";
        $db->setQuery($accgrp_query);
        $db->query();
        $newsletter_query = "INSERT IGNORE INTO `#__redshop_newsletter` (`newsletter_id` , `name` , `subject` , `body` , `template_id` , `published`)\n\t                       VALUES ('1', 'News Letter Demo', 'News Letter Demo', 'User Name : {username} Email : {email}', '29', '1')";
        $db->setQuery($newsletter_query);
        $db->query();
        // TEMPLATE MOVE DB TO  FILE
        $db = JFactory::getDbo();
        $q = "SELECT * FROM #__redshop_template";
        $db->setQuery($q);
        $list = $db->loadObjectList();
        for ($i = 0; $i < count($list); $i++) {
            $data =& $list[$i];
            $red_template = new Redtemplate();
            $tname = $data->template_name;
            $data->template_name = strtolower($data->template_name);
            $data->template_name = str_replace(" ", "_", $data->template_name);
            $tempate_file = $red_template->getTemplatefilepath($data->template_section, $data->template_name, true);
            if (!is_file($tempate_file)) {
                $fp = fopen($tempate_file, "w");
                fwrite($fp, $data->template_desc);
                fclose($fp);
            }
            if (is_file($tempate_file)) {
                $template_desc = file_get_contents($tempate_file);
                if (!strstr($template_desc, '{product_subtotal}') && !strstr($template_desc, '{product_subtotal_excl_vat}')) {
                    if (strstr($template_desc, '{subtotal}') || strstr($template_desc, '{order_subtotal}')) {
                        $template_desc = str_replace("{subtotal}", "{product_subtotal}", $template_desc);
                        $template_desc = str_replace("{order_subtotal}", "{product_subtotal}", $template_desc);
                    }
                    if (strstr($template_desc, '{subtotal_excl_vat}') || strstr($template_desc, '{order_subtotal_excl_vat}')) {
                        $template_desc = str_replace("{subtotal_excl_vat}", "{product_subtotal_excl_vat}", $template_desc);
                        $template_desc = str_replace("{order_subtotal_excl_vat}", "{product_subtotal_excl_vat}", $template_desc);
                    }
                }
                if (!strstr($template_desc, '{shipping_excl_vat}')) {
                    if (strstr($template_desc, '{shipping}')) {
                        $template_desc = str_replace('{shipping}', '{shipping_excl_vat}', $template_desc);
                    }
                    if (strstr($template_desc, '{shipping_with_vat}')) {
                        $template_desc = str_replace('{shipping_with_vat}', '{shipping}', $template_desc);
                    }
                }
                $fp = fopen($tempate_file, "w");
                fwrite($fp, $template_desc);
                fclose($fp);
            }
            if ($data->template_id) {
                if ($data->template_name != $tname) {
                    $uquery = "UPDATE `#__redshop_template` SET template_name ='" . $data->template_name . "' " . "WHERE template_id='" . $data->template_id . "'";
                    $db->setQuery($uquery);
                    $db->query();
                }
            }
        }
        $q = "select * from `#__redshop_mail` where mail_section = 'invoice_mail' or mail_section = 'order'";
        $db->setQuery($q);
        $list = $db->loadObjectList();
        for ($i = 0; $i < count($list); $i++) {
            $data =& $list[$i];
            $mail_body = $data->mail_body;
            if (!strstr($mail_body, '{product_subtotal}') && !strstr($mail_body, '{product_subtotal_excl_vat}')) {
                if (strstr($mail_body, '{subtotal}') || strstr($mail_body, '{order_subtotal}')) {
                    $mail_body = str_replace("{subtotal}", "{product_subtotal}", $mail_body);
                    $mail_body = str_replace("{order_subtotal}", "{product_subtotal}", $mail_body);
                }
                if (strstr($mail_body, '{subtotal_excl_vat}') || strstr($mail_body, '{order_subtotal_excl_vat}')) {
                    $mail_body = str_replace("{subtotal_excl_vat}", "{product_subtotal_excl_vat}", $mail_body);
                    $mail_body = str_replace("{order_subtotal_excl_vat}", "{product_subtotal_excl_vat}", $mail_body);
                }
                // $mail_body = addslashes($mail_body);
                $uquery = "UPDATE `#__redshop_mail` SET mail_body ='{$mail_body}' " . "WHERE mail_section='" . $data->mail_section . "' AND mail_id='" . $data->mail_id . "'";
                $db->setQuery($uquery);
                $db->query();
            }
            if (!strstr($mail_body, '{shipping_excl_vat}')) {
                if (strstr($mail_body, '{shipping}') || strstr($mail_body, '{order_shipping}')) {
                    $mail_body = str_replace("{shipping}", "{shipping_excl_vat}", $mail_body);
                }
                if (strstr($mail_body, '{order_shipping}')) {
                    $mail_body = str_replace("{order_shipping}", "{shipping_excl_vat}", $mail_body);
                }
                if (strstr($mail_body, '{shipping_with_vat}')) {
                    $mail_body = str_replace("{shipping_with_vat}", "{shipping}", $mail_body);
                }
                $mail_body = addslashes($mail_body);
                $uquery = "UPDATE `#__redshop_mail` SET mail_body ='{$mail_body}' " . "WHERE mail_section='" . $data->mail_section . "' AND mail_id='" . $data->mail_id . "'";
                $db->setQuery($uquery);
                $db->query();
            }
        }
        // TEMPLATE MOVE DB TO  FILE END
        // For Blank component id in menu table-admin menu error solution
        $q_ext = "select * from `#__extensions` where name = 'redshop' and element = 'com_redshop' and type='component'";
        $db->setQuery($q_ext);
        $list_ext = $db->loadObjectList();
        $data =& $list_ext[0];
        if (count($data) > 0) {
            $extension_id = $data->extension_id;
            if ($extension_id == "") {
                $extension_id = "1";
            }
            $uquery_ext = "UPDATE `#__menu` SET component_id ='.{$extension_id}.' " . " WHERE  menutype = 'main' and path = 'redshop' and type='component'";
            $db->setQuery($uquery_ext);
            $db->query();
        }
        $index_to = array("#__redshop_product" => "product_number", "#__redshop_orders" => "vm_order_number", "#__redshop_users_info" => "user_id");
        foreach ($index_to as $key => $val) {
            $db->setQuery('SHOW INDEXES FROM ' . $key . ' where Column_name="' . $val . '"');
            if ($redshop_users_info = $db->query()) {
                $redshop_users_info_index_count = $db->getNumRows($redshop_users_info);
                if ($redshop_users_info_index_count == 0) {
                    $db->setQuery('ALTER TABLE ' . $key . ' ADD INDEX(' . $val . ')');
                    $db->query();
                }
            }
        }
        ?>
		<center>
			<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
				<tr>
					<td valign="top">
						<img src="<?php 
        echo 'components/com_redshop/assets/images/261-x-88.png';
        ?>
" alt="redSHOP Logo"
						     align="left">
					</td>
					<td valign="top" width="100%">
						<strong>redSHOP</strong><br/>
						<font class="small">by <a href="http://www.redcomponent.com"
						                          target="_blank">redcomponent.com </a><br/></font>
						<font class="small">
							Released under the terms and conditions of the <a
								href="http://www.gnu.org/licenses/gpl-2.0.html" target="_blank">GNU General Public
								License</a>.
						</font>

						<p>Remember to check for updates on:
							<a href="http://redcomponent.com/" target="_new"><img
									src="http://images.redcomponent.com/redcomponent.jpg" alt=""></a>
						</p>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<form action="index.php" method="post" name="installDemoContent">
							<input type="button" name="save" id="installDemoContentsave" value="Configuration Wizard"
							       onclick="submitWizard('save');"/>
							<input type="button" name="content" value="install Demo Content"
							       onclick="submitWizard('content');"/>
							<input type="button" name="cancel" value="Cancel" onclick="submitWizard('cancel');"/>
							<input type="hidden" name="option" value="com_redshop">
							<input type="hidden" name="task" value="">
							<input type="hidden" name="wizard" value="1">
						</form>
						<script type="text/javascript">

							var ind = new Number(1);

							//window.onload = gotoconfigwizard();

							function gotoconfigwizard() {
								if (ind == 5) {
									submitWizard('save');
								} else {
									setTimeout("gotoconfigwizard()", 1000);
								}

								document.getElementById('installDemoContentsave').value = "Configuration Wizard " + ind++;

							}

							function submitWizard(task) {
								if (task == 'save') {
									document.installDemoContent.wizard.value = 1;
								}

								if (task == 'content') {
									document.installDemoContent.wizard.value = 0;
									document.installDemoContent.task.value = 'demoContentInsert';
								}

								if (task == 'cancel') {
									document.installDemoContent.wizard.value = 0;
								}

								document.installDemoContent.submit();
							}
						</script>
					</td>
				</tr>
			</table>
		</center>
		<?php 
        // Install the sh404SEF router files
        JLoader::import('joomla.filesystem.file');
        JLoader::import('joomla.filesystem.folder');
        $sh404sefext = JPATH_SITE . '/components/com_sh404sef/sef_ext';
        $sh404sefmeta = JPATH_SITE . '/components/com_sh404sef/meta_ext';
        $sh404sefadmin = JPATH_SITE . '/administrator/components/com_sh404sef';
        $redadmin = JPATH_SITE . '/administrator/components/com_redshop/extras';
        // Check if sh404SEF is installed
        if (JFolder::exists(JPATH_SITE . '/components/com_sh404sef')) {
            // Copy the plugin
            if (!JFile::copy($redadmin . '/sh404sef/sef_ext/com_redshop.php', $sh404sefext . '/com_redshop.php')) {
                echo JText::_('COM_REDSHOP_FAILED_TO_COPY_SH404SEF_EXTENSION_PLUGIN_FILE');
            }
            if (!JFile::copy($redadmin . '/sh404sef/meta_ext/com_redshop.php', $sh404sefmeta . '/com_redshop.php')) {
                echo JText::_('COM_REDSHOP_FAILED_TO_COPY_SH404SEF_META_PLUGIN_FILE');
            }
            if (!JFile::copy($redadmin . '/sh404sef/language/com_redshop.php', $sh404sefadmin . '/language/plugins/com_redshop.php')) {
                echo JText::_('COM_REDSHOP_FAILED_TO_COPY_SH404SEF_PLUGIN_LANGUAGE_FILE');
            }
        }
    }
Пример #21
0
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
JHTMLBehavior::modal();
$url = JURI::base();
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
$order_function = new order_functions();
$redconfig = new Redconfiguration();
$producthelper = new producthelper();
$carthelper = new rsCarthelper();
$Itemid = JRequest::getInt('Itemid');
$print = JRequest::getInt('print');
$document = JFactory::getDocument();
$redTemplate = new Redtemplate();
$template_id = $this->params->get('template_id');
$orderslist_template = $redTemplate->getTemplate("order_list", $template_id);
if (count($orderslist_template) > 0 && $orderslist_template[0]->template_desc != "") {
    $template_desc = $orderslist_template[0]->template_desc;
} else {
    $template_desc = "<table border=\"0\" cellspacing=\"5\" cellpadding=\"5\" width=\"100%\">\r\n<tbody>\r\n<tr>\r\n<th>{order_id_lbl}</th> <th>{product_name_lbl}</th> <th>{total_price_lbl}</th> <th>{order_date_lbl}</th> <th>{order_date_lbl}</th> <th>{order_detail_lbl}</th>\r\n</tr>\r\n{product_loop_start}       \r\n<tr>\r\n<td>{order_id}</td>\r\n<td>{order_products}</td>\r\n<td>{order_total}</td>\r\n<td>{order_date}</td>\r\n<td>{order_status}</td>\r\n<td>{order_detail_link}</td>\r\n</tr>\r\n{product_loop_end}\r\n</tbody>\r\n</table>\r\n<div>{pagination}</div>";
}
if ($this->params->get('show_page_heading', 1)) {
    ?>
	<div class="componentheading<?php 
    echo $this->params->get('pageclass_sfx');
    ?>
">
		<?php 
    echo $this->escape(JText::_('COM_REDSHOP_ORDER_LIST'));
Пример #22
0
/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
require_once JPATH_COMPONENT . '/helpers/product.php';
include_once JPATH_COMPONENT . '/helpers/helper.php';
include_once JPATH_COMPONENT . '/helpers/cart.php';
$carthelper = new rsCarthelper();
$redconfig = new Redconfiguration();
$configobj = new Redconfiguration();
$redTemplate = new Redtemplate();
$producthelper = new producthelper();
$order_functions = new order_functions();
$redhelper = new redhelper();
$db = JFactory::getDbo();
$url = JURI::base();
$Itemid = $redhelper->getCheckoutItemid();
$order_id = JRequest::getInt('oid');
// For barcode
$model = $this->getModel('order_detail');
$order = $this->OrdersDetail;
$thankyou_text = str_replace('{order_number}', $order->order_number, ORDER_RECEIPT_INTROTEXT);
if ($this->params->get('show_page_title', 1)) {
    ?>
	<div class="componentheading<?php 
    echo $this->params->get('pageclass_sfx');
Пример #23
0
 public function replaceUserfield($product_id = 0, $template_id = 0, $unique_id = "")
 {
     $producthelper = new producthelper();
     $redTemplate = new Redtemplate();
     $extraField = new extra_field();
     $template_desc = $redTemplate->getTemplate("product", $template_id);
     $returnArr = $producthelper->getProductUserfieldFromTemplate($template_desc[0]->template_desc);
     $commonid = $product_id . $unique_id;
     $product_userfileds = "<table>";
     for ($ui = 0; $ui < count($returnArr[1]); $ui++) {
         $result_arr = $extraField->list_all_user_fields($returnArr[1][$ui], 12, "", $commonid);
         $hidden_arr = $extraField->list_all_user_fields($returnArr[1][$ui], 12, "hidden", $commonid);
         if ($result_arr[0] != "") {
             $product_userfileds .= "<tr><td>" . $result_arr[0] . "</td><td>" . $result_arr[1] . $hidden_arr[1] . "</td></tr>";
         }
     }
     $product_userfileds .= "</table>";
     return $product_userfileds;
 }
Пример #24
0
 public function display($tpl = null)
 {
     $db = JFactory::getDbo();
     $option = JRequest::getVar('option');
     $document = JFactory::getDocument();
     $layout = JRequest::getVar('layout');
     if ($layout == "resettemplate") {
         $tpl = "resettemplate";
     }
     $document->setTitle(JText::_('COM_REDSHOP_CONFIG'));
     $document->addScript('components/' . $option . '/assets/js/validation.js');
     $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');
     $currency_data = JRequest::getVar('currency_data');
     $redhelper = new redhelper();
     $config = new Redconfiguration();
     $redTemplate = new Redtemplate();
     $extra_field = new extra_field();
     $userhelper = new rsUserhelper();
     $lists = array();
     // Load language file
     $payment_lang_list = $redhelper->getallPlugins("redshop_payment");
     $language = JFactory::getLanguage();
     $base_dir = JPATH_ADMINISTRATOR;
     $language_tag = $language->getTag();
     for ($l = 0; $l < count($payment_lang_list); $l++) {
         $extension = 'plg_redshop_payment_' . $payment_lang_list[$l]->element;
         $language->load($extension, $base_dir, $language_tag, true);
     }
     $configpath = JPATH_COMPONENT . '/helpers/redshop.cfg.php';
     if (!is_writable($configpath)) {
         JError::raiseWarning(21, JText::_('COM_REDSHOP_CONFIGURATION_FILE_IS_NOT_WRITABLE'));
     }
     JToolBarHelper::title(JText::_('COM_REDSHOP_CONFIG'), 'redshop_icon-48-settings');
     if (is_writable($configpath)) {
         JToolBarHelper::save();
         JToolBarHelper::apply();
     }
     JToolBarHelper::cancel();
     jimport('joomla.html.pane');
     $pane = JPane::getInstance('sliders');
     $this->pane = $pane;
     $uri = JFactory::getURI();
     $this->setLayout('default');
     $model = $this->getModel('configuration');
     $newsletters = $model->getnewsletters();
     $templatesel = array();
     $templatesel[0] = new stdClass();
     $templatesel[0]->template_id = 0;
     $templatesel[0]->template_name = JText::_('COM_REDSHOP_SELECT');
     $product_template = $redTemplate->getTemplate("product");
     $compare_template = $redTemplate->getTemplate("compare_product");
     $category_template = $redTemplate->getTemplate("category");
     $categorylist_template = $redTemplate->getTemplate("frontpage_category");
     $manufacturer_template = $redTemplate->getTemplate("manufacturer_products");
     $ajax_detail_template = $redTemplate->getTemplate("ajax_cart_detail_box");
     $product_template = array_merge($templatesel, $product_template);
     $compare_template = array_merge($templatesel, $compare_template);
     $category_template = array_merge($templatesel, $category_template);
     $categorylist_template = array_merge($templatesel, $categorylist_template);
     $manufacturer_template = array_merge($templatesel, $manufacturer_template);
     $ajax_detail_template = array_merge($templatesel, $ajax_detail_template);
     $shopper_groups = $userhelper->getShopperGroupList();
     if (count($shopper_groups) <= 0) {
         $shopper_groups = array();
     }
     $tmp = array();
     $tmp[] = JHTML::_('select.option', 0, JText::_('COM_REDSHOP_SELECT'));
     $new_shopper_group_get_value_from = array_merge($tmp, $shopper_groups);
     defined('CALCULATION_PRICE_DECIMAL') ? CALCULATION_PRICE_DECIMAL : define('CALCULATION_PRICE_DECIMAL', '4');
     defined('NEW_SHOPPER_GROUP_GET_VALUE_FROM') ? NEW_SHOPPER_GROUP_GET_VALUE_FROM : define('NEW_SHOPPER_GROUP_GET_VALUE_FROM', '0');
     defined('IMAGE_QUALITY_OUTPUT') ? IMAGE_QUALITY_OUTPUT : define('IMAGE_QUALITY_OUTPUT', '70');
     $lists['new_shopper_group_get_value_from'] = JHTML::_('select.genericlist', $new_shopper_group_get_value_from, 'new_shopper_group_get_value_from', 'class="inputbox" ', 'value', 'text', NEW_SHOPPER_GROUP_GET_VALUE_FROM);
     defined('MANUFACTURER_TITLE_MAX_CHARS') ? MANUFACTURER_TITLE_MAX_CHARS : define('MANUFACTURER_TITLE_MAX_CHARS', '');
     defined('MANUFACTURER_TITLE_END_SUFFIX') ? MANUFACTURER_TITLE_END_SUFFIX : define('MANUFACTURER_TITLE_END_SUFFIX', '');
     defined('WRITE_REVIEW_IS_LIGHTBOX') ? WRITE_REVIEW_IS_LIGHTBOX : define('WRITE_REVIEW_IS_LIGHTBOX', '0');
     $lists['write_review_is_lightbox'] = JHTML::_('select.booleanlist', 'write_review_is_lightbox', 'class="inputbox" ', WRITE_REVIEW_IS_LIGHTBOX);
     defined('NOOF_SUBATTRIB_THUMB_FOR_SCROLLER') ? NOOF_SUBATTRIB_THUMB_FOR_SCROLLER : define('NOOF_SUBATTRIB_THUMB_FOR_SCROLLER', '3');
     defined('ACCESSORY_PRODUCT_IN_LIGHTBOX') ? ACCESSORY_PRODUCT_IN_LIGHTBOX : define('ACCESSORY_PRODUCT_IN_LIGHTBOX', '0');
     $lists['accessory_product_in_lightbox'] = JHTML::_('select.booleanlist', 'accessory_product_in_lightbox', 'class="inputbox" ', ACCESSORY_PRODUCT_IN_LIGHTBOX);
     $show_price_user_group_list = explode(',', SHOW_PRICE_USER_GROUP_LIST);
     defined('REQUESTQUOTE_IMAGE') ? REQUESTQUOTE_IMAGE : define('REQUESTQUOTE_IMAGE', 'requestquote.gif');
     defined('REQUESTQUOTE_BACKGROUND') ? REQUESTQUOTE_BACKGROUND : define('REQUESTQUOTE_BACKGROUND', 'requestquotebg.jpg');
     defined('WEBPACK_ENABLE_SMS') ? WEBPACK_ENABLE_SMS : define('WEBPACK_ENABLE_SMS', '1');
     $lists['webpack_enable_sms'] = JHTML::_('select.booleanlist', 'webpack_enable_sms', 'class="inputbox" size="1"', WEBPACK_ENABLE_SMS);
     defined('WEBPACK_ENABLE_EMAIL_TRACK') ? WEBPACK_ENABLE_EMAIL_TRACK : define('WEBPACK_ENABLE_EMAIL_TRACK', '1');
     $lists['webpack_enable_email_track'] = JHTML::_('select.booleanlist', 'webpack_enable_email_track', 'class="inputbox" size="1"', WEBPACK_ENABLE_EMAIL_TRACK);
     defined('DEFAULT_STOCKAMOUNT_THUMB_WIDTH') ? DEFAULT_STOCKAMOUNT_THUMB_WIDTH : define('DEFAULT_STOCKAMOUNT_THUMB_WIDTH', '150');
     defined('DEFAULT_STOCKAMOUNT_THUMB_HEIGHT') ? DEFAULT_STOCKAMOUNT_THUMB_HEIGHT : define('DEFAULT_STOCKAMOUNT_THUMB_HEIGHT', '90');
     defined('AJAX_DETAIL_BOX_WIDTH') ? AJAX_DETAIL_BOX_WIDTH : define('AJAX_DETAIL_BOX_WIDTH', '500');
     defined('AJAX_DETAIL_BOX_HEIGHT') ? AJAX_DETAIL_BOX_HEIGHT : define('AJAX_DETAIL_BOX_HEIGHT', '600');
     defined('AJAX_BOX_WIDTH') ? AJAX_BOX_WIDTH : define('AJAX_BOX_WIDTH', '500');
     defined('AJAX_BOX_HEIGHT') ? AJAX_BOX_HEIGHT : define('AJAX_BOX_HEIGHT', '150');
     $q = "SELECT  country_3_code as value,country_name as text,country_jtext from #__" . TABLE_PREFIX . "_country ORDER BY country_name ASC";
     $db->setQuery($q);
     $countries = $db->loadObjectList();
     $countries = $redhelper->convertLanguageString($countries);
     $q = "SELECT  stockroom_id as value,stockroom_name as text from #__" . TABLE_PREFIX . "_stockroom ORDER BY stockroom_name ASC";
     $db->setQuery($q);
     $stockroom = $db->loadObjectList();
     $country_list = explode(',', COUNTRY_LIST);
     $tmp = array();
     $tmp[] = JHTML::_('select.option', 0, JText::_('COM_REDSHOP_SELECT'));
     $economic_accountgroup = $redhelper->getEconomicAccountGroup();
     $economic_accountgroup = array_merge($tmp, $economic_accountgroup);
     $lists['default_economic_account_group'] = JHTML::_('select.genericlist', $economic_accountgroup, 'default_economic_account_group', 'class="inputbox" size="1" ', 'value', 'text', DEFAULT_ECONOMIC_ACCOUNT_GROUP);
     defined('ATTRIBUTE_AS_PRODUCT_IN_ECONOMIC') ? ATTRIBUTE_AS_PRODUCT_IN_ECONOMIC : define('ATTRIBUTE_AS_PRODUCT_IN_ECONOMIC', '0');
     $tmpoption = array();
     $tmpoption[] = JHTML::_('select.option', 0, JText::_('COM_REDSHOP_NO'));
     $tmpoption[] = JHTML::_('select.option', 1, JText::_('COM_REDSHOP_ATTRIBUTE_AS_PRODUCT_IN_ECONOMIC_LBL'));
     $tmpoption[] = JHTML::_('select.option', 2, JText::_('COM_REDSHOP_ATTRIBUTE_PLUS_PRODUCT_IN_ECONOMIC_LBL'));
     $lists['attribute_as_product_in_economic'] = JHTML::_('select.genericlist', $tmpoption, 'attribute_as_product_in_economic', 'class="inputbox" size="1" ', 'value', 'text', ATTRIBUTE_AS_PRODUCT_IN_ECONOMIC);
     defined('DETAIL_ERROR_MESSAGE_ON') ? DETAIL_ERROR_MESSAGE_ON : define('DETAIL_ERROR_MESSAGE_ON', '1');
     $lists['detail_error_message_on'] = JHTML::_('select.booleanlist', 'detail_error_message_on', 'class="inputbox" ', DETAIL_ERROR_MESSAGE_ON);
     defined('PRODUCT_DETAIL_LIGHTBOX_CLOSE_BUTTON_IMAGE') ? PRODUCT_DETAIL_LIGHTBOX_CLOSE_BUTTON_IMAGE : define('PRODUCT_DETAIL_LIGHTBOX_CLOSE_BUTTON_IMAGE', '');
     $lists['newsletters'] = JHTML::_('select.genericlist', $newsletters, 'default_newsletter', 'class="inputbox" size="1" ', 'value', 'text', DEFAULT_NEWSLETTER);
     $lists['currency_data'] = JHTML::_('select.genericlist', $currency_data, 'currency_code', 'class="inputbox" size="1" ', 'value', 'text', CURRENCY_CODE);
     defined('USE_ENCODING') ? USE_ENCODING : define('USE_ENCODING', '0');
     $lists['use_encoding'] = JHTML::_('select.booleanlist', 'use_encoding', 'class="inputbox" ', USE_ENCODING);
     defined('REQUIRED_VAT_NUMBER') ? REQUIRED_VAT_NUMBER : define('REQUIRED_VAT_NUMBER', '1');
     $lists['required_vat_number'] = JHTML::_('select.booleanlist', 'required_vat_number', 'class="inputbox" ', REQUIRED_VAT_NUMBER);
     $lists['coupons_enable'] = JHTML::_('select.booleanlist', 'coupons_enable', 'class="inputbox" ', COUPONS_ENABLE);
     $lists['vouchers_enable'] = JHTML::_('select.booleanlist', 'vouchers_enable', 'class="inputbox" ', VOUCHERS_ENABLE);
     $lists['manufacturer_mail_enable'] = JHTML::_('select.booleanlist', 'manufacturer_mail_enable', 'class="inputbox" ', MANUFACTURER_MAIL_ENABLE);
     defined('SUPPLIER_MAIL_ENABLE') ? SUPPLIER_MAIL_ENABLE : define('SUPPLIER_MAIL_ENABLE', '0');
     defined('COMPARE_PRODUCT_THUMB_WIDTH') ? COMPARE_PRODUCT_THUMB_WIDTH : define('COMPARE_PRODUCT_THUMB_WIDTH', '70');
     defined('COMPARE_PRODUCT_THUMB_HEIGHT') ? COMPARE_PRODUCT_THUMB_HEIGHT : define('COMPARE_PRODUCT_THUMB_HEIGHT', '70');
     $lists['supplier_mail_enable'] = JHTML::_('select.booleanlist', 'supplier_mail_enable', 'class="inputbox" ', SUPPLIER_MAIL_ENABLE);
     $lists['splitable_payment'] = JHTML::_('select.booleanlist', 'splitable_payment', 'class="inputbox"', SPLITABLE_PAYMENT);
     $lists['show_captcha'] = JHTML::_('select.booleanlist', 'show_captcha', 'class="inputbox"', SHOW_CAPTCHA);
     $lists['create_account_checkbox'] = JHTML::_('select.booleanlist', 'create_account_checkbox', 'class="inputbox"', CREATE_ACCOUNT_CHECKBOX);
     $lists['show_email_verification'] = JHTML::_('select.booleanlist', 'show_email_verification', 'class="inputbox"', SHOW_EMAIL_VERIFICATION);
     $lists['quantity_text_display'] = JHTML::_('select.booleanlist', 'quantity_text_display', 'class="inputbox"', QUANTITY_TEXT_DISPLAY);
     $lists['enable_sef_product_number'] = JHTML::_('select.booleanlist', 'enable_sef_product_number', 'class="inputbox"', ENABLE_SEF_PRODUCT_NUMBER);
     $lists['enable_sef_number_name'] = JHTML::_('select.booleanlist', 'enable_sef_number_name', 'class="inputbox"', ENABLE_SEF_NUMBER_NAME, 'COM_REDSHOP_NAME', 'COM_REDSHOP_ID');
     $lists['category_in_sef_url'] = JHTML::_('select.booleanlist', 'category_in_sef_url', 'class="inputbox"', CATEGORY_IN_SEF_URL);
     $lists['autogenerated_seo'] = JHTML::_('select.booleanlist', 'autogenerated_seo', 'class="inputbox"', AUTOGENERATED_SEO);
     $lists['shop_country'] = JHTML::_('select.genericlist', $countries, 'shop_country', 'class="inputbox" size="1" ', 'value', 'text', SHOP_COUNTRY);
     $lists['default_shipping_country'] = JHTML::_('select.genericlist', $countries, 'default_shipping_country', 'class="inputbox" size="1" ', 'value', 'text', DEFAULT_SHIPPING_COUNTRY);
     // Default_shipping_country
     $lists['show_shipping_in_cart'] = JHTML::_('select.booleanlist', 'show_shipping_in_cart', 'class="inputbox"', SHOW_SHIPPING_IN_CART);
     $lists['discount_mail_send'] = JHTML::_('select.booleanlist', 'discount_mail_send', 'class="inputbox"', DISCOUNT_MAIL_SEND);
     defined('SPECIAL_DISCOUNT_MAIL_SEND') ? SPECIAL_DISCOUNT_MAIL_SEND : define('SPECIAL_DISCOUNT_MAIL_SEND', '1');
     $lists['special_discount_mail_send'] = JHTML::_('select.booleanlist', 'special_discount_mail_send', 'class="inputbox"', SPECIAL_DISCOUNT_MAIL_SEND);
     $lists['economic_integration'] = JHTML::_('select.booleanlist', 'economic_integration', 'class="inputbox"', ECONOMIC_INTEGRATION);
     $discoupon_percent_or_total = array(JHTML::_('select.option', 0, JText::_('COM_REDSHOP_TOTAL')), JHTML::_('select.option', 1, JText::_('COM_REDSHOP_PERCENTAGE')));
     $lists['discoupon_percent_or_total'] = JHTML::_('select.genericlist', $discoupon_percent_or_total, 'discoupon_percent_or_total', 'class="inputbox" size="1"', 'value', 'text', DISCOUPON_PERCENT_OR_TOTAL);
     $lists['use_container'] = JHTML::_('select.booleanlist', 'use_container', 'class="inputbox" size="1"', USE_CONTAINER);
     $lists['use_stockroom'] = JHTML::_('select.booleanlist', 'use_stockroom', 'class="inputbox" size="1"', USE_STOCKROOM);
     $lists['use_blank_as_infinite'] = JHTML::_('select.booleanlist', 'use_blank_as_infinite', 'class="inputbox" size="1"', USE_BLANK_AS_INFINITE);
     $lists['allow_pre_order'] = JHTML::_('select.booleanlist', 'allow_pre_order', 'class="inputbox" size="1"', ALLOW_PRE_ORDER);
     $lists['onestep_checkout_enable'] = JHTML::_('select.booleanlist', 'onestep_checkout_enable', 'class="inputbox" size="1"', ONESTEP_CHECKOUT_ENABLE);
     $lists['ssl_enable_in_checkout'] = JHTML::_('select.booleanlist', 'ssl_enable_in_checkout', 'class="inputbox" size="1"', SSL_ENABLE_IN_CHECKOUT);
     $lists['twoway_related_product'] = JHTML::_('select.booleanlist', 'twoway_related_product', 'class="inputbox" size="1"', TWOWAY_RELATED_PRODUCT);
     // For child product opttion
     defined('CHILDPRODUCT_DROPDOWN') ? CHILDPRODUCT_DROPDOWN : define('CHILDPRODUCT_DROPDOWN', 'product_name');
     $chilproduct_data = $redhelper->getChildProductOption();
     $lists['childproduct_dropdown'] = JHTML::_('select.genericlist', $chilproduct_data, 'childproduct_dropdown', 'class="inputbox" size="1" ', 'value', 'text', CHILDPRODUCT_DROPDOWN);
     defined('PURCHASE_PARENT_WITH_CHILD') ? PURCHASE_PARENT_WITH_CHILD : define('PURCHASE_PARENT_WITH_CHILD', '0');
     $lists['purchase_parent_with_child'] = JHTML::_('select.booleanlist', 'purchase_parent_with_child', 'class="inputbox" size="1"', PURCHASE_PARENT_WITH_CHILD);
     $lists['product_hover_image_enable'] = JHTML::_('select.booleanlist', 'product_hover_image_enable', 'class="inputbox" size="1"', PRODUCT_HOVER_IMAGE_ENABLE);
     $lists['additional_hover_image_enable'] = JHTML::_('select.booleanlist', 'additional_hover_image_enable', 'class="inputbox" size="1"', ADDITIONAL_HOVER_IMAGE_ENABLE);
     $lists['ssl_enable_in_backend'] = JHTML::_('select.booleanlist', 'ssl_enable_in_backend', 'class="inputbox" size="1"', SSL_ENABLE_IN_BACKEND);
     $lists['use_tax_exempt'] = JHTML::_('select.booleanlist', 'use_tax_exempt', 'class="inputbox" size="1"', USE_TAX_EXEMPT);
     $lists['tax_exempt_apply_vat'] = JHTML::_('select.booleanlist', 'tax_exempt_apply_vat', 'class="inputbox" size="1"', TAX_EXEMPT_APPLY_VAT);
     $lists['couponinfo'] = JHTML::_('select.booleanlist', 'couponinfo', 'class="inputbox" size="1"', COUPONINFO);
     $lists['my_tags'] = JHTML::_('select.booleanlist', 'my_tags', 'class="inputbox" size="1"', MY_TAGS);
     $lists['my_wishlist'] = JHTML::_('select.booleanlist', 'my_wishlist', 'class="inputbox" size="1"', MY_WISHLIST);
     $lists['compare_products'] = JHTML::_('select.booleanlist', 'compare_products', 'class="inputbox" size="1"', COMARE_PRODUCTS);
     $lists['country_list'] = JHTML::_('select.genericlist', $countries, 'country_list[]', 'class="inputbox" multiple="multiple"', 'value', 'text', $country_list);
     $lists['product_detail_is_lightbox'] = JHTML::_('select.booleanlist', 'product_detail_is_lightbox', 'class="inputbox" size="1"', PRODUCT_DETAIL_IS_LIGHTBOX);
     $lists['new_customer_selection'] = JHTML::_('select.booleanlist', 'new_customer_selection', 'class="inputbox" size="1"', NEW_CUSTOMER_SELECTION);
     $lists['ajax_cart_box'] = JHTML::_('select.booleanlist', 'ajax_cart_box', 'class="inputbox" size="1"', AJAX_CART_BOX);
     $lists['is_product_reserve'] = JHTML::_('select.booleanlist', 'is_product_reserve', 'class="inputbox" size="1"', IS_PRODUCT_RESERVE);
     $lists['product_is_lightbox'] = JHTML::_('select.booleanlist', 'product_is_lightbox', 'class="inputbox" size="1"', PRODUCT_IS_LIGHTBOX);
     $lists['product_addimg_is_lightbox'] = JHTML::_('select.booleanlist', 'product_addimg_is_lightbox', 'class="inputbox" size="1"', PRODUCT_ADDIMG_IS_LIGHTBOX);
     $lists['cat_is_lightbox'] = JHTML::_('select.booleanlist', 'cat_is_lightbox', 'class="inputbox" size="1"', CAT_IS_LIGHTBOX);
     $lists['default_stockroom'] = JHTML::_('select.genericlist', $stockroom, 'default_stockroom', 'class="inputbox" size="1" ', 'value', 'text', DEFAULT_STOCKROOM);
     $lists['portalshop'] = JHTML::_('select.booleanlist', 'portal_shop', 'class="inputbox" size="1"', PORTAL_SHOP);
     $lists['use_image_size_swapping'] = JHTML::_('select.booleanlist', 'use_image_size_swapping', 'class="inputbox" size="1"', USE_IMAGE_SIZE_SWAPPING);
     $lists['apply_vat_on_discount'] = JHTML::_('select.booleanlist', 'apply_vat_on_discount', 'class="inputbox" size="1"', APPLY_VAT_ON_DISCOUNT, $yes = JText::_('COM_REDSHOP_BEFORE_DISCOUNT'), $no = JText::_('COM_REDSHOP_AFTER_DISCOUNT'));
     $lists['auto_scroll_wrapper'] = JHTML::_('select.booleanlist', 'auto_scroll_wrapper', 'class="inputbox" size="1"', AUTO_SCROLL_WRAPPER);
     $lists['allow_multiple_discount'] = JHTML::_('select.booleanlist', 'allow_multiple_discount', 'class="inputbox" size="1"', ALLOW_MULTIPLE_DISCOUNT);
     defined('SHOW_PRODUCT_DETAIL') ? SHOW_PRODUCT_DETAIL : define('SHOW_PRODUCT_DETAIL', '1');
     $lists['show_product_detail'] = JHTML::_('select.booleanlist', 'show_product_detail', 'class="inputbox" size="1"', SHOW_PRODUCT_DETAIL);
     $lists['compare_template_id'] = JHTML::_('select.genericlist', $compare_template, 'compare_template_id', 'class="inputbox" size="1" ', 'template_id', 'template_name', COMPARE_TEMPLATE_ID);
     defined('SHOW_TERMS_AND_CONDITIONS') ? SHOW_TERMS_AND_CONDITIONS : define('SHOW_TERMS_AND_CONDITIONS', '0');
     $lists['show_terms_and_conditions'] = JHTML::_('select.booleanlist', 'show_terms_and_conditions', 'class="inputbox" size="1"', SHOW_TERMS_AND_CONDITIONS, $yes = JText::_('COM_REDSHOP_SHOW_PER_USER'), $no = JText::_('COM_REDSHOP_SHOW_PER_ORDER'));
     defined('RATING_REVIEW_LOGIN_REQUIRED') ? RATING_REVIEW_LOGIN_REQUIRED : define('RATING_REVIEW_LOGIN_REQUIRED', '1');
     $lists['rating_review_login_required'] = JHTML::_('select.booleanlist', 'rating_review_login_required', 'class="inputbox" size="1"', RATING_REVIEW_LOGIN_REQUIRED);
     $product_comparison = array();
     $product_comparison[] = JHTML::_('select.option', '', JText::_('COM_REDSHOP_SELECT'));
     $product_comparison[] = JHTML::_('select.option', 'category', JText::_('COM_REDSHOP_CATEGORY'));
     $product_comparison[] = JHTML::_('select.option', 'global', JText::_('COM_REDSHOP_GLOBAL'));
     $pagination = array(0 => array("value" => 0, "text" => "Joomla"), 1 => array("value" => 1, "text" => "Redshop"));
     $lists['product_comparison_type'] = JHTML::_('select.genericlist', $product_comparison, 'product_comparison_type', 'class="inputbox" size="1"', 'value', 'text', PRODUCT_COMPARISON_TYPE);
     $lists['pagination'] = JHTML::_('select.genericlist', $pagination, 'pagination', 'class="inputbox" size="1" ', 'value', 'text', PAGINATION);
     $lists['newsletter_enable'] = JHTML::_('select.booleanlist', 'newsletter_enable', 'class="inputbox" size="1"', NEWSLETTER_ENABLE);
     $lists['newsletter_confirmation'] = JHTML::_('select.booleanlist', 'newsletter_confirmation', 'class="inputbox" size="1"', NEWSLETTER_CONFIRMATION);
     $lists['watermark_category_image'] = JHTML::_('select.booleanlist', 'watermark_category_image', 'class="inputbox" size="1"', WATERMARK_CATEGORY_IMAGE);
     $lists['watermark_category_thumb_image'] = JHTML::_('select.booleanlist', 'watermark_category_thumb_image', 'class="inputbox" size="1"', WATERMARK_CATEGORY_THUMB_IMAGE);
     $lists['watermark_product_image'] = JHTML::_('select.booleanlist', 'watermark_product_image', 'class="inputbox" size="1"', WATERMARK_PRODUCT_IMAGE);
     $lists['watermark_product_thumb_image'] = JHTML::_('select.booleanlist', 'watermark_product_thumb_image', 'class="inputbox" size="1"', WATERMARK_PRODUCT_THUMB_IMAGE);
     defined('WATERMARK_PRODUCT_ADDITIONAL_IMAGE') ? WATERMARK_PRODUCT_ADDITIONAL_IMAGE : define('WATERMARK_PRODUCT_ADDITIONAL_IMAGE', '0');
     $lists['watermark_product_additional_image'] = JHTML::_('select.booleanlist', 'watermark_product_additional_image', 'class="inputbox" size="1"', WATERMARK_PRODUCT_ADDITIONAL_IMAGE);
     $lists['watermark_cart_thumb_image'] = JHTML::_('select.booleanlist', 'watermark_cart_thumb_image', 'class="inputbox" size="1"', WATERMARK_CART_THUMB_IMAGE);
     $lists['watermark_giftcart_image'] = JHTML::_('select.booleanlist', 'watermark_giftcart_image', 'class="inputbox" size="1"', WATERMARK_GIFTCART_IMAGE);
     $lists['watermark_giftcart_thumb_image'] = JHTML::_('select.booleanlist', 'watermark_giftcart_thumb_image', 'class="inputbox" size="1"', WATERMARK_GIFTCART_THUMB_IMAGE);
     $lists['watermark_manufacturer_thumb_image'] = JHTML::_('select.booleanlist', 'watermark_manufacturer_thumb_image', 'class="inputbox" size="1"', WATERMARK_MANUFACTURER_THUMB_IMAGE);
     $lists['watermark_manufacturer_image'] = JHTML::_('select.booleanlist', 'watermark_manufacturer_image', 'class="inputbox" size="1"', WATERMARK_MANUFACTURER_IMAGE);
     $lists['clickatell_enable'] = JHTML::_('select.booleanlist', 'clickatell_enable', 'class="inputbox" size="1"', CLICKATELL_ENABLE);
     $lists['quotation_mode'] = JHTML::_('select.booleanlist', 'default_quotation_mode', 'onclick="return quote_price(this.value);" class="inputbox" size="1"', DEFAULT_QUOTATION_MODE_PRE, $yes = JText::_('COM_REDSHOP_ON'), $no = JText::_('COM_REDSHOP_OFF'));
     $lists['wanttoshowattributeimage'] = JHTML::_('select.booleanlist', 'wanttoshowattributeimage', 'class="inputbox" size="1"', WANT_TO_SHOW_ATTRIBUTE_IMAGE_INCART);
     $lists['show_quotation_price'] = JHTML::_('select.booleanlist', 'show_quotation_price', 'class="inputbox" size="1"', SHOW_QUOTATION_PRICE);
     $lists['display_out_of_stock_attribute_data'] = JHTML::_('select.booleanlist', 'display_out_of_stock_attribute_data', 'class="inputbox"', DISPLAY_OUT_OF_STOCK_ATTRIBUTE_DATA);
     $orderstatus = $model->getOrderstatus();
     $tmp = array();
     $tmp[] = JHTML::_('select.option', 0, JText::_('COM_REDSHOP_SELECT'));
     $orderstatus = array_merge($tmp, $orderstatus);
     $lists['clickatell_order_status'] = JHTML::_('select.genericlist', $orderstatus, 'clickatell_order_status', 'class="inputbox" size="1" ', 'value', 'text', CLICKATELL_ORDER_STATUS);
     $menuitem = array();
     $menuitem[0] = new stdClass();
     $menuitem[0]->value = 0;
     $menuitem[0]->text = JText::_('COM_REDSHOP_SELECT');
     $q = "SELECT m.id,m.title AS name,mt.title FROM #__menu AS m " . "LEFT JOIN #__menu_types AS mt ON mt.menutype=m.menutype " . "WHERE m.published=1 " . "ORDER BY m.menutype,m.ordering";
     $db->setQuery($q);
     $menuitemlist = $db->loadObjectList();
     for ($i = 0; $i < count($menuitemlist); $i++) {
         $menuitem[$i + 1] = new stdClass();
         $menuitem[$i + 1]->value = $menuitemlist[$i]->id;
         $menuitem[$i + 1]->text = $menuitemlist[$i]->name;
     }
     $lists['url_after_portal_login'] = JHTML::_('select.genericlist', $menuitem, 'portal_login_itemid', 'class="inputbox" size="1" ', 'value', 'text', PORTAL_LOGIN_ITEMID);
     $lists['url_after_portal_logout'] = JHTML::_('select.genericlist', $menuitem, 'portal_logout_itemid', 'class="inputbox" size="1" ', 'value', 'text', PORTAL_LOGOUT_ITEMID);
     $default_vat_group = $model->getVatGroup();
     $tmp = array();
     $tmp[] = JHTML::_('select.option', 0, JText::_('COM_REDSHOP_SELECT'));
     $default_vat_group = array_merge($tmp, $default_vat_group);
     $tmp = array();
     $tmp[] = JHTML::_('select.option', '', JText::_('COM_REDSHOP_SELECT'));
     $default_vat_country = array_merge($tmp, $countries);
     $default_customer_register_type = array();
     $default_customer_register_type[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_SELECT'));
     $default_customer_register_type[] = JHTML::_('select.option', '1', JText::_('COM_REDSHOP_PRIVATE'));
     $default_customer_register_type[] = JHTML::_('select.option', '2', JText::_('COM_REDSHOP_COMPANY'));
     $lists['default_customer_register_type'] = JHTML::_('select.genericlist', $default_customer_register_type, 'default_customer_register_type', 'class="inputbox" ', 'value', 'text', DEFAULT_CUSTOMER_REGISTER_TYPE);
     $addtocart_behaviour = array();
     $addtocart_behaviour[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_SELECT'));
     $addtocart_behaviour[] = JHTML::_('select.option', '1', JText::_('COM_REDSHOP_DIRECT_TO_CART'));
     $addtocart_behaviour[] = JHTML::_('select.option', '2', JText::_('COM_REDSHOP_STAY_ON_CURRENT_VIEW'));
     $lists['addtocart_behaviour'] = JHTML::_('select.genericlist', $addtocart_behaviour, 'addtocart_behaviour', 'class="inputbox" ', 'value', 'text', ADDTOCART_BEHAVIOUR);
     $allow_customer_register_type = array();
     $allow_customer_register_type[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_BOTH'));
     $allow_customer_register_type[] = JHTML::_('select.option', '1', JText::_('COM_REDSHOP_PRIVATE'));
     $allow_customer_register_type[] = JHTML::_('select.option', '2', JText::_('COM_REDSHOP_COMPANY'));
     $lists['allow_customer_register_type'] = JHTML::_('select.genericlist', $allow_customer_register_type, 'allow_customer_register_type', 'class="inputbox" ', 'value', 'text', ALLOW_CUSTOMER_REGISTER_TYPE);
     // Optional shipping address select box
     $lists['optional_shipping_address'] = JHTML::_('select.booleanlist', 'optional_shipping_address', 'class="inputbox" ', OPTIONAL_SHIPPING_ADDRESS);
     $lists['shipping_method_enable'] = JHTML::_('select.booleanlist', 'shipping_method_enable', 'class="inputbox" ', SHIPPING_METHOD_ENABLE);
     $lists['default_vat_group'] = JHTML::_('select.genericlist', $default_vat_group, 'default_vat_group', 'class="inputbox" ', 'value', 'text', DEFAULT_VAT_GROUP);
     $vat_based_on = array();
     $vat_based_on[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_WEBSHOP_MODE'));
     $vat_based_on[] = JHTML::_('select.option', '1', JText::_('COM_REDSHOP_CUSTOMER_MODE'));
     $vat_based_on[] = JHTML::_('select.option', '2', JText::_('COM_REDSHOP_EU_MODE'));
     $lists['vat_based_on'] = JHTML::_('select.genericlist', $vat_based_on, 'vat_based_on', 'class="inputbox" ', 'value', 'text', VAT_BASED_ON);
     $lists['default_vat_country'] = JHTML::_('select.genericlist', $default_vat_country, 'default_vat_country', 'class="inputbox" onchange="changeStateList();"', 'value', 'text', DEFAULT_VAT_COUNTRY);
     $country_list_name = 'default_vat_country';
     $state_list_name = 'default_vat_state';
     $selected_country_code = DEFAULT_VAT_COUNTRY;
     $selected_state_code = DEFAULT_VAT_STATE;
     if (empty($selected_state_code)) {
         $selected_state_code = "originalPos";
     } else {
         $selected_state_code = "'" . $selected_state_code . "'";
     }
     $db->setQuery("SELECT c.country_id, c.country_3_code, s.state_name, s.state_2_code\n\t\t\t\t\t\tFROM #__" . TABLE_PREFIX . "_country c\n\t\t\t\t\t\tLEFT JOIN #__" . TABLE_PREFIX . "_state s\n\t\t\t\t\t\tON c.country_id=s.country_id OR s.country_id IS NULL\n\t\t\t\t\t\tORDER BY c.country_id, s.state_name");
     $states = $db->loadObjectList();
     // Build the State lists for each Country
     $script = "<script language=\"javascript\" type=\"text/javascript\">//<![CDATA[\n";
     $script .= "<!--\n";
     $script .= "var originalOrder = '1';\n";
     $script .= "var originalPos = '{$selected_country_code}';\n";
     $script .= "var states = new Array();\t// array in the format [key,value,text]\n";
     $i = 0;
     $prev_country = '';
     for ($j = 0; $j < count($states); $j++) {
         $state = $states[$j];
         $country_3_code = $state->country_3_code;
         if ($state->state_name) {
             if ($prev_country != $country_3_code) {
                 $script .= "states[" . $i++ . "] = new Array( '" . $country_3_code . "','',' -= " . JText::_("COM_REDSHOP_SELECT") . " =-' );\n";
             }
             $prev_country = $country_3_code;
             // Array in the format [key,value,text]
             $script .= "states[" . $i++ . "] = new Array( '" . $country_3_code . "','" . $state->state_2_code . "','" . addslashes(JText::_($state->state_name)) . "' );\n";
         } else {
             $script .= "states[" . $i++ . "] = new Array( '" . $country_3_code . "','','" . JText::_("COM_REDSHOP_NONE") . "' );\n";
         }
     }
     $script .= "function changeStateList()\n\t\t\t\t\t{\n\t\t\t\t\t\tvar selected_country = null;\n\t\t\t\t\t\tfor (var i=0; i<document.adminForm.default_vat_country.length; i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (document.adminForm." . $country_list_name . "[i].selected)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tselected_country = document.adminForm." . $country_list_name . "[i].value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchangeDynaList('" . $state_list_name . "',states,selected_country, originalPos, originalOrder);\n\t\t\t\t \t}\n\t\t\t\t \twriteDynaList( 'class=\"inputbox\" name=\"default_vat_state\" size=\"1\" id=\"default_vat_state\"',\n\t\t\t\t \tstates, originalPos, originalPos, {$selected_state_code} );\n\t\t\t\t\t//-->\n\t\t\t\t\t//]]></script>";
     $lists['default_vat_state'] = $script;
     $shopper_Group_private = $model->getShopperGroupPrivate();
     $tmp = array();
     $tmp[] = JHTML::_('select.option', 0, JText::_('COM_REDSHOP_SELECT'));
     $tmp = array_merge($tmp, $shopper_Group_private);
     $lists['shopper_group_default_private'] = JHTML::_('select.genericlist', $tmp, 'shopper_group_default_private', 'class="inputbox" ', 'value', 'text', SHOPPER_GROUP_DEFAULT_PRIVATE);
     $shopper_Group_company = $model->getShopperGroupCompany();
     $tmp = array();
     $tmp[] = JHTML::_('select.option', 0, JText::_('COM_REDSHOP_SELECT'));
     $tmp = array_merge($tmp, $shopper_Group_company);
     $lists['shopper_group_default_company'] = JHTML::_('select.genericlist', $tmp, 'shopper_group_default_company', 'class="inputbox" ', 'value', 'text', SHOPPER_GROUP_DEFAULT_COMPANY);
     $tmp = array();
     $tmp[] = JHTML::_('select.option', 0, JText::_('SELECT'));
     $tmp = array_merge($tmp, $shopper_Group_private, $shopper_Group_company);
     defined('SHOPPER_GROUP_DEFAULT_UNREGISTERED') ? SHOPPER_GROUP_DEFAULT_UNREGISTERED : define('SHOPPER_GROUP_DEFAULT_UNREGISTERED', SHOPPER_GROUP_DEFAULT_PRIVATE);
     $lists['shopper_group_default_unregistered'] = JHTML::_('select.genericlist', $tmp, 'shopper_group_default_unregistered', 'class="inputbox" ', 'value', 'text', SHOPPER_GROUP_DEFAULT_UNREGISTERED);
     $register_methods = array();
     $register_methods[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_REGISTER_WITH_ACCOUNT_CREATION'));
     $register_methods[] = JHTML::_('select.option', '1', JText::_('COM_REDSHOP_REGISTER_WITHOUT_ACCOUNT_CREATION'));
     $register_methods[] = JHTML::_('select.option', '2', JText::_('COM_REDSHOP_REGISTER_ACCOUNT_OPTIONAL'));
     $register_methods[] = JHTML::_('select.option', '3', JText::_('COM_REDSHOP_REGISTER_ACCOUNT_SILENT'));
     $lists['register_method'] = JHTML::_('select.genericlist', $register_methods, 'register_method', 'class="inputbox" id="register_method"', 'value', 'text', REGISTER_METHOD);
     $lists['product_template'] = JHTML::_('select.genericlist', $product_template, 'default_product_template', 'class="inputbox" size="1" ', 'template_id', 'template_name', PRODUCT_TEMPLATE);
     $lists['ajax_detail_template'] = JHTML::_('select.genericlist', $ajax_detail_template, 'default_ajax_detailbox_template', 'class="inputbox" size="1" ', 'template_id', 'template_name', DEFAULT_AJAX_DETAILBOX_TEMPLATE);
     $lists['category_template'] = JHTML::_('select.genericlist', $category_template, 'default_category_template', 'class="inputbox" size="1" ', 'template_id', 'template_name', CATEGORY_TEMPLATE);
     $lists['default_categorylist_template'] = JHTML::_('select.genericlist', $categorylist_template, 'default_categorylist_template', 'class="inputbox" size="1" ', 'template_id', 'template_name', DEFAULT_CATEGORYLIST_TEMPLATE);
     $lists['manufacturer_template'] = JHTML::_('select.genericlist', $manufacturer_template, 'default_manufacturer_template', 'class="inputbox" size="1" ', 'template_id', 'template_name', MANUFACTURER_TEMPLATE);
     $lists['show_price'] = JHTML::_('select.booleanlist', 'show_price', 'class="inputbox" size="1"', SHOW_PRICE_PRE);
     $PRE_USE_AS_CATALOG = defined('PRE_USE_AS_CATALOG') ? PRE_USE_AS_CATALOG : 0;
     $lists['use_as_catalog'] = JHTML::_('select.booleanlist', 'use_as_catalog', 'class="inputbox" size="1"', $PRE_USE_AS_CATALOG);
     $lists['show_tax_exempt_infront'] = JHTML::_('select.booleanlist', 'show_tax_exempt_infront', 'class="inputbox" size="1"', SHOW_TAX_EXEMPT_INFRONT);
     $lists['individual_add_to_cart_enable'] = JHTML::_('select.booleanlist', 'individual_add_to_cart_enable', 'class="inputbox" size="1"', INDIVIDUAL_ADD_TO_CART_ENABLE, JText::_('COM_REDSHOP_INDIVIDUAL_ADD_TO_CART_PER_PROPERTY'), JText::_('COM_REDSHOP_ADD_TO_CART_PER_PRODUCT'));
     defined('ACCESSORY_AS_PRODUCT_IN_CART_ENABLE') ? ACCESSORY_AS_PRODUCT_IN_CART_ENABLE : define('ACCESSORY_AS_PRODUCT_IN_CART_ENABLE', '0');
     $lists['accessory_as_product_in_cart_enable'] = JHTML::_('select.booleanlist', 'accessory_as_product_in_cart_enable', 'class="inputbox" size="1"', ACCESSORY_AS_PRODUCT_IN_CART_ENABLE);
     $lists['use_product_outofstock_image'] = JHTML::_('select.booleanlist', 'use_product_outofstock_image', 'class="inputbox" size="1"', USE_PRODUCT_OUTOFSTOCK_IMAGE);
     defined('ENABLE_ADDRESS_DETAIL_IN_SHIPPING') ? ENABLE_ADDRESS_DETAIL_IN_SHIPPING : define('ENABLE_ADDRESS_DETAIL_IN_SHIPPING', '0');
     $lists['enable_address_detail_in_shipping'] = JHTML::_('select.booleanlist', 'enable_address_detail_in_shipping', 'class="inputbox" size="1"', ENABLE_ADDRESS_DETAIL_IN_SHIPPING);
     defined('SEND_MAIL_TO_CUSTOMER') ? SEND_MAIL_TO_CUSTOMER : define('SEND_MAIL_TO_CUSTOMER', '1');
     $lists['send_mail_to_customer'] = JHTML::_('select.booleanlist', 'send_mail_to_customer', 'class="inputbox" size="1"', SEND_MAIL_TO_CUSTOMER);
     $bookinvoice = array();
     $bookinvoice[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_DIRECTLY_BOOK'));
     $bookinvoice[] = JHTML::_('select.option', '1', JText::_('COM_REDSHOP_MANUALLY_BOOK'));
     $bookinvoice[] = JHTML::_('select.option', '2', JText::_('COM_REDSHOP_BOOK_ON_ORDER_STATUS'));
     $lists['economic_invoice_draft'] = JHTML::_('select.genericlist', $bookinvoice, 'economic_invoice_draft', 'class="inputbox" onchange="javascript:changeBookInvoice(this.value);" ', 'value', 'text', ECONOMIC_INVOICE_DRAFT);
     defined('ECONOMIC_BOOK_INVOICE_NUMBER') ? ECONOMIC_BOOK_INVOICE_NUMBER : define('ECONOMIC_BOOK_INVOICE_NUMBER', '0');
     $lists['economic_book_invoice_number'] = JHTML::_('select.booleanlist', 'economic_book_invoice_number', 'class="inputbox" size="1"', ECONOMIC_BOOK_INVOICE_NUMBER, JText::_('COM_REDSHOP_SEQUENTIALLY_IN_ECONOMIC_NO_MATCH_UP_WITH_ORDER_NUMBER'), JText::_('COM_REDSHOP_SAME_AS_ORDER_NUMBER'));
     // NEXT-PREVIOUS LINK
     $link_type = array();
     $link_type[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_DEFAULT_LINK'));
     $link_type[] = JHTML::_('select.option', '1', JText::_('COM_REDSHOP_CUSTOM_LINK'));
     $link_type[] = JHTML::_('select.option', '2', JText::_('COM_REDSHOP_IMAGE_LINK'));
     $lists['next_previous_link'] = JHTML::_('select.genericlist', $link_type, 'next_previous_link', 'class="inputbox" ', 'value', 'text', DEFAULT_LINK_FIND);
     $order_data = $redhelper->getOrderByList();
     $lists['default_product_ordering_method'] = JHTML::_('select.genericlist', $order_data, 'default_product_ordering_method', 'class="inputbox" size="1" ', 'value', 'text', DEFAULT_PRODUCT_ORDERING_METHOD);
     $lists['default_manufacturer_product_ordering_method'] = JHTML::_('select.genericlist', $order_data, 'default_manufacturer_product_ordering_method', 'class="inputbox" size="1" ', 'value', 'text', DEFAULT_MANUFACTURER_PRODUCT_ORDERING_METHOD);
     $order_data = $redhelper->getRelatedOrderByList();
     $lists['default_related_ordering_method'] = JHTML::_('select.genericlist', $order_data, 'default_related_ordering_method', 'class="inputbox" size="1" ', 'value', 'text', DEFAULT_RELATED_ORDERING_METHOD);
     $order_data = $redhelper->getAccessoryOrderByList();
     $lists['default_accessory_ordering_method'] = JHTML::_('select.genericlist', $order_data, 'default_accessory_ordering_method', 'class="inputbox" size="1" ', 'value', 'text', DEFAULT_ACCESSORY_ORDERING_METHOD);
     $shipping_after = defined('SHIPPING_AFTER') ? SHIPPING_AFTER : 'total';
     $lists['shipping_after'] = $extra_field->rs_booleanlist('shipping_after', 'class="inputbox"', $shipping_after, $yes = JText::_('COM_REDSHOP_TOTAL'), $no = JText::_('COM_REDSHOP_SUBTOTAL_LBL'), '', 'total', 'subtotal');
     $payment_calculation = defined('PAYMENT_CALCULATION_ON') ? PAYMENT_CALCULATION_ON : 'total';
     $lists['payment_calculation_on'] = $extra_field->rs_booleanlist('payment_calculation_on', 'class="inputbox"', $payment_calculation, $yes = JText::_('COM_REDSHOP_TOTAL'), $no = JText::_('COM_REDSHOP_SUBTOTAL_LBL'), '', 'total', 'subtotal');
     $calculate_vat_on = defined('CALCULATE_VAT_ON') ? CALCULATE_VAT_ON : 'BT';
     $lists['calculate_vat_on'] = $extra_field->rs_booleanlist('calculate_vat_on', 'class="inputbox"', $calculate_vat_on, $yes = JText::_('COM_REDSHOP_BILLING_ADDRESS_LBL'), $no = JText::_('COM_REDSHOP_SHIPPING_ADDRESS_LBL'), '', 'BT', 'ST');
     $order_data = array();
     $order_data[0] = new stdClass();
     $order_data[0]->value = "c.category_name ASC";
     $order_data[0]->text = JText::_('COM_REDSHOP_CATEGORY_NAME');
     $order_data[1] = new stdClass();
     $order_data[1]->value = "c.category_id DESC";
     $order_data[1]->text = JText::_('COM_REDSHOP_NEWEST');
     $order_data[2] = new stdClass();
     $order_data[2]->value = "c.ordering ASC";
     $order_data[2]->text = JText::_('COM_REDSHOP_ORDERING');
     $lists['default_category_ordering_method'] = JHTML::_('select.genericlist', $order_data, 'default_category_ordering_method', 'class="inputbox" size="1" ', 'value', 'text', DEFAULT_CATEGORY_ORDERING_METHOD);
     $order_data = $redhelper->getManufacturerOrderByList();
     $lists['default_manufacturer_ordering_method'] = JHTML::_('select.genericlist', $order_data, 'default_manufacturer_ordering_method', 'class="inputbox" size="1" ', 'value', 'text', DEFAULT_MANUFACTURER_ORDERING_METHOD);
     $symbol_position = array();
     $symbol_position[0] = new stdClass();
     $symbol_position[0]->value = " ";
     $symbol_position[0]->text = JText::_('COM_REDSHOP_SELECT');
     $symbol_position[1] = new stdClass();
     $symbol_position[1]->value = "front";
     $symbol_position[1]->text = JText::_('COM_REDSHOP_FRONT');
     $symbol_position[2] = new stdClass();
     $symbol_position[2]->value = "behind";
     $symbol_position[2]->text = JText::_('COM_REDSHOP_BEHIND');
     $symbol_position[3] = new stdClass();
     $symbol_position[3]->value = "none";
     $symbol_position[3]->text = JText::_('COM_REDSHOP_NONE');
     $lists['currency_symbol_position'] = JHTML::_('select.genericlist', $symbol_position, 'currency_symbol_position', 'class="inputbox" ', 'value', 'text', CURRENCY_SYMBOL_POSITION);
     $default_dateformat = $config->getDateFormat();
     $lists['default_dateformat'] = JHTML::_('select.genericlist', $default_dateformat, 'default_dateformat', 'class="inputbox" ', 'value', 'text', DEFAULT_DATEFORMAT);
     $lists['discount_enable'] = JHTML::_('select.booleanlist', 'discount_enable', 'class="inputbox" ', DISCOUNT_ENABLE);
     $lists['invoice_mail_enable'] = JHTML::_('select.booleanlist', 'invoice_mail_enable', 'class="inputbox"', INVOICE_MAIL_ENABLE);
     $lists['enable_backendaccess'] = JHTML::_('select.booleanlist', 'enable_backendaccess', 'class="inputbox"', ENABLE_BACKENDACCESS);
     $lists['wishlist_login_required'] = JHTML::_('select.booleanlist', 'wishlist_login_required', 'class="inputbox"', WISHLIST_LOGIN_REQUIRED);
     $invoice_mail_send_option = array();
     $invoice_mail_send_option[0] = new stdClass();
     $invoice_mail_send_option[0]->value = 0;
     $invoice_mail_send_option[0]->text = JText::_('COM_REDSHOP_SELECT');
     $invoice_mail_send_option[1] = new stdClass();
     $invoice_mail_send_option[1]->value = 1;
     $invoice_mail_send_option[1]->text = JText::_('COM_REDSHOP_ADMINISTRATOR');
     $invoice_mail_send_option[2] = new stdClass();
     $invoice_mail_send_option[2]->value = 2;
     $invoice_mail_send_option[2]->text = JText::_('COM_REDSHOP_CUSTOMER');
     $invoice_mail_send_option[3] = new stdClass();
     $invoice_mail_send_option[3]->value = 3;
     $invoice_mail_send_option[3]->text = JText::_('COM_REDSHOP_BOTH');
     $lists['invoice_mail_send_option'] = JHTML::_('select.genericlist', $invoice_mail_send_option, 'invoice_mail_send_option', 'class="inputbox" ', 'value', 'text', INVOICE_MAIL_SEND_OPTION);
     $order_mail_after = array();
     $order_mail_after[0] = new stdClass();
     $order_mail_after[0]->value = 0;
     $order_mail_after[0]->text = JText::_('COM_REDSHOP_ORDER_MAIL_BEFORE_PAYMENT');
     $order_mail_after[1] = new stdClass();
     $order_mail_after[1]->value = 1;
     $order_mail_after[1]->text = JText::_('COM_REDSHOP_ORDER_MAIL_AFTER_PAYMENT');
     $lists['order_mail_after'] = JHTML::_('select.genericlist', $order_mail_after, 'order_mail_after', 'class="inputbox" ', 'value', 'text', ORDER_MAIL_AFTER);
     $discount_type = array();
     $discount_type[0] = new stdClass();
     $discount_type[0]->value = 0;
     $discount_type[0]->text = JText::_('COM_REDSHOP_SELECT');
     $discount_type[1] = new stdClass();
     $discount_type[1]->value = 1;
     $discount_type[1]->text = JText::_('COM_REDSHOP_DISCOUNT_OR_VOUCHER_OR_COUPON');
     $discount_type[2] = new stdClass();
     $discount_type[2]->value = 2;
     $discount_type[2]->text = JText::_('COM_REDSHOP_DISCOUNT_VOUCHER_OR_COUPON');
     $discount_type[3] = new stdClass();
     $discount_type[3]->value = 3;
     $discount_type[3]->text = JText::_('COM_REDSHOP_DISCOUNT_VOUCHER_COUPON');
     $discount_type[4] = new stdClass();
     $discount_type[4]->value = 4;
     $discount_type[4]->text = JText::_('COM_REDSHOP_DISCOUNT_VOUCHER_COUPON_MULTIPLE');
     $lists['discount_type'] = JHTML::_('select.genericlist', $discount_type, 'discount_type', 'class="inputbox" ', 'value', 'text', DISCOUNT_TYPE);
     /*
      * Measurement select boxes
      */
     $option = array();
     $option[0] = new stdClass();
     $option[0]->value = 0;
     $option[0]->text = JText::_('COM_REDSHOP_SELECT');
     $option[1] = new stdClass();
     $option[1]->value = 'mm';
     $option[1]->text = JText::_('COM_REDSHOP_MILLIMETER');
     $option[2] = new stdClass();
     $option[2]->value = 'cm';
     $option[2]->text = JText::_('COM_REDSHOP_CENTIMETERS');
     $option[3] = new stdClass();
     $option[3]->value = 'inch';
     $option[3]->text = JText::_('COM_REDSHOP_INCHES');
     $option[4] = new stdClass();
     $option[4]->value = 'feet';
     $option[4]->text = JText::_('COM_REDSHOP_FEET');
     $option[5] = new stdClass();
     $option[5]->value = 'm';
     $option[5]->text = JText::_('COM_REDSHOP_METER');
     $lists['default_volume_unit'] = JHTML::_('select.genericlist', $option, 'default_volume_unit', 'class="inputbox" ', 'value', 'text', DEFAULT_VOLUME_UNIT);
     unset($option);
     $option = array();
     $option[0] = new stdClass();
     $option[0]->value = 0;
     $option[0]->text = JText::_('COM_REDSHOP_SELECT');
     $option[1] = new stdClass();
     $option[1]->value = 'gram';
     $option[1]->text = JText::_('COM_REDSHOP_GRAM');
     $option[2] = new stdClass();
     $option[2]->value = 'pounds';
     $option[2]->text = JText::_('COM_REDSHOP_POUNDS');
     $option[3] = new stdClass();
     $option[3]->value = 'kg';
     $option[3]->text = JText::_('COM_REDSHOP_KG');
     $lists['default_weight_unit'] = JHTML::_('select.genericlist', $option, 'default_weight_unit', 'class="inputbox" ', 'value', 'text', DEFAULT_WEIGHT_UNIT);
     unset($option);
     $lists['postdk_integration'] = JHTML::_('select.booleanlist', 'postdk_integration', 'class="inputbox" size="1"', POSTDK_INTEGRATION);
     $lists['display_new_orders'] = JHTML::_('select.booleanlist', 'display_new_orders', 'class="inputbox" size="1"', DISPLAY_NEW_ORDERS);
     $lists['display_new_customers'] = JHTML::_('select.booleanlist', 'display_new_customers', 'class="inputbox" size="1"', DISPLAY_NEW_CUSTOMERS);
     $lists['display_statistic'] = JHTML::_('select.booleanlist', 'display_statistic', 'class="inputbox" size="1"', DISPLAY_STATISTIC);
     $lists['expand_all'] = JHTML::_('select.booleanlist', 'expand_all', 'class="inputbox" size="1"', EXPAND_ALL);
     $lists['send_catalog_reminder_mail'] = JHTML::_('select.booleanlist', 'send_catalog_reminder_mail', 'class="inputbox" size="1"', SEND_CATALOG_REMINDER_MAIL);
     $current_version = $model->getcurrentversion();
     $getinstalledmodule = $model->getinstalledmodule();
     $getinstalledplugins = $model->getinstalledplugins();
     $getinstalledshipping = $model->getinstalledplugins('redshop_shipping');
     $db_version = $db->getVersion();
     $php_version = phpversion();
     $server = $this->get_server_software();
     $gd_check = extension_loaded('gd');
     $mb_check = extension_loaded('mbstring');
     $this->server = $server;
     $this->php_version = $php_version;
     $this->db_version = $db_version;
     $this->gd_check = $gd_check;
     $this->mb_check = $mb_check;
     $this->getinstalledmodule = $getinstalledmodule;
     $this->getinstalledplugins = $getinstalledplugins;
     $this->getinstalledshipping = $getinstalledshipping;
     $this->current_version = $current_version;
     $this->lists = $lists;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
Пример #25
0
 public function display($tpl = null)
 {
     global $context;
     $context = 'product_id';
     $GLOBALS['productlist'] = array();
     $redTemplate = new Redtemplate();
     $extra_field = new extra_field();
     $adminproducthelper = new adminproducthelper();
     $list_in_products = $extra_field->list_all_field_in_product();
     $uri = JFactory::getURI();
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSHOP_PRODUCT'));
     $layout = JRequest::getVar('layout');
     JToolBarHelper::title(JText::_('COM_REDSHOP_PRODUCT_MANAGEMENT'), 'redshop_products48');
     if ($layout != 'importproduct' && $layout != 'importattribute' && $layout != 'listing' && $layout != 'ins_product') {
         JToolBarHelper::customX('gbasefeed', 'gbase.png', 'gbase.png', JText::_('COM_REDSHOP_GOOGLEBASE'), true);
         JToolBarHelper::custom('assignCategory', 'save.png', 'save_f2.png', JText::_('COM_REDSHOP_ASSIGN_CATEGORY'), true);
         JToolBarHelper::custom('removeCategory', 'delete.png', 'delete_f2.png', JText::_('COM_REDSHOP_REMOVE_CATEGORY'), true);
         JToolBarHelper::addNewX();
         JToolBarHelper::editListX();
         JToolBarHelper::customX('copy', 'copy.png', 'copy_f2.png', JText::_('COM_REDSHOP_TOOLBAR_COPY'), true);
         JToolBarHelper::deleteList();
         JToolBarHelper::publishList();
         JToolBarHelper::unpublishList();
     }
     if ($layout == 'listing') {
         JToolBarHelper::back();
     }
     $category_id = $app->getUserStateFromRequest($context . 'category_id', 'category_id', '');
     if ($category_id) {
         $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'x.ordering');
     } else {
         $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'p.product_id');
     }
     $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
     $search_field = $app->getUserStateFromRequest($context . 'search_field', 'search_field', '');
     $keyword = $app->getUserStateFromRequest($context . 'keyword', 'keyword', '');
     $categories = $this->get('CategoryList');
     $categories1 = array();
     foreach ($categories as $key => $value) {
         $categories1[$key] = new stdClass();
         $categories1[$key]->id = $categories[$key]->id;
         $categories1[$key]->parent_id = $categories[$key]->parent_id;
         $categories1[$key]->title = $categories[$key]->title;
         $treename = str_replace("&#160;&#160;&#160;&#160;&#160;&#160;", " ", $categories[$key]->treename);
         $treename = str_replace("<sup>", " ", $treename);
         $treename = str_replace("</sup>&#160;", " ", $treename);
         $categories1[$key]->treename = $treename;
         $categories1[$key]->children = $categories[$key]->children;
     }
     $temps = array();
     $temps[0] = new stdClass();
     $temps[0]->id = "0";
     $temps[0]->treename = JText::_('COM_REDSHOP_SELECT');
     $categories1 = @array_merge($temps, $categories1);
     $lists['category'] = JHTML::_('select.genericlist', $categories1, 'category_id', 'class="inputbox" onchange="document.adminForm2.submit();" ', 'id', 'treename', $category_id);
     $product_sort = $adminproducthelper->getProductrBySortedList();
     $product_sort_select = JRequest::getVar('product_sort', 0);
     $lists['product_sort'] = JHTML::_('select.genericlist', $product_sort, 'product_sort', 'class="inputbox"  onchange="document.adminForm2.submit();" ', 'value', 'text', $product_sort_select);
     $lists['order'] = $filter_order;
     $lists['order_Dir'] = $filter_order_Dir;
     $products = $this->get('Data');
     $pagination = $this->get('Pagination');
     /*
      * assign template
      */
     $templates = $redTemplate->getTemplate('product');
     $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['product_template'] = JHTML::_('select.genericlist', $templates, 'product_template', 'class="inputbox" size="1"  onchange="return AssignTemplate()" ', 'template_id', 'template_name', 0);
     $this->list_in_products = $list_in_products;
     $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);
 }
Пример #26
0
/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
/*
 * Include required files
 */
include_once JPATH_COMPONENT . '/helpers/product.php';
include_once JPATH_COMPONENT . '/helpers/cart.php';
$producthelper = new producthelper();
$carthelper = new rsCarthelper();
$redTemplate = new Redtemplate();
$cart = $this->cart;
$idx = $cart['idx'];
$Itemid = JRequest::getInt('Itemid');
$cart_index = JRequest::getInt('cart_index');
$product_id = JRequest::getInt('pid');
$model = $this->getModel('cart');
$session = JFactory::getSession();
$user = JFactory::getUser();
$document = JFactory::getDocument();
JHTML::Script('attribute.js', 'components/com_redshop/assets/js/', false);
JHTML::Script('common.js', 'components/com_redshop/assets/js/', false);
?>
	<script type="text/javascript">
		function cancelForm(frm) {
			frm.task.value = 'cancel';
Пример #27
0
 public function getProductPerPage()
 {
     $app = JFactory::getApplication();
     $redconfig = $app->getParams();
     $redTemplate = new Redtemplate();
     $template = $this->getCategoryTemplet();
     for ($i = 0; $i < count($template); $i++) {
         $template[$i]->template_desc = $redTemplate->readtemplateFile($template[$i]->template_section, $template[$i]->template_name);
     }
     if (isset($template[0]->template_desc) && !strstr($template[0]->template_desc, "{show_all_products_in_category}") && strstr($template[0]->template_desc, "{pagination}") && strstr($template[0]->template_desc, "perpagelimit:")) {
         $perpage = explode('{perpagelimit:', $template[0]->template_desc);
         $perpage = explode('}', $perpage[1]);
         $limit = intval($perpage[0]);
     } else {
         $productperpage = $this->getState('productperpage');
         if ($productperpage != 0 && $productperpage != '') {
             $limit = $productperpage;
         } elseif ($this->_id) {
             $limit = intval($redconfig->get('maxproduct', 0));
             if ($limit == 0) {
                 $limit = $this->_maincat->products_per_page;
             }
         } else {
             $limit = MAXCATEGORY;
         }
     }
     if (strstr($template[0]->template_desc, "{product_display_limit}")) {
         $endlimit = JRequest::getInt('limit', 0, '', 'int');
     }
     return $limit;
 }
Пример #28
0
<?php

/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
$redTemplate = new Redtemplate();
$Itemid = JRequest::getInt('Itemid');
$layout = JRequest::getCmd('layout', 'default');
$model = $this->getModel('catalog');
$template = $redTemplate->getTemplate("catalog");
if (count($template) > 0 && $template[0]->template_desc != "") {
    $template_desc = $template[0]->template_desc;
} else {
    $template_desc = '<div id="katalog_wrapper"><div id="bestil_katalog_wrapper"><div id="katalog_overskrift"><h1>Order Catalog</h1></div><div id="katalog_venstre_wrapper"><div id="katalog_tekst"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris eget nisi orci, vel vehicula massa. Phasellus ipsum est, egestas a consequat eget, placerat vitae ipsum. Proin ac purus risus. Quisque nec nisi lacus, vitae iaculis eros. Donec ipsum diam, dictum ac euismod molestie, ultrices eget arcu. Vestibulum lacinia nisl et odio sagittis fermentum. Aliquam tristique volutpat faucibus. Sed id orci ut metus condimentum bibendum. Ut gravida scelerisque magna et pharetra. Ut vel turpis in orci molestie scelerisque. Proin nisl elit, ullamcorper id blandit nec, congue eget augue. Nullam gravida ligula nisi.</p></div><div>Catalog:{catalog_select}</div><div id="katalog_navn_email">NAME  {name} <br /><br />EMAIL {email_address} <br /><br />{submit_button_catalog}</div></div><div id="katalog_hojre_wrapper"></div></div></div>';
}
if ($this->params->get('show_page_heading', 1)) {
    if ($this->params->get('page_title')) {
        ?>
	<h1 class="componentheading<?php 
        echo $this->escape($this->params->get('pageclass_sfx'));
        ?>
">
		<?php 
        echo $this->escape($this->params->get('page_title'));
        ?>
Пример #29
0
 public function getRelatedtemplateView($template_desc, $product_id)
 {
     $extra_field = new extraField();
     $config = new Redconfiguration();
     $redTemplate = new Redtemplate();
     $redhelper = new redhelper();
     $related_product = $this->getRelatedProduct($product_id);
     $related_template = $this->getRelatedProductTemplate($template_desc);
     $option = 'com_redshop';
     $fieldArray = $extra_field->getSectionFieldList(17, 0, 0);
     if (count($related_template) > 0) {
         if (count($related_product) > 0 && strstr($related_template->template_desc, "{related_product_start}") && strstr($related_template->template_desc, "{related_product_end}")) {
             $related_template_data = '';
             $product_start = explode("{related_product_start}", $related_template->template_desc);
             $product_end = explode("{related_product_end}", $product_start[1]);
             $tempdata_div_start = $product_start[0];
             $tempdata_div_middle = $product_end[0];
             $tempdata_div_end = $product_end[1];
             $attribute_template = $this->getAttributeTemplate($tempdata_div_middle);
             for ($r = 0; $r < count($related_product); $r++) {
                 $related_template_data .= $tempdata_div_middle;
                 $ItemData = $this->getMenuInformation(0, 0, '', 'product&pid=' . $related_product[$r]->product_id);
                 if (count($ItemData) > 0) {
                     $pItemid = $ItemData->id;
                 } else {
                     $pItemid = $redhelper->getItemid($related_product[$r]->product_id);
                 }
                 $rlink = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $related_product[$r]->product_id . '&Itemid=' . $pItemid);
                 if (strstr($related_template_data, "{relproduct_image_3}")) {
                     $rpimg_tag = '{relproduct_image_3}';
                     $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT_3;
                     $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH_3;
                 } elseif (strstr($related_template_data, "{relproduct_image_2}")) {
                     $rpimg_tag = '{relproduct_image_2}';
                     $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT_2;
                     $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH_2;
                 } elseif (strstr($related_template_data, "{relproduct_image_1}")) {
                     $rpimg_tag = '{relproduct_image_1}';
                     $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT;
                     $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH;
                 } else {
                     $rpimg_tag = '{relproduct_image}';
                     $rph_thumb = RELATED_PRODUCT_THUMB_HEIGHT;
                     $rpw_thumb = RELATED_PRODUCT_THUMB_WIDTH;
                 }
                 $hidden_thumb_image = "<input type='hidden' name='rel_main_imgwidth' id='rel_main_imgwidth' value='" . $rpw_thumb . "'><input type='hidden' name='rel_main_imgheight' id='rel_main_imgheight' value='" . $rph_thumb . "'>";
                 $relimage = $this->getProductImage($related_product[$r]->product_id, $rlink, $rpw_thumb, $rph_thumb);
                 $related_template_data = str_replace($rpimg_tag, $relimage . $hidden_thumb_image, $related_template_data);
                 if (strstr($related_template_data, "{relproduct_link}")) {
                     $rpname = "<a href='" . $rlink . "' title='" . $related_product[$r]->product_name . "'>" . $config->maxchar($related_product[$r]->product_name, RELATED_PRODUCT_TITLE_MAX_CHARS, RELATED_PRODUCT_TITLE_END_SUFFIX) . "</a>";
                 } else {
                     $rpname = $config->maxchar($related_product[$r]->product_name, RELATED_PRODUCT_TITLE_MAX_CHARS, RELATED_PRODUCT_TITLE_END_SUFFIX);
                 }
                 $rpdesc = $config->maxchar($related_product[$r]->product_desc, RELATED_PRODUCT_DESC_MAX_CHARS, RELATED_PRODUCT_DESC_END_SUFFIX);
                 $rp_shortdesc = $config->maxchar($related_product[$r]->product_s_desc, RELATED_PRODUCT_SHORT_DESC_MAX_CHARS, RELATED_PRODUCT_SHORT_DESC_END_SUFFIX);
                 $related_template_data = str_replace("{relproduct_link}", '', $related_template_data);
                 if (strstr($related_template_data, "{relproduct_link}")) {
                     $related_template_data = str_replace("{relproduct_name}", "", $related_template_data);
                 } else {
                     $related_template_data = str_replace("{relproduct_name}", $rpname, $related_template_data);
                 }
                 $related_template_data = str_replace("{relproduct_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER_LBL'), $related_template_data);
                 $related_template_data = str_replace("{relproduct_number}", $related_product[$r]->product_number, $related_template_data);
                 $related_template_data = str_replace("{relproduct_s_desc}", $rp_shortdesc, $related_template_data);
                 $related_template_data = str_replace("{relproduct_desc}", $rpdesc, $related_template_data);
                 // ProductFinderDatepicker Extra Field Start
                 $related_template_data = $this->getProductFinderDatepickerValue($related_template_data, $related_product[$r]->product_id, $fieldArray);
                 // ProductFinderDatepicker Extra Field End
                 if (strstr($related_template_data, "{manufacturer_name}") || strstr($related_template_data, "{manufacturer_link}")) {
                     $manufacturer = $this->getSection("manufacturer", $related_product[$r]->manufacturer_id);
                     if (count($manufacturer) > 0) {
                         $man_url = JRoute::_('index.php?option=' . $option . '&view=manufacturers&layout=products&mid=' . $related_product[$r]->manufacturer_id . '&Itemid=' . $pItemid);
                         $manufacturerLink = "<a href='" . $man_url . "'>" . JText::_("COM_REDSHOP_VIEW_ALL_MANUFACTURER_PRODUCTS") . "</a>";
                         $related_template_data = str_replace("{manufacturer_name}", $manufacturer->manufacturer_name, $related_template_data);
                         $related_template_data = str_replace("{manufacturer_link}", $manufacturerLink, $related_template_data);
                     } else {
                         $related_template_data = str_replace("{manufacturer_name}", '', $related_template_data);
                         $related_template_data = str_replace("{manufacturer_link}", '', $related_template_data);
                     }
                 }
                 $relmorelink = JRoute::_('index.php?option=' . $option . '&view=product&pid=' . $related_product[$r]->product_id . '&cid=' . $related_product[$r]->cat_in_sefurl . '&Itemid=' . $pItemid);
                 $rmore = "<a href='" . $relmorelink . "' title='" . $related_product[$r]->product_name . "'>" . JText::_('COM_REDSHOP_READ_MORE') . "</a>";
                 $related_template_data = str_replace("{read_more}", $rmore, $related_template_data);
                 $related_template_data = str_replace("{read_more_link}", $relmorelink, $related_template_data);
                 /*
                  *  related product Required Attribute start
                  * 	this will parse only Required Attributes
                  */
                 $relid = $related_product[$r]->product_id;
                 $attributes_set = array();
                 if ($related_product[$r]->attribute_set_id > 0) {
                     $attributes_set = $this->getProductAttribute(0, $related_product[$r]->attribute_set_id);
                 }
                 $attributes = $this->getProductAttribute($relid);
                 $attributes = array_merge($attributes, $attributes_set);
                 $related_template_data = $this->replaceAttributeData($related_product[$r]->mainproduct_id, 0, $related_product[$r]->product_id, $attributes, $related_template_data, $attribute_template);
                 // Check product for not for sale
                 $related_template_data = $this->getProductNotForSaleComment($related_product[$r], $related_template_data, $attributes, 1);
                 $related_template_data = $this->replaceCartTemplate($related_product[$r]->mainproduct_id, 0, 0, $related_product[$r]->product_id, $related_template_data, false, 0, count($attributes), 0, 0);
                 $related_template_data = $this->replaceCompareProductsButton($related_product[$r]->product_id, 0, $related_template_data, 1);
                 $related_template_data = $this->replaceProductInStock($related_product[$r]->product_id, $related_template_data);
                 $related_template_data = $this->getProductOnSaleComment($related_product[$r], $related_template_data);
                 $related_template_data = $this->getSpecialProductComment($related_product[$r], $related_template_data);
                 // related product attribute price list
                 $related_template_data = $this->replaceAttributePriceList($related_product[$r]->product_id, $related_template_data);
             }
             $related_template_data = $tempdata_div_start . $related_template_data . $tempdata_div_end;
             $template_desc = str_replace("{related_product:{$related_template->template_name}}", $related_template_data, $template_desc);
             $template_desc = $redTemplate->parseredSHOPplugin($template_desc);
         } else {
             $template_desc = str_replace("{related_product:{$related_template->template_name}}", "", $template_desc);
         }
     }
     return $template_desc;
 }
Пример #30
0
 public function clickatellSMS($order_id)
 {
     if (CLICKATELL_ENABLE <= 0) {
         return;
     }
     $db = JFactory::getDbo();
     $shippinghelper = new shipping();
     $query = "SELECT * FROM " . $this->_table_prefix . "order_users_info AS oui " . "LEFT JOIN " . $this->_table_prefix . "orders AS o ON o.order_id = oui.order_id " . "WHERE oui.order_id = " . (int) $order_id . " " . "AND address_type='ST' ";
     $this->_db->setQuery($query);
     $orderData = $this->_db->loadobject();
     $query = "SELECT payment_method_name, oy.payment_method_id FROM " . $this->_table_prefix . "order_payment AS oy " . "LEFT JOIN " . $this->_table_prefix . "orders AS o ON o.order_id = oy.order_id " . "LEFT JOIN " . $this->_table_prefix . "payment_method AS p ON p.payment_method_id = oy.payment_method_id " . "WHERE oy.order_id = " . (int) $order_id;
     $this->_db->setQuery($query);
     $paymentData = $this->_db->loadobject();
     $paymentName = $paymentData->payment_method_name;
     $payment_method_id = $paymentData->payment_method_id;
     $redTemplate = new Redtemplate();
     $TemplateDetail = $redTemplate->getTemplate("clicktell_sms_message");
     $order_shipping_class = 0;
     $order_shipping = explode("|", $shippinghelper->decryptShipping(str_replace(" ", "+", $orderData->ship_method_id)));
     if (isset($order_shipping[0])) {
         $order_shipping_class = $order_shipping[0];
     }
     $p_where = " AND (FIND_IN_SET( " . $db->quote($payment_method_id) . ", payment_methods ))";
     $s_where = " AND (FIND_IN_SET( " . $db->quote($order_shipping_class) . ", shipping_methods ))";
     $orderby = " ORDER BY `template_id` DESC LIMIT 0,1";
     $query = "SELECT * FROM " . $this->_table_prefix . "template AS t " . "WHERE t.template_section = 'clicktell_sms_message' " . "AND (FIND_IN_SET( " . $db->quote($orderData->order_status) . ", order_status )) ";
     $to = $orderData->phone;
     $this->_db->setQuery($query . $p_where . $orderby);
     $payment_methods = $this->_db->loadobject();
     $message = $this->replaceMessage($payment_methods->template_desc, $orderData, $paymentName);
     if ($message) {
         $this->sendmessage(urlencode($message), $to);
     }
     $this->_db->setQuery($query . $s_where . $orderby);
     $shipping_methods = $this->_db->loadobject();
     $message = $this->replaceMessage($shipping_methods->template_desc, $orderData, $paymentName);
     if ($message) {
         $this->sendmessage(urlencode($message), $to);
     }
     if (CLICKATELL_ORDER_STATUS == $orderData->order_status) {
         $message = $this->replaceMessage($TemplateDetail[0]->template_desc, $orderData, $paymentName);
         if ($message) {
             $this->sendmessage(urlencode($message), $to);
         }
     }
 }