function listing() { $app = JFactory::getApplication(); $database = JFactory::getDBO(); $toggleClass = hikashop_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $pageInfo = $this->getPageInfo('a.warehouse_id'); $filters = array(); $order = ''; $searchMap = array('a.warehouse_id', 'a.warehouse_name', 'a.warehouse_description'); $this->processFilters($filters, $order, $searchMap); $query = ' FROM ' . hikashop_table('warehouse') . ' AS a' . $filters . $order; $this->getPageInfoTotal($query, '*'); $database->setQuery('SELECT a.*' . $query, $pageInfo->limit->start, $pageInfo->limit->value); $rows = $database->loadObjectList(); if (!empty($pageInfo->search)) { $rows = hikashop_search($pageInfo->search, $rows, 'warehouse_id'); } $database->setQuery('SELECT count(*)' . $query); $pageInfo->elements->page = count($rows); $toggleClass = hikashop_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->getPagination(); $this->getOrdering('a.warehouse_ordering', true); $this->assignRef('order', $order); hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $config =& hikashop_config(); $manage = hikashop_isAllowed($config->get('acl_warehouse_manage', 'all')); $this->assignRef('manage', $manage); $this->toolbar = array(array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'check' => JText::_('HIKA_VALIDDELETEITEMS'), 'display' => hikashop_isAllowed($config->get('acl_warehouse_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); }
function options(&$params) { $this->id = $params->get('id'); $this->name = str_replace('[]', '', $params->get('name')); $this->element = $params->get('value'); $this->pricetaxType = hikashop_get('type.pricetax'); $this->discountDisplayType = hikashop_get('type.discount_display'); $this->priceDisplayType = hikashop_get('type.priceDisplay'); $this->arr = array(JHTML::_('select.option', '-1', JText::_('HIKA_INHERIT')), JHTML::_('select.option', '1', JText::_('HIKASHOP_YES')), JHTML::_('select.option', '0', JText::_('HIKASHOP_NO'))); $this->arr[0]->class = 'btn-primary'; $this->arr[1]->class = 'btn-success'; $this->arr[2]->class = 'btn-danger'; $this->type = 'cart'; if (preg_match('/wishlist/', $this->name)) { $this->type = 'wishlist'; } $cid = JRequest::getInt('id', ''); if (empty($cid)) { $cid = hikashop_getCID(); } $modulesClass = hikashop_get('class.modules'); $module = $modulesClass->get($cid); if (empty($this->element)) { $this->element = $module->hikashop_params; } $config = hikashop_config(); $this->default_params = $config->get('default_params'); }
function hikashopAcltableType() { if (version_compare(JVERSION, '1.6.0', '<')) { $acl =& JFactory::getACL(); $this->groups = $acl->get_group_children_tree(null, 'USERS', false); } else { $db = JFactory::getDBO(); $db->setQuery('SELECT a.*, a.title as text, a.id as value FROM #__usergroups AS a ORDER BY a.lft ASC'); $this->groups = $db->loadObjectList('id'); foreach ($this->groups as $id => $group) { if (isset($this->groups[$group->parent_id])) { $this->groups[$id]->level = intval(@$this->groups[$group->parent_id]->level) + 1; $this->groups[$id]->text = str_repeat('- - ', $this->groups[$id]->level) . $this->groups[$id]->text; } } } $this->choice = array(); $this->choice[] = JHTML::_('select.option', 'all', JText::_('HIKA_ALL')); $this->choice[] = JHTML::_('select.option', 'special', JText::_('HIKA_CUSTOM')); $this->config =& hikashop_config(); $js = "function updateACLTable(cat, action) {\r\n\t\t\tchoice = document['adminForm']['acl_'+cat];\r\n\t\t\tchoiceValue = 'special';\r\n\t\t\tfor (var i=0; i < choice.length; i++){\r\n\t\t\t\t if (choice[i].checked){\r\n\t\t\t\t\t choiceValue = choice[i].value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(choiceValue == 'all'){\r\n\t\t\t\tdocument.getElementById('div_acl_'+cat).style.display = 'none';\r\n\t\t\t}else{\r\n\t\t\t\tdocument.getElementById('div_acl_'+cat).style.display = 'block';\r\n\t\t\t\tfinalValue = '';\r\n\t\t\t\tfor(i=0;i<allGroups.length;i++){\r\n\t\t\t\t\tvar myvar = document.getElementById('acl_'+cat+'_'+allGroups[i]+'_'+action);\r\n\t\t\t\t\tif(myvar && myvar.checked){\r\n\t\t\t\t\t\t\t finalValue += myvar.value+',';\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tdocument.getElementById('acl_'+cat+'_'+action).value = finalValue;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfunction updateGroup(cat,groupid,actions){\r\n\t\t\tfor(i=0;i<actions.length;i++){\r\n\t\t\t\tvar myvar = document.getElementById('acl_'+cat+'_'+groupid+'_'+actions[i]);\r\n\t\t\t\tif(!myvar) return;\r\n\t\t\t\tmyvar.checked = 1 - myvar.checked;\r\n\t\t\t\tupdateACLTable(cat,actions[i]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tfunction updateAction(cat,action){\r\n\t\t\tfor(i=0;i<allGroups.length;i++){\r\n\t\t\t\tvar myvar = document.getElementById('acl_'+cat+'_'+allGroups[i]+'_'+action);\r\n\t\t\t\tif(myvar) myvar.checked = 1 - myvar.checked;\r\n\t\t\t}\r\n\t\t\tupdateACLTable(cat,action);\r\n\t\t}\r\n\t\tvar allGroups = new Array("; foreach ($this->groups as $oneGroup) { $js .= "'" . $oneGroup->value . "',"; } $js = rtrim($js, ',') . ");"; if (!HIKASHOP_PHP5) { $doc =& JFactory::getDocument(); } else { $doc = JFactory::getDocument(); } $doc->addScriptDeclaration($js); }
function pricesSelection(&$prices, $quantity) { $matches = array(); $otherCurrencies = array(); if (!empty($prices)) { foreach ($prices as $k2 => $price) { if ($price->price_min_quantity > $quantity) { continue; } if (empty($price->price_orig_currency_id)) { $matches[] = $price; } else { $otherCurrencies[] = $price; } } } if (empty($matches) && !empty($otherCurrencies)) { $config =& hikashop_config(); $main_currency = (int) $config->get('main_currency', 1); foreach ($otherCurrencies as $price) { if ($price->price_orig_currency_id == $main_currency) { $matches[] = $price; } } if (empty($matches)) { $matches = $otherCurrencies; } } $prices = $matches; }
function loadValues($optGroup, $files) { $this->values[] = JHTML::_('select.optgroup', $optGroup); foreach ($files as $file) { if (preg_match('#^listing_((?!div|list|price|table|vote).*)\\.php$#', $file, $match)) { $val = strtoupper($match[1]); $trans = JText::_($val); if ($trans == $val) { $trans = $match[1]; } $this->values[$match[1]] = JHTML::_('select.option', $match[1], $trans); } } if (version_compare(JVERSION, '1.6.0', '>=')) { $this->values[] = JHTML::_('select.optgroup', $optGroup); } if (JRequest::getVar('inherit', true) == true) { $config = hikashop_config(); $defaultParams = $config->get('default_params'); $default = ''; if (isset($defaultParams['div_item_layout_type'])) { $default = ' (' . $this->values[$defaultParams['div_item_layout_type']]->text . ')'; } $this->values[] = JHTML::_('select.option', 'inherit', JText::_('HIKA_INHERIT') . $default); } }
function display($map, $volume_unit, $type = 'dimension', $id = '', $extra = '') { $config =& hikashop_config(); $symbols = explode(',', $config->get('volume_symbols', 'm,cm')); if (empty($volume_unit)) { $volume_unit = $symbols[0]; } $this->values = array(); if (!in_array($volume_unit, $symbols)) { $text = JText::_($volume_unit); if ($type != 'dimension') { $text .= '³'; } $this->values[] = JHTML::_('select.option', $volume_unit, $text); } foreach ($symbols as $symbol) { $text = JText::_($symbol); if ($type != 'dimension') { $text .= '³'; } $this->values[] = JHTML::_('select.option', $symbol, $text); } if (!empty($extra)) { $extra = ' ' . trim($extra); } if (!empty($id)) { return JHTML::_('select.genericlist', $this->values, $map, 'class="inputbox volumeselect" size="1"' . $extra, 'value', 'text', $volume_unit, $id); } return JHTML::_('select.genericlist', $this->values, $map, 'class="inputbox volumeselect" size="1"' . $extra, 'value', 'text', $volume_unit); }
protected function getInput() { if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) { return 'This plugin can not work without the Hikashop Component'; } $id = JRequest::getInt('extension_id'); $plugins = hikashop_get('class.plugins'); $plugin = $plugins->get($id); $name = @$plugin->element; if (@$plugin->folder == 'hikashopshipping') { $group = 'shipping'; } elseif (@$plugin->folder == 'hikashop') { $group = 'plugin'; } else { $group = 'payment'; } $config =& hikashop_config(); if (!hikashop_isAllowed($config->get('acl_plugins_manage', 'all'))) { return 'Access to the HikaShop options of the plugins is restricted'; } $text = '<a style="float:left;" title="' . JText::_('HIKASHOP_OPTIONS') . '" href="' . JRoute::_('index.php?option=com_hikashop&ctrl=plugins&fromjoomla=1&task=listing&name=' . $name . '&plugin_type=' . $group) . '" >' . JText::_('HIKASHOP_OPTIONS') . '</a>'; return $text; }
function fetchElement($name, $value, &$node, $control_name) { if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) { return 'This module can not work without the Hikashop Component'; } $config =& hikashop_config(); if (!hikashop_isAllowed($config->get('acl_modules_manage', 'all'))) { return 'Access to the HikaShop options of the modules is restricted'; } $id = hikashop_getCID('id'); if (!empty($id)) { $app = JFactory::getApplication(); if ($app->isAmdin()) { $link = JRoute::_('index.php?option=com_hikashop&ctrl=modules&task=edit&cid[]=' . $id); } else { $link = JURI::base() . 'administrator/index.php?option=com_hikashop&ctrl=modules&task=edit&cid[]=' . $id; } $text = '<a title="' . JText::_('HIKASHOP_OPTIONS') . '" href="' . $link . '" >' . JText::_('HIKASHOP_OPTIONS') . '</a>'; $config =& hikashop_config(); $level = $config->get('params_' . $id); } else { $text = JText::_('HIKASHOP_OPTIONS_EDIT'); } return $text; }
function checkProducts() { $db = JFactory::getDBO(); $query = 'SELECT * FROM ' . hikashop_table('product') . ' WHERE ' . ' product_quantity < ' . (int) $this->stock_limit . ' AND product_published = 1 AND product_quantity != -1 ' . ' AND (product_sale_start = 0 OR product_sale_start < ' . time() . ') AND (product_sale_end = 0 OR product_sale_end > ' . time() . ')'; $db->setQuery($query); $products = $db->loadObjectList(); if (!empty($products)) { $mailClass = hikashop_get('class.mail'); $infos = new stdClass(); $infos->products =& $products; $mail = $mailClass->get('out_of_stock', $infos); $mail->subject = JText::sprintf($mail->subject, HIKASHOP_LIVE); $config =& hikashop_config(); if (!empty($infos->email)) { $mail->dst_email = $infos->email; } else { $mail->dst_email = $config->get('from_email'); } if (!empty($infos->name)) { $mail->dst_name = $infos->name; } else { $mail->dst_name = $config->get('from_name'); } $mailClass->sendMail($mail); } $app = JFactory::getApplication(); $this->message = 'Products quantity checked'; $app->enqueueMessage($this->message); return true; }
function edit() { $tmpl = JRequest::getCmd('tmpl', ''); $subtask = JRequest::getCmd('subtask', ''); $addrtype = JRequest::getCmd('address_type', ''); $config = hikashop_config(); if ($tmpl == 'component' && ($addrtype != '' || $subtask != '') && $config->get('checkout_address_selector', 0)) { JRequest::setVar('hidemainmenu', 1); JRequest::setVar('layout', 'show'); JRequest::setVar('edition', true); ob_end_clean(); if (HIKASHOP_J25) { $app = JFactory::getApplication(); $messages = $app->getMessageQueue(); if (!empty($messages)) { foreach ($messages as $message) { hikashop_display($message['message'], 'error'); } } } parent::display(); exit; } parent::edit(); }
public function onAfterOrderCreate(&$order) { if (empty($order) || empty($order->order_type) || $order->order_type != 'sale' || !isset($order->order_full_price)) { return; } $this->init(); $send_confirmation = $this->params->get('send_confirmation', 1); if (!$send_confirmation && $order->order_status == 'confirmed') { $class = hikashop_get('class.cart'); $class->cleanCartFromSession(); return; } if ($send_confirmation && bccomp($order->order_full_price, 0, 5) == 0) { $config = hikashop_config(); $orderObj = new stdClass(); $orderObj->order_id = (int) $order->order_id; $orderObj->order_status = $config->get('order_confirmed_status', 'confirmed'); $orderObj->history = new stdClass(); $orderObj->history->history_notified = 1; $orderClass = hikashop_get('class.order'); $orderClass->save($orderObj); $class = hikashop_get('class.cart'); $class->cleanCartFromSession(); } }
function checkOrders($notify = false) { $db = JFactory::getDBO(); $config =& hikashop_config(); $status = $config->get('order_created_status'); $query = 'SELECT order_id, order_status, order_created FROM ' . hikashop_table('order') . ' WHERE order_type = ' . $db->Quote('sale') . ' AND order_created < ' . (time() - $this->period) . ' AND order_status = ' . $db->Quote($status) . ' ORDER BY order_created ASC LIMIT 0, 20'; $db->setQuery($query); $orders = $db->loadObjectList(); if (!empty($orders)) { $orderClass = hikashop_get('class.order'); $status = $config->get('cancelled_order_status'); $statuses = explode(',', $status); $status = reset($statuses); foreach ($orders as $order) { $update = new stdClass(); $update->order_id = $order->order_id; $update->order_status = $status; if ($notify) { $update->history = new stdClass(); $update->history->history_notified = 1; } $orderClass->save($update); } } $app = JFactory::getApplication(); $this->message = 'Orders checked'; $app->enqueueMessage($this->message); return true; }
function listing() { hikashop_setTitle(JText::_('DOCUMENTATION'), 'help_header', 'documentation'); if (!HIKASHOP_PHP5) { $bar =& JToolBar::getInstance('toolbar'); } else { $bar = JToolBar::getInstance('toolbar'); } $bar->appendButton('Link', 'hikashop', JText::_('HIKASHOP_CPANEL'), hikashop_completeLink('dashboard')); $config =& hikashop_config(); $level = $config->get('level'); $url = HIKASHOP_HELPURL . 'documentation&level=' . $level; if (hikashop_isSSL()) { $url = str_replace('http://', 'https://', $url); } $config =& hikashop_config(); $menu_style = $config->get('menu_style', 'title_bottom'); if (HIKASHOP_J30) { $menu_style = 'content_top'; } if ($menu_style == 'content_top') { echo hikashop_getMenu('', $menu_style); } ?> <div id="hikashop_div"> <iframe allowtransparency="true" scrolling="auto" height="450px" frameborder="0" width="100%" name="hikashop_frame" id="hikashop_frame" src="<?php echo $url; ?> "> </iframe> </div> <?php }
protected function getInput() { if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (!function_exists('hikashop_config') && !(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) { return 'This menu options cannot be displayed without the Hikashop Component'; } $id = JRequest::getInt('id'); if (HIKASHOP_J30) { $empty = ''; jimport('joomla.html.parameter'); $params = new HikaParameter($empty); $js = ''; $params->set('id', $this->id); $params->set('name', $this->name); $params->set('value', $this->value); $params->set('type', $this->getAttribute('content')); $params->set('menu', $this->getAttribute('menu')); $content = hikashop_getLayout('menus', 'options', $params, $js); $text = '</div></div>' . $content . '<div><div>'; } elseif (!empty($id)) { $config =& hikashop_config(); if (!hikashop_isAllowed($config->get('acl_menus_manage', 'all'))) { return 'Access to the HikaShop options of the menus is restricted'; } $text = '<a title="' . JText::_('HIKASHOP_OPTIONS') . '" href="' . JRoute::_('index.php?option=com_hikashop&ctrl=menus&fromjoomla=1&task=edit&cid[]=' . $id) . '" >' . JText::_('HIKASHOP_OPTIONS') . '</a>'; } else { $text = JText::_('HIKASHOP_OPTIONS_EDIT'); } return $text; }
public function displayMultiple($map, $values) { if (empty($this->values)) { $this->load(); } if (empty($values)) { $values = array(); } else { if (is_string($values)) { $values = explode(',', $values); } } $config = hikashop_config(); hikashop_loadJslib('otree'); if (substr($map, -2) == '[]') { $map = substr($map, 0, -2); } $id = str_replace(array('[', ']'), array('_', ''), $map); $ret = '<div class="nameboxes" id="' . $id . '" onclick="window.oNameboxes[\'' . $id . '\'].focus(\'' . $id . '_text\');">'; if (!empty($values)) { foreach ($values as $key) { if (isset($this->values[$key])) { $name = $this->values[$key]->text; } else { $name = JText::sprintf('UNKNOWN_PACK_X', $key); } $ret .= '<div class="namebox" id="' . $id . '_' . $key . '">' . '<input type="hidden" name="' . $map . '[]" value="' . $key . '"/>' . $name . ' <a class="closebutton" href="#" onclick="window.oNameboxes[\'' . $id . '\'].unset(this,\'' . $key . '\');window.oNamebox.cancelEvent();return false;"><span>X</span></a>' . '</div>'; } } $ret .= '<div class="namebox" style="display:none;" id="' . $id . 'tpl">' . '<input type="hidden" name="{map}" value="{key}"/>{name}' . ' <a class="closebutton" href="#" onclick="window.oNameboxes[\'' . $id . '\'].unset(this,\'{key}\');window.oNamebox.cancelEvent();return false;"><span>X</span></a>' . '</div>'; $ret .= '<div class="nametext">' . '<input id="' . $id . '_text" type="text" style="width:50px;min-width:60px" onfocus="window.oNameboxes[\'' . $id . '\'].focus(this);" onkeyup="window.oNameboxes[\'' . $id . '\'].search(this);" onchange="window.oNameboxes[\'' . $id . '\'].search(this);"/>' . '<span style="position:absolute;top:0px;left:-2000px;visibility:hidden" id="' . $id . '_span">span</span>' . '</div>'; $data = array(); foreach ($this->values as $key => $value) { if (empty($key)) { continue; } $data[$key] = $value->text; } $namebox_options = array('mode' => 'list', 'img_dir' => HIKASHOP_IMAGES, 'map' => $map, 'min' => $config->get('namebox_search_min_length', 3), 'multiple' => true); $ret .= '<div style="clear:both;float:none;"></div></div> <div class="namebox-popup"> <div id="' . $id . '_olist" style="display:none;" class="oList namebox-popup-content"></div> </div> <script type="text/javascript"> new window.oNamebox( \'' . $id . '\', ' . json_encode($data) . ', ' . json_encode($namebox_options) . ' );'; if (!empty($values)) { $ret .= ' try{ window.oNameboxes[\'' . $id . '\'].content.block(' . json_encode($values) . '); }catch(e){}'; } $ret .= ' </script>'; return $ret; }
function listing() { $app = JFactory::getApplication(); $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $pageInfo->limit = new stdClass(); $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string'); $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.waitlist_id', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int'); $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int'); $database = JFactory::getDBO(); $filters = array(); $searchMap = array('a.waitlist_id', 'a.email', 'a.name', 'a.product_id', 'b.product_name', 'b.product_code'); if (!empty($pageInfo->search)) { $searchVal = '\'%' . hikashop_getEscaped(JString::strtolower(trim($pageInfo->search)), true) . '%\''; $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}"; } $order = ''; if (!empty($pageInfo->filter->order->value)) { $order = ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir; } if (!empty($filters)) { $filters = ' WHERE (' . implode(') AND (', $filters) . ')'; } else { $filters = ''; } $query = ' FROM ' . hikashop_table('waitlist') . ' AS a LEFT JOIN ' . hikashop_table('product') . ' AS b ON a.product_id=b.product_id ' . $filters . $order; $database->setQuery('SELECT *' . $query, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value); $rows = $database->loadObjectList(); $class = hikashop_get('class.product'); foreach ($rows as $i => $element) { if ($element->product_type == 'variant') { $database->setQuery('SELECT * FROM ' . hikashop_table('variant') . ' AS a LEFT JOIN ' . hikashop_table('characteristic') . ' AS b ON a.variant_characteristic_id=b.characteristic_id WHERE a.variant_product_id=' . (int) $element->product_id . ' ORDER BY a.ordering'); $element->characteristics = $database->loadObjectList(); $parentProduct = $class->get((int) $element->product_parent_id); $class->checkVariant($element, $parentProduct); $rows[$i] = $element; } } if (!empty($pageInfo->search)) { $rows = hikashop_search($pageInfo->search, $rows, 'waitlist_id'); } $database->setQuery('SELECT COUNT(*)' . $query); $pageInfo->elements = new stdClass(); $pageInfo->elements->total = $database->loadResult(); $pageInfo->elements->page = count($rows); $toggleClass = hikashop_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->getPagination(); hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $config =& hikashop_config(); $manage = hikashop_isAllowed($config->get('acl_waitlist_manage', 'all')); $this->assignRef('manage', $manage); $this->toolbar = array(array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_waitlist_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); }
protected function getInput() { if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (!function_exists('hikashop_config') && !(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) { return 'This module can not work without the Hikashop Component'; } $config =& hikashop_config(); $id = JRequest::getInt('id'); if (HIKASHOP_J30 && !in_array(@$_REQUEST['option'], array('com_falang', 'com_joomfish'))) { if (preg_match('/hikashopmodule/', $this->name)) { $associated = false; $cid = JRequest::getVar('id', ''); if (empty($cid)) { $cid = hikashop_getCID(); } foreach ($config->values as $name => $values) { if (preg_match('#menu_[0-9]#', $name)) { $params = unserialize(base64_decode($values->config_value)); $modules = array(); if (isset($params['modules'])) { $modules = explode(',', $params['modules']); } if (in_array($cid, $modules)) { $associated = str_replace('menu_', '', $values->config_namekey); break; } } } if ($associated) { $app = JFactory::getApplication(); $app->enqueueMessage(JText::sprintf('USE_MENU_SETTINGS_INSTEAD_OF_ASSOCIATED_ONES', JRoute::_('index.php?option=com_menus&view=item&layout=edit&id=' . $associated))); } $layout = 'modules'; } else { $layout = 'cartmodules'; } $empty = ''; jimport('joomla.html.parameter'); $params = new HikaParameter($empty); $js = ''; $params->set('id', $this->id); $params->set('name', $this->name); $params->set('value', $this->value); $content = hikashop_getLayout($layout, 'options', $params, $js, true); $text = '</div></div>' . $content . '<div><div>'; } elseif (!empty($id)) { if (!hikashop_isAllowed($config->get('acl_modules_manage', 'all'))) { return 'Access to the HikaShop options of the modules is restricted'; } $text = '<a style="float:left;" title="' . JText::_('HIKASHOP_OPTIONS') . '" href="' . JRoute::_('index.php?option=com_hikashop&ctrl=modules&fromjoomla=1&task=edit&cid[]=' . $id) . '" >' . JText::_('HIKASHOP_OPTIONS') . '</a>'; } else { $text = JText::_('HIKASHOP_OPTIONS_EDIT'); } return $text; }
function display($tpl = null, $params = null) { $this->config = hikashop_config(); $this->paramBase = HIKASHOP_COMPONENT . '.' . $this->getName(); $function = $this->getLayout(); if (method_exists($this, $function)) { $this->{$function}($params); } parent::display($tpl); }
public function onAfterOrderUpdate(&$order, &$send_email) { $full_order = null; if (!isset($order->order_type)) { $orderClass = hikashop_get('class.order'); $full_order = $orderClass->loadFullOrder($order->order_id, false, false); if ($full_order->order_type != 'sale') { return; } } elseif ($order->order_type != 'sale') { return; } if (!$this->loadOptions()) { return false; } $config =& hikashop_config(); $app = JFactory::getApplication(); $confirmed_statuses = explode(',', trim($config->get('invoice_order_statuses', 'confirmed,shipped'), ',')); $cancelled_statuses = explode(',', trim($config->get('cancelled_order_status', 'cancelled'), ',')); if (empty($confirmed_statuses)) { $confirmed_statuses = array('confirmed', 'shipped'); } if (empty($cancelled_statuses)) { $cancelled_statuses = array('cancelled'); } if (!empty($_SESSION['order_products'][$order->order_id])) { if (!isset($full_order)) { $orderClass = hikashop_get('class.order'); $full_order = $orderClass->loadFullOrder($order->order_id, false, false); } if ($this->partialReturn($full_order, false)) { return; } } if (!empty($order->order_status)) { if (in_array($order->order_status, $confirmed_statuses) && !in_array($order->old->order_status, $confirmed_statuses)) { //if the actual status is confirmed and the old status wasn't confirmed $this->AuthorizedWithCaptured($order); return; } if (in_array($order->order_status, $cancelled_statuses) && in_array($order->old->order_status, $confirmed_statuses)) { //if the changed status is cancelled and the old status was confirmed if (!isset($full_order)) { $orderClass = hikashop_get('class.order'); $full_order = $orderClass->loadFullOrder($order->order_id, false, false); } $error = ''; $error = $this->Returned($full_order); if ($error != '') { $app->enqueueMessage('TaxCloud Error : ' . $error); } return; } } }
function listing() { $app = JFactory::getApplication(); $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $pageInfo->limit = new stdClass(); $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.currency_id', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'asc', 'word'); $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int'); if (JRequest::getVar('search') != $app->getUserState($this->paramBase . ".search")) { $app->setUserState($this->paramBase . '.limitstart', 0); $pageInfo->limit->start = 0; } else { $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int'); } $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string'); $pageInfo->search = JString::strtolower(trim($pageInfo->search)); $database = JFactory::getDBO(); $searchMap = array('a.currency_symbol', 'a.currency_code', 'a.currency_name', 'a.currency_id'); $filters = array(); if (!empty($pageInfo->search)) { $searchVal = '\'%' . hikashop_getEscaped($pageInfo->search, true) . '%\''; $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}"; } $query = 'FROM ' . hikashop_table('currency') . ' AS a'; if (!empty($filters)) { $query .= ' WHERE (' . implode(') AND (', $filters) . ')'; } if (!empty($pageInfo->filter->order->value)) { $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir; } $database->setQuery('SELECT a.* ' . $query, $pageInfo->limit->start, $pageInfo->limit->value); $rows = $database->loadObjectList('currency_id'); $currencyClass = hikashop_get('class.currency'); $currencyClass->getCurrencies(null, $rows); if (!empty($pageInfo->search)) { $rows = hikashop_search($pageInfo->search, $rows, 'currency_id'); } $database->setQuery('SELECT count(*) ' . $query); $pageInfo->elements = new stdClass(); $pageInfo->elements->total = $database->loadResult(); $pageInfo->elements->page = count($rows); hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $config =& hikashop_config(); $manage = hikashop_isAllowed($config->get('acl_currency_manage', 'all')); $this->assignRef('manage', $manage); $this->toolbar = array(array('name' => 'confirm', 'check' => false, 'msg' => JText::_('UPDATE_RATES_WARNING'), 'icon' => 'upload', 'alt' => JText::_('UPDATE_RATES'), 'task' => 'update', 'display' => $manage && hikashop_level(2)), array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_currency_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); $toggleClass = hikashop_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('currency', $currencyClass); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->getPagination(); }
function getSymbol() { if (empty($this->main_symbol)) { $config =& hikashop_config(); $this->symbols = explode(',', $config->get('volume_symbols', 'm,dm,cm,mm,in,ft,yd')); foreach ($this->symbols as $k => $symbol) { $this->symbols[$k] = trim($symbol); } $this->main_symbol = array_shift($this->symbols); } return $this->main_symbol; }
function getSymbol() { if (empty($this->main_symbol)) { $config =& hikashop_config(); $this->symbols = explode(',', $config->get('weight_symbols', 'kg,dag,g,mg,lb,oz,ozt')); foreach ($this->symbols as $k => $symbol) { $this->symbols[$k] = trim($symbol); } $this->main_symbol = array_shift($this->symbols); } return $this->main_symbol; }
function load($inherit = false) { $this->values = array(0 => JHTML::_('select.option', 0, JText::_('NO_TAX')), 1 => JHTML::_('select.option', 1, JText::_('WITH_TAX')), 2 => JHTML::_('select.option', 2, JText::_('DISPLAY_BOTH_TAXES'))); if ($inherit) { $config = hikashop_config(); $defaultValue = $config->get('price_with_tax', ''); $default = ''; if (!empty($defaultValue)) { $default = ' (' . $this->values[$defaultValue]->text . ')'; } $this->values[3] = JHTML::_('select.option', 3, JText::_('HIKA_INHERIT') . $default); } }
function load() { $this->values = array('ASC' => JHTML::_('select.option', 'ASC', JText::_('ASCENDING')), 'DESC' => JHTML::_('select.option', 'DESC', JText::_('DESCENDING'))); if (JRequest::getCmd('from_display', false) == false) { $config = hikashop_config(); $defaultParams = $config->get('default_params'); $default = ''; if (isset($defaultParams['order_dir'])) { $default = ' (' . $this->values[$defaultParams['order_dir']]->text . ')'; } $this->values['inherit'] = JHTML::_('select.option', 'inherit', JText::_('HIKA_INHERIT') . $default); } }
function load() { $this->values = array('cheapest' => JHTML::_('select.option', 'cheapest', JText::_('CHEAPEST_PRICE')), 'unit' => JHTML::_('select.option', 'unit', JText::_('UNIT_PRICE_ONLY')), 'range' => JHTML::_('select.option', 'range', JText::_('PRICE_RANGE')), 'all' => JHTML::_('select.option', 'all', JText::_('HIKA_ALL'))); if (JRequest::getCmd('from_display', false) == false) { $config = hikashop_config(); $defaultParams = $config->get('default_params'); $default = ''; if (isset($defaultParams['price_display_type'])) { $default = ' (' . $this->values[$defaultParams['price_display_type']]->text . ')'; } $this->values['inherit'] = JHTML::_('select.option', 'inherit', JText::_('HIKA_INHERIT') . $default); } }
function load() { $this->values = array(2 => JHTML::_('select.option', 2, JText::_('RELATED_PRODUCTS')), 1 => JHTML::_('select.option', 1, JText::_('IN_SAME_CATEGORIES')), 3 => JHTML::_('select.option', 3, JText::_('FROM_SAME_MANUFACTURER')), 0 => JHTML::_('select.option', 0, JText::_('IN_MODULE_PARENT_CATEGORY'))); if (JRequest::getCmd('from_display', false) == false) { $config = hikashop_config(); $defaultParams = $config->get('default_params'); $default = ''; if (isset($defaultParams['product_synchronize'])) { $default = ' (' . $this->values[$defaultParams['product_synchronize']]->text . ')'; } $this->values[4] = JHTML::_('select.option', 4, JText::_('HIKA_INHERIT') . $default); } }
public function galleryimage() { hikashop_loadJslib('otree'); $app = JFactory::getApplication(); $config = hikashop_config(); $this->assignRef('config', $config); $this->paramBase = HIKASHOP_COMPONENT . '.' . $this->getName() . '.gallery'; $uploadConfig = JRequest::getVar('uploadConfig', null); if (empty($uploadConfig) || !is_array($uploadConfig)) { return false; } $this->assignRef('uploadConfig', $uploadConfig); $uploader = JRequest::getCmd('uploader', ''); $this->assignRef('uploader', $uploader); $field = JRequest::getCmd('field', ''); $this->assignRef('field', $field); $uploadFolder = ltrim(JPath::clean(html_entity_decode($config->get('uploadfolder'))), DS); $uploadFolder = rtrim($uploadFolder, DS) . DS; $basePath = JPATH_ROOT . DS . $uploadFolder . DS; $pageInfo = new stdClass(); $pageInfo->limit = new stdClass(); $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', 20, 'int'); $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int'); $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . '.search', 'search', '', 'string'); $this->assignRef('pageInfo', $pageInfo); jimport('joomla.filesystem.folder'); if (!JFolder::exists($basePath)) { JFolder::create($basePath); } $galleryHelper = hikashop_get('helper.gallery'); $galleryHelper->setRoot($basePath); $this->assignRef('galleryHelper', $galleryHelper); $folder = str_replace('|', '/', JRequest::getString('folder', '')); $destFolder = rtrim($folder, '/\\'); if (!$galleryHelper->validatePath($destFolder)) { $destFolder = ''; } if (!empty($destFolder)) { $destFolder .= '/'; } $this->assignRef('destFolder', $destFolder); $galleryOptions = array('filter' => '.*' . str_replace(array('.', '?', '*', '$', '^'), array('\\.', '\\?', '\\*', '$', '\\^'), $pageInfo->search) . '.*', 'offset' => $pageInfo->limit->start, 'length' => $pageInfo->limit->value); $this->assignRef('galleryOptions', $galleryOptions); $treeContent = $galleryHelper->getTreeList(null, $destFolder); $this->assignRef('treeContent', $treeContent); $dirContent = $galleryHelper->getDirContent($destFolder, $galleryOptions); $this->assignRef('dirContent', $dirContent); jimport('joomla.html.pagination'); $pagination = new JPagination($galleryHelper->filecount, $pageInfo->limit->start, $pageInfo->limit->value); $this->assignRef('pagination', $pagination); }
protected function load($config) { $this->values = array(); if ($config) { $this->values[] = JHTML::_('select.option', 2, JText::_('GLOBAL_ON_LISTINGS')); $hkconfig = hikashop_config(); if ($hkconfig->get('show_quantity_field', 1) == '-2') { $this->values[] = JHTML::_('select.option', -2, JText::_('ON_A_PER_PRODUCT_BASIS')); } } $this->values[] = JHTML::_('select.option', 1, JText::_('AJAX_INPUT')); $this->values[] = JHTML::_('select.option', -1, JText::_('NORMAL_INPUT')); $this->values[] = JHTML::_('select.option', 0, JText::_('NO_DISPLAY')); }
function cron() { $config =& hikashop_config(); if ($config->get('cron') == 'no') { hikashop_display(JText::_('CRON_DISABLED'), 'info'); return false; } $cronHelper = hikashop_get('helper.cron'); $cronHelper->report = true; $launched = $cronHelper->cron(); if ($launched) { $cronHelper->report(); } }
function load($value) { $this->values = array(); $config =& hikashop_config(); $forced = array((int) $config->get('main_currency')); $filters = array('currency_published = 1'); if ($this->displayType == 'auto') { $app = JFactory::getApplication(); if ($app->isAdmin()) { if (is_array($value)) { $forced = array_merge($forced, $value); JArrayHelper::toInteger($forced); } else { $forced[] = (int) $value; } } else { $filters[] = 'currency_displayed = 1'; } $filters[] = 'currency_id IN (' . implode(',', $forced) . ')'; } elseif ($this->displayType == 'all') { $filters[] = 'currency_displayed = 1'; $this->values[] = JHTML::_('select.option', 0, JText::_('HIKA_NONE')); } if (empty($this->currencies)) { $query = 'SELECT * FROM ' . hikashop_table('currency') . ' WHERE (' . implode(') OR (', $filters) . ')'; $db = JFactory::getDBO(); $db->setQuery($query); $this->currencies = $db->loadObjectList('currency_id'); } if (!empty($this->currencies)) { foreach ($this->currencies as $currency) { $this->values[] = JHTML::_('select.option', (int) $currency->currency_id, $currency->currency_symbol . ' ' . $currency->currency_code); } } }