コード例 #1
0
ファイル: product.php プロジェクト: jaanusnurmoja/redjoomla
 public function replaceShippingMethod($d = array(), $shipp_users_info_id = 0, $shipping_rate_id = 0, $shipping_box_post_id = 0)
 {
     $producthelper = new producthelper();
     $order_functions = new order_functions();
     if ($shipp_users_info_id > 0) {
         $shippingmethod = $order_functions->getShippingMethodInfo();
         JPluginHelper::importPlugin('redshop_shipping');
         $dispatcher = JDispatcher::getInstance();
         $shippingrate = $dispatcher->trigger('onListRates', array(&$d));
         $ratearr = array();
         $r = 0;
         for ($s = 0; $s < count($shippingmethod); $s++) {
             if (isset($shippingrate[$s]) === false) {
                 continue;
             }
             $rate = $shippingrate[$s];
             if (count($rate) > 0) {
                 $rs = $shippingmethod[$s];
                 for ($i = 0; $i < count($rate); $i++) {
                     $displayrate = $rate[$i]->rate > 0 ? " (" . $producthelper->getProductFormattedPrice($rate[$i]->rate) . " )" : "";
                     $ratearr[$r] = new stdClass();
                     $ratearr[$r]->text = $rs->name . " - " . $rate[$i]->text . $displayrate;
                     $ratearr[$r]->value = $rate[$i]->value;
                     $r++;
                 }
             }
         }
         if (count($ratearr) > 0) {
             if (!$shipping_rate_id) {
                 $shipping_rate_id = $ratearr[0]->value;
             }
             $displayrespoce = JHTML::_('select.genericlist', $ratearr, 'shipping_rate_id', 'class="inputbox" onchange="calculateOfflineShipping();" ', 'value', 'text', $shipping_rate_id);
         } else {
             $displayrespoce = JText::_('COM_REDSHOP_NO_SHIPPING_METHODS_TO_DISPLAY');
         }
     } else {
         $displayrespoce = '<div class="shipnotice">' . JText::_('COM_REDSHOP_FILL_SHIPPING_ADDRESS') . '</div>';
     }
     return $displayrespoce;
 }
コード例 #2
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     JToolBarHelper::title(JText::_('COM_REDSHOP_TEMPLATES_MANAGEMET'), 'redshop_templates48');
     $uri = JFactory::getURI();
     jimport('joomla.html.pane');
     $pane = JPane::getInstance('sliders');
     $this->pane = $pane;
     $model = $this->getModel('template_detail');
     $user = JFactory::getUser();
     $redtemplate = new Redtemplate();
     // 	fail if checked out not by 'me'
     if ($model->isCheckedOut($user->get('id'))) {
         $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('COM_REDSHOP_THE_DETAIL'), $detail->title);
         $app->redirect('index.php?option=com_redshop&view=template', $msg);
     }
     $this->setLayout('default');
     $lists = array();
     $detail = $this->get('data');
     $isNew = $detail->template_id < 1;
     $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT');
     JToolBarHelper::title(JText::_('COM_REDSHOP_TEMPLATES') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_templates48');
     JToolBarHelper::apply();
     JToolBarHelper::save();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         // EDIT - check out the item
         $model->checkout($user->get('id'));
         JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE'));
     }
     // TEMPLATE MOVE DB TO FILE
     $post = JRequest::get('post');
     if ($isNew && (isset($post['template_name']) && $post['template_name'] != "")) {
         $detail->template_name = $post['template_name'];
         $detail->template_section = $post['template_section'];
         $template_desc = JRequest::getVar('template_desc', '', 'post', 'string', JREQUEST_ALLOWRAW);
         $detail->template_desc = $template_desc;
         $detail->published = $post['published'];
         $detail->msg = JText::_('PLEASE_CHANGE_FILE_NAME_IT_IS_ALREADY_EXISTS');
     }
     // TEMPLATE MOVE DB TO FILE END
     // Section can be added from here
     $optionsection = $redtemplate->getTemplateSections();
     $lists['section'] = JHTML::_('select.genericlist', $optionsection, 'template_section', 'class="inputbox" size="1"  onchange="showclicktellbox();"', 'value', 'text', $detail->template_section);
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox" ', $detail->published);
     $order_functions = new order_functions();
     $paymentMethod = $order_functions->getPaymentMethodInfo();
     $payment_methods = explode(',', $detail->payment_methods);
     $tmp = new stdClass();
     $tmp = @array_merge($tmp, $payment_methods);
     $lists['payment_methods'] = JHTML::_('select.genericlist', $paymentMethod, 'payment_methods[]', 'class="inputbox" multiple="multiple" size="4" ', 'element', 'name', $payment_methods);
     $shippingMethod = $order_functions->getShippingMethodInfo();
     $shipping_methods = explode(',', $detail->shipping_methods);
     $tmp = new stdClass();
     $tmp = @array_merge($tmp, $shipping_methods);
     $lists['shipping_methods'] = JHTML::_('select.genericlist', $shippingMethod, 'shipping_methods[]', 'class="inputbox" multiple="multiple" size="4" ', 'element', 'name', $shipping_methods);
     $lists['order_status'] = $order_functions->getstatuslist('order_status', $detail->order_status, 'class="inputbox" multiple="multiple"');
     $this->lists = $lists;
     $this->detail = $detail;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }