Beispiel #1
0
 public function display($tpl = null)
 {
     $context = 'user_info_id';
     $uri = JFactory::getURI();
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSHOP_USER'));
     $userhelper = new rsUserhelper();
     $sync = JRequest::getVar('sync');
     $filter_by = JRequest::getVar('filter_by', '', 'request', 'string');
     $spgrp_filter = JRequest::getVar('spgrp_filter', '', 'request', 'string');
     $approved_filter = JRequest::getVar('approved_filter', '', 'request', 'string');
     $tax_exempt_request_filter = JRequest::getVar('tax_exempt_request_filter', '', 'request', 'string');
     $model = $this->getModel('user');
     if ($sync) {
         $this->setLayout('user_sync');
         $sync_user = $userhelper->userSynchronization();
         $this->sync_user = $sync_user;
     } else {
         $this->setLayout('default');
         JToolBarHelper::addNewX();
         JToolBarHelper::editListX();
         JToolBarHelper::deleteList();
     }
     $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'users_info_id');
     $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
     $lists['order'] = $filter_order;
     $lists['order_Dir'] = $filter_order_Dir;
     $user = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     $shopper_groups = $userhelper->getShopperGroupList();
     $temps = array();
     $temps[0] = new stdClass();
     $temps[0]->value = 0;
     $temps[0]->text = JText::_('COM_REDSHOP_SELECT');
     $shopper_groups = array_merge($temps, $shopper_groups);
     $lists['shopper_group'] = JHTML::_('select.genericlist', $shopper_groups, 'spgrp_filter', 'class="inputbox" size="1" onchange="document.adminForm.submit()"', 'value', 'text', $spgrp_filter);
     $arr_filter_by = array();
     $arr_filter_by[] = JHTML::_('select.option', '', 'All');
     $arr_filter_by[] = JHTML::_('select.option', 'fullname', JText::_('COM_REDSHOP_FULLNAME'));
     $arr_filter_by[] = JHTML::_('select.option', 'username', JText::_('COM_REDSHOP_USERNAME'));
     $lists['filter_by'] = JHTML::_('select.genericlist', $arr_filter_by, 'filter_by', 'class="inputbox" size="1"', 'value', 'text', $filter_by);
     $optiontax_req = array();
     $optiontax_req[] = JHTML::_('select.option', 'select', JText::_('COM_REDSHOP_SELECT'));
     $optiontax_req[] = JHTML::_('select.option', '1', JText::_('COM_REDSHOP_yes'));
     $optiontax_req[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_no'));
     $lists['tax_exempt_request'] = JHTML::_('select.genericlist', $optiontax_req, 'tax_exempt_request_filter', 'class="inputbox" size="1" onchange="document.adminForm.submit()"', 'value', 'text', $tax_exempt_request_filter);
     $this->lists = $lists;
     $this->user = $user;
     $this->pagination = $pagination;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
Beispiel #2
0
 public function store($post)
 {
     $userhelper = new rsUserhelper();
     $post['billisship'] = 1;
     $post['createaccount'] = isset($post['username']) && $post['username'] != "" ? 1 : 0;
     $joomlauser = $userhelper->updateJoomlaUser($post);
     if (!$joomlauser) {
         return false;
     }
     $reduser = $userhelper->storeRedshopUser($post, $joomlauser->id);
     return $reduser;
 }
Beispiel #3
0
 public function store(&$data)
 {
     $userhelper = new rsUserhelper();
     $captcha = $userhelper->checkCaptcha($data);
     if (!$captcha) {
         return false;
     }
     $joomlauser = $userhelper->createJoomlaUser($data, 1);
     if (!$joomlauser) {
         return false;
     }
     $data['billisship'] = 1;
     $reduser = $userhelper->storeRedshopUser($data, $joomlauser->id);
     return $reduser;
 }
Beispiel #4
0
 /**
  *  Method to unsubscribe newsletter
  *
  * @return void
  */
 public function unsubscribe()
 {
     $post = JRequest::get('get');
     $model = $this->getModel('newsletter');
     $option = JRequest::getVar('option');
     $Itemid = JRequest::getVar('Itemid');
     $email = JRequest::getVar('email1');
     $newsletteritemid = JRequest::getVar('newsletteritemid');
     $menu = JFactory::getApplication()->getMenu();
     $item = $menu->getItem($newsletteritemid);
     if ($item) {
         $return = $item->link . '&Itemid=' . $newsletteritemid;
     } else {
         $return = "index.php?option=com_redshop&view=newsletter&layout=thankyou&Itemid=" . $Itemid;
     }
     /*
      *  check if user has subscribe or not.
      */
     $alreadysubscriberbymail = $model->checksubscriptionbymail($email);
     if ($alreadysubscriberbymail) {
         $userhelper = new rsUserhelper();
         if ($userhelper->newsletterUnsubscribe($email)) {
             $msg = JText::_('COM_REDSHOP_CANCLE_SUBSCRIPTION');
         } else {
             $msg = JText::_('COM_REDSHOP_CANCLE_SUBSCRIPTION_FAIL');
         }
     } else {
         $msg = JText::_('COM_REDSHOP_ALREADY_CANCLE_SUBSCRIPTION');
     }
     $this->setRedirect($return, $msg);
 }
Beispiel #5
0
 public function display($tpl = null)
 {
     global $context;
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSHOP_DISCOUNT'));
     $layout = JRequest::getVar('layout');
     if (isset($layout) && $layout == 'product') {
         $context = 'discount_product_id';
     } else {
         $context = 'discount_id';
     }
     JToolBarHelper::title(JText::_('COM_REDSHOP_DISCOUNT_MANAGEMENT'), 'redshop_discountmanagmenet48');
     JToolBarHelper::addNewX();
     JToolBarHelper::editListX();
     JToolBarHelper::deleteList();
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     $uri = JFactory::getURI();
     if (isset($layout) && $layout == 'product') {
         $this->setLayout('product');
         $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'discount_product_id');
     } else {
         $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'discount_id');
     }
     $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
     $lists['order'] = $filter_order;
     $lists['order_Dir'] = $filter_order_Dir;
     $discounts = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     $spgrpdis_filter = $app->getUserStateFromRequest($context . 'spgrpdis_filter', 'spgrpdis_filter', 0);
     $userhelper = new rsUserhelper();
     $shopper_groups = $userhelper->getShopperGroupList();
     $temps = array();
     $temps[0] = new stdClass();
     $temps[0]->value = 0;
     $temps[0]->text = JText::_('COM_REDSHOP_SELECT');
     $shopper_groups = array_merge($temps, $shopper_groups);
     $lists['shopper_group'] = JHTML::_('select.genericlist', $shopper_groups, 'spgrpdis_filter', 'class="inputbox" size="1" onchange="document.adminForm.submit()"', 'value', 'text', $spgrpdis_filter);
     $this->user = JFactory::getUser();
     $this->lists = $lists;
     $this->discounts = $discounts;
     $this->pagination = $pagination;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
Beispiel #6
0
 public function _buildQuery()
 {
     $and = "";
     // Shopper group - choose from manufactures Start
     $rsUserhelper = new rsUserhelper();
     $shopper_group_manufactures = $rsUserhelper->getShopperGroupManufacturers();
     if ($shopper_group_manufactures != "") {
         $shopper_group_manufactures = explode(',', $shopper_group_manufactures);
         JArrayHelper::toInteger($shopper_group_manufactures);
         $shopper_group_manufactures = implode(',', $shopper_group_manufactures);
         $and .= " AND p.manufacturer_id IN (" . $shopper_group_manufactures . ") ";
     }
     // Shopper group - choose from manufactures End
     if (isset($this->_catid) && $this->_catid != 0) {
         $and .= "AND pcx.category_id = " . (int) $this->_catid . " ";
     }
     $query = "SELECT p.*, c.category_id, c.category_name ,c.category_back_full_image,c.category_full_image , m.manufacturer_name,pcx.ordering " . "FROM " . $this->_table_prefix . "product AS p " . "LEFT JOIN " . $this->_table_prefix . "product_category_xref AS pcx ON pcx.product_id = p.product_id " . $and . "LEFT JOIN " . $this->_table_prefix . "manufacturer AS m ON m.manufacturer_id = p.manufacturer_id " . "LEFT JOIN " . $this->_table_prefix . "category AS c ON c.category_id = pcx.category_id " . "WHERE 1=1 " . "AND p.product_id = " . (int) $this->_id . " " . "LIMIT 0,1 ";
     return $query;
 }
Beispiel #7
0
 /**
  * User synchronization
  *
  * @return  void
  */
 private function userSynchronization()
 {
     require_once JPATH_SITE . "/administrator/components/com_redshop/helpers/redshop.cfg.php";
     require_once JPATH_SITE . '/components/com_redshop/helpers/user.php';
     JTable::addIncludePath(JPATH_SITE . '/administrator/components/com_redshop/tables');
     $userhelper = new rsUserhelper();
     $cnt = $userhelper->userSynchronization();
 }
Beispiel #8
0
    public function getfreeshippingRate($shipping_rate_id = 0)
    {
        $userhelper = new rsUserhelper();
        $session = JFactory::getSession();
        $cart = $session->get('cart', null);
        $db = JFactory::getDbo();
        $idx = 0;
        if (isset($cart['idx']) === true) {
            $idx = (int) $cart['idx'];
        }
        $order_subtotal = isset($cart['product_subtotal']) ? $cart['product_subtotal'] : null;
        $order_functions = new order_functions();
        $user = JFactory::getUser();
        $user_id = $user->id;
        if (!empty($idx)) {
            $text = JText::_('COM_REDSHOP_NO_SHIPPING_RATE_AVAILABLE');
        } else {
            return JText::_('COM_REDSHOP_NO_SHIPPING_RATE_AVAILABLE_WHEN_NOPRODUCT_IN_CART');
        }
        $users_info_id = JRequest::getVar('users_info_id');
        // Try to load user information
        $userInfo = null;
        $country = null;
        $state = null;
        $is_company = null;
        $shoppergroup = null;
        $zip = null;
        if ($user_id) {
            if ($users_info_id) {
                $userInfo = $this->getShippingAddress($users_info_id);
            } elseif ($userInfo = $order_functions->getShippingAddress($user_id)) {
                $userInfo = $userInfo[0];
            }
        }
        $where = '';
        $wherestate = '';
        $whereshopper = '';
        if (!$is_company) {
            $where = " AND ( company_only = 2 or company_only = 0) ";
        } else {
            $where = " AND ( company_only = 1 or company_only = 0) ";
        }
        if ($userInfo) {
            $country = $userInfo->country_code;
            $state = $userInfo->state_code;
            $is_company = $userInfo->is_company;
            $shoppergroup = $userhelper->getShoppergroupData($userInfo->user_id);
            $zip = $userInfo->zipcode;
        }
        if (count($shoppergroup) > 0) {
            $shopper_group_id = $shoppergroup->shopper_group_id;
            $whereshopper = ' AND (FIND_IN_SET(' . (int) $shopper_group_id . ', shipping_rate_on_shopper_group )
			OR shipping_rate_on_shopper_group="") ';
        }
        $shippingrate = array();
        if ($country) {
            $wherecountry = 'AND (FIND_IN_SET(' . $db->quote($country) . ', shipping_rate_country ) OR shipping_rate_country="0"
			OR shipping_rate_country="" )';
        } else {
            $wherecountry = 'AND (FIND_IN_SET(' . $db->quote(DEFAULT_SHIPPING_COUNTRY) . ', shipping_rate_country )
			OR shipping_rate_country="0" OR shipping_rate_country="")';
        }
        if ($state) {
            $wherestate = ' AND (FIND_IN_SET(' . $db->quote($state) . ', shipping_rate_state ) OR shipping_rate_state="0" OR shipping_rate_state="")';
        }
        $zipCond = "";
        $zip = trim($zip);
        if (preg_match('/^[0-9 ]+$/', $zip) && !empty($zip)) {
            $zipCond = ' AND ( ( shipping_rate_zip_start <= ' . $db->quote($zip) . ' AND shipping_rate_zip_end >= ' . $db->quote($zip) . ' )
				OR (shipping_rate_zip_start = "0" AND shipping_rate_zip_end = "0")
				OR (shipping_rate_zip_start = "" AND shipping_rate_zip_end = "") ) ';
        }
        if ($shipping_rate_id) {
            $where .= ' AND sr.shipping_rate_id = ' . (int) $shipping_rate_id . ' ';
        }
        $sql = "SELECT * FROM " . $this->_table_prefix . "shipping_rate as sr\n\t\t\t\t\t\t\t\t LEFT JOIN #__extensions AS s\n\t\t\t\t\t\t\t\t ON\n\t\t\t\t\t\t\t\t sr.shipping_class = s.element\n\t\t\t\t\t\t\t\t WHERE (shipping_rate_value =0 OR shipping_rate_value ='0')\n\n\t\t\t\t{$wherecountry} {$wherestate} {$whereshopper} {$zipCond} {$where}\n\t\t\t\tORDER BY s.ordering,sr.shipping_rate_priority LIMIT 0,1";
        $db->setQuery($sql);
        $shippingrate = $db->loadObject();
        if ($shippingrate) {
            if ($shippingrate->shipping_rate_ordertotal_start > $order_subtotal) {
                $diff = $shippingrate->shipping_rate_ordertotal_start - $order_subtotal;
                $text = sprintf(JText::_('COM_REDSHOP_SHIPPING_TEXT_LBL'), $this->producthelper->getProductFormattedPrice($diff));
            } elseif ($shippingrate->shipping_rate_ordertotal_start < $order_subtotal && $shippingrate->shipping_rate_ordertotal_end > $order_subtotal) {
                $text = JText::_('COM_REDSHOP_FREE_SHIPPING_RATE_IS_IN_USED');
            } else {
                $text = JText::_('COM_REDSHOP_NO_SHIPPING_RATE_AVAILABLE');
            }
        }
        return $text;
    }
Beispiel #9
0
 public function display($tpl = null)
 {
     $Redconfiguration = new Redconfiguration();
     $userhelper = new rsUserhelper();
     $extra_field = new extra_field();
     $shipping = JRequest::getVar('shipping', '', 'request', 'string');
     $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->users_info_id < 1;
     $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT');
     if ($shipping) {
         JToolBarHelper::title(JText::_('COM_REDSHOP_USER_SHIPPING_DETAIL') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_user48');
     } else {
         JToolBarHelper::title(JText::_('COM_REDSHOP_USER_MANAGEMENT_DETAIL') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_user48');
     }
     JToolBarHelper::apply();
     JToolBarHelper::save();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         JToolBarHelper::customX('order', 'redshop_order32', '', JText::_('COM_REDSHOP_PLACE_ORDER'), false);
         JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE'));
     }
     $pagination = $this->get('Pagination');
     $user_groups = $userhelper->getUserGroupList($detail->users_info_id);
     $detail->user_groups = $user_groups;
     $shopper_detail = $userhelper->getShopperGroupList();
     $temps = array();
     $temps[0] = new stdClass();
     $temps[0]->value = 0;
     $temps[0]->text = JText::_('COM_REDSHOP_SELECT');
     $shopper_detail = array_merge($temps, $shopper_detail);
     $lists['shopper_group'] = JHTML::_('select.genericlist', $shopper_detail, 'shopper_group_id', '', 'value', 'text', $detail->shopper_group_id);
     $lists['tax_exempt'] = JHTML::_('select.booleanlist', 'tax_exempt', 'class="inputbox"', $detail->tax_exempt);
     $lists['block'] = JHTML::_('select.booleanlist', 'block', 'class="inputbox"', $detail->block);
     $lists['tax_exempt_approved'] = JHTML::_('select.booleanlist', 'tax_exempt_approved', 'class="inputbox"', $detail->tax_exempt_approved);
     $lists['requesting_tax_exempt'] = JHTML::_('select.booleanlist', 'requesting_tax_exempt', 'class="inputbox"', $detail->requesting_tax_exempt);
     $lists['is_company'] = JHTML::_('select.booleanlist', 'is_company', 'class="inputbox" onchange="showOfflineCompanyOrCustomer(this.value);" ', $detail->is_company, JText::_('COM_REDSHOP_USER_COMPANY'), JText::_('COM_REDSHOP_USER_CUSTOMER'));
     $lists['sendEmail'] = JHTML::_('select.booleanlist', 'sendEmail', 'class="inputbox"', $detail->sendEmail);
     $lists['extra_field'] = $extra_field->list_all_field(6, $detail->users_info_id);
     $lists['customer_field'] = $extra_field->list_all_field(7, $detail->users_info_id);
     $lists['company_field'] = $extra_field->list_all_field(8, $detail->users_info_id);
     $lists['shipping_customer_field'] = $extra_field->list_all_field(14, $detail->users_info_id);
     $lists['shipping_company_field'] = $extra_field->list_all_field(15, $detail->users_info_id);
     $countryarray = $Redconfiguration->getCountryList((array) $detail);
     $detail->country_code = $countryarray['country_code'];
     $lists['country_code'] = $countryarray['country_dropdown'];
     $statearray = $Redconfiguration->getStateList((array) $detail);
     $lists['state_code'] = $statearray['state_dropdown'];
     $this->lists = $lists;
     $this->detail = $detail;
     $this->request_url = $uri->toString();
     $this->pagination = $pagination;
     parent::display($tpl);
 }
 public function setQuotationMode()
 {
     $user = JFactory::getUser();
     $userhelper = new rsUserhelper();
     $shopper_group_id = SHOPPER_GROUP_DEFAULT_UNREGISTERED;
     if ($user->id) {
         $getShopperGroupID = $userhelper->getShopperGroup($user->id);
         if ($getShopperGroupID) {
             $shopper_group_id = $getShopperGroupID;
         }
     }
     $qurey = "SELECT * FROM " . $this->_table_prefix . "shopper_group " . "WHERE shopper_group_id = " . (int) $shopper_group_id;
     $this->_db->setQuery($qurey);
     $list = $this->_db->loadObject();
     if ($list) {
         if ($list->shopper_group_quotation_mode) {
             return 1;
         } else {
             return 0;
         }
     } else {
         return DEFAULT_QUOTATION_MODE_PRE;
     }
 }
Beispiel #11
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;
$userhelper = new rsUserhelper();
$user = JFactory::getUser();
$Itemid = JRequest::getInt('Itemid');
$post = (array) $this->billingaddresses;
$post["email1"] = $post["email"] = $post["user_email"];
if ($user->username) {
    $post["username"] = $user->username;
}
$create_account = 1;
if ($post["user_id"] < 0) {
    $create_account = 0;
}
?>
<script type="text/javascript">
	function cancelForm(frm) {
		frm.task.value = 'cancel';
		frm.submit();
	}
</script>
<?php 
if ($this->params->get('show_page_heading', 1)) {
Beispiel #12
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);
 }
 public function resetTermsCondition()
 {
     $userhelper = new rsUserhelper();
     $userhelper->updateUserTermsCondition();
     die;
 }
Beispiel #14
0
 public function store($post)
 {
     $userhelper = new rsUserhelper();
     $post['user_email'] = $post['email1'] = $post['email'];
     $reduser = $userhelper->storeRedshopUserShipping($post);
     return $reduser;
 }
Beispiel #15
0
 /**
  * getCompanyOrCustomer
  *
  * @return  string
  */
 public function getCompanyOrCustomer()
 {
     $redTemplate = new Redtemplate();
     $rsUserhelper = new rsUserhelper();
     $extraField = new extraField();
     $get = JRequest::get('get');
     $template_id = $get['template_id'];
     $is_company = $get['is_company'];
     $lists['extra_field_user'] = $extraField->list_all_field(7);
     $lists['extra_field_company'] = $extraField->list_all_field(8);
     $lists['shipping_customer_field'] = $extraField->list_all_field(14, 0, 'billingRequired valid');
     $lists['shipping_company_field'] = $extraField->list_all_field(15, 0, 'billingRequired valid');
     $lists['isAjax'] = 1;
     if ($is_company == 1) {
         $template = $redTemplate->getTemplate("company_billing_template", $template_id);
         if (count($template) > 0 && $template[0]->template_desc != "") {
             $template_desc = $template[0]->template_desc;
         } else {
             $template_desc = '<table class="admintable" style="height: 221px;" border="0" width="183"><tbody><tr><td width="100" align="right">{email_lbl}:</td><td>{email}</td><td><span class="required">*</span></td></tr><!-- {retype_email_start} --><tr><td width="100" align="right">{retype_email_lbl}</td><td>{retype_email}</td><td><span class="required">*</span></td></tr><!-- {retype_email_end} --><tr><td width="100" align="right">{company_name_lbl}</td><td>{company_name}</td><td><span class="required">*</span></td></tr><!-- {vat_number_start} --><tr><td width="100" align="right">{vat_number_lbl}</td><td>{vat_number}</td><td><span class="required">*</span></td></tr><!-- {vat_number_end} --><tr><td width="100" align="right">{firstname_lbl}</td><td>{firstname}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{lastname_lbl}</td><td>{lastname}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{address_lbl}</td><td>{address}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{zipcode_lbl}</td><td>{zipcode}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{city_lbl}</td><td>{city}</td><td><span class="required">*</span></td></tr><tr id="{country_txtid}" style="{country_style}"><td width="100" align="right">{country_lbl}</td><td>{country}</td><td><span class="required">*</span></td></tr><tr id="{state_txtid}" style="{state_style}"><td width="100" align="right">{state_lbl}</td><td>{state}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{phone_lbl}</td><td>{phone}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{ean_number_lbl}</td><td>{ean_number}</td><td></td></tr><tr><td width="100" align="right">{tax_exempt_lbl}</td><td>{tax_exempt}</td></tr><tr><td colspan="3">{company_extrafield}</td></tr></tbody></table>';
         }
         $template_desc = $rsUserhelper->replaceCompanyCustomer($template_desc, $get, $lists);
     } else {
         $template = $redTemplate->getTemplate("private_billing_template", $template_id);
         if (count($template) > 0 && $template[0]->template_desc != "") {
             $template_desc = $template[0]->template_desc;
         } else {
             $template_desc = '<table class="admintable" style="height: 221px;" border="0" width="183"><tbody><tr><td width="100" align="right">{email_lbl}:</td><td>{email}</td><td><span class="required">*</span></td></tr><!-- {retype_email_start} --><tr><td width="100" align="right">{retype_email_lbl}</td><td>{retype_email}</td><td><span class="required">*</span></td></tr><!-- {retype_email_end} --><tr><td width="100" align="right">{firstname_lbl}</td><td>{firstname}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{lastname_lbl}</td><td>{lastname}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{address_lbl}</td><td>{address}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{zipcode_lbl}</td><td>{zipcode}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{city_lbl}</td><td>{city}</td><td><span class="required">*</span></td></tr><tr id="{country_txtid}" style="{country_style}"><td width="100" align="right">{country_lbl}</td><td>{country}</td><td><span class="required">*</span></td></tr><tr id="{state_txtid}" style="{state_style}"><td width="100" align="right">{state_lbl}</td><td>{state}</td><td><span class="required">*</span></td></tr><tr><td width="100" align="right">{phone_lbl}</td><td>{phone}</td><td><span class="required">*</span></td></tr><tr><td colspan="3">{private_extrafield}</td></tr></tbody></table>';
         }
         $template_desc = $rsUserhelper->replacePrivateCustomer($template_desc, $get, $lists);
     }
     echo $return = "<div id='ajaxRegistrationDiv'>" . $template_desc . "</div>";
     die;
 }
Beispiel #16
0
 /**
  *  Method to unsubscribe newsletter
  *
  * @return void
  */
 public function newsletterUnsubscribe()
 {
     $user = JFactory::getUser();
     $option = JRequest::getVar('option');
     $Itemid = JRequest::getVar('Itemid');
     $userhelper = new rsUserhelper();
     $userhelper->newsletterUnsubscribe($user->email);
     $msg = JText::_('COM_REDSHOP_CANCLE_SUBSCRIPTION');
     $this->setRedirect("index.php?option=" . $option . "&view=account&Itemid=" . $Itemid, $msg);
 }
Beispiel #17
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_once JPATH_COMPONENT . '/helpers/helper.php';
include_once JPATH_COMPONENT . '/helpers/extra_field.php';
JHTML::_('behavior.tooltip');
JHTMLBehavior::modal();
$url = JURI::base();
$user = JFactory::getUser();
$session = JFactory::getSession();
$redhelper = new redhelper();
$userhelper = new rsUserhelper();
$order_functions = new order_functions();
$telesearch = $order_functions->getparameters('rs_telesearch');
$Itemid = $redhelper->getCheckoutItemid();
$auth = $session->get('auth');
$l = JRequest::getInt('l', 1);
$jinput = JFactory::getApplication()->input;
/*
 * REGISTER_METHOD
 * 0 With account creation
 * 1 Without account creation
 * 2 Optional (create an account if you like or dont)
 * 3 Silent account creation
 *
 * */
$post = $jinput->getArray($_POST);
Beispiel #18
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $context = 'shipping_rate';
     $shippinghelper = new shipping();
     $userhelper = new rsUserhelper();
     $uri = JFactory::getURI();
     $model = $this->getModel();
     $db = JFactory::getDbo();
     $id = $app->getUserStateFromRequest($context . 'extension_id', 'extension_id', '0');
     $shipping = $shippinghelper->getShippingMethodById($id);
     $option = JRequest::getVar('option');
     $document = JFactory::getDocument();
     $document->addScript('components/' . $option . '/assets/js/select_sort.js');
     $document->addStyleSheet('components/' . $option . '/assets/css/search.css');
     $document->addScript('components/' . $option . '/assets/js/search.js');
     $document->addScript('components/' . $option . '/assets/js/common.js');
     $shippingpath = JPATH_ROOT . '/plugins/' . $shipping->folder . '/' . $shipping->element . '.xml';
     $myparams = new JRegistry($shipping->params, $shippingpath);
     $is_shipper = $myparams->get('is_shipper');
     $shipper_location = $myparams->get('shipper_location');
     $jtitle = $shipper_location ? JText::_('COM_REDSHOP_SHIPPING_LOCATION') : JText::_('COM_REDSHOP_SHIPPING_RATE');
     $this->setLayout('default');
     $lists = array();
     $detail = $this->get('data');
     $isNew = $detail->shipping_rate_id < 1;
     $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT');
     JToolBarHelper::title($jtitle . ': <small><small>[ ' . $shipping->name . ' : ' . $text . ' ]</small></small>', 'redshop_shipping_rates48');
     JToolBarHelper::save();
     JToolBarHelper::apply();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE'));
     }
     $q = "SELECT  country_3_code as value,country_name as text from #__" . TABLE_PREFIX . "_country ORDER BY country_name ASC";
     $db->setQuery($q);
     $countries[] = JHTML::_('select.option', '0', '- ' . JText::_('COM_REDSHOP_SELECT_COUNTRY') . ' -', 'value', 'text');
     $countries = array_merge($countries, $db->loadObjectList());
     $shipping_rate_state = array();
     if ($detail->shipping_rate_country) {
         $shipping_rate_state = $model->GetStateList($detail->shipping_rate_country);
     }
     $detail->shipping_rate_state = explode(',', $detail->shipping_rate_state);
     $tmp = new stdClass();
     $tmp = @array_merge($tmp, $detail->shipping_rate_state);
     $lists['shipping_rate_state'] = JHTML::_('select.genericlist', $shipping_rate_state, 'shipping_rate_state[]', 'class="inputbox" multiple="multiple"', 'value', 'text', $detail->shipping_rate_state);
     $detail->shipping_rate_country = explode(',', $detail->shipping_rate_country);
     $tmp = new stdClass();
     $tmp = @array_merge($tmp, $detail->shipping_rate_country);
     $lists['shipping_rate_country'] = JHTML::_('select.genericlist', $countries, 'shipping_rate_country[]', 'class="inputbox" multiple="multiple" onchange="getStateList()" ', 'value', 'text', $detail->shipping_rate_country);
     $detail->shipping_rate_on_category = explode(',', $detail->shipping_rate_on_category);
     $product_category = new product_category();
     $lists['shipping_rate_on_category'] = $product_category->list_all("shipping_rate_on_category[]", 0, $detail->shipping_rate_on_category, 10, false, true);
     $shoppergroup = $userhelper->getShopperGroupList();
     $detail->shipping_rate_on_shopper_group = explode(',', $detail->shipping_rate_on_shopper_group);
     $lists['shipping_rate_on_shopper_group'] = JHTML::_('select.genericlist', $shoppergroup, 'shipping_rate_on_shopper_group[]', 'class="inputbox" multiple="multiple" ', 'value', 'text', $detail->shipping_rate_on_shopper_group);
     $lists['deliver_type'] = JHTML::_('select.booleanlist', 'deliver_type', 'class="inputbox"', $detail->deliver_type, 'COM_REDSHOP_HOME', 'COM_REDSHOP_POSTOFFICE');
     $productData = array();
     $result_container = array();
     if ($detail->shipping_rate_on_product) {
         $result_container = $model->GetProductListshippingrate($detail->shipping_rate_on_product);
     }
     $lists['product_all'] = JHTML::_('select.genericlist', $productData, 'product_all[]', 'class="inputbox" multiple="multiple" ', 'value', 'text', $detail->shipping_rate_on_product);
     $lists['shipping_product'] = JHTML::_('select.genericlist', $result_container, 'container_product[]', 'class="inputbox" onmousewheel="mousewheel(this);" ondblclick="selectnone(this);" multiple="multiple"  size="15" style="width:200px;" ', 'value', 'text', 0);
     $field = new extra_field();
     // Extra field
     $list_field = $field->list_all_field(11, $detail->shipping_rate_id);
     $lists['extra_field'] = $list_field;
     $shippingVatGroup = $model->getVatGroup();
     $temps = array((object) array('value' => '', 'text' => JText::_('COM_REDSHOP_SELECT')));
     $shippingVatGroup = array_merge($temps, $shippingVatGroup);
     $shippingfor = array((object) array('value' => 0, 'text' => JText::_('COM_REDSHOP_BOTH')), (object) array('value' => 1, 'text' => JText::_('COM_REDSHOP_COMPANY_ONLY')), (object) array('value' => 2, 'text' => JText::_('COM_REDSHOP_PRIVATE')));
     $lists['company_only'] = JHTML::_('select.genericlist', $shippingfor, 'company_only', 'class="inputbox" size="1" ', 'value', 'text', $detail->company_only);
     $lists['shipping_tax_group_id'] = JHTML::_('select.genericlist', $shippingVatGroup, 'shipping_tax_group_id', 'class="inputbox" size="1" ', 'value', 'text', $detail->shipping_tax_group_id);
     $this->is_shipper = $is_shipper;
     $this->shipper_location = $shipper_location;
     $this->lists = $lists;
     $this->detail = $detail;
     $this->shipping = $shipping;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
Beispiel #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;
 }
Beispiel #20
0
defined('_JEXEC') or die('restricted access');
$url = JURI::base();
$user = JFactory::getUser();
$request = JRequest::get();
JHTML::_('behavior.tooltip');
JHTMLBehavior::modal();
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
include_once JPATH_COMPONENT_SITE . '/helpers/product.php';
include_once JPATH_COMPONENT_SITE . '/helpers/cart.php';
include_once JPATH_COMPONENT_SITE . '/helpers/user.php';
include_once JPATH_COMPONENT_SITE . '/helpers/helper.php';
$carthelper = new rsCarthelper();
$producthelper = new producthelper();
$order_functions = new order_functions();
$redhelper = new redhelper();
$userhelper = new rsUserhelper();
$user = JFactory::getUser();
$session = JFactory::getSession();
$user_id = $user->id;
// get redshop helper
$Itemid = $redhelper->getCheckoutItemid();
if ($Itemid == 0) {
    $Itemid = JRequest::getVar('Itemid');
}
$option = JRequest::getVar('option');
$model = $this->getModel('checkout');
$ccinfo = JRequest::getVar('ccinfo');
/*$paymentinfo = $order_functions->getPaymentMethodInfo($this->payment_method_id);
$paymentinfo = $paymentinfo[0];
*/
//$cart 		 = $this->cart;
Beispiel #21
0
 public function store($post)
 {
     $userhelper = new rsUserhelper();
     $shipping = isset($post["shipping"]) ? true : false;
     $post['createaccount'] = isset($post['username']) && $post['username'] != "" ? 1 : 0;
     $post['user_email'] = $post['email1'] = $post['email'];
     if ($shipping) {
         $post['country_code_ST'] = $post['country_code'];
         $post['state_code_ST'] = $post['state_code'];
         $post['firstname_ST'] = $post['firstname'];
         $post['lastname_ST'] = $post['lastname'];
         $post['address_ST'] = $post['address'];
         $post['city_ST'] = $post['city'];
         $post['zipcode_ST'] = $post['zipcode'];
         $post['phone_ST'] = $post['phone'];
         $reduser = $userhelper->storeRedshopUserShipping($post);
     } else {
         $post['billisship'] = 1;
         $joomlauser = $userhelper->updateJoomlaUser($post);
         if (!$joomlauser) {
             return false;
         }
         $reduser = $userhelper->storeRedshopUser($post, $joomlauser->id, 1);
     }
     return $reduser;
 }
Beispiel #22
0
 public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $db = JFactory::getDbo();
     $user = JFactory::getUser();
     $searchText = $text;
     // Load plugin params info
     $pluginParams = $this->params;
     $limit = $pluginParams->def('search_limit', 50);
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     $section = JText::_('COM_REDSHOP_Products');
     $wheres = array();
     switch ($phrase) {
         case 'exact':
             $text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
             $wheres2 = array();
             $wheres2[] = 'a.product_name LIKE ' . $text;
             $wheres2[] = 'a.product_number LIKE ' . $text;
             $wheres2[] = 'c.data_txt LIKE ' . $text;
             $where = '(' . implode(') OR (', $wheres2) . ')';
             break;
         case 'all':
         case 'any':
         default:
             $words = explode(' ', $text);
             $wheres = array();
             foreach ($words as $word) {
                 $word = $db->Quote('%' . $db->getEscaped($word, true) . '%', false);
                 $wheres2 = array();
                 $wheres2[] = 'a.product_name LIKE ' . $word;
                 $wheres2[] = 'a.product_number LIKE ' . $word;
                 $wheres2[] = 'c.data_txt LIKE ' . $word;
                 $wheres[] = implode(' OR ', $wheres2);
             }
             $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
             break;
     }
     switch ($ordering) {
         case 'oldest':
             $order = 'a.product_id ASC';
             break;
         case 'newest':
         default:
             $order = 'a.product_id DESC';
     }
     // Shopper group - choose from manufactures Start
     $rsUserhelper = new rsUserhelper();
     $shopper_group_manufactures = $rsUserhelper->getShopperGroupManufacturers();
     $whereaclProduct = "";
     if ($shopper_group_manufactures != "") {
         $whereaclProduct = " AND a.manufacturer_id IN (" . $shopper_group_manufactures . ") ";
     }
     // Shopper group - choose from manufactures End
     $query = 'SELECT c.data_txt as customtxt,a.product_id,a.product_name AS title,a.product_number as number,a.product_s_desc AS text,' . ' "2" AS browsernav,"Redshop product" as section,"" as created' . ' FROM #__redshop_product AS a LEFT join #__redshop_fields_data As c on c.itemid = a.product_id' . ' WHERE (' . $where . ') ' . $whereaclProduct . '' . ' AND a.published = 1' . ' ORDER BY ' . $order;
     $db->setQuery($query, 0, $limit);
     $rows = $db->loadObjectList();
     $redhelper = new redhelper();
     foreach ($rows as $key => $row) {
         $Itemid = $redhelper->getItemid($row->product_id);
         $rows[$key]->href = "index.php?option=com_redshop&view=product&pid=" . $row->product_id . "&Itemid=" . $Itemid;
     }
     $return = array();
     foreach ($rows as $key => $weblink) {
         if (searchHelper::checkNoHTML($weblink, $searchText, array('url', 'text', 'title', 'number', 'customtxt'))) {
             $return[] = $weblink;
         }
     }
     return $return;
 }
 public function storeShipping($data)
 {
     $userhelper = new rsUserhelper();
     $data['address_type'] = 'BT';
     $data['createaccount'] = isset($data['username']) && $data['username'] != "" ? 1 : 0;
     $data['user_email'] = $data['email1'] = $data['email'];
     $data['sameasbilling'] = isset($data['billisship']) && $data['billisship'] == 1 ? 1 : 0;
     $data['billisship'] = 1;
     $data['groups'] = array("Registered" => "2");
     if ($data['guestuser'] && !$data['user_id']) {
         $joomlauser = $userhelper->updateJoomlaUser($data);
         if (!$joomlauser) {
             return false;
         }
     }
     $reduser = $userhelper->storeRedshopUser($data, $joomlauser->id, 1);
     if ($reduser) {
         if ($data['sameasbilling'] != 1) {
             $data['users_info_id'] = $data['shipp_users_info_id'] != "" ? $data['shipp_users_info_id'] : 0;
             $data['user_email'] = $reduser->user_email;
             $data['user_id'] = $reduser->user_id;
             $data['tax_exempt'] = $reduser->tax_exempt;
             $data['requesting_tax_exempt'] = $reduser->requesting_tax_exempt;
             $data['shopper_group_id'] = $reduser->shopper_group_id;
             $data['tax_exempt_approved'] = $reduser->tax_exempt_approved;
             $data['company_name'] = $reduser->company_name;
             $data['vat_number'] = $reduser->vat_number;
             if ($data['firstname_ST'] == "") {
                 $data['firstname_ST'] = $data['firstname'];
             }
             if ($data['lastname_ST'] == "") {
                 $data['lastname_ST'] = $data['lastname'];
             }
             if ($data['address_ST'] == "") {
                 $data['address_ST'] = $data['address'];
             }
             if ($data['city_ST'] == "") {
                 $data['city_ST'] = $data['city'];
             }
             if ($data['state_code_ST'] == "0") {
                 $data['state_code_ST'] = $data['state_code'];
             }
             if ($data['country_code_ST'] == "0") {
                 $data['country_code_ST'] = $data['country_code'];
             }
             if ($data['zipcode_ST'] == "") {
                 $data['zipcode_ST'] = $data['zipcode'];
             }
             if ($data['phone_ST'] == "") {
                 $data['phone_ST'] = $data['phone'];
             }
             $rowsh = $userhelper->storeRedshopUserShipping($data);
             return $rowsh;
         } else {
             $reduser->users_info_id = 0;
             return $reduser;
         }
     }
     return $reduser;
 }
Beispiel #24
0
 public function _buildQuery($manudata = 0)
 {
     $app = JFactory::getApplication();
     $context = 'search';
     $db = JFactory::getDbo();
     $keyword = $app->getUserStateFromRequest($context . 'keyword', 'keyword', '');
     $defaultSearchType = '';
     if (!empty($manudata['search_type'])) {
         $defaultSearchType = $manudata['search_type'];
         $defaultSearchType_tmp = $manudata['search_type'];
     }
     if ($defaultSearchType == "") {
         $defaultSearchType = 'product_name';
     }
     if ($defaultSearchType == "name_number") {
         $defaultSearchField = "name_number";
         $defaultSearchType = '(p.product_name LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_number LIKE ' . $db->quote('%' . $keyword . '%') . ')';
     } elseif ($defaultSearchType == "name_desc") {
         $defaultSearchField = "name_desc";
         $defaultSearchType = '(p.product_name LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_desc LIKE ' . $db->quote('%' . $keyword . '%') . ' OR  p.product_s_desc LIKE ' . $db->quote('%' . $keyword . '%') . ')';
     } elseif ($defaultSearchType == "virtual_product_num") {
         $defaultSearchField = "virtual_product_num";
         $defaultSearchType = '(pa.property_number LIKE ' . $db->quote('%' . $keyword . '%') . ' OR  ps.subattribute_color_number LIKE ' . $db->quote('%' . $keyword . '%') . ')';
     } elseif ($defaultSearchType == "name_number_desc") {
         $defaultSearchType = '(p.product_name LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_number LIKE ' . $db->quote('%' . $keyword . '%') . ' OR p.product_desc LIKE ' . $db->quote('%' . $keyword . '%') . ' OR  p.product_s_desc LIKE ' . $db->quote('%' . $keyword . '%') . ' OR  pa.property_number LIKE ' . $db->quote('%' . $keyword . '%') . ' OR  ps.subattribute_color_number LIKE ' . $db->quote('%' . $keyword . '%') . ')';
     } elseif ($defaultSearchType == "product_desc") {
         $defaultSearchField = $defaultSearchType;
         $defaultSearchType = '(p.' . $defaultSearchType . ' LIKE ' . $db->quote('%' . $keyword . '%') . ' OR  p.product_s_desc LIKE ' . $db->quote('%' . $keyword . '%') . ' )';
     } elseif ($defaultSearchType == "product_name") {
         $main_sp_name = explode(" ", $keyword);
         $defaultSearchField = $defaultSearchType;
         for ($f = 0; $f < count($main_sp_name); $f++) {
             $defaultSearchType1[] = " p.product_name LIKE " . $db->quote('%' . $main_sp_name[$f] . '%');
         }
         $defaultSearchType = "(" . implode("AND", $defaultSearchType1) . ")";
     } elseif ($defaultSearchType == "product_number") {
         $defaultSearchField = $defaultSearchType;
         $defaultSearchType = '(p.product_number LIKE ' . $db->quote('%' . $keyword . '%') . ')';
     }
     $redconfig = $app->getParams();
     $getorderby = urldecode(JRequest::getCmd('order_by', ''));
     if (in_array($getorderby, $this->filter_fields)) {
         $order_by = $getorderby;
     } else {
         $order_by = $redconfig->get('order_by', DEFAULT_PRODUCT_ORDERING_METHOD);
     }
     if ($order_by == 'pc.ordering ASC' || $order_by == 'c.ordering ASC') {
         $order_by = 'p.product_id DESC';
     }
     $layout = JRequest::getVar('layout', 'default');
     $category_helper = new product_category();
     $producthelper = new producthelper();
     $manufacture_id = JRequest::getInt('manufacture_id', 0);
     $category_id = JRequest::getInt('category_id', 0);
     $cat = $category_helper->getCategoryListArray(0, $category_id);
     $cat_group = array();
     for ($j = 0; $j < count($cat); $j++) {
         $cat_group[$j] = $cat[$j]->category_id;
         if ($j == count($cat) - 1) {
             $cat_group[$j + 1] = $category_id;
         }
     }
     JArrayHelper::toInteger($cat_group);
     if ($cat_group) {
         $cat_group = join(',', $cat_group);
     } else {
         $cat_group = $category_id;
     }
     $params = JComponentHelper::getParams('com_redshop');
     $menu = $app->getMenu();
     $item = $menu->getActive();
     $days = 0;
     $days = isset($item->query['newproduct']) ? $item->query['newproduct'] : 0;
     $today = date('Y-m-d H:i:s', time());
     $days_before = date('Y-m-d H:i:s', time() - $days * 60 * 60 * 24);
     $aclProducts = $producthelper->loadAclProducts();
     $whereaclProduct = "";
     // Shopper group - choose from manufactures Start
     $rsUserhelper = new rsUserhelper();
     $shopper_group_manufactures = $rsUserhelper->getShopperGroupManufacturers();
     if ($shopper_group_manufactures != "") {
         // Sanitize ids
         $manufacturerIds = explode(',', $shopper_group_manufactures);
         JArrayHelper::toInteger($manufacturerIds);
         $whereaclProduct .= " AND p.manufacturer_id IN (" . implode(',', $manufacturerIds) . ") ";
     }
     // Shopper group - choose from manufactures End
     if ($aclProducts != "") {
         // Sanitize ids
         $productIds = explode(',', $aclProducts);
         JArrayHelper::toInteger($productIds);
         $whereaclProduct .= " AND p.product_id IN (" . implode(',', $productIds) . ")  ";
     }
     if ($layout == 'productonsale') {
         $categoryid = $item->params->get('categorytemplate');
         $cat_array = "";
         $left_join = "";
         if ($categoryid) {
             $cat_main = $category_helper->getCategoryTree($categoryid);
             $cat_group_main = array();
             for ($j = 0; $j < count($cat_main); $j++) {
                 $cat_group_main[$j] = $cat_main[$j]->category_id;
             }
             $cat_group_main[] = $categoryid;
             JArrayHelper::toInteger($cat_group_main);
             $cat_array = " AND pcx.category_id IN (" . implode(',', $cat_group_main) . ") AND pcx.product_id=p.product_id ";
             $left_join = " LEFT JOIN " . $this->_table_prefix . "product_category_xref pcx ON pcx.product_id=p.product_id ";
         }
         $query = " SELECT * FROM " . $this->_table_prefix . "product AS p " . $left_join . "WHERE p.published = 1 " . "AND p.product_on_sale=1 " . "AND p.expired=0 " . "AND p.product_parent_id=0 " . $whereaclProduct . $cat_array . " ORDER BY " . $db->escape($order_by);
     } elseif ($layout == 'featuredproduct') {
         $query = " SELECT * FROM " . $this->_table_prefix . "product AS p " . "WHERE p.published = 1 " . "AND p.product_special=1 " . $whereaclProduct . " ORDER BY " . $db->escape($order_by);
     } elseif ($layout == 'newproduct') {
         $catid = $item->query['categorytemplate'];
         $cat_main = $category_helper->getCategoryTree($catid);
         $cat_group_main = array();
         for ($j = 0; $j < count($cat_main); $j++) {
             $cat_group_main[$j] = $cat_main[$j]->category_id;
         }
         $cat_group_main[] = $catid;
         JArrayHelper::toInteger($cat_group_main);
         $extracond = "";
         if ($catid) {
             $extracond = " AND pcx.category_id in (" . implode(',', $cat_group_main) . ") AND pcx.product_id=p.product_id ";
         }
         $query = " SELECT distinct p.* " . " FROM " . $this->_table_prefix . "product p " . "LEFT JOIN " . $this->_table_prefix . "product_category_xref pcx ON pcx.product_id = p.product_id " . "WHERE p.published = 1  " . "and  p.publish_date BETWEEN " . $db->quote($days_before) . " AND " . $db->quote($today) . " AND p.expired = 0  AND p.product_parent_id = 0 " . $whereaclProduct . $extracond . " ORDER BY " . $db->escape($order_by);
     } elseif ($layout == 'redfilter') {
         // Get products for filtering
         $products = $this->getRedFilterProduct();
         $query = " SELECT * " . " FROM " . $this->_table_prefix . "product as p " . "WHERE p.published = 1 AND p.expired = 0 " . $whereaclProduct;
         if ($products != "") {
             // Sanitize ids
             $productIds = explode(',', $products);
             JArrayHelper::toInteger($productIds);
             $query .= "AND p.product_id IN ( " . implode(',', $productIds) . " )  ";
         }
         $query .= " ORDER BY " . $db->escape($order_by);
     } else {
         if ($manufacture_id == 0) {
             if (!empty($manudata['manufacturer_id'])) {
                 $manufacture_id = $manudata['manufacturer_id'];
             }
         }
         $query = "SELECT distinct p.* " . " FROM  " . $this->_table_prefix . "product as p  ";
         if ($category_id != 0) {
             $query .= " LEFT JOIN  " . $this->_table_prefix . "product_category_xref as pcx on p.product_id = pcx.product_id ";
         }
         if ($defaultSearchType_tmp == "name_number_desc" || $defaultSearchType_tmp == "virtual_product_num") {
             $query .= "LEFT JOIN " . $this->_table_prefix . "product_attribute AS a ON a.product_id = p.product_id " . "LEFT JOIN " . $this->_table_prefix . "product_attribute_property AS pa ON pa.attribute_id = a.attribute_id " . "LEFT JOIN " . $this->_table_prefix . "product_subattribute_color AS ps ON ps.subattribute_id = pa.property_id ";
         }
         $query .= " WHERE 1=1 AND p.expired = 0  " . $whereaclProduct;
         if ($category_id != 0) {
             // Sanitize ids
             $catIds = explode(',', $cat_group);
             JArrayHelper::toInteger($catIds);
             $query .= " AND pcx.category_id in (" . $cat_group . ")";
         }
         if ($manufacture_id != 0) {
             $query .= " AND p.manufacturer_id =" . (int) $manufacture_id;
         }
         $query .= " AND " . $defaultSearchType . " AND p.published = 1" . " ORDER BY " . $db->escape($order_by);
     }
     return $query;
 }
Beispiel #25
0
<?php

/**
 * @package     RedSHOP.Backend
 * @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('Restricted access');
$producthelper = new producthelper();
$redhelper = new redhelper();
$userhelper = new rsUserhelper();
$option = JRequest::getVar('option');
$filter = JRequest::getVar('filter');
$model = $this->getModel('user');
?>
<script language="javascript" type="text/javascript">
	Joomla.submitbutton = function (pressbutton) {
		submitbutton(pressbutton);
	}
	submitbutton = function (pressbutton) {
		var form = document.adminForm;
		if (pressbutton) {
			form.task.value = pressbutton;
		}
		if (pressbutton == 'add') {
			<?php 
$link = 'index.php?option=' . $option . '&view=user_detail';
$link = $redhelper->sslLink($link);
?>
Beispiel #26
0
 public function getCategoryProduct($minmax = 0, $isSlider = false)
 {
     $app = JFactory::getApplication();
     $menu = $app->getMenu();
     $item = $menu->getActive();
     $manufacturer_id = isset($item) ? intval($item->params->get('manufacturer_id')) : 0;
     $setproductfinderobj = new redhelper();
     $order_by = $this->_buildProductOrderBy();
     $manufacturer_id = JRequest::getInt('manufacturer_id', $manufacturer_id, '', 'int');
     $sort = "";
     $and = "";
     // Shopper group - choose from manufactures Start
     $rsUserhelper = new rsUserhelper();
     $shopper_group_manufactures = $rsUserhelper->getShopperGroupManufacturers();
     if ($shopper_group_manufactures != "") {
         $shopper_group_manufactures = explode(',', $shopper_group_manufactures);
         JArrayHelper::toInteger($shopper_group_manufactures);
         $shopper_group_manufactures = implode(',', $shopper_group_manufactures);
         $and .= " AND p.manufacturer_id IN (" . $shopper_group_manufactures . ") ";
     }
     // Shopper group - choose from manufactures End
     if ($manufacturer_id && $manufacturer_id > 0) {
         $and .= " AND p.manufacturer_id = " . (int) $manufacturer_id . " ";
     }
     if ($minmax && !(strstr($order_by, "p.product_price ASC") || strstr($order_by, "p.product_price DESC"))) {
         $order_by = " ORDER BY p.product_price ASC";
     }
     $finder_condition = $this->getredproductfindertags();
     $query = "SELECT * FROM " . $this->_table_prefix . "product AS p " . "LEFT JOIN " . $this->_table_prefix . "product_category_xref AS pc ON pc.product_id=p.product_id " . "LEFT JOIN " . $this->_table_prefix . "category AS c ON c.category_id=pc.category_id " . "LEFT JOIN " . $this->_table_prefix . "manufacturer AS m ON m.manufacturer_id=p.manufacturer_id " . "WHERE p.published = 1 AND p.expired = 0 " . "AND pc.category_id = " . (int) $this->_id . " " . "AND p.product_parent_id = 0 " . $and . $finder_condition . $order_by;
     $this->_product = $this->_getList($query);
     $priceSort = false;
     if (strstr($order_by, "p.product_price ASC")) {
         $priceSort = true;
         for ($i = 0; $i < count($this->_product); $i++) {
             $ProductPriceArr = $this->producthelper->getProductNetPrice($this->_product[$i]->product_id);
             $this->_product[$i]->productPrice = $ProductPriceArr['product_price'];
         }
         $this->_product = $this->columnSort($this->_product, 'productPrice', 'ASC');
     } elseif (strstr($order_by, "p.product_price DESC")) {
         $priceSort = true;
         $sort = "DESC";
         for ($i = 0; $i < count($this->_product); $i++) {
             $ProductPriceArr = $this->producthelper->getProductNetPrice($this->_product[$i]->product_id);
             $this->_product[$i]->productPrice = $ProductPriceArr['product_price'];
         }
         $this->_product = $this->columnSort($this->_product, 'productPrice', 'DESC');
     }
     if ($minmax > 0) {
         $min = 0;
         if (!empty($priceSort)) {
             if ($sort == "DESC") {
                 $max = $this->_product[0]->productPrice + 100;
                 $min = $this->_product[count($this->_product) - 1]->productPrice;
             } else {
                 $min = $this->_product[0]->productPrice;
                 $max = $this->_product[count($this->_product) - 1]->productPrice + 100;
             }
         } else {
             $ProductPriceArr = $this->producthelper->getProductNetPrice($this->_product[0]->product_id);
             $min = $ProductPriceArr['product_price'];
             $ProductPriceArr = $this->producthelper->getProductNetPrice($this->_product[count($this->_product) - 1]->product_id);
             $max = $ProductPriceArr['product_price'];
             if ($min >= $max) {
                 $min = $this->_product[0]->product_price;
                 $max = $max + 100;
             }
         }
         $this->_product[0]->minprice = floor($min);
         $this->_product[0]->maxprice = ceil($max);
         $this->setMaxMinProductPrice(array(floor($min), ceil($max)));
     } elseif ($isSlider) {
         $newProduct = array();
         for ($i = 0; $i < count($this->_product); $i++) {
             $ProductPriceArr = $this->producthelper->getProductNetPrice($this->_product[$i]->product_id);
             $this->_product[$i]->sliderprice = $ProductPriceArr['product_price'];
             if ($this->_product[$i]->sliderprice >= $this->minmaxArr[0] && $this->_product[$i]->sliderprice <= $this->minmaxArr[1]) {
                 $newProduct[] = $this->_product[$i];
             }
         }
         $this->_product = $newProduct;
         $this->_total = count($this->_product);
     } else {
         $this->_total = count($this->_product);
     }
     return $this->_product;
 }
Beispiel #27
0
 public function _buildProductQuery($template_data = '')
 {
     $filter_by = JRequest::getVar('filter_by', 0);
     $and = '';
     // Shopper group - choose from manufactures Start
     $rsUserhelper = new rsUserhelper();
     $shopper_group_manufactures = $rsUserhelper->getShopperGroupManufacturers();
     if ($shopper_group_manufactures != "") {
         $shopper_group_manufactures = explode(',', $shopper_group_manufactures);
         JArrayHelper::toInteger($shopper_group_manufactures);
         $shopper_group_manufactures = implode(',', $shopper_group_manufactures);
         $and .= " AND p.manufacturer_id IN (" . $shopper_group_manufactures . ") ";
     }
     // Shopper group - choose from manufactures End
     if ($filter_by != '0') {
         $and .= " AND c.category_id = " . (int) $filter_by;
     }
     $orderby = $this->_buildProductOrderBy($template_data);
     $query = "SELECT DISTINCT(p.product_id),p.*, c.category_name, c.category_id FROM " . $this->_table_prefix . "product AS p " . "LEFT JOIN " . $this->_table_prefix . "product_category_xref AS pc ON p.product_id=pc.product_id " . "LEFT JOIN " . $this->_table_prefix . "category AS c ON pc.category_id=c.category_id " . "WHERE p.published = 1 " . "AND p.manufacturer_id = " . (int) $this->_id . " " . "AND p.expired = 0 " . "AND p.product_parent_id = 0 " . $and . " GROUP BY p.product_id " . $orderby;
     return $query;
 }
Beispiel #28
0
 public function getCartItemid()
 {
     $userhelper = new rsUserhelper();
     $Itemid = DEFAULT_CART_CHECKOUT_ITEMID;
     $shopper_group_data = $userhelper->getShoppergroupData();
     if (count($shopper_group_data) > 0 && $shopper_group_data->shopper_group_cart_itemid != 0) {
         $Itemid = $shopper_group_data->shopper_group_cart_itemid;
     }
     return $Itemid;
 }
Beispiel #29
0
 public function getProductCategory($id = 0)
 {
     $rsUserhelper = new rsUserhelper();
     $shopper_group_manufactures = $rsUserhelper->getShopperGroupManufacturers();
     if ($shopper_group_manufactures != "") {
         // Sanitize groups
         $shopGroupsIds = explode(',', $shopper_group_manufactures);
         JArrayHelper::toInteger($shopGroupsIds);
         $and .= " AND p.manufacturer_id IN (" . implode(',', $shopGroupsIds) . ") ";
     }
     $query = "SELECT p.product_id FROM " . $this->_table_prefix . "product_category_xref pc" . " LEFT JOIN " . $this->_table_prefix . "product AS p ON pc.product_id=p.product_id " . " WHERE category_id = " . (int) $id . " " . $and;
     $this->_db->setQuery($query);
     $res = $this->_db->loadObjectlist();
     return $res;
 }
Beispiel #30
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;
$Itemid = JRequest::getInt('Itemid');
$userhelper = new rsUserhelper();
$post = (array) $this->shippingaddresses;
$post['firstname_ST'] = $post['firstname'];
$post['lastname_ST'] = $post['lastname'];
$post['address_ST'] = $post['address'];
$post['city_ST'] = $post['city'];
$post['zipcode_ST'] = $post['zipcode'];
$post['phone_ST'] = $post['phone'];
$post['country_code_ST'] = $post['country_code'];
$post['state_code_ST'] = $post['state_code'];
?>
<script type="text/javascript">
	function cancelForm(frm) {
		frm.task.value = 'cancel';
		frm.submit();
	}
	function validateInfo() {
		var frm = document.adminForm;

		if (frm.firstname.value == '') {