Esempio n. 1
0
 /**
  * Display the view
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $zoneHelper = new zoneHelper();
     // Check whether view is accessible to user
     if (!$zoneHelper->isUserAccessible()) {
         return;
     }
     $app = JFactory::getApplication();
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->params = $app->getParams('com_quick2cart');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     // Get user store list
     $storeHelper = new storeHelper();
     // Get all stores.
     $user = JFactory::getUser();
     $this->userStores = $storeHelper->getUserStore($user->id);
     // Get toolbar path
     $comquick2cartHelper = new comquick2cartHelper();
     $this->toolbar_view_path = $comquick2cartHelper->getViewpath('vendor', 'toolbar');
     // Publish states
     $this->publish_states = array('' => JText::_('JOPTION_SELECT_PUBLISHED'), '1' => JText::_('JPUBLISHED'), '0' => JText::_('JUNPUBLISHED'));
     // Setup TJ toolbar
     $this->addTJtoolbar();
     $this->_prepareDocument();
     parent::display($tpl);
 }
Esempio n. 2
0
 /**
  * Displays the application output in the canvas.
  *
  * @param   int   The user id that is currently being viewed.
  * @param   string   layout path
  * @since   1.0
  * @access  public
  */
 public function display($userId = null, $docType = null)
 {
     // Get the user params
     $params = $this->getUserParams($userId);
     // Get the app params
     $appParams = $this->app->getParams();
     // Get the blog model
     $total = (int) $params->get('total', $appParams->get('total', 5));
     $pin_width = (int) $appParams->get('pin_width', 145);
     $pin_padding = (int) $appParams->get('pin_padding', 3);
     // Get list of all products created by the user on the site.
     $input = JFactory::getApplication()->input;
     $storeid = $input->get('storeid', '', 'INT');
     $model = $this->getModel('q2cmyproducts');
     $products = $model->getItems($userId, $total, $storeid);
     $productsCount = $model->getProductsCount($userId, $storeid);
     $user = Foundry::user($userId);
     // Get store list of user
     require_once JPATH_ROOT . '/components/com_quick2cart/helpers/storeHelper.php';
     $storeHelper = new storeHelper();
     $storelist = $storeHelper->getUserStore($userId);
     $this->set('user', $user);
     $this->set('userId', $userId);
     $this->set('total', $total);
     $this->set('pin_width', $pin_width);
     $this->set('pin_padding', $pin_padding);
     $this->set('products', $products);
     $this->set('productsCount', $productsCount);
     $this->set('storelists', $storelist);
     echo parent::display('profile/default');
 }
Esempio n. 3
0
 /**
  * Method to get a list of options for a list input.
  *
  * @return	array		An array of JHtml options.
  *
  * @since   11.4
  */
 protected function getOptions()
 {
     require_once JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'helpers' . DS . 'storeHelper.php';
     $storeHelper = new storeHelper();
     // Get all stores.
     $user = JFactory::getUser();
     $stores = $storeHelper->getUserStore($user->id);
     $options = array();
     //$options[] = JHtml::_('select.option', '', JText::_('QTC_SELET_STORE'));
     foreach ($stores as $key => $value) {
         $options[] = JHtml::_('select.option', $value['id'], $value['title']);
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Esempio n. 4
0
 /**
  * Build an SQL query to load the list data.
  *
  * @return	JDatabaseQuery
  *
  * @since	1.6
  */
 protected function getListQuery()
 {
     $storeHelper = new storeHelper();
     // Get all stores.
     $user = JFactory::getUser();
     $storeList = $storeHelper->getUserStore($user->id);
     $storeIds = array();
     foreach ($storeList as $store) {
         $storeIds[] = $store['id'];
     }
     $accessibleStoreIds = '';
     if (!empty($storeIds)) {
         $accessibleStoreIds = implode(',', $storeIds);
     } else {
         // Accessed view before creating the store.
         $accessibleStoreIds = '-1';
     }
     // Create a new query object.
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     // Select the required fields from the table.
     $query->select($this->getState('list.select', 'a.*'));
     $query->from('`#__kart_shipprofile` AS a');
     $query->where('(a.store_id IN (' . $accessibleStoreIds . '))');
     // Filter by published state
     $published = $this->getState('filter.state');
     if (is_numeric($published)) {
         $query->where('a.state = ' . (int) $published);
     } elseif ($published === '') {
         $query->where('(a.state IN (0, 1))');
     }
     // Filter by search in title
     $search = $this->getState('filter.search');
     if (!empty($search)) {
         if (stripos($search, 'id:') === 0) {
             $query->where('a.id = ' . (int) substr($search, 3));
         } else {
             $search = $db->Quote('%' . $db->escape($search, true) . '%');
             $query->where('( a.name LIKE ' . $search . ' )');
         }
     }
     return $query;
 }
Esempio n. 5
0
 /**
  * Display the view
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $this->params = JComponentHelper::getParams('com_quick2cart');
     $mainframe = JFactory::getApplication();
     $input = $mainframe->input;
     $option = $input->get('option');
     $layout = $input->get('layout', 'default');
     $this->comquick2cartHelper = new comquick2cartHelper();
     $this->productHelper = new productHelper();
     $storeHelper = new storeHelper();
     $productHelper = new productHelper();
     if ($layout == 'default') {
         $this->products = $this->items = $this->get('Items');
         $this->pagination = $this->get('Pagination');
         $this->state = $this->get('State');
         $this->filterForm = $this->get('FilterForm');
         $this->activeFilters = $this->get('ActiveFilters');
         // Creating status filter.
         $sstatus = array();
         if (JVERSION < '3.0') {
             $sstatus[] = JHtml::_('select.option', '', JText::_('JOPTION_SELECT_PUBLISHED'));
             $sstatus[] = JHtml::_('select.option', 1, JText::_('COM_QUICK2CART_PUBLISH'));
             $sstatus[] = JHtml::_('select.option', 0, JText::_('COM_QUICK2CART_UNPUBLISH'));
             $this->sstatus = $sstatus;
         }
         // Create clients array
         $clients = array();
         if (JVERSION < '3.0') {
             $clients[] = JHtml::_('select.option', '', JText::_('COM_QUICK2CART_FILTER_SELECT_CLIENT'));
             $clients[] = JHtml::_('select.option', 'com_quick2cart', JText::_('COM_QUICK2CART_NATIVE'));
             $clients[] = JHtml::_('select.option', 'com_content', JText::_('COM_QUICK2CART_CONTENT_ARTICLES'));
             $clients[] = JHtml::_('select.option', 'com_flexicontent', JText::_('COM_QUICK2CART_FLEXICONTENT'));
             $clients[] = JHtml::_('select.option', 'com_k2', JText::_('COM_QUICK2CART_K2'));
             $clients[] = JHtml::_('select.option', 'com_zoo', JText::_('COM_QUICK2CART_ZOO'));
             $this->clients = $clients;
         }
         // Get all stores.
         $this->store_details = $this->comquick2cartHelper->getAllStoreDetails();
     } elseif ($layout == "new") {
         // @TODO ADD CONDITION :: LOGGED IN USER MUST HV STORE
         // Gettting store id if store is changed
         $user = JFactory::getUser();
         global $mainframe;
         $mainframe = JFactory::getApplication();
         $change_storeto = $mainframe->getUserStateFromRequest('current_store', 'current_store', 0, 'INTEGER');
         // Get item_id from request from GET/POST
         $item_id = $mainframe->getUserStateFromRequest('item_id', 'item_id', '', 'STRING');
         // REMOVE FROM REQUEST
         $mainframe->setUserState('item_id', '');
         $this->client = $client = "com_quick2cart";
         $this->pid = 0;
         // LOAD CART MODEL
         $Quick2cartModelcart = $this->comquick2cartHelper->loadqtcClass(JPATH_SITE . "/components/com_quick2cart/models/cart.php", "Quick2cartModelcart");
         // If item_id NOT found then SET TO ''
         $this->item_id = '';
         // If edit task then fetch item DETAILS
         if (!empty($item_id)) {
             // Check whether called from backend
             $admin_call = $mainframe->getUserStateFromRequest('admin_call', 'admin_call', 0, 'INTEGER');
             if (!empty($admin_call)) {
                 // CHECK SPECIAL ACCESS
                 $special_access = $this->comquick2cartHelper->isSpecialAccess();
             }
             // Load Attributes model
             $path = '/components/com_quick2cart/models/attributes.php';
             $attri_model = $this->comquick2cartHelper->loadqtcClass(JPATH_SITE . $path, "quick2cartModelAttributes");
             // GET ITEM DETAIL
             $this->itemDetail = $itemDetail = $attri_model->getItemDetail(0, '', $item_id);
             // Getting attribure
             $this->item_id = !empty($this->itemDetail) ? $itemDetail['item_id'] : '';
             $this->allAttribues = $attri_model->getItemAttributes($this->item_id);
             $this->getMediaDetail = $productHelper->getMediaDetail($item_id);
             $this->store_id = $store_id = $this->store_role_list = $this->itemDetail['store_id'];
         } else {
             $storeHelper = new storeHelper();
             $storeList = (array) $storeHelper->getUserStore($user->id);
             $this->store_id = $storeList[0]['id'];
         }
         // IF ITEM_ID AND SPECIAL ACCESS EG ADMIN THEN FETCH STORE ID // means edit task
         // Else :
         if (!empty($item_id) && !empty($special_access)) {
             // WE DONT WANT TO SHOW STORE SELECT LIST
             $this->store_id = $store_id = $this->store_role_list = $this->itemDetail['store_id'];
         } else {
             $this->store_role_list = $store_role_list = $this->comquick2cartHelper->getStoreIds();
             // as no NEED TO CHECK AUTHORIZATION AT ADMINSIDE
             $storeHelper = new storeHelper();
             $this->defaultStoreId = $defaultStoreId = $storeHelper->getAdminDefaultStoreId();
             // get all store ids of vendor
             //	$this->authorized_store_id = $comquick2cartHelper->store_authorize("managecoupon_default",isset($change_storeto)?$change_storeto:$store_role_list[0]['store_id']);
             $this->store_id = $store_id = !empty($change_storeto) ? $change_storeto : $defaultStoreId;
             $this->selected_store = $store_id;
             if (!$this->store_id) {
                 $user = JFactory::getUser();
                 $storeHelper = $comquick2cartHelper->loadqtcClass(JPATH_SITE . DS . "components" . DS . "com_quick2cart" . DS . "helpers" . DS . "storeHelper.php", "storeHelper");
                 $storeList = (array) $storeHelper->getUserStore($user->id);
                 $this->store_id = $storeList[0]['id'];
             }
         }
         // ALL FETCH ALL CATEGORIES //$catid='',$onchangeSubmitForm=1,$name='prod_cat',$class=''
         if (!empty($this->itemDetail['category'])) {
             $this->cats = $this->comquick2cartHelper->getQ2cCatsJoomla($this->itemDetail['category'], 0, 'prod_cat', ' required ');
         } else {
             $this->cats = $this->comquick2cartHelper->getQ2cCatsJoomla('', 0, 'prod_cat', ' required ');
         }
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->addToolbar();
     if (JVERSION >= '3.0') {
         $this->sidebar = JHtmlSidebar::render();
     }
     parent::display($tpl);
 }
Esempio n. 6
0
 /**
  * Build an SQL query to load the list data.
  *
  * @return  JDatabaseQuery
  *
  * @since   1.6
  */
 protected function getListQuery()
 {
     // Create a new query object.
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     // Select the required fields from the table.
     $query->select($this->getState('list.select', 'a.*'));
     $query->from('`#__kart_zone` AS a');
     $query->select("s.title");
     $query->JOIN("LEFT", '#__kart_store AS s ON s.id = a.store_id');
     // Filter by published state
     $published = $this->getState('filter.state');
     if (is_numeric($published)) {
         $query->where('a.state = ' . (int) $published);
     } elseif ($published === '') {
         $query->where('(a.state IN (0, 1))');
     }
     $filter_store = $this->getState('filter.sel_store');
     if ($filter_store) {
         $query->where('a.store_id = ' . $filter_store);
     } else {
         // Getting user accessible store ids
         $storeHelper = new storeHelper();
         // Get all stores.
         $user = JFactory::getUser();
         $storeList = $storeHelper->getUserStore($user->id);
         $storeIds = array();
         foreach ($storeList as $store) {
             $storeIds[] = $store['id'];
         }
         $accessibleStoreIds = '';
         // Make string
         if (!empty($storeIds)) {
             $accessibleStoreIds = implode(',', $storeIds);
             $query->where('(a.store_id IN (' . $accessibleStoreIds . '))');
         } else {
             $query->where('a.store_id = -1');
         }
     }
     // Filter by search in title
     $search = $this->getState('filter.search');
     if (!empty($search)) {
         if (stripos($search, 'id:') === 0) {
             $query->where('a.id = ' . (int) substr($search, 3));
         } else {
             $search = $db->Quote('%' . $db->escape($search, true) . '%');
             $query->where('(a.name LIKE ' . $search . ')');
         }
     }
     // Add the list ordering clause.
     $orderCol = $this->state->get('list.ordering');
     $orderDirn = $this->state->get('list.direction');
     if ($orderCol && $orderDirn) {
         $query->order($db->escape($orderCol . ' ' . $orderDirn));
     }
     return $query;
 }
 /**
  * This function load data which is require for creatshipmeth layout (INTERNAL USE ONLY).
  *
  * @param   object  $jinput  Joomla's jinput Object.
  *
  * @since   2.2
  * @return   Layoutdata.
  */
 function ViewDataForShipmethListView($jinput)
 {
     $storeHelper = new storeHelper();
     // Get all stores.
     $user = JFactory::getUser();
     $storeList = $storeHelper->getUserStore($user->id);
     $storeIds = array();
     foreach ($storeList as $store) {
         $storeIds[] = $store['id'];
     }
     $accessibleStoreIds = '';
     if (!empty($storeIds)) {
         $accessibleStoreIds = implode(',', $storeIds);
     }
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select(" id AS methodId,name,taxprofileId,state,shipping_type,min_value,max_value")->from('#__kart_zoneShipMethods');
     $query->where('(store_id IN (' . $accessibleStoreIds . '))');
     $db->setQuery((string) $query);
     $data = $db->loadAssocList();
     return $data;
 }