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; }
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 show() { $data_id = JRequest::getVar('data_id', 0, 'default', 'int'); $data_type = JRequest::getVar('main_ctrl', 'product', 'default', 'string', 0); $empty = $js = ''; jimport('joomla.html.parameter'); $params = new HikaParameter($empty); $params->set('vote_ref_id', $data_id); $params->set('main_ctrl', $data_type); $params->set('vote_type', $data_type); ob_get_clean(); echo hikashop_getLayout('vote', 'listing', $params, $js); exit; }
function display($cachable = false, $urlparams = array()) { $cart_type = JRequest::getString('cart_type', 'cart'); $empty = ''; jimport('joomla.html.parameter'); $params = new HikaParameter($empty); $js = ''; $params->set('cart_type', $cart_type); $html = trim(hikashop_getLayout('product', 'cart', $params, $js)); if (!empty($html)) { JRequest::setVar('savecart', '1'); echo '<div class="hikashop_cart_display" id="hikashop_cart_display">' . $html . '</div>'; } }
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.order_created', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string'); $pageInfo->search = JString::strtolower(trim($pageInfo->search)); $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int'); $oldValue = $app->getUserState($this->paramBase . '.list_limit'); if (empty($oldValue)) { $oldValue = $app->getCfg('list_limit'); } $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int'); if ($oldValue != $pageInfo->limit->value) { $pageInfo->limit->start = 0; $app->setUserState($this->paramBase . '.limitstart', 0); } $database = JFactory::getDBO(); $searchMap = array('a.order_id', 'a.order_status', 'a.order_number'); $filters = array(); $order = ''; if (!empty($pageInfo->filter->order->value)) { $order = ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir; } if (!empty($pageInfo->search)) { $searchVal = '\'%' . hikashop_getEscaped(JString::strtolower(trim($pageInfo->search)), true) . '%\''; $filter = '(' . implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}" . ')'; $filters[] = $filter; } if (is_array($filters) && count($filters)) { $filters = ' AND ' . implode(' AND ', $filters); } else { $filters = ''; } $query = 'FROM ' . hikashop_table('order') . ' AS a WHERE a.order_type = ' . $database->Quote('sale') . ' AND a.order_user_id=' . (int) hikashop_loadUser() . $filters . $order; $database->setQuery('SELECT a.* ' . $query, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value); $rows = $database->loadObjectList(); if (!empty($pageInfo->search)) { $rows = hikashop_search($pageInfo->search, $rows, 'order_id'); } $database->setQuery('SELECT COUNT(*) ' . $query); $pageInfo->elements = new stdClass(); $pageInfo->elements->total = $database->loadResult(); $pageInfo->elements->page = count($rows); $currencyClass = hikashop_get('class.currency'); $this->assignRef('currencyHelper', $currencyClass); if (!$pageInfo->elements->page) { $app->enqueueMessage(JText::_('NO_ORDERS_FOUND')); } $pagination = hikashop_get('helper.pagination', $pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value); $pagination->hikaSuffix = ''; $this->assignRef('pagination', $pagination); $this->assignRef('pageInfo', $pageInfo); $string = ''; $params = new HikaParameter($string); $params->set('show_quantity_field', 0); $config =& hikashop_config(); if (hikashop_level(1) && $config->get('allow_payment_button', 1)) { $unpaid_statuses = explode(',', $config->get('order_unpaid_statuses', 'created')); if (!empty($rows)) { foreach ($rows as $k => $order) { if (in_array($order->order_status, $unpaid_statuses)) { $rows[$k]->show_payment_button = true; } } } $payment_change = $config->get('allow_payment_change', 1); $this->assignRef('payment_change', $payment_change); $pluginsPayment = hikashop_get('type.plugins'); $pluginsPayment->type = 'payment'; $this->assignRef('payment', $pluginsPayment); } if ($config->get('cancellable_order_status', '') != '') { $cancellable_order_status = explode(',', $config->get('cancellable_order_status', '')); foreach ($rows as $k => $order) { if (in_array($order->order_status, $cancellable_order_status)) { $rows[$k]->show_cancel_button = true; } } } $this->assignRef('params', $params); $this->assignRef('rows', $rows); $this->assignRef('config', $config); $cart = hikashop_get('helper.cart'); $this->assignRef('cart', $cart); $category = hikashop_get('type.categorysub'); $category->type = 'status'; $category->load(true); $this->assignRef('order_statuses', $category); hikashop_setPageTitle('ORDERS'); }
function displayAddress(&$fields, &$address, $view = 'address', $text = false) { $params = new HikaParameter(''); if (HIKASHOP_J25) { $params->set('address', $address); } $js = ''; $fieldsClass = hikashop_get('class.field'); $html = '' . hikashop_getLayout($view, 'address_template', $params, $js); if (!empty($fields)) { foreach ($fields as $field) { $fieldname = $field->field_namekey; if (!empty($address->{$fieldname})) { $html = str_replace('{' . $fieldname . '}', $fieldsClass->show($field, $address->{$fieldname}), $html); } } } $html = str_replace("\n\n", "\n", trim(str_replace("\r\n", "\n", trim(preg_replace('#{(?:(?!}).)*}#i', '', $html))), "\n")); if (!$text) { $html = str_replace("\n", "<br/>\n", $html); } return $html; }
if (empty($layout_type) || $layout_type == 'table') { $layout_type = 'div'; } $html = $this->loadTemplate($layout_type); if (!empty($html)) { echo '<div class="hikashop_subcategories_listing">' . $html . '</div>'; } if (!$this->module) { $data = $this->params->get('data'); if (isset($data->hk_product) && is_object($data->hk_product)) { $js = ''; $empty = ''; jimport('joomla.html.parameter'); $params = new HikaParameter($empty); foreach ($data->hk_product as $k => $v) { $params->set($k, $v); } $main_div_name = 'hikashop_category_information_module_' . $params->get('id'); $params->set('main_div_name', $main_div_name); echo '<div class="hikashop_submodules" style="clear:both">' . hikashop_getLayout('product', 'listing', $params, $js) . '</div>'; } else { if (!empty($this->modules)) { $html = ''; jimport('joomla.application.module.helper'); foreach ($this->modules as $module) { $html .= JModuleHelper::renderModule($module); } if (!empty($html)) { echo '<div class="hikashop_submodules" style="clear:both">' . $html . '</div>'; } }
function compare() { if (!hikashop_level(2)) { return; } $app = JFactory::getApplication(); $cids = JRequest::getVar('cid', array(), '', 'array'); $config =& hikashop_config(); $this->assignRef('config', $config); global $Itemid; $menus = $app->getMenu(); $menu = $menus->getActive(); if (empty($menu)) { if (!empty($Itemid)) { $menus->setActive($Itemid); $menu = $menus->getItem($Itemid); } } if (empty($cids)) { if (is_object($menu)) { jimport('joomla.html.parameter'); $category_params = new HikaParameter($menu->params); $cids = $category_params->get('product_id'); if (!is_array($cids)) { $cids = array($cids); } foreach ($cids as $k => $cid) { if ($k > 7) { unset($cids[$k]); } } } } if (empty($cids)) { return; } $c = array(); foreach ($cids as $cid) { if (strpos($cid, ',') !== false) { $c = array_merge($c, explode(',', $cid)); } else { $c[] = (int) $cid; } } $cids = $c; JArrayHelper::toInteger($cids); $empty = ''; $default_params = $config->get('default_params'); jimport('joomla.html.parameter'); $params = new HikaParameter($empty); foreach ($default_params as $k => $param) { $params->set($k, $param); } $main_currency = (int) $config->get('main_currency', 1); $params->set('main_currency', $main_currency); $discount_before_tax = (int) $config->get('discount_before_tax', 0); $params->set('discount_before_tax', $discount_before_tax); $params->set('show_compare', (int) $config->get('show_compare', 0)); $compare_limit = (int) $config->get('compare_limit', 5); $params->set('compare_limit', $compare_limit); $compare_inc_lastseen = (int) $config->get('compare_inc_lastseen', 0); $params->set('compare_inc_lastseen', $compare_inc_lastseen); $params->set('compare_show_name_separator', (int) $config->get('compare_show_name_separator', 1)); $params->set('catalogue', (int) $config->get('catalogue', 0)); $params->set('add_to_cart', (int) 1); $params->set('show_price_weight', (int) $config->get('show_price_weight', 0)); $params->set('characteristic_display', $config->get('characteristic_display', 'table')); $params->set('characteristic_display_text', $config->get('characteristic_display_text', 1)); $params->set('show_quantity_field', $config->get('show_quantity_field', 1)); $this->assignRef('params', $params); if (count($cids) > $compare_limit) { $cids = array_slice($cids, 0, $compare_limit); } $filters = array('a.product_id IN (' . implode(',', $cids) . ')'); hikashop_addACLFilters($filters, 'product_access', 'a'); $query = 'SELECT DISTINCT a.product_id, a.*,b.product_category_id, b.category_id, b.ordering FROM ' . hikashop_table('product') . ' AS a LEFT JOIN ' . hikashop_table('product_category') . ' AS b ON a.product_id = b.product_id WHERE ' . implode(' AND ', $filters) . ' ORDER BY b.ordering ASC, a.product_id ASC'; $database = JFactory::getDBO(); $database->setQuery($query); $elements = $database->loadObjectList(); if (empty($elements)) { return; } $this->modules = $config->get('product_show_modules', ''); $module = hikashop_get('helper.module'); $this->modules = $module->setModuleData($this->modules); $currencyClass = hikashop_get('class.currency'); $currency_id = hikashop_getCurrency(); $zone_id = hikashop_getZone(null); $cart = hikashop_get('helper.cart'); $this->assignRef('cart', $cart); $this->selected_variant_id = 0; $productClass = hikashop_get('class.product'); $this->assignRef('currencyHelper', $currencyClass); $fieldsClass = hikashop_get('class.field'); $this->assignRef('fieldsClass', $fieldsClass); $classbadge = hikashop_get('class.badge'); $this->assignRef('classbadge', $classbadge); $fields = array(0 => array()); $unset = array(); $done = array(); foreach ($elements as $k => $element) { $product_id = $element->product_id; if (isset($done[$product_id])) { $unset[] = $k; continue; } else { $done[$product_id] = $product_id; } if ($element->product_type == 'variant') { $filters = array('a.product_id=' . $element->product_parent_id); hikashop_addACLFilters($filters, 'product_access', 'a'); $query = 'SELECT a.*,b.* FROM ' . hikashop_table('product') . ' AS a LEFT JOIN ' . hikashop_table('product_category') . ' AS b ON a.product_id = b.product_id WHERE ' . implode(' AND ', $filters) . ' LIMIT 1'; $database->setQuery($query); $elements[$k] = $database->loadObject(); if (empty($elements[$k])) { return; } $k = array_search($product_id, $cids); if ($k !== false) { $cids[$k] = (int) $element->product_id; } } $productClass->addAlias($elements[$k]); if (!$elements[$k]->product_published) { return; } if ($compare_inc_lastseen) { $prod = new stdClass(); $prod->product_id = $product_id; $prod->product_hit = $element->product_hit + 1; $prod->product_last_seen_date = time(); $productClass->save($prod, true); } $f = $fieldsClass->getFields('frontcomp', $element, 'product', 'checkout&task=state'); $fields[$element->product_id] =& $f; foreach ($f as $i => $v) { $fields[0][$i] = $v; } } if (!empty($unset)) { foreach ($unset as $u) { unset($elements[$u]); } } $query = 'SELECT * FROM ' . hikashop_table('file') . ' WHERE file_ref_id IN (' . implode(',', $cids) . ') AND file_type IN (\'product\',\'file\') ORDER BY file_ref_id ASC, file_ordering ASC, file_id ASC'; $database->setQuery($query); $product_files = $database->loadObjectList(); if (!empty($product_files)) { foreach ($elements as $k => $element) { $productClass->addFiles($elements[$k], $product_files); } } $defaultParams = $config->get('default_params'); $detault_display_type = @$defaultParams['price_display_type']; $currencyClass->getListingPrices($elements, $zone_id, $currency_id, $detault_display_type); $this->assignRef('elements', $elements); $image = hikashop_get('helper.image'); $this->assignRef('image', $image); $this->assignRef('fields', $fields); $url = $this->init(); $cart->getJS($url); $this->assignRef('redirect_url', $url); }
public function updatecart() { hikashop_nocache(); $app = JFactory::getApplication(); $product_id = (int) JRequest::getCmd('product_id', 0); $module_id = (int) JRequest::getCmd('module_id', 0); $cart_type = JRequest::getString('hikashop_cart_type_' . $product_id . '_' . $module_id, 'null'); if ($cart_type == 'null') { $cart_type = JRequest::getString('hikashop_cart_type_' . $module_id, 'null'); } if ($cart_type == 'null') { $cart_type = JRequest::getString('cart_type', 'cart'); } $cart_type_id = $cart_type . '_id'; $class = hikashop_get('class.cart'); $class->cart_type = $cart_type; $cart_id = 0; if ($class->hasCart(JRequest::getInt('cart_id', 0, 'GET'))) { $cart_id = $class->cart->cart_id; } $addTo = JRequest::getString('add_to', ''); if ($addTo != '') { $from_id = $cart_id; if ($addTo == 'cart') { JRequest::setVar('from_id', $cart_id); } $cart_id = $app->getUserState(HIKASHOP_COMPONENT . '.' . $addTo . '_id', 0); $cart_type_id = $addTo . '_id'; JRequest::setVar('cart_type', $addTo); } else { JRequest::setVar('cart_type', $cart_type); } JRequest::setVar($cart_type_id, $cart_id); $char = JRequest::getString('characteristic', ''); if (!empty($char)) { return $this->show(); } $tmpl = JRequest::getCmd('tmpl', 'index'); $add = JRequest::getCmd('add', ''); if (!empty($add)) { $add = 1; } else { $add = 0; } if (empty($product_id)) { $product_id = JRequest::getCmd('cid', 0); } $cart_product_id = JRequest::getCmd('cart_product_id', 0); $quantity = JRequest::getInt('quantity', 1); if (hikashop_loadUser() != null || $cart_type != 'wishlist') { if (!empty($product_id)) { $type = JRequest::getWord('type', 'product'); if ($type == 'product') { $product_id = (int) $product_id; } $status = $class->update($product_id, $quantity, $add, $type); } elseif (!empty($cart_product_id)) { $status = $class->update($cart_product_id, $quantity, $add, 'item'); } else { $formData = JRequest::getVar('item', array(), '', 'array'); if (!empty($formData)) { $class->update($formData, 0, $add, 'item'); } else { $formData = JRequest::getVar('data', array(), '', 'array'); if (!empty($formData)) { $class->update($formData, 0, $add); } } } } $app->setUserState(HIKASHOP_COMPONENT . '.' . $cart_type . '_new', '1'); if (@$class->errors && $tmpl != 'component') { if (!empty($_SERVER['HTTP_REFERER'])) { if (strpos($_SERVER['HTTP_REFERER'], HIKASHOP_LIVE) === false && preg_match('#^https?://.*#', $_SERVER['HTTP_REFERER'])) { return false; } $app->redirect(str_replace('&popup=1', '', $_SERVER['HTTP_REFERER'])); } else { echo '<html><head><script type="text/javascript">history.back();</script></head><body></body></html>'; exit; } } $app->setUserState(HIKASHOP_COMPONENT . '.shipping_method', null); $app->setUserState(HIKASHOP_COMPONENT . '.shipping_id', null); $app->setUserState(HIKASHOP_COMPONENT . '.shipping_data', null); $app->setUserState(HIKASHOP_COMPONENT . '.payment_method', null); $app->setUserState(HIKASHOP_COMPONENT . '.payment_id', null); $app->setUserState(HIKASHOP_COMPONENT . '.payment_data', null); $config =& hikashop_config(); $checkout = JRequest::getString('checkout', ''); if (!empty($checkout)) { global $Itemid; $url = 'checkout'; if (!empty($Itemid)) { $url .= '&Itemid=' . $Itemid; } $url = hikashop_completeLink($url, false, true); $this->setRedirect($url); } else { if ($cart_type == 'wishlist') { $app->setUserState(HIKASHOP_COMPONENT . '.popup_cart_type', 'wishlist'); if (hikashop_loadUser() == null) { $url = JRequest::getVar('return_url', ''); if (!empty($url)) { $url = base64_decode(urldecode($url)); } $url = str_replace(array('&popup=1', '?popup=1'), '', $url); if ($config->get('redirect_url_after_add_cart', 'stay_if_cart') != 'ask_user') { $app->enqueueMessage(JText::_('LOGIN_REQUIRED_FOR_WISHLISTS')); } if ($tmpl != 'component') { if (!empty($_SERVER['HTTP_REFERER'])) { if (strpos($_SERVER['HTTP_REFERER'], HIKASHOP_LIVE) === false && preg_match('#^https?://.*#', $_SERVER['HTTP_REFERER'])) { return false; } if ($config->get('redirect_url_after_add_cart', 'stay_if_cart') == 'ask_user') { $app->enqueueMessage(JText::_('LOGIN_REQUIRED_FOR_WISHLISTS')); } $app->redirect(str_replace('&popup=1', '', $_SERVER['HTTP_REFERER'])); } } else { echo 'notLogged'; exit; } } else { $redirectConfig = $config->get('redirect_url_after_add_cart', 'stay_if_cart'); $url = ''; $stay = 0; switch ($redirectConfig) { case 'ask_user': $url = JRequest::getVar('return_url', ''); if (!empty($url)) { $url = base64_decode(urldecode($url)); } $url = str_replace(array('&popup=1', '?popup=1'), '', $url); if (JRequest::getInt('popup', 0) && empty($_COOKIE['popup']) || JRequest::getInt('quantity', 0)) { if (strpos($url, '?')) { $url .= '&'; } else { $url .= '?'; } $url .= 'popup=1'; $app->setUserState(HIKASHOP_COMPONENT . '.popup', '1'); } JRequest::setVar('cart_type', 'wishlist'); break; case 'stay': $stay = 1; break; //$stay = 1; && $url =''; //$stay = 1; && $url =''; case 'checkout': break; //$stay = 0; && $url =''; //$stay = 0; && $url =''; case 'stay_if_cart': default: $module = JModuleHelper::getModule('hikashop_wishlist', false); if ($module != null) { $stay = 1; } break; } if ($redirectConfig != 'checkout') { $module = JModuleHelper::getModule('hikashop_wishlist', false); $params = new HikaParameter(@$module->params); if (!empty($module)) { $module_options = $config->get('params_' . $module->id); } if (empty($module_options)) { $module_options = $config->get('default_params'); } $data = $params->get('hikashopwishlistmodule'); if (HIKASHOP_J30 && (empty($data) || !is_object($data))) { $db = JFactory::getDBO(); $query = 'SELECT params FROM ' . hikashop_table('modules', false) . ' WHERE id = ' . (int) $module->id; $db->setQuery($query); $itemData = json_decode($db->loadResult()); if (!empty($itemData->hikashopwishlistmodule) && is_object($itemData->hikashopwishlistmodule)) { $data = $itemData->hikashopwishlistmodule; $params->set('hikashopwishlistmodule', $data); } } if (!empty($data) && is_object($data)) { foreach ($data as $k => $v) { $module_options[$k] = $v; } } foreach ($module_options as $key => $optionElement) { $params->set($key, $optionElement); } if (!empty($module)) { foreach (get_object_vars($module) as $k => $v) { if (!is_object($v)) { $params->set($k, $v); } } $params->set('from', 'module'); } $params->set('return_url', $url); $params->set('cart_type', 'wishlist'); $js = ''; hikashop_getLayout('product', 'cart', $params, $js); } } if (empty($url)) { global $Itemid; if (isset($from_id)) { $cart_id = $from_id; } if (JRequest::getInt('new_' . $cart_type . '_id', 0) != 0 && JRequest::getInt('delete', 0) == 0) { $cart_id = JRequest::getInt('new_' . $cart_type . '_id', 0); } $cart = $class->get($cart_id, false, $cart_type); if (!empty($cart) && (int) $cart_id != 0) { $url = 'cart&task=showcart&cart_type=wishlist&cart_id=' . $cart_id . '&Itemid=' . $Itemid; } else { $url = 'cart&task=showcarts&cart_type=wishlist&Itemid=' . $Itemid; } $url = hikashop_completeLink($url, false, true); } if (!isset($stay)) { $stay = JRequest::getInt('stay', 0); } if ($stay == 0) { if (hikashop_disallowUrlRedirect($url)) { return false; } if (JRequest::getVar('from_form', true)) { JRequest::setVar('cart_type', 'wishlist'); $this->setRedirect($url); return false; } else { ob_clean(); echo 'URL|' . $url; exit; } } else { echo '<html><head><script type="text/javascript">history.back();</script></head><body></body></html>'; exit; } } else { $app->setUserState(HIKASHOP_COMPONENT . '.popup_cart_type', 'cart'); $url = JRequest::getVar('return_url', ''); if (empty($url)) { $url = JRequest::getVar('url', ''); $url = urldecode($url); } else { $url = base64_decode(urldecode($url)); } $url = str_replace(array('&popup=1', '?popup=1'), '', $url); if (hikashop_disallowUrlRedirect($url)) { $url = ''; } if (empty($url)) { global $Itemid; $url = 'checkout'; if (!empty($Itemid)) { $url .= '&Itemid=' . $Itemid; } $url = hikashop_completeLink($url, false, true); } $params = new HikaParameter(@$module->params); if ($tmpl == 'component' && $config->get('redirect_url_after_add_cart', 'stay_if_cart') != 'checkout') { $js = ''; jimport('joomla.application.module.helper'); global $Itemid; if (isset($Itemid) && empty($Itemid)) { $Itemid = null; JRequest::setVar('Itemid', null); } $module = JModuleHelper::getModule('hikashop_cart', false); $config =& hikashop_config(); $params = new HikaParameter(@$module->params); if (!empty($module)) { $module_options = $config->get('params_' . $module->id); } if (empty($module_options)) { $module_options = $config->get('default_params'); } $data = $params->get('hikashopcartmodule'); if (HIKASHOP_J30 && (empty($data) || !is_object($data))) { $db = JFactory::getDBO(); $query = 'SELECT params FROM ' . hikashop_table('modules', false) . ' WHERE id = ' . (int) $module->id; $db->setQuery($query); $itemData = json_decode($db->loadResult()); if (!empty($itemData->hikashopcartmodule) && is_object($itemData->hikashopcartmodule)) { $data = $itemData->hikashopcartmodule; $params->set('hikashopcartmodule', $data); } } if (!empty($data) && is_object($data)) { foreach ($data as $k => $v) { $module_options[$k] = $v; } } foreach ($module_options as $key => $optionElement) { $params->set($key, $optionElement); } if (!empty($module)) { foreach (get_object_vars($module) as $k => $v) { if (!is_object($v)) { $params->set($k, $v); } } $params->set('from', 'module'); } $params->set('return_url', $url); hikashop_getLayout('product', 'cart', $params, $js); return true; } else { $config =& hikashop_config(); $url = str_replace(array('&popup=1', '?popup=1'), '', $url); if (JRequest::getInt('popup', 0) || @JRequest::getInt('quantity', 0) && $config->get('redirect_url_after_add_cart', 'stay_if_cart') == 'ask_user') { if (strpos($url, '?')) { $url .= '&'; } else { $url .= '?'; } $url .= 'popup=1'; $app->setUserState(HIKASHOP_COMPONENT . '.popup', '1'); } if (JRequest::getInt('hikashop_ajax', 0) == 0) { // $config->get('ajax_add_to_cart','1') == '0'){ $this->setRedirect($url); return false; } else { ob_clean(); if ($params->get('from', 'module') != 'module' || $config->get('redirect_url_after_add_cart', 'stay_if_cart') == 'checkout') { echo 'URL|' . $url; exit; } else { $this->setRedirect($url); return false; } } } } } }
public function onAfterOrderProductsListingDisplay(&$order, $type) { if (!$this->init()) { return; } $types = array('order_back_show', 'order_back_invoice', 'order_front_show', 'email_notification_html', 'order_frontvendor_show', 'order_frontvendor_invoice'); if (in_array($type, $types)) { $params = new HikaParameter(''); if (isset($order->order_id)) { $params->set('order_id', (int) $order->order_id); } else { $params->set('order_id', (int) $order->products[0]->order_id); } $params->set('order_obj', $order); $js = ''; echo hikaserial::getLayout('orderserial', 'show_' . $type, $params, $js); } }