/** * Fetch custom Element view. * * @param string $name Field Name. * @param mixed $value Field value. * @param mixed $node Field node. * @param mixed $control_name Field control_name/Id. * * @since 2.2 * @return null */ public function fetchElement($name, $value, $node, $control_name) { $db = JFactory::getDBO(); $user = JFactory::getUser(); $comquick2cartHelper = new comquick2cartHelper(); // Getting user accessible store ids $storeList = $comquick2cartHelper->getStoreIds(); $options = array(); $app = JFactory::getApplication(); $jinput = $app->input; $zone_id = $jinput->get('id'); $defaultSstore_id = 0; if ($zone_id) { // Load Zone helper. $path = JPATH_SITE . DS . "components" . DS . "com_quick2cart" . DS . 'helpers' . DS . "zoneHelper.php"; if (!class_exists('zoneHelper')) { JLoader::register('zoneHelper', $path); JLoader::load('zoneHelper'); } $zoneHelper = new zoneHelper(); $defaultSstore_id = $zoneHelper->getZoneStoreId($zone_id); } foreach ($storeList as $store) { $storename = ucfirst($store['title']); $options[] = JHtml::_('select.option', $store['store_id'], $storename); } $fieldName = $name; return JHtml::_('select.genericlist', $options, $fieldName, 'class="inputbox required" size="1" ', 'value', 'text', $defaultSstore_id, $control_name); }
/** * Fetch custom Element view. * * @param string $name Field Name. * @param mixed $value Field value. * @param mixed $node Field node. * @param mixed $control_name Field control_name/Id. * * @since 2.2 * @return null */ public function fetchElement($name, $value, $node, $control_name) { $db = JFactory::getDBO(); $user = JFactory::getUser(); // Load Zone helper. $path = JPATH_SITE . DS . "components" . DS . "com_quick2cart" . DS . 'helpers' . DS . "zoneHelper.php"; JLoader::register('zoneHelper', $path); JLoader::load('zoneHelper'); $zoneHelper = new zoneHelper(); // Get user's accessible zone list $zoneList = $zoneHelper->getUserZoneList('', array(1)); $options = array(); $app = JFactory::getApplication(); $jinput = $app->input; $taxrate_id = $jinput->get('id'); $defaultZoneid = ""; if ($taxrate_id) { $defaultZoneid = $zoneHelper->getZoneFromTaxRateId($taxrate_id); } foreach ($zoneList as $zone) { $zoneName = ucfirst($zone['name']); $options[] = JHtml::_('select.option', $zone['id'], $zoneName); } $fieldName = $name; return JHtml::_('select.genericlist', $options, $fieldName, 'class="inputbox required" size="1" ', 'value', 'text', $defaultZoneid, $control_name); }
/** * 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); }
/** * Display the view */ public function display($tpl = null) { $this->params = JComponentHelper::getParams('com_quick2cart'); $comquick2cartHelper = new comquick2cartHelper(); $zoneHelper = new zoneHelper(); // Check whether view is accessible to user if (!$zoneHelper->isUserAccessible()) { return; } $qtcshiphelper = new qtcshiphelper(); $app = JFactory::getApplication(); $jinput = $app->input; $user = JFactory::getUser(); $layout = $jinput->get('layout', 'default'); $model = $this->getModel('shipprofileform'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors)); } if ($layout == 'default') { $this->state = $this->get('State'); $this->item = $this->get('Data'); $this->form = $this->get('Form'); // Check whether user is authorized for this zone ? if (!empty($this->item->store_id)) { $status = $comquick2cartHelper->store_authorize('shipprofileform_default', $this->item->store_id); if (!$status) { $zoneHelper->showUnauthorizedMsg(); return false; } } // Get store name while edit view if (!empty($this->item->id) && !empty($this->item->store_id)) { $comquick2cartHelper = new comquick2cartHelper(); $this->storeDetails = $comquick2cartHelper->getSoreInfo($this->item->store_id); $this->shipPluglist = $model->getShipPluginListSelect(); } // Get shipping profile_id $shipprofile_id = $app->input->get('id', 0); // Getting saved tax rules. if (!empty($shipprofile_id)) { $this->shipMethods = $model->getShipMethods($shipprofile_id); } } else { $this->qtcShipProfileId = $jinput->get('id'); $this->shipmethId = $jinput->get('shipmethId', 0); $shipProfileDetail = $this->shipProfileDetail = $qtcshiphelper->getShipProfileDetail($this->qtcShipProfileId); // Getting saved tax rules. if (!empty($this->shipmethId) && !empty($shipProfileDetail['store_id'])) { // GET PLUGIN DETAIL $this->plgDetail = $qtcshiphelper->getPluginDetailByShipMethId($this->shipmethId); $this->shipPluglist = $model->getShipPluginListSelect($this->plgDetail['extension_id']); // Get plugin shipping methods $qtcshiphelper = new qtcshiphelper(); $this->response = $qtcshiphelper->qtcLoadShipPlgMethods($this->plgDetail['extension_id'], $shipProfileDetail['store_id'], $this->plgDetail['methodId']); } } $this->_prepareDocument(); parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { $comquick2cartHelper = new comquick2cartHelper(); $zoneHelper = new zoneHelper(); // Check whether view is accessible to user if (!$zoneHelper->isUserAccessible()) { return; } $app = JFactory::getApplication(); $user = JFactory::getUser(); $this->state = $this->get('State'); $this->item = $this->get('Data'); $this->params = $app->getParams('com_quick2cart'); $this->form = $this->get('Form'); if (!empty($this->item->zone_id)) { $zoneDetail = $zoneHelper->getZoneDetail($this->item->zone_id); // Check whether user is authorized for this zone ? if (!empty($zoneDetail['store_id'])) { $status = $comquick2cartHelper->store_authorize('taxrateform_default', $zoneDetail['store_id']); if (!$status) { $zoneHelper->showUnauthorizedMsg(); return false; } } } // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors)); } $this->_prepareDocument(); parent::display($tpl); }
/** * 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) { $app = JFactory::getApplication(); $user = JFactory::getUser(); if (!$user->id) { ?> <div class="<?php echo Q2C_WRAPPER_CLASS; ?> my-coupons"> <div class="well" > <div class="alert alert-error"> <span><?php echo JText::_('QTC_LOGIN'); ?> </span> </div> </div> </div> <?php return false; } $zoneHelper = new zoneHelper(); // Check whether view is accessible to user if (!$zoneHelper->isUserAccessible()) { return; } $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)); } $this->publish_states = array('' => JText::_('JOPTION_SELECT_PUBLISHED'), '1' => JText::_('JPUBLISHED'), '0' => JText::_('JUNPUBLISHED')); // Get toolbar path $comquick2cartHelper = new comquick2cartHelper(); $this->toolbar_view_path = $comquick2cartHelper->getViewpath('vendor', 'toolbar'); // get store id (list))from model and pass to getManagecoupon() $this->store_role_list = $store_role_list = $comquick2cartHelper->getStoreIds(); if ($this->store_role_list) { $this->store_id = $store_id = !empty($change_storeto) ? $change_storeto : $store_role_list[0]['store_id']; $this->selected_store = $store_id; if ($this->store_id) { //$this->authorized_store_id= storeid of user $this->authorized_store_id = $authorized_store_id = $comquick2cartHelper->createCouponAuthority($store_id); } } // Setup TJ toolbar $this->addTJtoolbar(); $this->_prepareDocument(); parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { $zoneHelper = new zoneHelper(); $comquick2cartHelper = new comquick2cartHelper(); // Check whether view is accessible to user if (!$zoneHelper->isUserAccessible('zoneform', "default", 'form')) { return; } $app = JFactory::getApplication(); $previousId = JFactory::getApplication()->input->get('id'); $user = JFactory::getUser(); $jinput = $app->input; $layout = $jinput->get('layout', ''); $this->state = $this->get('State'); $this->item = $this->get('Data'); $this->params = $app->getParams('com_quick2cart'); $this->form = $this->get('Form'); $model = $this->getModel('zoneform'); if ($this->item) { // Getting countries $country = $model->getCountry(); $this->country = $country; // Getting zone rules $this->geozonerules = $model->getZoneRules(); // Check whether user is authorized for this zone ? if (!empty($this->item->store_id)) { $status = $comquick2cartHelper->store_authorize('zoneform_default'); if (!$status) { $zoneHelper->showUnauthorizedMsg(); return false; } } } // For edit zone rules if ($layout === 'setrule') { $this->rule_id = $jinput->get('zonerule_id'); // Getting zone rule detail $this->ruleDetail = $model->getZoneRuleDetail($this->rule_id); if (!empty($this->ruleDetail->country_id)) { // Getting Regions from country $this->getRegionList = $model->getRegionList($this->ruleDetail->country_id); } // Getting countries $country = $model->getCountry(); $this->country = $country; $app->setUserState('com_quick2cart.edit.zone.id', $previousId); } // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors)); } $this->_prepareDocument(); parent::display($tpl); }
/** * Method to get profiles tax rule(s) detail. * * @param string $taxRule_id Tax rule id. * * @since 2.2 * @return null object. */ public function getTaxRules($taxprofile_id = '', $taxRule_id = '') { $zoneHelper = new zoneHelper(); return $zoneHelper->getTaxRules($taxprofile_id, $taxRule_id); }
function display($tpl = null) { $comquick2cartHelper = new comquick2cartHelper(); $app = JFactory::getApplication(); $this->params = $app->getParams('com_quick2cart'); $zoneHelper = new zoneHelper(); // Check whether view is accessible to user if (!$zoneHelper->isUserAccessible()) { return; } $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $option = 'com_quick2cart'; $nameSpace = 'com_quick2cart.shipping'; $task = $jinput->get('task'); $view = $jinput->get('view', ''); $layout = $jinput->get('layout', 'default'); // Get other vars $this->toolbar_view_path = $comquick2cartHelper->getViewpath('vendor', 'toolbar'); if ($layout == 'default') { // Display list of pluigns $filter_order = $mainframe->getUserStateFromRequest($nameSpace . 'filter_order', 'filter_order', 'tbl.id', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($nameSpace . 'filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_orderstate = $mainframe->getUserStateFromRequest($nameSpace . 'filter_orderstate', 'filter_orderstate', '', 'string'); $filter_name = $mainframe->getUserStateFromRequest($nameSpace . 'filter_name', 'filter_name', 'tbl.name', 'cmd'); $search = $mainframe->getUserStateFromRequest($nameSpace . 'search', 'search', '', 'string'); if (strpos($search, '"') !== false) { $search = str_replace(array('=', '<'), '', $search); } $search = JString::strtolower($search); $model = $this->getModel('shipping'); // Get data from the model $items = $this->get('Items'); $total = $model->getTotal(); $pagination = $model->getPagination(); if (count($items) == 1) { // If there is only one plug then redirct to that shipping view $extension_id = $items[0]->extension_id; $this->form = ''; if ($extension_id) { $this->form = $this->getShipPluginForm($extension_id); $plugConfigLink = "index.php?option=com_quick2cart&task=shipping.getShipView&extension_id=" . $extension_id; $CpItemid = $comquick2cartHelper->getItemId('index.php?option=com_quick2cart&view=vendor&layout=cp'); $redirect = JRoute::_($plugConfigLink . '&Itemid=' . $itemid, false); $app->redirect($redirect); } } // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $lists['filter_name'] = $filter_name; // search filter $lists['search'] = $search; $this->assignRef('lists', $lists); $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); } elseif ($layout == 'list') { $this->form = ''; $extension_id = $jinput->get('extension_id'); if ($extension_id) { $this->form = $this->getShipPluginForm($extension_id); } } //JToolBarHelper::title(JText::_('COM_QUICK2CART_SHIPM_SHIPPING_METHODS','quick2cart-logo'); //JToolBarHelper::title(JText::_('COM_QUICK2CART_SHIPM_SHIPPING_METHODS')); parent::display($tpl); }
/** * @version SVN: <svn_id> * @package Quick2cart * @author Techjoomla <*****@*****.**> * @copyright Copyright (c) 2009-2015 TechJoomla. All rights reserved. * @license GNU General Public License version 2 or later. */ // no direct access defined('_JEXEC') or die; JHtml::_('behavior.modal'); require_once JPATH_SITE . '/plugins/tjshipping/qtc_default_zoneshipping/qtc_default_zoneshipping/qtczoneShipHelper.php'; $qtczoneShipHelper = new qtczoneShipHelper(); $comquick2cartHelper = new comquick2cartHelper(); $productHelper = new productHelper(); $zoneHelper = new zoneHelper(); $qtcshiphelper = new qtcshiphelper(); $taxHelper = new taxHelper(); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $extension_id = $jinput->get('extension_id'); $methodId = $jinput->get('methodId', 0); $shipMethDetail = $qtcshiphelper->getShipMethDetail($methodId); $itemid = $comquick2cartHelper->getitemid('index.php?option=com_quick2cart&view=vendor&layout=cp'); if (!empty($methodId)) { $status = $comquick2cartHelper->store_authorize('', $shipMethDetail['store_id']); if (!$status) { $zoneHelper->showUnauthorizedMsg(); return false; } }
/** * Method to delete a row from the database table by primary key value. * * @param array $items An array of primary key value to delete. * * @return int Returns count of success */ public function delete($items) { $user = JFactory::getUser(); $db = JFactory::getDBO(); $ids = ''; $app = JFactory::getApplication(); $ids = count($items) > 1 ? implode(',', $items) : $items[0]; $path = JPATH_SITE . '/components/com_quick2cart/helpers/zoneHelper.php'; if (!class_exists('zoneHelper')) { JLoader::register('zoneHelper', $path); JLoader::load('zoneHelper'); } $zoneHelper = new zoneHelper(); if (is_array($items)) { $successCount = 0; foreach ($items as $id) { // Check whether zone is allowed to delete or not. If not the enqueue error message accordingly. $count_id = $zoneHelper->isAllowedToDelZone($id); if ($count_id === true) { try { $query = $db->getQuery(true)->delete('#__kart_zone')->where('id =' . $id); $db->setQuery($query); if (!$db->execute()) { $this->setError($this->_db->getErrorMsg()); return 0; } } catch (RuntimeException $e) { $this->setError($e->getMessage()); throw new Exception($this->_db->getErrorMsg()); return 0; } // For enqueue success msg along with error msg. $successCount += 1; } } return $successCount; } }
/** * Method to get the users tax rule select box. * * @param string $default_val default value of select box. * * @since 2.2 * @return null object of tax rule select box. */ public function getTaxRateListSelect($store_id, $default_val = '') { $zoneHelper = new zoneHelper(); // Get tax rate list $taxrates = $zoneHelper->getUserTaxRateList($store_id); $taxrate_options = array(); $taxrate_options[] = JHtml::_('select.option', '', JText::_('COM_QUICK2CART_SELECT_TAXRATE')); foreach ($taxrates as $item) { $name = $item->name . ' (' . floatval($item->percentage) . '%)'; $taxrate_options[] = JHtml::_('select.option', $item->id, $name); } $taxrate_list = JHtml::_('select.genericlist', $taxrate_options, 'jform[taxrate_id]', '', 'value', 'text', $default_val); return $taxrate_list; }
/** * This function load data which is require for edit rate layout (INTERNAL USE ONLY). * * @param object $jinput Joomla's jinput Object. * * @since 2.2 * @return Layoutdata. */ function loadViewDataForEditrate($jinput) { $qtcshiphelper = new qtcshiphelper(); $shipFormData = array(); $rateId = $jinput->get('rateId', 0); if (!empty($rateId)) { // Get rate detials $shipFormData['rateDetail'] = $qtcshiphelper->getShipMethRateDetail($rateId); } $qtcshiphelper = new qtcshiphelper(); // Load Zone helper. $path = JPATH_SITE . DS . "components" . DS . "com_quick2cart" . DS . 'helpers' . DS . "zoneHelper.php"; JLoader::register('zoneHelper', $path); JLoader::load('zoneHelper'); $zoneHelper = new zoneHelper(); // Get user's accessible zone list $shipFormData['zonelist'] = $zoneHelper->getUserZoneList(); return $shipFormData; }
defined('_JEXEC') or die; jimport('joomla.form.formvalidator'); jimport('joomla.html.pane'); JHtml::_('behavior.formvalidation'); JHtml::_('behavior.tooltip'); JHtmlBehavior::framework(); jimport('joomla.html.parameter'); $comquick2cartHelper = new comquick2cartHelper(); $qtczoneShipHelper = new qtczoneShipHelper(); $path = JPATH_SITE . '/components/com_quick2cart/helpers/storeHelper.php'; if (!class_exists('storeHelper')) { //require_once $path; JLoader::register('storeHelper', $path); JLoader::load('storeHelper'); } $zoneHelper = new zoneHelper(); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $extension_id = $jinput->get('extension_id', 0); ?> <script type="text/javascript"> function myValidate(f) { var msg = "<?php echo JText::_("PLG_QTC_DEFAULT_ZONESHIPPING_NOT_ACCEPTABLE_FORM"); ?> "; //vm PRODUCT LAEVAL COP COMPULSORY ::coupon exist then only allow to save & check for other validation if (document.formvalidator.isValid(f)) {
/** * Display the view */ public function display($tpl = null) { $comquick2cartHelper = new comquick2cartHelper(); $zoneHelper = new zoneHelper(); // Check whether view is accessible to user if (!$zoneHelper->isUserAccessible()) { return; } $app = JFactory::getApplication(); $jinput = $app->input; $user = JFactory::getUser(); $this->params = $app->getParams('com_quick2cart'); $layout = $jinput->get('layout', 'default'); $model = $this->getModel('taxprofileform'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors)); } if ($layout == 'default') { $this->state = $this->get('State'); $this->item = $this->get('Data'); $this->form = $this->get('Form'); // Get taxprofile_id $taxprofile_id = $app->input->get('id', 0); // Getting saved tax rules. if (!empty($taxprofile_id)) { $this->taxrules = $model->getTaxRules($taxprofile_id); } // Check whether user is authorized for this zone ? if (!empty($this->item->store_id)) { $status = $comquick2cartHelper->store_authorize('taxprofileform_default', $this->item->store_id); if (!$status) { $zoneHelper->showUnauthorizedMsg(); return false; } } // Get store name while edit view if (!empty($this->item->id) && !empty($this->item->store_id)) { $comquick2cartHelper = new comquick2cartHelper(); $this->storeDetails = $comquick2cartHelper->getSoreInfo($this->item->store_id); // Getting tax rates and Adress types $this->taxrate = $model->getTaxRateListSelect($this->item->store_id, ''); $this->address = $model->getAddressList(); } // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors)); } } else { $this->taxRule_id = $jinput->get('id'); $defaultTaxRateId = ''; $defaultAddressId = ''; // Getting saved tax rules. if (!empty($this->taxRule_id)) { $this->taxrules = $model->getTaxRules('', $this->taxRule_id); if (!empty($this->taxrules)) { $defaultTaxRateId = $this->taxrules[0]->taxrate_id; $defaultAddressId = $this->taxrules[0]->address; } // Get store id of taxrule $taxHelper = new taxHelper(); $store_id = $taxHelper->getStoreIdFromTaxrule($this->taxRule_id); if (empty($store_id)) { $this->qtcStoreNotFoundMsg(); } // Getting tax rates and Adress types $this->taxrate = $model->getTaxRateListSelect($store_id, $defaultTaxRateId); $this->address = $model->getAddressList($defaultAddressId); } } $this->_prepareDocument(); parent::display($tpl); }
public function delete($pk = null) { $zoneHelper = new zoneHelper(); if ($pk) { // Check whether zone is allowed to delete or not. If not the enqueue error message accordingly. $count_id = $zoneHelper->isAllowedToDelZone($pk); if ($count_id === true) { $this->load($pk); $result = parent::delete($pk); if ($result) { } return $result; } } }