示例#1
0
 public function display($tpl = null)
 {
     $context = 'shipping_rate';
     $uri = JFactory::getURI();
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $shippinghelper = new shipping();
     $lists['order'] = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'shipping_rate_id');
     $lists['order_Dir'] = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
     $id = $app->getUserStateFromRequest($context . 'extension_id', 'extension_id', '0');
     if ((int) $id == 0) {
         JError::raiseError(500, "Direct Access not allowed, go to <a href='index.php?option=com_redshop&view=shipping'>" . JText::_('COM_REDSHOP_SHIPPING') . "</a>");
         return false;
     }
     $shipping = $shippinghelper->getShippingMethodById($id);
     $shipping_rates = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     $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');
     JToolBarHelper::title($jtitle . ' <small><small>[ ' . $shipping->name . ' ]</small></small>', 'redshop_shipping_rates48');
     JToolBarHelper::addNewX();
     JToolBarHelper::editListX();
     if ($is_shipper) {
         JToolBarHelper::customX('copy', 'copy.png', 'copy_f2.png', JText::_('COM_REDSHOP_TOOLBAR_COPY'), true);
     }
     JToolBarHelper::deleteList();
     JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE'));
     $this->lists = $lists;
     $this->shipping_rates = $shipping_rates;
     $this->shipping = $shipping;
     $this->pagination = $pagination;
     $this->is_shipper = $is_shipper;
     $this->shipper_location = $shipper_location;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
示例#2
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);
 }