/** * This function unpublishes taxrate. * * @since 2.2 * @return null */ function unpublish() { $app = JFactory::getApplication(); $input = JFactory::getApplication()->input; $cid = $input->get('cid', '', 'array'); JArrayHelper::toInteger($cid); $model = $this->getModel('shipprofiles'); if ($model->setItemState($cid, 0)) { $msg = JText::sprintf(JText::_('COM_QUICK2CART_S_SHIPPROFILE_UNPUBLISH_SUCCESSFULLY'), count($cid)); } $comquick2cartHelper = new comquick2cartHelper(); $itemid = $comquick2cartHelper->getItemId('index.php?option=com_quick2cart&view=vendor&layout=cp'); $redirect = JRoute::_('index.php?option=com_quick2cart&view=shipprofiles&Itemid=' . $itemid, false); $this->setMessage($msg); $this->setRedirect($redirect); }
function SendMailToOwner($values) { $app = JFactory::getApplication(); $mailfrom = $app->getCfg('mailfrom'); $fromname = $app->getCfg('fromname'); $sitename = $app->getCfg('sitename'); $loguser = JFactory::getUser(); $sendto = $loguser->email; $subject = JText::_('COM_Q2C_PRODUCT_AAPROVAL_OWNER_SUBJECT'); $subject = str_replace('{sellername}', $loguser->name, $subject); $comquick2cartHelper = new comquick2cartHelper(); $itemid = $comquick2cartHelper->getItemId('index.php?option=com_quick2cart&view=category&layout=default'); $body = JText::_('COM_Q2C_PRODUCT_AAPROVAL_OWNER_BODY'); $body = str_replace('{sellername}', $loguser->name, $body); $body = str_replace('{title}', $values->get('item_name', '', 'RAW'), $body); $body = str_replace('{link}', JUri::base() . 'index.php?option=com_quick2cart&view=category&layout=default&Itemid=' . $itemid, $body); $body = str_replace('{sitename}', $sitename, $body); $res = $comquick2cartHelper->sendmail($mailfrom, $subject, $body, $sendto); }
/** * Search Quick2cart (Products). * The SQL must return the following fields that are used in a common display * routine: href, title, section, created, text, browsernav. * * @param string $text Target search string. * @param string $phrase Matching option (possible values: exact|any|all). Default is "any". * @param string $ordering Ordering option (possible values: newest|oldest|popular|alpha|category). Default is "newest". * @param mixed $areas An array if the search it to be restricted to areas or null to search all areas. * * @return array Search results. * * @since 1.6 */ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null) { $db = JFactory::getDbo(); $app = JFactory::getApplication(); $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); $tag = JFactory::getLanguage()->getTag(); require_once JPATH_ADMINISTRATOR . '/components/com_search/helpers/search.php'; $searchText = $text; if (is_array($areas)) { if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) { return array(); } } $sContent = $this->params->get('search_products', 1); $limit = $this->params->def('search_limit', 50); $nullDate = $db->getNullDate(); $date = JFactory::getDate(); $now = $date->toSql(); $text = trim($text); if ($text == '') { return array(); } switch ($phrase) { case 'exact': $text = $db->quote('%' . $db->escape($text, true) . '%', false); $wheres2 = array(); $wheres2[] = 'a.name LIKE ' . $text; $wheres2[] = 'a.description LIKE ' . $text; $wheres2[] = 'a.metakey LIKE ' . $text; $wheres2[] = 'a.metadesc LIKE ' . $text; $where = '(' . implode(') OR (', $wheres2) . ')'; break; case 'all': case 'any': default: $words = explode(' ', $text); $wheres = array(); foreach ($words as $word) { $word = $db->quote('%' . $db->escape($word, true) . '%', false); $wheres2 = array(); $wheres2[] = 'a.name LIKE ' . $word; $wheres2[] = 'a.description LIKE ' . $word; $wheres2[] = 'a.metakey LIKE ' . $word; $wheres2[] = 'a.metadesc LIKE ' . $word; $wheres[] = implode(' OR ', $wheres2); } $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')'; break; } switch ($ordering) { case 'oldest': $order = 'a.cdate ASC'; break; /*case 'popular': $order = 'a.hits DESC'; break;*/ /*case 'popular': $order = 'a.hits DESC'; break;*/ case 'alpha': $order = 'a.name ASC'; break; case 'category': $order = 'c.title ASC, a.title ASC'; break; case 'newest': default: $order = 'a.cdate DESC'; break; } $rows = array(); $query = $db->getQuery(true); // Search products. if ($sContent && $limit > 0) { $query->clear(); $query->select('a.item_id, a.name AS title, a.metadesc, a.metakey, a.cdate AS created')->select('a.description AS text')->select('c.title AS section')->from('#__kart_items AS a')->join('INNER', '#__categories AS c ON c.id=a.category')->where('(' . $where . ') AND a.state=1 AND c.published = 1')->group('a.item_id, a.name, a.metadesc, a.metakey, a.cdate, a.description, c.title, c.id')->order($order); $db->setQuery($query, 0, $limit); $list = $db->loadObjectList(); $limit -= count($list); if (isset($list)) { $comquick2cartHelper = new comquick2cartHelper(); $itemid = $comquick2cartHelper->getItemId('index.php?option=com_quick2cart&view=productpage&layout=default'); foreach ($list as $key => $item) { $link = 'index.php?option=com_quick2cart&view=productpage&layout=default&item_id=' . $item->item_id . '&Itemid=' . $itemid; $list[$key]->href = JRoute::_($link, false); } } $rows[] = $list; } $results = array(); if (count($rows)) { foreach ($rows as $row) { $new_row = array(); foreach ($row as $article) { $article->browsernav = ''; if (SearchHelper::checkNoHTML($article, $searchText, array('text', 'title', 'metadesc', 'metakey'))) { $new_row[] = $article; } } $results = array_merge($results, (array) $new_row); } } return $results; }
function SendMailToOwnerAfterApproval($owner) { $comquick2cartHelper = new comquick2cartHelper(); $itemid = $comquick2cartHelper->getItemId('index.php?option=com_quick2cart&view=category&layout=default'); $app = JFactory::getApplication(); $fromname = $app->getCfg('fromname'); $sitename = $app->getCfg('sitename'); $subject = JText::_('COM_Q2C_PRODUCT_AAPROVED_SUBJECT'); $subject = str_replace('{sellername}', $owner->name, $subject); $body = JText::_('COM_Q2C_PRODUCT_APPROVED_BODY'); $body = str_replace('{name}', $owner->name, $body); $body = str_replace('{admin}', $fromname, $body); $body = str_replace('{link}', JUri::root() . 'index.php?option=com_quick2cart&view=category&layout=default&Itemid=' . $itemid, $body); $body = str_replace('{sitelink}', JUri::root(), $body); $body = str_replace('{sitename}', $sitename, $body); $res = $comquick2cartHelper->sendmail($owner->email, $subject, $body); return $res; }
function cancel() { $comquick2cartHelper = new comquick2cartHelper(); $itemid = $comquick2cartHelper->getItemId('index.php?option=com_quick2cart&view=vendor&layout=cp'); $redirect = JRoute::_('index.php?option=com_quick2cart&view=taxprofiles&Itemid=' . $itemid, false); $this->setMessage($msg); $this->setRedirect($redirect); }
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); }
<?php echo JText::_($item->name); ?> <p class="help"> <i>(<?php echo !empty($item->plugDescription) ? $item->plugDescription : ''; ?> )</i> </p> </td> <td> <?php $item->plugConfigLink = "index.php?option=com_quick2cart&task=shipping.getShipView&extension_id=" . $item->extension_id; $comquick2cartHelper = new comquick2cartHelper(); $CpItemid = $comquick2cartHelper->getItemId('index.php?option=com_quick2cart&view=vendor&layout=cp'); $redirect = JRoute::_($item->plugConfigLink . '&Itemid=' . $itemid, false); ?> <a class="btn btn-primary btn-small" target="" href="<?php echo !empty($item->plugConfigLink) ? $item->plugConfigLink : ''; ?> "> <strong><?php echo JText::_('COM_QUICK2CART_SHIPPING_EDIT_PLUGIN_PARAMS'); ?> </strong> </a> </td> </tr> <?php $i = $i + 1;
/** * This function publishes taxrate. * * @since 2.2 * @return null */ function publish() { $app = JFactory::getApplication(); $input = JFactory::getApplication()->input; $cid = $input->get('cid', '', 'array'); $data = array('publish' => 1, 'unpublish' => 0); $task = $this->getTask(); $value = JArrayHelper::getValue($data, $task, 0, 'int'); JArrayHelper::toInteger($cid); $model = $this->getModel('taxrates'); try { $successCount = $model->setItemState($cid, $value); if ($successCount) { if ($value === 1) { $ntext = 'COM_QUICK2CART_N_STORES_PUBLISHED'; } elseif ($value === 0) { $ntext = 'COM_QUICK2CART_N_STORES_UNPUBLISHED'; } $this->setMessage(JText::plural($ntext, count($cid))); } } catch (Exception $e) { $this->setMessage($e->getMessage(), 'error'); } $comquick2cartHelper = new comquick2cartHelper(); $itemid = $comquick2cartHelper->getItemId('index.php?option=com_quick2cart&view=vendor&layout=cp'); $redirect = JRoute::_('index.php?option=com_quick2cart&view=taxrates&Itemid=' . $itemid, false); $this->setRedirect($redirect); }
/** * Method use to delete shipprofile. * * @since 2.2 */ public function delete() { $app = JFactory::getApplication(); $input = JFactory::getApplication()->input; $cid = $input->get('cid', '', 'array'); JArrayHelper::toInteger($cid); $model = $this->getModel('shipprofile'); $successCount = $model->delete($cid); if ($successCount) { $msg = JText::sprintf('COM_QUICK2CART_S_SHIPPROFILE_DELETED_SUCCESSFULLY'); $app->enqueueMessage($ms); } else { $msg = JText::_('COM_QUICK2CART_S_SHIPPROFILE_ERROR_DELETE') . '</br>' . $model->getError(); $app->enqueueMessage($msg, 'error'); } $comquick2cartHelper = new comquick2cartHelper(); $itemid = $comquick2cartHelper->getItemId('index.php?option=com_quick2cart&view=vendor&layout=cp'); $redirect = JRoute::_('index.php?option=com_quick2cart&view=shipprofiles&Itemid=' . $itemid, false); $this->setRedirect($redirect); }
/** * Method use when new zone create * * @return void * * @since 1.6 */ public function delete() { $app = JFactory::getApplication(); $input = JFactory::getApplication()->input; $cid = $input->get('cid', '', 'array'); JArrayHelper::toInteger($cid); $model = $this->getModel('zones'); $successCount = $model->delete($cid); if ($successCount) { if ($successCount >= 1) { $msg = JText::sprintf(JText::_('COM_QUICK2CART_ZONE_DELETED'), $successCount); } } else { $msg = JText::_('COM_QUICK2CART_ZONE_ERROR_DELETE') . '</br>' . $model->getError(); } $comquick2cartHelper = new comquick2cartHelper(); $itemid = $comquick2cartHelper->getItemId('index.php?option=com_quick2cart&view=vendor&layout=cp'); $redirect = JRoute::_('index.php?option=com_quick2cart&view=zones&Itemid=' . $itemid, false); $this->setMessage($msg); $this->setRedirect($redirect); }