示例#1
0
文件: reviews.php 项目: Tommar/vino2
 function display($cachable = false, $urlparams = false)
 {
     $mainframe = JFactory::getApplication();
     $id_vendor_cuser = getIdVendorForCUser();
     $reviews_model = $this->getModel("reviews");
     $products_model = $this->getModel("products");
     $context = "jshoping.list.admin.reviews";
     $limit = $mainframe->getUserStateFromRequest($context . 'limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($context . 'limitstart', 'limitstart', 0, 'int');
     $category_id = $mainframe->getUserStateFromRequest($context . 'category_id', 'category_id', 0, 'int');
     $text_search = $mainframe->getUserStateFromRequest($context . 'text_search', 'text_search', '');
     $filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', "pr_rew.review_id", 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', "desc", 'cmd');
     if ($category_id) {
         $product_id = $mainframe->getUserStateFromRequest($context . 'product_id', 'product_id', 0, 'int');
     } else {
         $product_id = null;
     }
     $products_select = "";
     if ($category_id) {
         $prod_filter = array("category_id" => $category_id);
         if ($id_vendor_cuser) {
             $prod_filter['vendor_id'] = $id_vendor_cuser;
         }
         $products = $products_model->getAllProducts($prod_filter, 0, 100);
         if (count($products)) {
             $start_pr_option = JHTML::_('select.option', '0', _JSHOP_SELECT_PRODUCT, 'product_id', 'name');
             array_unshift($products, $start_pr_option);
             $products_select = JHTML::_('select.genericlist', $products, 'product_id', 'class = "inputbox" onchange="document.adminForm.submit();" size = "1" ', 'product_id', 'name', $product_id);
         }
     }
     $total = $reviews_model->getAllReviews($category_id, $product_id, NULL, NULL, $text_search, "count", $id_vendor_cuser, $filter_order, $filter_order_Dir);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $reviews = $reviews_model->getAllReviews($category_id, $product_id, $pagination->limitstart, $pagination->limit, $text_search, "list", $id_vendor_cuser, $filter_order, $filter_order_Dir);
     $start_option = JHTML::_('select.option', '0', _JSHOP_SELECT_CATEGORY, 'category_id', 'name');
     $categories_select = buildTreeCategory(0, 1, 0);
     array_unshift($categories_select, $start_option);
     $categories = JHTML::_('select.genericlist', $categories_select, 'category_id', 'class = "inputbox" onchange="document.adminForm.submit();" size = "1" ', 'category_id', 'name', $category_id);
     $view = $this->getView("comments", 'html');
     $view->setLayout("list");
     $view->assign('categories', $categories);
     $view->assign('reviews', $reviews);
     $view->assign('limit', $limit);
     $view->assign('limitstart', $limitstart);
     $view->assign('text_search', $text_search);
     $view->assign('pagination', $pagination);
     $view->assign('products_select', $products_select);
     $view->assign('filter_order', $filter_order);
     $view->assign('filter_order_Dir', $filter_order_Dir);
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeDisplayReviews', array(&$view));
     $view->displayList();
 }
示例#2
0
 function edit()
 {
     $mainframe = JFactory::getApplication();
     $order_id = JRequest::getVar("order_id");
     $client_id = JRequest::getInt('client_id', 0);
     $lang = JSFactory::getLang();
     $db = JFactory::getDBO();
     $jshopConfig = JSFactory::getConfig();
     $orders = $this->getModel("orders");
     $order = JTable::getInstance('order', 'jshop');
     $order->load($order_id);
     $name = $lang->get("name");
     $id_vendor_cuser = getIdVendorForCUser();
     if ($jshopConfig->admin_show_vendors && $id_vendor_cuser) {
         if ($order->vendor_id != $id_vendor_cuser) {
             $mainframe->redirect('index.php', JText::_('ALERTNOTAUTH'));
             return 0;
         }
     }
     $order_items = $order->getAllItems();
     $_languages = $this->getModel("languages");
     $languages = $_languages->getAllLanguages(1);
     $select_language = JHTML::_('select.genericlist', $languages, 'lang', 'class = "inputbox" style="float:none"', 'language', 'name', $order->lang);
     $country = JTable::getInstance('country', 'jshop');
     $countries = $country->getAllCountries();
     $select_countries = JHTML::_('select.genericlist', $countries, 'country', 'class = "inputbox"', 'country_id', 'name', $order->country);
     $select_d_countries = JHTML::_('select.genericlist', $countries, 'd_country', 'class = "inputbox"', 'country_id', 'name', $order->d_country);
     $option_title = array();
     foreach ($jshopConfig->user_field_title as $key => $value) {
         if ($key > 0) {
             $option_title[] = JHTML::_('select.option', $key, $value, 'title_id', 'title_name');
         }
     }
     $select_titles = JHTML::_('select.genericlist', $option_title, 'title', 'class = "inputbox"', 'title_id', 'title_name', $order->title);
     $select_d_titles = JHTML::_('select.genericlist', $option_title, 'd_title', 'class = "inputbox endes"', 'title_id', 'title_name', $order->d_title);
     $order->birthday = getDisplayDate($order->birthday, $jshopConfig->field_birthday_format);
     $order->d_birthday = getDisplayDate($order->d_birthday, $jshopConfig->field_birthday_format);
     $client_types = array();
     foreach ($jshopConfig->user_field_client_type as $key => $value) {
         $client_types[] = JHTML::_('select.option', $key, $value, 'id', 'name');
     }
     $select_client_types = JHTML::_('select.genericlist', $client_types, 'client_type', 'class = "inputbox" onchange="showHideFieldFirm(this.value)"', 'id', 'name', $order->client_type);
     $jshopConfig->user_field_client_type[0] = "";
     if (isset($jshopConfig->user_field_client_type[$order->client_type])) {
         $order->client_type_name = $jshopConfig->user_field_client_type[$order->client_type];
     } else {
         $order->client_type_name = '';
     }
     $tmp_fields = $jshopConfig->getListFieldsRegister();
     $config_fields = $tmp_fields["address"];
     $count_filed_delivery = $jshopConfig->getEnableDeliveryFiledRegistration('address');
     $pm_method = JTable::getInstance('paymentMethod', 'jshop');
     $pm_method->load($order->payment_method_id);
     $order->payment_name = $pm_method->{$name};
     $order->order_tax_list = $order->getTaxExt();
     $_currency = $this->getModel("currencies");
     $currency_list = $_currency->getAllCurrencies();
     $order_currency = 0;
     foreach ($currency_list as $k => $v) {
         if ($v->currency_code_iso == $order->currency_code_iso) {
             $order_currency = $v->currency_id;
         }
     }
     $select_currency = JHTML::_('select.genericlist', $currency_list, 'currency_id', 'class = "inputbox"', 'currency_id', 'currency_code', $order_currency);
     $display_price_list = array();
     $display_price_list[] = JHTML::_('select.option', 0, _JSHOP_PRODUCT_BRUTTO_PRICE, 'id', 'name');
     $display_price_list[] = JHTML::_('select.option', 1, _JSHOP_PRODUCT_NETTO_PRICE, 'id', 'name');
     $display_price_select = JHTML::_('select.genericlist', $display_price_list, 'display_price', 'onchange="updateOrderTotalValue();"', 'id', 'name', $order->display_price);
     $shippings = $this->getModel("shippings");
     $shippings_list = $shippings->getAllShippings(0);
     $shippings_select = JHTML::_('select.genericlist', $shippings_list, 'shipping_method_id', '', 'shipping_id', 'name', $order->shipping_method_id);
     $payments = $this->getModel("payments");
     $payments_list = $payments->getAllPaymentMethods(0);
     $payments_select = JHTML::_('select.genericlist', $payments_list, 'payment_method_id', '', 'payment_id', 'name', $order->payment_method_id);
     $deliverytimes = JSFactory::getAllDeliveryTime();
     $first = array(0 => "- - -");
     $delivery_time_select = JHTML::_('select.genericlist', array_merge($first, $deliverytimes), 'delivery_times_id', '', 'id', 'name', $order->delivery_times_id);
     $users = $this->getModel('users');
     $users_list = $users->getUsers();
     $first = array(0 => '- - -');
     $users_list_select = JHTML::_('select.genericlist', array_merge($first, $users_list), 'user_id', 'onchange="updateBillingShippingForUser(this.value);"', 'user_id', 'name', $order->user_id);
     filterHTMLSafe($order);
     foreach ($order_items as $k => $v) {
         JFilterOutput::objectHTMLSafe($order_items[$k]);
     }
     JHTML::_('behavior.calendar');
     $view = $this->getView("orders", 'html');
     $view->setLayout("edit");
     $view->assign('config', $jshopConfig);
     $view->assign('order', $order);
     $view->assign('order_items', $order_items);
     $view->assign('config_fields', $config_fields);
     $view->assign('etemplatevar', '');
     $view->assign('count_filed_delivery', $count_filed_delivery);
     $view->assign('order_id', $order_id);
     $view->assign('select_countries', $select_countries);
     $view->assign('select_d_countries', $select_d_countries);
     $view->assign('select_titles', $select_titles);
     $view->assign('select_d_titles', $select_d_titles);
     $view->assign('select_client_types', $select_client_types);
     $view->assign('select_currency', $select_currency);
     $view->assign('display_price_select', $display_price_select);
     $view->assign('shippings_select', $shippings_select);
     $view->assign('payments_select', $payments_select);
     $view->assign('select_language', $select_language);
     $view->assign('delivery_time_select', $delivery_time_select);
     $view->assign('users_list_select', $users_list_select);
     $view->assign('client_id', $client_id);
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeEditOrders', array(&$view));
     $view->displayEdit();
 }
 function loadproductinfo()
 {
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onLoadInfoProduct', array());
     $id_vendor_cuser = getIdVendorForCUser();
     $product_id = JRequest::getInt('product_id');
     $layout = JRequest::getVar('layout', 'productinfo_json');
     if ($id_vendor_cuser && $product_id) {
         checkAccessVendorToProduct($id_vendor_cuser, $product_id);
     }
     $products = $this->getModel("products");
     $product = JTable::getInstance('product', 'jshop');
     $product->load($product_id);
     $product->getDescription();
     $res = array();
     $res['product_id'] = $product->product_id;
     $res['product_ean'] = $product->product_ean;
     $res['product_price'] = $product->product_price;
     $res['delivery_times_id'] = $product->delivery_times_id;
     $res['vendor_id'] = fixRealVendorId($product->vendor_id);
     $res['product_weight'] = $product->product_weight;
     $res['product_tax'] = $product->getTax();
     $res['product_name'] = $product->name;
     $res['thumb_image'] = getPatchProductImage($product->image, 'thumb');
     $view = $this->getView("product_edit", 'html');
     $view->setLayout($layout);
     $view->assign('res', $res);
     $view->assign('edit', null);
     $view->assign('product', $product);
     $dispatcher->trigger('onBeforeDisplayLoadInfoProduct', array(&$view));
     $view->display();
     die;
 }
 function loadproductinfo()
 {
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onLoadInfoProduct', array());
     $id_vendor_cuser = getIdVendorForCUser();
     $product_id = JRequest::getInt('product_id');
     $currency_id = JRequest::getInt('currency_id');
     $layout = JRequest::getVar('layout', 'productinfo_json');
     if ($id_vendor_cuser && $product_id) {
         checkAccessVendorToProduct($id_vendor_cuser, $product_id);
     }
     $products = JSFactory::getModel("products");
     $product = JSFactory::getTable('product', 'jshop');
     $product->load($product_id);
     $product->getDescription();
     $currency = JSFactory::getTable('currency', 'jshop');
     $currency->load($currency_id);
     if ($currency_id) {
         $currency_value = $currency->currency_value;
     } else {
         $currency_value = 1;
     }
     $product_price = getPriceFromCurrency($product->product_price, $product->currency_id, $currency_value);
     $res = array();
     $res['product_id'] = $product->product_id;
     $res['product_ean'] = $product->product_ean;
     $res['product_price'] = $product_price;
     $res['delivery_times_id'] = $product->delivery_times_id;
     $res['vendor_id'] = fixRealVendorId($product->vendor_id);
     $res['product_weight'] = $product->product_weight;
     $res['product_tax'] = $product->getTax();
     $res['product_name'] = $product->name;
     $res['thumb_image'] = $product->product_thumb_image;
     $view = $this->getView("product_edit", 'html');
     $view->setLayout($layout);
     $view->assign('res', $res);
     $view->assign('product', $product);
     $dispatcher->trigger('onBeforeDisplayLoadInfoProduct', array(&$view));
     $view->display();
     die;
 }
示例#5
0
    function edit(){
        $mainframe =& JFactory::getApplication();                         
        $order_id = JRequest::getVar("order_id");
        $lang = &JSFactory::getLang();
        $db = &JFactory::getDBO();
        $jshopConfig = &JSFactory::getConfig();
        $orders = &$this->getModel("orders");
        $order = &JTable::getInstance('order', 'jshop');
        $order->load($order_id);
        $name = $lang->get("name");
        
        $id_vendor_cuser = getIdVendorForCUser();
        if ($jshopConfig->admin_show_vendors && $id_vendor_cuser){
            if ($order->vendor_id!=$id_vendor_cuser) {
                $mainframe->redirect('index.php', JText::_('ALERTNOTAUTH'));
                return 0;
            }
        }    

        $order_items = $order->getAllItems();
        
        $country = &JTable::getInstance('country', 'jshop');
        $countries = $country->getAllCountries();
        $select_countries = JHTML::_('select.genericlist', $countries, 'country', 'class = "inputbox"','country_id', 'name', $order->country );
        $select_d_countries = JHTML::_('select.genericlist', $countries, 'd_country', 'class = "inputbox"','country_id', 'name', $order->d_country);
        
        $client_types = array(); 
        foreach ($jshopConfig->user_field_client_type as $key => $value) {        
            $client_types[] = JHTML::_('select.option', $key, $value, 'id', 'name' );
        }
        $select_client_types = JHTML::_('select.genericlist', $client_types,'client_type','class = "inputbox" onchange="showHideFieldFirm(this.value)"','id','name', $order->client_type);

        $jshopConfig->user_field_client_type[0]="";
        $order->client_type_name = $jshopConfig->user_field_client_type[$order->client_type];
        
        $tmp_fields = $jshopConfig->getListFieldsRegister();
        $config_fields = $tmp_fields["address"];
        $count_filed_delivery = 0;
        foreach($config_fields as $k=>$v){
            if (substr($k, 0, 2)=="d_" && $v['display']==1) $count_filed_delivery++;
        }
        
        $pm_method = &JTable::getInstance('paymentMethod', 'jshop');
        $pm_method->load($order->payment_method_id);
        $order->payment_name = $pm_method->$name;      
        
        $order->order_tax_list = $order->getTaxExt();
        
        $view=&$this->getView("orders_edit", 'html');                
        $view->assign('config', $jshopConfig); 
        $view->assign('order', $order);  
        $view->assign('order_items', $order_items); 
        $view->assign('config_fields', $config_fields);
        $view->assign('count_filed_delivery', $count_filed_delivery);
        $view->assign('order_id',$order_id);
        $view->assign('select_countries', $select_countries);
        $view->assign('select_d_countries', $select_d_countries);
        $view->assign('select_client_types', $select_client_types);

        $view->display();
    }