Example #1
0
 public function display($tpl = null)
 {
     $option = JRequest::getVar('option');
     $extra_field = new extra_field();
     $order_functions = new order_functions();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSHOP_QUOTATION_MANAGEMENT'));
     $document->addScript('components/' . $option . '/assets/js/json.js');
     $document->addScript('components/' . $option . '/assets/js/validation.js');
     $document->addScript('components/' . $option . '/assets/js/order.js');
     $document->addScript('components/' . $option . '/assets/js/common.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');
     $session = JFactory::getSession();
     $uri = JFactory::getURI();
     $lists = array();
     $model = $this->getModel();
     $detail = $this->get('Data');
     $Redconfiguration = new Redconfiguration();
     $user_id = JRequest::getVar('user_id', 0);
     if ($user_id != 0) {
         $billing = $order_functions->getBillingAddress($user_id);
     } else {
         $billing = $model->setBilling();
     }
     if (!is_object($detail)) {
         $detail = new stdClass();
     }
     $detail->user_id = $user_id;
     $session->set('offlineuser_id', $user_id);
     $userop = array();
     $userop[0] = new stdClass();
     $userop[0]->user_id = 0;
     $userop[0]->text = JText::_('COM_REDSHOP_SELECT');
     $userlists = $model->getUserData(0, "BT");
     $userlist = array_merge($userop, $userlists);
     $lists['userlist'] = JHTML::_('select.genericlist', $userlist, 'user_id', 'class="inputbox" onchange="showquotationUserDetail();" ', 'user_id', 'text');
     JToolBarHelper::title(JText::_('COM_REDSHOP_QUOTATION_MANAGEMENT') . ': <small><small>[ ' . JText::_('COM_REDSHOP_NEW') . ' ]</small></small>', 'redshop_order48');
     JToolBarHelper::save();
     JToolBarHelper::custom('send', 'send.png', 'send.png', JText::_('COM_REDSHOP_SEND'), false);
     JToolBarHelper::cancel();
     // PRODUCT/ATTRIBUTE STOCK ROOM QUANTITY CHECKING IS IMPLEMENTED
     $countryarray = $Redconfiguration->getCountryList((array) $billing);
     $billing->country_code = $countryarray['country_code'];
     $lists['country_code'] = $countryarray['country_dropdown'];
     $statearray = $Redconfiguration->getStateList((array) $billing);
     $lists['state_code'] = $statearray['state_dropdown'];
     $lists['quotation_extrafield'] = $extra_field->list_all_field(16, $billing->users_info_id);
     $this->lists = $lists;
     $this->detail = $detail;
     $this->billing = $billing;
     $this->userlist = $userlists;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
Example #2
0
 public function display($tpl = null)
 {
     $extra_field = new extra_field();
     $option = JRequest::getVar('option', '', 'request', 'string');
     JToolBarHelper::title(JText::_('COM_REDSHOP_FIELDS_MANAGEMENT_DETAIL'), 'redshop_fields48');
     $document = JFactory::getDocument();
     $document->addScript('components/' . $option . '/assets/js/fields.js');
     $uri = JFactory::getURI();
     $this->setLayout('default');
     $lists = array();
     $detail = $this->get('data');
     $filed_data = $extra_field->getFieldValue($detail->field_id);
     $isNew = $detail->field_id < 1;
     $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT');
     JToolBarHelper::title(JText::_('COM_REDSHOP_FIELDS') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_fields48');
     JToolBarHelper::apply();
     JToolBarHelper::save();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE'));
     }
     $redtemplate = new Redtemplate();
     $optiontype = $redtemplate->getFieldTypeSections();
     $optionsection = $redtemplate->getFieldSections();
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->published);
     $lists['show_in_front'] = JHTML::_('select.booleanlist', 'field_show_in_front', 'class="inputbox"', $detail->field_show_in_front);
     $lists['display_in_product'] = JHTML::_('select.booleanlist', 'display_in_product', 'class="inputbox"', $detail->display_in_product);
     $lists['display_in_checkout'] = JHTML::_('select.booleanlist', 'display_in_checkout', 'class="inputbox"', $detail->display_in_checkout);
     $lists['required'] = JHTML::_('select.booleanlist', 'required', 'class="inputbox"', $detail->required);
     $lists['type'] = JHTML::_('select.genericlist', $optiontype, 'field_type', 'class="inputbox" size="1" onchange="field_select(this.value)" ', 'value', 'text', $detail->field_type);
     $disable = "";
     if ($detail->field_type == 15) {
         $disable = "disabled='disabled' ";
     }
     $lists['section'] = JHTML::_('select.genericlist', $optionsection, 'field_section', 'class="inputbox" size="1" ' . $disable . ' onchange="sectionValidation(this.value)"', 'value', 'text', $detail->field_section);
     $lists['extra_data'] = $filed_data;
     $this->lists = $lists;
     $this->detail = $detail;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
Example #3
0
 public function display($tpl = null)
 {
     require_once JPATH_COMPONENT . '/helpers/extra_field.php';
     JToolBarHelper::title(JText::_('COM_REDSHOP_MANUFACTURER_MANAGEMENT_DETAIL'), 'redshop_manufact48');
     $uri = JFactory::getURI();
     $document = JFactory::getDocument();
     $option = JRequest::getVar('option');
     $document->addScript('components/' . $option . '/assets/js/validation.js');
     $this->setLayout('default');
     $lists = array();
     $detail = $this->get('data');
     $model = $this->getModel('manufacturer_detail');
     $template_data = $model->TemplateData();
     $isNew = $detail->manufacturer_id < 1;
     $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT');
     JToolBarHelper::title(JText::_('COM_REDSHOP_MANUFACTURER') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_manufact48');
     JToolBarHelper::apply();
     JToolBarHelper::save();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE'));
     }
     $optiontemplet = array();
     $optiontemplet[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_Select'));
     $result = array_merge($optiontemplet, $template_data);
     $lists['template'] = JHTML::_('select.genericlist', $result, 'template_id', 'class="inputbox" size="1" ', 'value', 'text', $detail->template_id);
     $detail->excluding_category_list = explode(',', $detail->excluding_category_list);
     $product_category = new product_category();
     $lists['excluding_category_list'] = $product_category->list_all("excluding_category_list[]", 0, $detail->excluding_category_list, 10, false, true);
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->published);
     $field = new extra_field();
     $list_field = $field->list_all_field(10, $detail->manufacturer_id);
     $lists['extra_field'] = $list_field;
     $this->lists = $lists;
     $this->detail = $detail;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
 public function save($apply = 0)
 {
     $post = JRequest::get('post', JREQUEST_ALLOWRAW);
     $manufacturer_desc = JRequest::getVar('manufacturer_desc', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $post["manufacturer_desc"] = $manufacturer_desc;
     $option = JRequest::getVar('option');
     $cid = JRequest::getVar('cid', array(0), 'post', 'array');
     $post['manufacturer_id'] = $cid[0];
     $model = $this->getModel('manufacturer_detail');
     if ($row = $model->store($post)) {
         $field = new extra_field();
         $field->extra_field_save($post, "10", $row->manufacturer_id);
         $msg = JText::_('COM_REDSHOP_MANUFACTURER_DETAIL_SAVED');
     } else {
         $msg = JText::_('COM_REDSHOP_ERROR_SAVING_MANUFACTURER_DETAIL');
     }
     if ($apply == 1) {
         $this->setRedirect('index.php?option=' . $option . '&view=manufacturer_detail&task=edit&cid[]=' . $row->manufacturer_id, $msg);
     } else {
         $this->setRedirect('index.php?option=' . $option . '&view=manufacturer', $msg);
     }
 }
Example #5
0
 /**
  * Method to send catalog sample
  *
  * @return void
  */
 public function catalogsample_send()
 {
     $post = JRequest::get('post');
     $Itemid = JRequest::getVar('Itemid');
     $option = JRequest::getVar('option', '', 'request', 'string');
     $model = $this->getModel('catalog');
     if (isset($post["sample_code"])) {
         $colour_id = implode(",", $post["sample_code"]);
         $post['colour_id'] = $colour_id;
     }
     $post["registerdate"] = time();
     $post["email"] = $post["email_address"];
     $post["name"] = $post["name_2"];
     if ($row = $model->catalogSampleStore($post)) {
         $extra_field = new extra_field();
         $extra_field->extra_field_save($post, 9, $row->request_id);
         $msg = JText::_('COM_REDSHOP_SAMPLE_SEND_SUCCSEEFULLY');
     } else {
         $msg = JText::_('COM_REDSHOP_ERROR_SAMPLE_SEND_SUCCSEEFULLY');
     }
     $this->setRedirect('index.php?option=' . $option . '&view=catalog&layout=sample&Itemid=' . $Itemid, $msg);
 }
 public function save($apply = 0)
 {
     $post = JRequest::get('post');
     // Include extra field class
     require_once JPATH_COMPONENT . '/helpers/extra_field.php';
     $option = JRequest::getVar('option');
     $post['shipping_rate_on_product'] = $post['container_product'];
     $post["shipping_location_info"] = JRequest::getVar('shipping_location_info', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $model = $this->getModel('shipping_rate_detail');
     if ($row = $model->store($post)) {
         $field = new extra_field();
         // Field_section 11 :Shipping
         $field->extra_field_save($post, "11", $row->shipping_rate_id);
         $msg = JText::_('COM_REDSHOP_SHIPPING_LOCATION_SAVED');
     } else {
         $msg = JText::_('COM_REDSHOP_ERROR_SAVING_SHIPPING');
     }
     if ($apply) {
         $this->setRedirect('index.php?option=' . $option . '&view=shipping_rate_detail&cid=' . $row->shipping_rate_id . '&id=' . $post['id'], $msg);
     } else {
         $this->setRedirect('index.php?option=' . $option . '&view=shipping_rate&id=' . $post['id'], $msg);
     }
 }
Example #7
0
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
$redTemplate = new Redtemplate();
$carthelper = new rsCarthelper();
$Itemid = JRequest::getInt('Itemid');
$return = JRequest::getString('return');
$session = JFactory::getSession();
$cart = $session->get('cart');
$detail = $this->detail;
$user = JFactory::getUser();
$extra_field = new extra_field();
$quotation_template = $redTemplate->getTemplate("quotation_request");
if (count($quotation_template) > 0 && $quotation_template[0]->template_desc != "") {
    $template_desc = $quotation_template[0]->template_desc;
} else {
    $template_desc = "<fieldset class=\"adminform\"><legend>{order_detail_lbl}</legend> \r\n<table class=\"admintable\">\r\n<tbody>\r\n<tr>\r\n<td>{product_name_lbl}</td>\r\n<td>{quantity_lbl}</td>\r\n</tr>\r\n{product_loop_start}\r\n<tr>\r\n<td>{product_name}<br />{product_attribute}<br />{product_accessory}<br />{product_userfields}</td>\r\n<td>{update_cart}</td>\r\n</tr>\r\n{product_loop_end}\r\n</tbody>\r\n</table>\r\n</fieldset>\r\n<p>{customer_note_lbl}:{customer_note}</p>\r\n<fieldset class=\"adminform\"><legend>{billing_address_information_lbl}</legend> {billing_address}{quotation_custom_field_list} </fieldset> \r\n<table border=\"0\">\r\n<tbody>\r\n<tr>\r\n<td align=\"center\">{cancel_btn}{request_quotation_btn}</td>\r\n</tr>\r\n</tbody>\r\n</table>";
}
?>
<script type="text/javascript">
	function validateInfo() {
		var frm = document.adminForm;

		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

		if (frm.user_email.value == '') {
			alert("<?php 
Example #8
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);
 }
Example #9
0
<?php

/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
JHTMLBehavior::modal();
$url = JURI::base();
$extraField = new extraField();
$extra_field = new extra_field();
$producthelper = new producthelper();
$redTemplate = new Redtemplate();
$redhelper = new redhelper();
$Itemid = JRequest::getInt('Itemid');
$model = $this->getModel('manufacturers');
// Page Title Start
$pagetitle = JText::_('COM_REDSHOP_MANUFACTURER_DETAIL');
if ($this->pageheadingtag != '') {
    $pagetitle = $this->pageheadingtag;
}
if ($this->params->get('show_page_heading', 1)) {
    ?>
	<h1 class="componentheading<?php 
    echo $this->escape($this->params->get('pageclass_sfx'));
    ?>
">
Example #10
0
<?php

/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
$redTemplate = new Redtemplate();
$extra_field = new extra_field();
$Itemid = JRequest::getInt('Itemid');
$layout = JRequest::getCmd('layout', 'default');
$model = $this->getModel('catalog');
$template = $redTemplate->getTemplate("product_sample");
if (count($template) > 0 && $template[0]->template_desc != "") {
    $template_desc = $template[0]->template_desc;
} else {
    $template_desc = '<div id="katalog_wrapper"><div id="bestil_katalog_wrapper"><div id="katalog_hojre_wrapper"></div></div><div id="bestil_farveproeve_wrapper"><div id="farveproeve_overskrift"><h2>Bestil Farveprver</h2></div><div id="farveproeve_venstre"><div id="farveproever_tekst">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris eget nisi orci, vel vehicula massa. Phasellus ipsum est, egestas a consequat eget, placerat vitae ipsum. Proin ac purus risus. Quisque nec nisi lacus, vitae iaculis eros. Donec ipsum diam, dictum ac euismod molestie, ultrices eget arcu. Vestibulum lacinia nisl et odio sagittis fermentum. Aliquam tristique volutpat faucibus. Sed id orci ut metus condimentum bibendum. Ut gravida scelerisque magna et pharetra. Ut vel turpis in orci molestie scelerisque. Proin nisl elit, ullamcorper id blandit nec, congue eget augue. Nullam gravida ligula nisi.</div><div id="farveproever"><p style="text-align: left;">{product_samples}</p></div></div><div id="farveproeve_hojre_wrapper"><div id="farveproeve_addressefelt"><p style="text-align: left;">{address_fields}</p></div><div id="farveproeve_sendknap"><p style="text-align: left;">{submit_button_sample}</p></div></div></div></div>';
}
if ($this->params->get('show_page_heading', 1)) {
    if ($this->params->get('page_title')) {
        ?>
	<h1 class="componentheading<?php 
        echo $this->escape($this->params->get('pageclass_sfx'));
        ?>
">
		<?php 
        echo $this->escape($this->params->get('page_title'));
    public function changeshippingaddress($shippingadd_id, $user_id, $is_company)
    {
        $extra_field = new extra_field();
        $Redconfiguration = new Redconfiguration();
        $query = 'SELECT * FROM ' . $this->_table_prefix . 'users_info ' . 'WHERE address_type like "ST" ' . 'AND user_id = ' . (int) $user_id . ' ' . 'AND users_info_id = ' . (int) $shippingadd_id;
        $this->_db->setQuery($query);
        $list = $this->_db->loadObject();
        if (count($list) > 0) {
            $shipping = $list;
        } else {
            $shipping = $this->setShipping();
        }
        $allowCustomer = '';
        $allowCompany = '';
        if ($is_company) {
            $allowCustomer = 'style="display:none;"';
        } else {
            $allowCompany = 'style="display:none;"';
        }
        // Field_section 7 :Customer Address
        $lists['shipping_customer_field'] = $extra_field->list_all_field(14, $shipping->users_info_id);
        // Field_section 8 :Company Address
        $lists['shipping_company_field'] = $extra_field->list_all_field(15, $shipping->users_info_id);
        $countryarray = $Redconfiguration->getCountryList((array) $shipping, "country_code_ST", "ST");
        $shipping->country_code_ST = $shipping->country_code = $countryarray['country_code_ST'];
        $lists['country_code_ST'] = $countryarray['country_dropdown'];
        $statearray = $Redconfiguration->getStateList((array) $shipping, "state_code_ST", "country_code_ST", "ST", 1);
        $lists['state_code_ST'] = $statearray['state_dropdown'];
        $htmlshipping = '<table class="adminlist" border="0" width="100%">';
        $htmlshipping .= '<tr><td width="100" align="right">' . JText::_('FIRSTNAME') . ':</td>';
        $htmlshipping .= '<td><input class="inputbox" type="text" name="firstname_ST" maxlength="250" value="' . $shipping->firstname . '" /></td></tr>';
        $htmlshipping .= '<tr><td width="100" align="right">' . JText::_('LASTNAME') . ':</td>';
        $htmlshipping .= '<td><input class="inputbox" type="text" name="lastname_ST" maxlength="250" value="' . $shipping->lastname . '" /></td></tr>';
        $htmlshipping .= '<tr><td width="100" align="right">' . JText::_('ADDRESS') . ':</td>';
        $htmlshipping .= '<td><input class="inputbox" type="text" name="address_ST" maxlength="250" value="' . $shipping->address . '" /></td></tr>';
        $htmlshipping .= '<tr><td width="100" align="right">' . JText::_('ZIP') . ':</td>';
        $htmlshipping .= '<td><input class="inputbox" type="text" name="zipcode_ST" maxlength="250" value="' . $shipping->zipcode . '" /></td></tr>';
        $htmlshipping .= '<tr><td width="100" align="right">' . JText::_('CITY') . ':</td>';
        $htmlshipping .= '<td><input class="inputbox" type="text" name="city_ST" maxlength="250" value="' . $shipping->city . '" /></td></tr>';
        $htmlshipping .= '<tr><td width="100" align="right">' . JText::_('COUNTRY') . ':</td>';
        $htmlshipping .= '<td>' . $lists['country_code_ST'] . '</td></tr>';
        $htmlshipping .= '<tr><td width="100" align="right">' . JText::_('STATE') . ':</td>';
        $htmlshipping .= '<td>' . $lists['state_code_ST'] . '</td></tr>';
        $htmlshipping .= '<tr><td width="100" align="right">' . JText::_('PHONE') . ':</td>';
        $htmlshipping .= '<td><input class="inputbox" type="text" name="phone_ST" maxlength="250" value="' . $shipping->phone . '" /></td></tr>';
        $htmlshipping .= '<tr><td colspan="2"><div id="exCustomerFieldST" ' . $allowCustomer . '>' . $lists['shipping_customer_field'] . '</div>
							<div id="exCompanyFieldST" ' . $allowCompany . '>' . $lists['shipping_company_field'] . '</div></td></tr>';
        $htmlshipping .= '</table>';
        return $htmlshipping;
    }
 public function store($data)
 {
     $row =& $this->getTable();
     if (!$row->bind($data)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // Storing image name in the database
     $option = JRequest::getVar('option');
     $filename = "";
     // Get File name, tmp_name
     $file = JRequest::getVar('category_full_image', array(), 'files', 'array');
     if (count($file) > 0) {
         // Make the filename unique
         $filename = JPath::clean(time() . '_' . $file['name']);
         $filename = str_replace(" ", "_", $filename);
     }
     if (isset($data['image_delete'])) {
         unlink(REDSHOP_FRONT_IMAGES_RELPATH . 'category/thumb/' . $data['old_image']);
         unlink(REDSHOP_FRONT_IMAGES_RELPATH . 'category/' . $data['old_image']);
         $query = "UPDATE " . $this->_table_prefix . "category set category_thumb_image = '',category_full_image = ''  where category_id =" . $row->category_id;
         $this->_db->setQuery($query);
         $this->_db->query();
     }
     if (count($_FILES) > 0 && $_FILES['category_full_image']['name'] != "") {
         $newwidth = THUMB_WIDTH;
         $newheight = THUMB_HEIGHT;
         $row->category_full_image = $filename;
         $row->category_thumb_image = $filename;
         // Get extension of the file
         $filetype = JFile::getExt($file['name']);
         $src = $file['tmp_name'];
         // Specific path of the file
         $dest = REDSHOP_FRONT_IMAGES_RELPATH . 'category/' . $filename;
         JFile::upload($src, $dest);
     } else {
         if (isset($data['category_image']) && $data['category_image'] != null) {
             $image_split = explode('/', $data['category_image']);
             // Make the filename unique
             $filename = JPath::clean(time() . '_' . $image_split[count($image_split) - 1]);
             $row->category_full_image = $filename;
             $row->category_thumb_image = $filename;
             // Image Upload
             $newwidth = THUMB_WIDTH;
             $newheight = THUMB_HEIGHT;
             $src = JPATH_ROOT . '/' . $data['category_image'];
             $dest = REDSHOP_FRONT_IMAGES_RELPATH . 'category/' . $filename;
             copy($src, $dest);
         }
     }
     // Get File name, tmp_name
     $backfile = JRequest::getVar('category_back_full_image', '', 'files', 'array');
     if (isset($data['image_back_delete'])) {
         unlink(REDSHOP_FRONT_IMAGES_RELPATH . 'category/thumb/' . $data['old_back_image']);
         unlink(REDSHOP_FRONT_IMAGES_RELPATH . 'category/' . $data['old_back_image']);
         $query = "UPDATE " . $this->_table_prefix . "category set category_back_full_image = ''  where category_id =" . $row->category_id;
         $this->_db->setQuery($query);
         $this->_db->query();
     }
     if (count($backfile) > 0 && $backfile['name'] != "") {
         // Make the filename unique
         $filename = JPath::clean(time() . '_' . $backfile['name']);
         $row->category_back_full_image = $filename;
         // Get extension of the file
         $filetype = JFile::getExt($backfile['name']);
         $src = $backfile['tmp_name'];
         // Specific path of the file
         $dest = REDSHOP_FRONT_IMAGES_RELPATH . 'category/' . $filename;
         JFile::upload($src, $dest);
     }
     // Upload back image end
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if (!$data['category_id']) {
         $newcatid = $this->_db->insertid();
         if (isset($_POST['category_parent_id'])) {
             $parentcat = $_POST['category_parent_id'];
         } else {
             $parentcat = $data['category_parent_id'];
         }
         $query = 'INSERT INTO ' . $this->_table_prefix . 'category_xref(category_parent_id,category_child_id) VALUES ("' . $parentcat . '","' . $newcatid . '");';
         $this->_db->setQuery($query);
         $this->_db->query();
     } else {
         $newcatid = $data['category_id'];
         if (isset($_POST['category_parent_id'])) {
             $parentcat = $_POST['category_parent_id'];
         } else {
             $parentcat = $data['category_parent_id'];
         }
         $query = 'UPDATE ' . $this->_table_prefix . 'category_xref SET category_parent_id= "' . $parentcat . '"  WHERE category_child_id = "' . $newcatid . '" ';
         $this->_db->setQuery($query);
         $this->_db->query();
         // Sheking for the image at the updation time
         if ($_FILES['category_full_image']['name'] != "") {
             @unlink(REDSHOP_FRONT_IMAGES_RELPATH . 'category/thumb/' . $_POST['old_image']);
             @unlink(REDSHOP_FRONT_IMAGES_RELPATH . 'category/' . $_POST['old_image']);
         }
     }
     // Extra Field Data Saved
     $field = new extra_field();
     $field->extra_field_save($data, 2, $newcatid);
     // Start Accessory Product
     if (count($data['product_accessory']) > 0 && is_array($data['product_accessory'])) {
         $data['product_accessory'] = array_merge(array(), $data['product_accessory']);
         $product_category = new product_category();
         $product_list = $product_category->getCategoryProductList($newcatid);
         for ($p = 0; $p < count($product_list); $p++) {
             $product_id = $product_list[$p]->id;
             for ($a = 0; $a < count($data['product_accessory']); $a++) {
                 $acc = $data['product_accessory'][$a];
                 $accessory_id = $product_category->CheckAccessoryExists($product_id, $acc['child_product_id']);
                 if ($product_id != $acc['child_product_id']) {
                     $accdetail =& $this->getTable('accessory_detail');
                     $accdetail->accessory_id = $accessory_id;
                     $accdetail->category_id = $newcatid;
                     $accdetail->product_id = $product_id;
                     $accdetail->child_product_id = $acc['child_product_id'];
                     $accdetail->accessory_price = $acc['accessory_price'];
                     $accdetail->oprand = $acc['oprand'];
                     $accdetail->ordering = $acc['ordering'];
                     $accdetail->setdefault_selected = isset($acc['setdefault_selected']) && $acc['setdefault_selected'] == 1 ? 1 : 0;
                     if (!$accdetail->store()) {
                         $this->setError($this->_db->getErrorMsg());
                         return false;
                     }
                 }
             }
         }
     }
     // End Accessory Product insert
     return $row;
 }
Example #13
0
echo JText::_('COM_REDSHOP_PHONE');
?>
:
						</label>
					</td>
					<td>
						<input class="inputbox" type="text" name="phone" size="32" maxlength="250"
						       value="<?php 
echo @$shipping->phone;
?>
"/>
					</td>
				</tr>
				<tr>
					<?php 
$field = new extra_field();
if ($shipping->is_company == 1) {
    echo $extrafields = $field->list_all_field(15, $shipping->users_info_id);
} else {
    echo $extrafields = $field->list_all_field(14, $shipping->users_info_id);
}
?>
				</tr>
				<tr>
					<td></td>
					<td>
						<input type="submit" name="submit" value="<?php 
echo JText::_('COM_REDSHOP_SAVE');
?>
"
						       onclick="return validateInfo();">
Example #14
0
 public function removeimg()
 {
     ob_clean();
     $imname = JRequest::getString('imname', '');
     $spath = JRequest::getString('spath', '');
     $data_id = JRequest::getInt('data_id', 0);
     $extra_field = new extra_field();
     if ($data_id) {
         $extra_field->deleteExtraFieldData($data_id);
     }
     if (JPATH_ROOT . '/' . $spath . '/' . $imname) {
         unlink(JPATH_ROOT . '/' . $spath . '/' . $imname);
     }
     exit;
 }
Example #15
0
 public function field_save($id, $post)
 {
     $extra_field = new extra_field();
     $value_id = array();
     $extra_name = array();
     $extra_value = array();
     if (array_key_exists("value_id", $post)) {
         $extra_value = JRequest::getVar('extra_value', '', 'post', 'string', JREQUEST_ALLOWRAW);
         $value_id = $post["value_id"];
         if ($post["field_type"] == 11 || $post["field_type"] == 13) {
             $extra_name = JRequest::getVar('extra_name_file', '', 'files', 'array');
             $total = count($extra_name['name']);
         } else {
             $extra_name = JRequest::getVar('extra_name', '', 'post', 'string', JREQUEST_ALLOWRAW);
             $total = count($extra_name);
         }
     }
     $filed_data_id = $extra_field->getFieldValue($id);
     if (count($filed_data_id) > 0) {
         $fid = array();
         foreach ($filed_data_id as $f) {
             $fid[] = $f->value_id;
         }
         $del_fid = array_diff($fid, $value_id);
         if (count($del_fid) > 0) {
             $this->field_delete($del_fid, 'value_id');
         }
     }
     for ($j = 0; $j < $total; $j++) {
         $set = "";
         if ($post["field_type"] == 11 || $post["field_type"] == 13) {
             if ($extra_value[$j] != "" && $extra_name['name'][$j] != "") {
                 $filename = time() . "_" . $extra_name['name'][$j];
                 $src = $extra_name['tmp_name'][$j];
                 $dest = REDSHOP_FRONT_IMAGES_RELPATH . 'extrafield/' . $filename;
                 JFile::upload($src, $dest);
                 $set = " field_name='" . $filename . "', ";
             }
         } else {
             $filename = $extra_name[$j];
             $set = " field_name='" . $filename . "', ";
         }
         if ($value_id[$j] == "") {
             $query = "INSERT INTO " . $this->_table_prefix . "fields_value " . "(field_id,field_name,field_value) " . "VALUE ( '" . $id . "','" . $filename . "','" . $extra_value[$j] . "' ) ";
         } else {
             $query = "UPDATE " . $this->_table_prefix . "fields_value " . "SET " . $set . " field_value='" . $extra_value[$j] . "' " . "WHERE value_id='" . $value_id[$j] . "' ";
         }
         $this->_db->setQuery($query);
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
     }
 }
Example #16
0
 /**
  * Check validation
  *
  * @param   string  $users_info_id  not used
  *
  * @return bool
  */
 public function chkvalidation($users_info_id)
 {
     $model = $this->getModel('checkout');
     $billingaddresses = $model->billingaddresses();
     $shippingaddresses = $model->shipaddress($users_info_id);
     $extra_field = new extra_field();
     $extrafield_name = '';
     $return = 0;
     if (!$billingaddresses->is_company) {
         if ($billingaddresses->firstname == '') {
             $return = 1;
             $msg = JText::_('COM_REDSHOP_PLEASE_ENTER_FIRST_NAME');
             JError::raiseWarning('', $msg);
             return $return;
         } elseif ($billingaddresses->lastname == '') {
             $return = 1;
             $msg = JText::_('COM_REDSHOP_PLEASE_ENTER_LAST_NAME');
             JError::raiseWarning('', $msg);
             return $return;
         }
     } else {
         if ($billingaddresses->company_name == '') {
             $return = 1;
             $msg = JText::_('COM_REDSHOP_PLEASE_ENTER_COMPANY_NAME');
             JError::raiseWarning('', $msg);
             return $return;
         }
         if ($billingaddresses->firstname == '') {
             $return = 1;
             $msg = JText::_('COM_REDSHOP_PLEASE_ENTER_FIRST_NAME');
             JError::raiseWarning('', $msg);
             return $return;
         } elseif ($billingaddresses->lastname == '') {
             $return = 1;
             $msg = JText::_('COM_REDSHOP_PLEASE_ENTER_LAST_NAME');
             JError::raiseWarning('', $msg);
             return $return;
         } elseif (ECONOMIC_INTEGRATION == 1 && trim($billingaddresses->ean_number) != '') {
             $economic = new economic();
             $debtorHandle = $economic->createUserInEconomic($billingaddresses);
             if (JError::isError(JError::getError())) {
                 $return = 1;
                 $error = JError::getError();
                 $msg = $error->message;
                 JError::raiseWarning('', $msg);
                 return $return;
             }
         }
     }
     if (!trim($billingaddresses->address)) {
         $return = 1;
         $msg = JText::_('COM_REDSHOP_PLEASE_ENTER_ADDRESS');
         JError::raiseWarning('', $msg);
         return $return;
     } elseif (!$billingaddresses->country_code) {
         $return = 1;
         $msg = JText::_('COM_REDSHOP_PLEASE_SELECT_COUNTRY');
         JError::raiseWarning('', $msg);
         return $return;
     } elseif (!$billingaddresses->zipcode) {
         $return = 1;
         $msg = JText::_('COM_REDSHOP_PLEASE_ENTER_ZIPCODE');
         JError::raiseWarning('', $msg);
         return $return;
     } elseif (!$billingaddresses->phone) {
         $return = 1;
         $msg = JText::_('COM_REDSHOP_PLEASE_ENTER_PHONE');
         JError::raiseWarning('', $msg);
         return $return;
     }
     if ($billingaddresses->is_company == 1) {
         $extrafield_name = $extra_field->chk_extrafieldValidation(8, $billingaddresses->users_info_id);
         if (!empty($extrafield_name)) {
             $return = 1;
             $msg = $extrafield_name . JText::_('COM_REDSHOP_IS_REQUIRED');
             JError::raiseWarning('', $msg);
             return $return;
         }
     } else {
         $extrafield_name = $extra_field->chk_extrafieldValidation(7, $billingaddresses->users_info_id);
         if (!empty($extrafield_name)) {
             $return = 1;
             $msg = $extrafield_name . JText::_('COM_REDSHOP_IS_REQUIRED');
             JError::raiseWarning('', $msg);
             return $return;
         }
     }
     if (SHIPPING_METHOD_ENABLE && $users_info_id != $billingaddresses->users_info_id) {
         if ($billingaddresses->is_company == 1) {
             $extrafield_name = $extra_field->chk_extrafieldValidation(15, $users_info_id);
             if (!empty($extrafield_name)) {
                 $return = 2;
                 $msg = $extrafield_name . JText::_('COM_REDSHOP_IS_REQUIRED');
                 JError::raiseWarning('', $msg);
                 return $return;
             }
         } else {
             $extrafield_name = $extra_field->chk_extrafieldValidation(14, $users_info_id);
             if (!empty($extrafield_name)) {
                 $return = 2;
                 $msg = $extrafield_name . JText::_('COM_REDSHOP_IS_REQUIRED');
                 JError::raiseWarning('', $msg);
                 return $return;
             }
         }
     }
     return $return;
 }
    /**
     * Function copy.
     *
     * @param   array  $cid  Array of IDs.
     *
     * @return bool
     */
    public function copy($cid = array())
    {
        $row = null;
        if (count($cid)) {
            $cids = implode(',', $cid);
            $query = 'SELECT * FROM ' . $this->table_prefix . 'product WHERE product_id IN ( ' . $cids . ' )';
            $this->_db->setQuery($query);
            $this->copydata = $this->_db->loadObjectList();
        }
        foreach ($this->copydata as $pdata) {
            $query = 'SELECT category_id FROM ' . $this->table_prefix . 'product_category_xref
					  WHERE product_id IN ( ' . $pdata->product_id . ' )';
            $this->_db->setQuery($query);
            $categorydata = $this->_db->loadObjectList();
            $copycategory = array();
            for ($i = 0; $i < count($categorydata); $i++) {
                $copycategory[$i] = $categorydata[$i]->category_id;
            }
            $query = 'SELECT related_id FROM ' . $this->table_prefix . 'product_related WHERE product_id IN ( ' . $pdata->product_id . ' )';
            $this->_db->setQuery($query);
            $relatedproductdata = $this->_db->loadObjectList();
            $copyrelatedproduct = array();
            for ($i = 0; $i < count($relatedproductdata); $i++) {
                $copyrelatedproduct[$i] = $relatedproductdata[$i]->related_id;
            }
            $query = 'SELECT stockroom_id,quantity FROM ' . $this->table_prefix . 'product_stockroom_xref
					  WHERE product_id IN ( ' . $pdata->product_id . ' )';
            $this->_db->setQuery($query);
            $stockroomdata = $this->_db->loadObjectList();
            $copystockroom = array();
            $copyquantity = array();
            for ($i = 0; $i < count($stockroomdata); $i++) {
                $copystockroom[$i] = $stockroomdata[$i]->stockroom_id;
                $copyquantity[$i] = $stockroomdata[$i]->quantity;
            }
            $query = 'SELECT * FROM ' . $this->table_prefix . 'product_accessory WHERE product_id IN ( ' . $pdata->product_id . ' )';
            $this->_db->setQuery($query);
            $accessorydata = $this->_db->loadObjectList();
            $copyaccessory = array();
            // Accessory_product.
            for ($i = 0; $i < count($accessorydata); $i++) {
                $copyaccessory[$i] = (array) $accessorydata[$i];
            }
            $query = 'SELECT * FROM ' . $this->table_prefix . 'product_price WHERE product_id IN ( ' . $pdata->product_id . ' )';
            $this->_db->setQuery($query);
            $productpricedata = $this->_db->loadObjectList();
            $query = 'SELECT * FROM ' . $this->table_prefix . 'media WHERE media_section = "product" AND section_id IN ( ' . $pdata->product_id . ' )';
            $this->_db->setQuery($query);
            $mediadata = $this->_db->loadObjectList();
            $post['copy_product'] = 1;
            $post['product_id'] = 0;
            $post['product_parent_id'] = $pdata->product_parent_id;
            $post['manufacturer_id'] = $pdata->manufacturer_id;
            $post['supplier_id'] = $pdata->supplier_id;
            $post['product_on_sale'] = $pdata->product_on_sale;
            $post['product_special'] = $pdata->product_special;
            $post['product_download'] = $pdata->product_download;
            $post['product_template'] = $pdata->product_template;
            $post['product_name'] = JText::_('COM_REDSHOP_COPY_OF') . ' ' . $pdata->product_name;
            $post['product_price'] = $pdata->product_price;
            $post['discount_price'] = $pdata->discount_price;
            $post['discount_stratdate'] = $pdata->discount_stratdate;
            $post['discount_enddate'] = $pdata->discount_enddate;
            $post['product_length'] = $pdata->product_length;
            $post['product_height'] = $pdata->product_height;
            $post['product_width'] = $pdata->product_width;
            $post['product_diameter'] = $pdata->product_diameter;
            $post['discount_calc_method'] = $pdata->discount_calc_method;
            $post['use_discount_calc'] = $pdata->use_discount_calc;
            $post['use_range'] = $pdata->use_range;
            $post['product_number'] = trim(JText::_('COM_REDSHOP_COPY_OF') . ' ' . $pdata->product_number);
            $post['product_type'] = $pdata->product_type;
            $post['product_s_desc'] = $pdata->product_s_desc;
            $post['product_desc'] = $pdata->product_desc;
            $post['product_volume'] = $pdata->product_volume;
            $post['product_tax_id'] = $pdata->product_tax_id;
            $post['attribute_set_id'] = $pdata->attribute_set_id;
            $post['product_tax_group_id'] = $pdata->product_tax_group_id;
            $post['min_order_product_quantity'] = $pdata->min_order_product_quantity;
            $post['max_order_product_quantity'] = $pdata->max_order_product_quantity;
            $post['accountgroup_id'] = $pdata->accountgroup_id;
            $post['quantity_selectbox_value'] = $pdata->quantity_selectbox_value;
            $post['not_for_sale'] = $pdata->not_for_sale;
            $post['product_availability_date'] = $pdata->product_availability_date;
            $post['published'] = 0;
            $post['product_thumb_image'] = '';
            $post['product_full_image'] = '';
            $new_product_thumb_image = null;
            $new_product_full_image = null;
            $new_product_back_full_image = null;
            $new_product_back_thumb_image = null;
            $new_product_preview_image = null;
            $new_product_preview_back_image = null;
            if (!empty($pdata->product_thumb_image)) {
                $new_product_thumb_image = strstr($pdata->product_thumb_image, '_') ? strstr($pdata->product_thumb_image, '_') : $pdata->product_thumb_image;
                $post['product_thumb_image'] = JPath::clean(time() . $new_product_thumb_image);
            }
            if (!empty($pdata->product_full_image)) {
                $new_product_full_image = strstr($pdata->product_full_image, '_') ? strstr($pdata->product_full_image, '_') : $pdata->product_full_image;
                $post['product_full_image'] = JPath::clean(time() . $new_product_full_image);
            }
            if (!empty($pdata->product_back_full_image)) {
                $new_product_back_full_image = strstr($pdata->product_back_full_image, '_') ? strstr($pdata->product_back_full_image, '_') : $pdata->product_back_full_image;
                $post['product_back_full_image'] = JPath::clean(time() . $new_product_back_full_image);
            }
            if (!empty($pdata->product_back_thumb_image)) {
                $new_product_back_thumb_image = strstr($pdata->product_back_thumb_image, '_') ? strstr($pdata->product_back_thumb_image, '_') : $pdata->product_back_thumb_image;
                $post['product_back_thumb_image'] = JPath::clean(time() . $new_product_back_thumb_image);
            }
            if (!empty($pdata->product_preview_image)) {
                $new_product_preview_image = strstr($pdata->product_preview_image, '_') ? strstr($pdata->product_preview_image, '_') : $pdata->product_preview_image;
                $post['product_preview_image'] = JPath::clean(time() . $new_product_preview_image);
            }
            if (!empty($pdata->product_preview_back_image)) {
                $new_product_preview_back_image = strstr($pdata->product_preview_back_image, '_') ? strstr($pdata->product_preview_back_image, '_') : $pdata->product_preview_back_image;
                $post['product_preview_back_image'] = JPath::clean(time() . $new_product_preview_back_image);
            }
            $post['publish_date'] = date("Y-m-d H:i:s");
            $post['update_date'] = date("Y-m-d H:i:s");
            $post['visited'] = $pdata->visited;
            $post['metakey'] = $pdata->metakey;
            $post['metadesc'] = $pdata->metadesc;
            $post['metalanguage_setting'] = $pdata->metalanguage_setting;
            $post['metarobot_info'] = $pdata->metarobot_info;
            $post['pagetitle'] = $pdata->pagetitle;
            $post['pageheading'] = $pdata->pageheading;
            $post['cat_in_sefurl'] = $pdata->cat_in_sefurl;
            $post['weight'] = $pdata->weight;
            $post['expired'] = $pdata->expired;
            $post['product_category'] = $copycategory;
            $post['related_product'] = $copyrelatedproduct;
            $post['quantity'] = $copyquantity;
            $post['stockroom_id'] = $copystockroom;
            $post['product_accessory'] = $copyaccessory;
            if ($row = $this->store($post)) {
                // Image Copy Start
                $old = REDSHOP_FRONT_IMAGES_RELPATH . 'product/' . $pdata->product_full_image;
                $new = REDSHOP_FRONT_IMAGES_RELPATH . 'product/' . JPath::clean(time() . $new_product_full_image);
                copy($old, $new);
                $old_thumb = REDSHOP_FRONT_IMAGES_RELPATH . 'product/' . $pdata->product_thumb_image;
                $new_thumb = REDSHOP_FRONT_IMAGES_RELPATH . 'product/' . JPath::clean(time() . $new_product_thumb_image);
                copy($old_thumb, $new_thumb);
                $old_preview = REDSHOP_FRONT_IMAGES_RELPATH . 'product/' . $pdata->product_preview_image;
                $new_preview = REDSHOP_FRONT_IMAGES_RELPATH . 'product/' . JPath::clean(time() . $new_product_preview_image);
                copy($old_preview, $new_preview);
                $old_back_preview = REDSHOP_FRONT_IMAGES_RELPATH . 'product/' . $pdata->product_preview_back_image;
                $new_back_preview = REDSHOP_FRONT_IMAGES_RELPATH . 'product/' . JPath::clean(time() . $new_product_preview_back_image);
                copy($old_back_preview, $new_back_preview);
                $old_prod_back_full = REDSHOP_FRONT_IMAGES_RELPATH . 'product/' . $pdata->product_back_full_image;
                $new_prod_back_full = REDSHOP_FRONT_IMAGES_RELPATH . 'product/' . JPath::clean(time() . $new_product_back_full_image);
                copy($old_prod_back_full, $new_prod_back_full);
                $old_prod_back_thumb = REDSHOP_FRONT_IMAGES_RELPATH . 'product/' . $pdata->product_back_thumb_image;
                $new_back_back_thumb = REDSHOP_FRONT_IMAGES_RELPATH . 'product/' . JPath::clean(time() . $new_product_back_thumb_image);
                copy($old_prod_back_thumb, $new_back_back_thumb);
                $field = new extra_field();
                // Field_section 1 :Product.
                $field->copy_product_extra_field($pdata->product_id, $row->product_id);
                // End.
                $this->SaveStockroom($row->product_id, $post);
                $this->copyProductAttribute($pdata->product_id, $row->product_id);
                $this->copyDiscountCalcdata($pdata->product_id, $row->product_id, $pdata->discount_calc_method);
                for ($i = 0; $i < count($productpricedata); $i++) {
                    $rowprices_detail =& $this->getTable('prices_detail');
                    $data['price_id '] = 0;
                    $data['product_id'] = $row->product_id;
                    $data['product_price'] = $productpricedata[$i]->product_price;
                    $data['product_currency'] = $productpricedata[$i]->product_currency;
                    $data['shopper_group_id'] = $productpricedata[$i]->shopper_group_id;
                    $data['price_quantity_start'] = $productpricedata[$i]->price_quantity_start;
                    $data['price_quantity_end'] = $productpricedata[$i]->price_quantity_end;
                    if (!$rowprices_detail->bind($data)) {
                        $this->setError($this->_db->getErrorMsg());
                        return false;
                    }
                    if (!$rowprices_detail->store()) {
                        $this->setError($this->_db->getErrorMsg());
                        return false;
                    }
                }
                for ($j = 0; $j < count($mediadata); $j++) {
                    $old_img = $mediadata[$j]->media_name;
                    $new_img = strstr($old_img, '_') ? strstr($old_img, '_') : $old_img;
                    $old_media = REDSHOP_FRONT_IMAGES_RELPATH . 'product/' . $mediadata[$j]->media_name;
                    $new_media = REDSHOP_FRONT_IMAGES_RELPATH . 'product/' . JPath::clean(time() . $new_img);
                    copy($old_media, $new_media);
                    $rowmedia =& $this->getTable('media_detail');
                    $data['media_id '] = 0;
                    $data['media_name'] = JPath::clean(time() . $new_img);
                    $data['media_alternate_text'] = $mediadata[$j]->media_alternate_text;
                    $data['media_section'] = $mediadata[$j]->media_section;
                    $data['section_id'] = $row->product_id;
                    $data['media_type'] = $mediadata[$j]->media_type;
                    $data['media_mimetype'] = $mediadata[$j]->media_mimetype;
                    $data['published'] = $mediadata[$j]->published;
                    if (!$rowmedia->bind($data)) {
                        $this->setError($this->_db->getErrorMsg());
                        return false;
                    }
                    if (!$rowmedia->store()) {
                        $this->setError($this->_db->getErrorMsg());
                        return false;
                    }
                }
            }
        }
        return $row;
    }
Example #18
0
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
$url = JURI::base();
include_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/quotation.php';
include_once JPATH_COMPONENT . '/helpers/product.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/extra_field.php';
require_once JPATH_COMPONENT . '/helpers/extra_field.php';
$producthelper = new producthelper();
$quotationHelper = new quotationHelper();
$order_functions = new order_functions();
$configobj = new Redconfiguration();
$redTemplate = new Redtemplate();
$extra_field = new extra_field();
$extraField = new extraField();
$carthelper = new rsCarthelper();
$user = JFactory::getUser();
$Itemid = JRequest::getInt('Itemid');
$app = JFactory::getApplication();
$params = $app->getParams('com_redshop');
$returnitemid = $params->get('logout', $Itemid);
$accountbillto_link = JRoute::_("index.php?option=com_redshop&view=account_billto&Itemid=" . $Itemid);
$accountshipto_link = JRoute::_("index.php?option=com_redshop&view=account_shipto&Itemid=" . $Itemid);
$logout_link = JRoute::_("index.php?option=com_redshop&view=login&task=logout&logout=" . $returnitemid . "&Itemid=" . $Itemid);
$compare_link = JRoute::_("index.php?option=com_redshop&view=product&layout=compare&Itemid=" . $Itemid);
$mytags_link = JRoute::_("index.php?option=com_redshop&view=account&layout=mytags&Itemid=" . $Itemid);
$wishlist_link = JRoute::_("index.php?option=com_redshop&view=wishlist&task=viewwishlist&Itemid=" . $Itemid);
$model = $this->getModel('account');
$template = $redTemplate->getTemplate("account_template");
Example #19
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);
 }
Example #20
0
 public function product_template($template_id, $product_id, $section)
 {
     $redTemplate = new Redtemplate();
     if ($section == 1 || $section == 12) {
         $template_desc = $redTemplate->getTemplate("product", $template_id);
     } else {
         $template_desc = $redTemplate->getTemplate("category", $template_id);
     }
     if (count($template_desc) == 0) {
         return;
     }
     $template = $template_desc[0]->template_desc;
     $str = array();
     $sec = explode(',', $section);
     for ($t = 0; $t < count($sec); $t++) {
         $inArr[] = "'" . $sec[$t] . "'";
     }
     $in = implode(',', $inArr);
     $q = "SELECT field_name,field_type,field_section from " . $this->_table_prefix . "fields where field_section in (" . $in . ") ";
     $this->_db->setQuery($q);
     $fields = $this->_db->loadObjectlist();
     for ($i = 0; $i < count($fields); $i++) {
         if (strstr($template, "{" . $fields[$i]->field_name . "}")) {
             if ($fields[$i]->field_section == 12) {
                 if ($fields[$i]->field_type == 15) {
                     $str[] = $fields[$i]->field_name;
                 }
             } else {
                 $str[] = $fields[$i]->field_name;
             }
         }
     }
     $list_field = array();
     if (count($str) > 0) {
         $dbname = "'" . implode("','", $str) . "'";
         $field = new extra_field();
         for ($t = 0; $t < count($sec); $t++) {
             $list_field[] = $field->list_all_field($sec[$t], $product_id, $dbname);
         }
     }
     if (count($list_field) > 0) {
         return $list_field;
     } else {
         return "";
     }
 }
Example #21
0
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
$model = $this->getModel('checkout');
$uri = JURI::getInstance();
$url = $uri->root();
$redhelper = new redhelper();
$Itemid = $redhelper->getCheckoutItemid();
if ($Itemid == 0) {
    $Itemid = JRequest::getInt('Itemid');
}
$session = JFactory::getSession();
$order_functions = new order_functions();
$extra_field = new extra_field();
$billingaddresses = $model->billingaddresses();
?>
<table class="admintable">
	<?php 
if ($billingaddresses->is_company == 1) {
    ?>
		<tr>
			<td width="100" align="left"><label><?php 
    echo JText::_('COM_REDSHOP_COMPANY_NAME');
    ?>
:</label></td>
			<td><?php 
    echo $billingaddresses->company_name;
    ?>
</td>
Example #22
0
 public function display($tpl = null)
 {
     $option = JRequest::getVar('option');
     $extra_field = new extra_field();
     $order_functions = new order_functions();
     $Redconfiguration = new Redconfiguration();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSHOP_ORDER'));
     $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/json.js');
     $document->addScript('components/' . $option . '/assets/js/validation.js');
     $document->addScript('components/' . $option . '/assets/js/order.js');
     $document->addScript('components/' . $option . '/assets/js/common.js');
     $uri = JFactory::getURI();
     $lists = array();
     $billing = array();
     $shippinginfo = array();
     $model = $this->getModel();
     $detail = $this->get('data');
     $redhelper = new redhelper();
     $payment_lang_list = $redhelper->getPlugins("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);
     }
     $err = JRequest::getVar('err', '');
     $shipping_rate_id = JRequest::getVar('shipping_rate_id');
     $user_id = JRequest::getVar('user_id', 0);
     if ($user_id != 0) {
         $billing = $order_functions->getBillingAddress($user_id);
         $shippinginfo = $order_functions->getShippingAddress($user_id);
     } else {
         $billing = $model->setBilling();
     }
     $shipping_country = 0;
     $shipping_state = 0;
     $key = 0;
     $shippingop = array();
     $shippingop[0] = new stdClass();
     $shippingop[0]->users_info_id = 0;
     $shippingop[0]->text = JText::_('COM_REDSHOP_SELECT');
     if (count($shippinginfo) > 0) {
         $shipping_users_info_id = JRequest::getVar('shipping_users_info_id', 0);
         if ($shipping_users_info_id != 0) {
             for ($o = 0; $o < count($shippinginfo); $o++) {
                 if ($shippinginfo[$o]->users_info_id == $shipping_users_info_id) {
                     $key = $o;
                     break;
                 }
             }
             $shipping_country = $shippinginfo[$key]->country_code;
             $shipping_state = $shippinginfo[$key]->state_code;
         }
         $shippingop = array_merge($shippingop, $shippinginfo);
         $billisship = $shippinginfo[$key]->billisship = $shipping_users_info_id ? 0 : 1;
     } else {
         $shippinginfo[0] = $model->setShipping();
         $shipping_users_info_id = $shippinginfo[0]->users_info_id = 0;
         $billisship = $shippinginfo[0]->billisship;
     }
     $shdisable = $billisship ? "disabled" : "";
     $detail->user_id = $user_id;
     $lists['shippinginfo_list'] = JHTML::_('select.genericlist', $shippingop, 'shipp_users_info_id', 'class="inputbox" ' . $shdisable . ' onchange="getShippinginfo(this.value, ' . $billing->is_company . ');" ', 'users_info_id', 'text', $shipping_users_info_id);
     $payment_detail = $this->get('payment');
     JToolBarHelper::title(JText::_('COM_REDSHOP_ORDER') . ': <small><small>[ ' . JText::_('COM_REDSHOP_NEW') . ' ]</small></small>', 'redshop_order48');
     if ($err == "" && array_key_exists("users_info_id", $billing) && $billing->users_info_id) {
         JToolBarHelper::custom('savepay', 'save.png', 'save_f2.png', 'Save + Pay', false);
         JToolBarHelper::custom('save_without_sendmail', 'save.png', 'save_f2.png', JText::_('COM_REDSHOP_SAVE_WITHOUT_SEND_ORDERMAIL_LBL'), false);
         JToolBarHelper::save();
     }
     JToolBarHelper::cancel();
     $countryarray = $Redconfiguration->getCountryList((array) $billing, "country_code", "BT");
     $billing->country_code = $countryarray['country_code'];
     $lists['country_code'] = $countryarray['country_dropdown'];
     $statearray = $Redconfiguration->getStateList((array) $billing, "state_code", "country_code", "BT", 1);
     $lists['state_code'] = $statearray['state_dropdown'];
     $shipping['country_code_ST'] = $shippinginfo[$key]->country_code;
     $countryarray = $Redconfiguration->getCountryList((array) $shipping, "country_code_ST", "ST");
     $shipping['country_code_ST'] = $shippinginfo[$key]->country_code = $countryarray['country_code_ST'];
     $lists['country_code_ST'] = $countryarray['country_dropdown'];
     $statearray = $Redconfiguration->getStateList((array) $shipping, "state_code_ST", "country_code_ST", "ST", 1);
     $lists['state_code_ST'] = $statearray['state_dropdown'];
     $lists['is_company'] = JHTML::_('select.booleanlist', 'is_company', 'class="inputbox" onchange="showOfflineCompanyOrCustomer(this.value);" ', $billing->is_company, JText::_('COM_REDSHOP_USER_COMPANY'), JText::_('COM_REDSHOP_USER_CUSTOMER'));
     $lists['customer_field'] = $extra_field->list_all_field(7, $billing->users_info_id);
     $lists['company_field'] = $extra_field->list_all_field(8, $billing->users_info_id);
     $lists['shipping_customer_field'] = $extra_field->list_all_field(14, $shippinginfo[0]->users_info_id);
     $lists['shipping_company_field'] = $extra_field->list_all_field(15, $shippinginfo[0]->users_info_id);
     $this->lists = $lists;
     $this->detail = $detail;
     $this->billing = $billing;
     $this->shipping = $shippinginfo[$key];
     $this->shipping_users_info_id = $shipping_users_info_id;
     $this->payment_detail = $payment_detail;
     $this->shipping_rate_id = $shipping_rate_id;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
Example #23
0
 public function replaceUserfield($product_id = 0, $template_id = 0, $unique_id = "")
 {
     $producthelper = new producthelper();
     $redTemplate = new Redtemplate();
     $extraField = new extra_field();
     $template_desc = $redTemplate->getTemplate("product", $template_id);
     $returnArr = $producthelper->getProductUserfieldFromTemplate($template_desc[0]->template_desc);
     $commonid = $product_id . $unique_id;
     $product_userfileds = "<table>";
     for ($ui = 0; $ui < count($returnArr[1]); $ui++) {
         $result_arr = $extraField->list_all_user_fields($returnArr[1][$ui], 12, "", $commonid);
         $hidden_arr = $extraField->list_all_user_fields($returnArr[1][$ui], 12, "hidden", $commonid);
         if ($result_arr[0] != "") {
             $product_userfileds .= "<tr><td>" . $result_arr[0] . "</td><td>" . $result_arr[1] . $hidden_arr[1] . "</td></tr>";
         }
     }
     $product_userfileds .= "</table>";
     return $product_userfileds;
 }
 public function store($data)
 {
     $extra_field = new extra_field();
     $quotationHelper = new quotationHelper();
     $producthelper = new producthelper();
     $rsCarthelper = new rsCarthelper();
     $stockroomhelper = new rsstockroomhelper();
     $extra_field->extra_field_save($data, 16, $data['user_info_id'], $data['user_email']);
     $row = $this->getTable('quotation_detail');
     if ($data['quotation_discount'] > 0) {
         $data['order_total'] = $data['order_total'] - $data['quotation_discount'] - $data['order_total'] * $data['quotation_special_discount'] / 100;
     }
     $data['quotation_number'] = $quotationHelper->generateQuotationNumber();
     $data['quotation_encrkey'] = $quotationHelper->randomQuotationEncrkey();
     $data['quotation_cdate'] = time();
     $data['quotation_mdate'] = time();
     $data['quotation_total'] = $data['order_total'];
     $data['quotation_subtotal'] = $data['order_subtotal'];
     $data['quotation_tax'] = $data['order_tax'];
     $data['quotation_ipaddress'] = !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'unknown';
     if (!$row->bind($data)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $row->quotation_status = 2;
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $quotation_item = array();
     $user_id = $row->user_id;
     $item = $data['order_item'];
     for ($i = 0; $i < count($item); $i++) {
         $product_id = $item[$i]->product_id;
         $quantity = $item[$i]->quantity;
         $product_excl_price = $item[$i]->prdexclprice;
         $product_price = $item[$i]->productprice;
         // Attribute price added
         $generateAttributeCart = $rsCarthelper->generateAttributeArray((array) $item[$i], $user_id);
         $retAttArr = $producthelper->makeAttributeCart($generateAttributeCart, $product_id, $user_id, 0, $quantity);
         $product_attribute = $retAttArr[0];
         // Accessory price
         $generateAccessoryCart = $rsCarthelper->generateAccessoryArray((array) $item[$i], $user_id);
         $retAccArr = $producthelper->makeAccessoryCart($generateAccessoryCart, $product_id, $user_id);
         $product_accessory = $retAccArr[0];
         $wrapper_price = 0;
         $wrapper_vat = 0;
         $wrapper = $producthelper->getWrapper($product_id, $item[$i]->wrapper_data);
         if (count($wrapper) > 0) {
             if ($wrapper[0]->wrapper_price > 0) {
                 $wrapper_vat = $producthelper->getProducttax($product_id, $wrapper[0]->wrapper_price, $user_id);
             }
             $wrapper_price = $wrapper[0]->wrapper_price + $wrapper_vat;
         }
         $rowitem =& $this->getTable('quotation_item_detail');
         $product = $producthelper->getProductById($product_id);
         $quotation_item[$i]->quotation_id = $row->quotation_id;
         $quotation_item[$i]->product_id = $product_id;
         $quotation_item[$i]->is_giftcard = 0;
         $quotation_item[$i]->product_name = $product->product_name;
         $quotation_item[$i]->actualitem_price = $product_price;
         $quotation_item[$i]->product_price = $product_price;
         $quotation_item[$i]->product_excl_price = $product_excl_price;
         $quotation_item[$i]->product_final_price = $product_price * $quantity;
         $quotation_item[$i]->product_attribute = $product_attribute;
         $quotation_item[$i]->product_accessory = $product_accessory;
         $quotation_item[$i]->product_wrapperid = $item[$i]->wrapper_data;
         $quotation_item[$i]->wrapper_price = $wrapper_price;
         $quotation_item[$i]->product_quantity = $quantity;
         if (!$rowitem->bind($quotation_item[$i])) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         if (!$rowitem->store()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         // Store userfields
         $userfields = JRequest::getVar('extrafields' . $product_id);
         $userfields_id = JRequest::getVar('extrafields_id_' . $product_id);
         for ($ui = 0; $ui < count($userfields); $ui++) {
             $quotationHelper->insertQuotationUserfield($userfields_id[$ui], $rowitem->quotation_item_id, 12, $userfields[$ui]);
         }
         /** my accessory save in table start */
         if (count($generateAccessoryCart) > 0) {
             $attArr = $generateAccessoryCart;
             for ($a = 0; $a < count($attArr); $a++) {
                 $accessory_vat_price = 0;
                 $accessory_attribute = "";
                 $accessory_id = $attArr[$a]['accessory_id'];
                 $accessory_name = $attArr[$a]['accessory_name'];
                 $accessory_price = $attArr[$a]['accessory_price'];
                 $accessory_org_price = $accessory_price;
                 if ($accessory_price > 0) {
                     $accessory_vat_price = $producthelper->getProductTax($rowitem->product_id, $accessory_price, $user_id);
                 }
                 $attchildArr = $attArr[$a]['accessory_childs'];
                 for ($j = 0; $j < count($attchildArr); $j++) {
                     $attribute_id = $attchildArr[$j]['attribute_id'];
                     $accessory_attribute .= urldecode($attchildArr[$j]['attribute_name']) . ":<br/>";
                     $rowattitem =& $this->getTable('quotation_attribute_item');
                     $rowattitem->quotation_att_item_id = 0;
                     $rowattitem->quotation_item_id = $rowitem->quotation_item_id;
                     $rowattitem->section_id = $attribute_id;
                     $rowattitem->section = "attribute";
                     $rowattitem->parent_section_id = $accessory_id;
                     $rowattitem->section_name = $attchildArr[$j]['attribute_name'];
                     $rowattitem->is_accessory_att = 1;
                     if ($attribute_id > 0) {
                         if (!$rowattitem->store()) {
                             $this->setError($this->_db->getErrorMsg());
                             return false;
                         }
                     }
                     $propArr = $attchildArr[$j]['attribute_childs'];
                     for ($k = 0; $k < count($propArr); $k++) {
                         $section_vat = 0;
                         if ($propArr[$k]['property_price'] > 0) {
                             $section_vat = $producthelper->getProducttax($rowitem->product_id, $propArr[$k]['property_price'], $user_id);
                         }
                         $property_id = $propArr[$k]['property_id'];
                         $accessory_attribute .= urldecode($propArr[$k]['property_name']) . " (" . $propArr[$k]['property_oprand'] . $producthelper->getProductFormattedPrice($propArr[$k]['property_price'] + $section_vat) . ")<br/>";
                         $subpropArr = $propArr[$k]['property_childs'];
                         $rowattitem =& $this->getTable('quotation_attribute_item');
                         $rowattitem->quotation_att_item_id = 0;
                         $rowattitem->quotation_item_id = $rowitem->quotation_item_id;
                         $rowattitem->section_id = $property_id;
                         $rowattitem->section = "property";
                         $rowattitem->parent_section_id = $attribute_id;
                         $rowattitem->section_name = $propArr[$k]['property_name'];
                         $rowattitem->section_price = $propArr[$k]['property_price'];
                         $rowattitem->section_vat = $section_vat;
                         $rowattitem->section_oprand = $propArr[$k]['property_oprand'];
                         $rowattitem->is_accessory_att = 1;
                         if ($property_id > 0) {
                             if (!$rowattitem->store()) {
                                 $this->setError($this->_db->getErrorMsg());
                                 return false;
                             }
                         }
                         for ($l = 0; $l < count($subpropArr); $l++) {
                             $section_vat = 0;
                             if ($subpropArr[$l]['subproperty_price'] > 0) {
                                 $section_vat = $producthelper->getProducttax($rowitem->product_id, $subpropArr[$l]['subproperty_price'], $user_id);
                             }
                             $subproperty_id = $subpropArr[$l]['subproperty_id'];
                             $accessory_attribute .= urldecode($subpropArr[$l]['subproperty_name']) . " (" . $subpropArr[$l]['subproperty_oprand'] . $producthelper->getProductFormattedPrice($subpropArr[$l]['subproperty_price'] + $section_vat) . ")<br/>";
                             $rowattitem =& $this->getTable('quotation_attribute_item');
                             $rowattitem->quotation_att_item_id = 0;
                             $rowattitem->quotation_item_id = $rowitem->quotation_item_id;
                             $rowattitem->section_id = $subproperty_id;
                             $rowattitem->section = "subproperty";
                             $rowattitem->parent_section_id = $property_id;
                             $rowattitem->section_name = $subpropArr[$l]['subproperty_name'];
                             $rowattitem->section_price = $subpropArr[$l]['subproperty_price'];
                             $rowattitem->section_vat = $section_vat;
                             $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand'];
                             $rowattitem->is_accessory_att = 1;
                             if ($subproperty_id > 0) {
                                 if (!$rowattitem->store()) {
                                     $this->setError($this->_db->getErrorMsg());
                                     return false;
                                 }
                             }
                         }
                     }
                 }
                 $accdata =& $this->getTable('accessory_detail');
                 if ($accessory_id > 0) {
                     $accdata->load($accessory_id);
                 }
                 $accProductinfo = $producthelper->getProductById($accdata->child_product_id);
                 $rowaccitem =& $this->getTable('quotation_accessory_item');
                 $rowaccitem->quotation_item_acc_id = 0;
                 $rowaccitem->quotation_item_id = $rowitem->quotation_item_id;
                 $rowaccitem->accessory_id = $accessory_id;
                 $rowaccitem->accessory_item_sku = $accProductinfo->product_number;
                 $rowaccitem->accessory_item_name = $accessory_name;
                 $rowaccitem->accessory_price = $accessory_org_price;
                 $rowaccitem->accessory_vat = $accessory_vat_price;
                 $rowaccitem->accessory_quantity = $rowitem->product_quantity;
                 $rowaccitem->accessory_item_price = $accessory_price;
                 $rowaccitem->accessory_final_price = $accessory_price * $rowitem->product_quantity;
                 $rowaccitem->accessory_attribute = $accessory_attribute;
                 if ($accessory_id > 0) {
                     if (!$rowaccitem->store()) {
                         $this->setError($this->_db->getErrorMsg());
                         return false;
                     }
                 }
             }
         }
         /** my attribute save in table start */
         if (count($generateAttributeCart) > 0) {
             $attArr = $generateAttributeCart;
             for ($j = 0; $j < count($attArr); $j++) {
                 $attribute_id = $attArr[$j]['attribute_id'];
                 $rowattitem =& $this->getTable('quotation_attribute_item');
                 $rowattitem->quotation_att_item_id = 0;
                 $rowattitem->quotation_item_id = $rowitem->quotation_item_id;
                 $rowattitem->section_id = $attribute_id;
                 $rowattitem->section = "attribute";
                 $rowattitem->parent_section_id = $rowitem->product_id;
                 $rowattitem->section_name = $attArr[$j]['attribute_name'];
                 $rowattitem->is_accessory_att = 0;
                 if ($attribute_id > 0) {
                     if (!$rowattitem->store()) {
                         $this->setError($this->_db->getErrorMsg());
                         return false;
                     }
                 }
                 $propArr = $attArr[$j]['attribute_childs'];
                 for ($k = 0; $k < count($propArr); $k++) {
                     $section_vat = 0;
                     if ($propArr[$k]['property_price'] > 0) {
                         $section_vat = $producthelper->getProducttax($rowitem->product_id, $propArr[$k]['property_price'], $user_id);
                     }
                     $property_id = $propArr[$k]['property_id'];
                     /** product property STOCKROOM update start */
                     $stockroomhelper->updateStockroomQuantity($property_id, $rowitem->product_quantity, "property");
                     $rowattitem =& $this->getTable('quotation_attribute_item');
                     $rowattitem->quotation_att_item_id = 0;
                     $rowattitem->quotation_item_id = $rowitem->quotation_item_id;
                     $rowattitem->section_id = $property_id;
                     $rowattitem->section = "property";
                     $rowattitem->parent_section_id = $attribute_id;
                     $rowattitem->section_name = $propArr[$k]['property_name'];
                     $rowattitem->section_price = $propArr[$k]['property_price'];
                     $rowattitem->section_vat = $section_vat;
                     $rowattitem->section_oprand = $propArr[$k]['property_oprand'];
                     $rowattitem->is_accessory_att = 0;
                     if ($property_id > 0) {
                         if (!$rowattitem->store()) {
                             $this->setError($this->_db->getErrorMsg());
                             return false;
                         }
                     }
                     $subpropArr = $propArr[$k]['property_childs'];
                     for ($l = 0; $l < count($subpropArr); $l++) {
                         $section_vat = 0;
                         if ($subpropArr[$l]['subproperty_price'] > 0) {
                             $section_vat = $producthelper->getProducttax($rowitem->product_id, $subpropArr[$l]['subproperty_price'], $user_id);
                         }
                         $subproperty_id = $subpropArr[$l]['subproperty_id'];
                         /** product subproperty STOCKROOM update start */
                         $stockroomhelper->updateStockroomQuantity($subproperty_id, $rowitem->product_quantity, "subproperty");
                         $rowattitem = $this->getTable('quotation_attribute_item');
                         $rowattitem->quotation_att_item_id = 0;
                         $rowattitem->quotation_item_id = $rowitem->quotation_item_id;
                         $rowattitem->section_id = $subproperty_id;
                         $rowattitem->section = "subproperty";
                         $rowattitem->parent_section_id = $property_id;
                         $rowattitem->section_name = $subpropArr[$l]['subproperty_name'];
                         $rowattitem->section_price = $subpropArr[$l]['subproperty_price'];
                         $rowattitem->section_vat = $section_vat;
                         $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand'];
                         $rowattitem->is_accessory_att = 0;
                         if ($subproperty_id > 0) {
                             if (!$rowattitem->store()) {
                                 $this->setError($this->_db->getErrorMsg());
                                 return false;
                             }
                         }
                     }
                 }
             }
         }
     }
     return $row;
 }
Example #25
0
 public function display($tpl = null)
 {
     global $context;
     $context = 'product_id';
     $GLOBALS['productlist'] = array();
     $redTemplate = new Redtemplate();
     $extra_field = new extra_field();
     $adminproducthelper = new adminproducthelper();
     $list_in_products = $extra_field->list_all_field_in_product();
     $uri = JFactory::getURI();
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSHOP_PRODUCT'));
     $layout = JRequest::getVar('layout');
     JToolBarHelper::title(JText::_('COM_REDSHOP_PRODUCT_MANAGEMENT'), 'redshop_products48');
     if ($layout != 'importproduct' && $layout != 'importattribute' && $layout != 'listing' && $layout != 'ins_product') {
         JToolBarHelper::customX('gbasefeed', 'gbase.png', 'gbase.png', JText::_('COM_REDSHOP_GOOGLEBASE'), true);
         JToolBarHelper::custom('assignCategory', 'save.png', 'save_f2.png', JText::_('COM_REDSHOP_ASSIGN_CATEGORY'), true);
         JToolBarHelper::custom('removeCategory', 'delete.png', 'delete_f2.png', JText::_('COM_REDSHOP_REMOVE_CATEGORY'), true);
         JToolBarHelper::addNewX();
         JToolBarHelper::editListX();
         JToolBarHelper::customX('copy', 'copy.png', 'copy_f2.png', JText::_('COM_REDSHOP_TOOLBAR_COPY'), true);
         JToolBarHelper::deleteList();
         JToolBarHelper::publishList();
         JToolBarHelper::unpublishList();
     }
     if ($layout == 'listing') {
         JToolBarHelper::back();
     }
     $category_id = $app->getUserStateFromRequest($context . 'category_id', 'category_id', '');
     if ($category_id) {
         $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'x.ordering');
     } else {
         $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'p.product_id');
     }
     $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
     $search_field = $app->getUserStateFromRequest($context . 'search_field', 'search_field', '');
     $keyword = $app->getUserStateFromRequest($context . 'keyword', 'keyword', '');
     $categories = $this->get('CategoryList');
     $categories1 = array();
     foreach ($categories as $key => $value) {
         $categories1[$key] = new stdClass();
         $categories1[$key]->id = $categories[$key]->id;
         $categories1[$key]->parent_id = $categories[$key]->parent_id;
         $categories1[$key]->title = $categories[$key]->title;
         $treename = str_replace("&#160;&#160;&#160;&#160;&#160;&#160;", " ", $categories[$key]->treename);
         $treename = str_replace("<sup>", " ", $treename);
         $treename = str_replace("</sup>&#160;", " ", $treename);
         $categories1[$key]->treename = $treename;
         $categories1[$key]->children = $categories[$key]->children;
     }
     $temps = array();
     $temps[0] = new stdClass();
     $temps[0]->id = "0";
     $temps[0]->treename = JText::_('COM_REDSHOP_SELECT');
     $categories1 = @array_merge($temps, $categories1);
     $lists['category'] = JHTML::_('select.genericlist', $categories1, 'category_id', 'class="inputbox" onchange="document.adminForm2.submit();" ', 'id', 'treename', $category_id);
     $product_sort = $adminproducthelper->getProductrBySortedList();
     $product_sort_select = JRequest::getVar('product_sort', 0);
     $lists['product_sort'] = JHTML::_('select.genericlist', $product_sort, 'product_sort', 'class="inputbox"  onchange="document.adminForm2.submit();" ', 'value', 'text', $product_sort_select);
     $lists['order'] = $filter_order;
     $lists['order_Dir'] = $filter_order_Dir;
     $products = $this->get('Data');
     $pagination = $this->get('Pagination');
     /*
      * assign template
      */
     $templates = $redTemplate->getTemplate('product');
     $temps = array();
     $temps[0] = new stdClass();
     $temps[0]->template_id = "0";
     $temps[0]->template_name = JText::_('COM_REDSHOP_ASSIGN_TEMPLATE');
     $templates = @array_merge($temps, $templates);
     $lists['product_template'] = JHTML::_('select.genericlist', $templates, 'product_template', 'class="inputbox" size="1"  onchange="return AssignTemplate()" ', 'template_id', 'template_name', 0);
     $this->list_in_products = $list_in_products;
     $this->keyword = $keyword;
     $this->search_field = $search_field;
     $this->user = JFactory::getUser();
     $this->lists = $lists;
     $this->products = $products;
     $this->pagination = $pagination;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
 public function product_template($template_id, $product_id, $section)
 {
     require_once JPATH_COMPONENT . '/helpers/extra_field.php';
     $query = 'SELECT template_desc FROM ' . $this->_table_prefix . 'template  WHERE template_id =' . $template_id;
     if ($section == 1) {
         $query .= ' and template_section="product" ';
     } else {
         $query .= ' and template_section="category" ';
     }
     $this->_db->setQuery($query);
     $template_desc = $this->_db->loadObject();
     $template = $template_desc->template_desc;
     $tmp1 = explode("{", $template);
     $str = '';
     for ($h = 0; $h < count($tmp1); $h++) {
         $word = explode("}", $tmp1[$h]);
         if ($h != 0) {
             $str .= "'" . $word[0] . "'";
         }
         if ($h != 0 && $h != count($tmp1) - 1) {
             $str .= ",";
         }
     }
     $field = new extra_field();
     $list_field = $field->list_all_field($section, $product_id, $str);
     /// field_section 6 :Userinformations
     return $list_field;
 }
Example #27
0
 /**
  * Load the fields for export
  *
  * @return  void
  */
 private function loadFields()
 {
     $extra_field = new extra_field();
     $producthelper = new producthelper();
     $db = JFactory::getDbo();
     $query = "SELECT * FROM `#__redshop_fields` ORDER BY field_id asc ";
     $this->_db->setQuery($query);
     $cur = $this->_db->loadObjectList();
     $ret = null;
     for ($i = 0; $i < count($cur); $i++) {
         if ($i == 0) {
             echo "field_id,field_title,field_name_field,field_type,field_desc,field_class,field_section,field_maxlength,field_cols,field_rows,field_size,field_show_in_front,required,published,data_id,data_txt,itemid,section,value_id,field_value,field_name,data_number";
             echo "\r\n";
         }
         $query = 'SELECT data_id,`data_txt`,`itemid`,`section` FROM `#__redshop_fields_data` WHERE `fieldid` = ' . $cur[$i]->field_id . ' and section!=""';
         $this->_db->setQuery($query);
         $data = $this->_db->loadObjectList();
         $attr = array();
         $datavalue = $extra_field->getFieldValue($cur[$i]->field_id);
         $attrvalue = array();
         echo $cur[$i]->field_id . "," . $cur[$i]->field_title . "," . $cur[$i]->field_name . "," . $cur[$i]->field_type . "," . $cur[$i]->field_desc . "," . $cur[$i]->field_class . "," . $cur[$i]->field_section . "," . $cur[$i]->field_maxlength . "," . $cur[$i]->field_cols . "," . $cur[$i]->field_rows . "," . $cur[$i]->field_size . "," . $cur[$i]->field_show_in_front . "," . $cur[$i]->required . "," . $cur[$i]->published . "\n";
         for ($att = 0; $att < count($data); $att++) {
             $product_details = $producthelper->getProductById($data[$att]->itemid);
             echo $cur[$i]->field_id . ",,,,,,,,,,,,,," . $data[$att]->data_id . ",\"" . $data[$att]->data_txt . "\"," . $data[$att]->itemid . "," . $data[$att]->section . ",,,," . $product_details->product_number . ",\n";
         }
         for ($attrvalue = 0; $attrvalue < count($datavalue); $attrvalue++) {
             echo $cur[$i]->field_id . ",,,,,,,,,,,,,,,,,," . $datavalue[$attrvalue]->value_id . "," . $datavalue[$attrvalue]->field_value . "," . $datavalue[$attrvalue]->field_name . ",\n";
         }
     }
 }
Example #28
0
 public function updateBillingAdd($data)
 {
     $row = $this->getTable('order_user_detail');
     $row->load($data['order_info_id']);
     $row->bind($data);
     if ($row->store()) {
         if ($row->is_company == 1) {
             // Saving users extra fields information
             $field = new extra_field();
             // Field_section 8 :Company Address Section
             $list_field = $field->extra_field_save($data, 8, $row->users_info_id);
         } else {
             // Saving users extra fields information
             $field = new extra_field();
             // Field_section 7 :Customer Address Section
             $list_field = @$field->extra_field_save($data, 7, $row->users_info_id);
         }
         return true;
     } else {
         return false;
     }
 }
Example #29
0
 public function manageQuotationUserfield($cart = array(), $quotation_item_id = 0, $section_id = 12)
 {
     $extra_field = new extra_field();
     $row_data = $extra_field->getSectionFieldList($section_id, 1);
     for ($i = 0; $i < count($row_data); $i++) {
         if (array_key_exists($row_data[$i]->field_name, $cart) && $cart[$row_data[$i]->field_name]) {
             $user_fields = $cart[$row_data[$i]->field_name];
             if ($user_fields != '') {
                 $this->insertQuotationUserfield($row_data[$i]->field_id, $quotation_item_id, $section_id, $user_fields);
             }
         }
     }
     return true;
 }
Example #30
0
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
JHTML::_('behavior.modal');
require_once JPATH_COMPONENT_SITE . '/helpers/product.php';
require_once JPATH_COMPONENT_SITE . '/helpers/helper.php';
require_once JPATH_COMPONENT_SITE . '/helpers/cart.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/shipping.php';
$producthelper = new producthelper();
$carthelper = new rsCarthelper();
$order_functions = new order_functions();
$redhelper = new redhelper();
$extra_field = new extra_field();
$shippinghelper = new shipping();
$config = new Redconfiguration();
$uri = JURI::getInstance();
$url = $uri->root();
$option = JRequest::getVar('option');
$tmpl = JRequest::getVar('tmpl');
$model = $this->getModel('order_detail');
$session = JFactory::getSession();
$billing = $this->billing;
$shipping = $this->shipping;
$is_company = $billing->is_company;
$order_id = $this->detail->order_id;
$products = $order_functions->getOrderItemDetail($order_id);
$log_rec = $model->getOrderLog($order_id);
if (!$shipping) {