Exemplo n.º 1
0
 function load($form = false)
 {
     $this->values = array();
     if (!$form) {
         $this->values[] = JHTML::_('select.option', '', JText::_('HIKA_ALL'));
     }
     $this->values[] = JHTML::_('select.option', 'address', JText::_('ADDRESS'));
     if (hikashop_level(1)) {
         $this->values[] = JHTML::_('select.option', 'user', JText::_('HIKA_USER'));
         $this->values[] = JHTML::_('select.option', 'product', JText::_('PRODUCT'));
         $this->values[] = JHTML::_('select.option', 'category', JText::_('CATEGORY'));
         $this->values[] = JHTML::_('select.option', 'contact', JText::_('HIKA_CONTACT'));
         if (hikashop_level(2)) {
             $this->values[] = JHTML::_('select.option', 'order', JText::_('HIKASHOP_ORDER'));
             $this->values[] = JHTML::_('select.option', 'item', JText::_('HIKASHOP_ITEM'));
             $this->values[] = JHTML::_('select.option', 'entry', JText::_('HIKASHOP_ENTRY'));
         }
         if ($this->externalValues == null) {
             $this->externalValues = array();
             JPluginHelper::importPlugin('hikashop');
             $dispatcher = JDispatcher::getInstance();
             $dispatcher->trigger('onTableFieldsLoad', array(&$this->externalValues));
             foreach ($this->externalValues as $externalValue) {
                 if (!empty($externalValue->table) && substr($externalValue->value, 0, 4) != 'plg.') {
                     $externalValue->value = 'plg.' . $externalValue->value;
                 }
                 $this->values[] = JHTML::_('select.option', $externalValue->value, $externalValue->text);
             }
         }
     }
 }
Exemplo n.º 2
0
 function isMulti($inConfig = false, $level = true)
 {
     static $multi = array();
     static $falang = false;
     $this->falang =& $falang;
     $key = (int) $inConfig . '_' . (int) $level;
     if (!isset($multi[$key])) {
         $multi[$key] = false;
         $config =& hikashop_config();
         if ((hikashop_level(1) || !$level) && ($config->get('multi_language_edit', 1) || $inConfig)) {
             $oldQuery = $this->database->getQuery(false);
             $query = 'SHOW TABLES LIKE ' . $this->database->Quote($this->database->getPrefix() . substr(hikashop_table('falang_content', false), 3));
             $this->database->setQuery($query);
             $table = $this->database->loadResult();
             if (!empty($table)) {
                 $falang = true;
                 $multi[$key] = true;
             } else {
                 $query = 'SHOW TABLES LIKE ' . $this->database->Quote($this->database->getPrefix() . substr(hikashop_table('jf_content', false), 3));
                 $this->database->setQuery($query);
                 $table = $this->database->loadResult();
                 if (!empty($table)) {
                     $multi[$key] = true;
                 }
             }
             $this->database->setQuery($oldQuery);
         }
     }
     return $multi[$key];
 }
Exemplo n.º 3
0
 /**
  *
  */
 private function chkHikashopLevel()
 {
     if (function_exists('hikashop_level')) {
         return hikashop_level(1);
     }
     return false;
 }
Exemplo n.º 4
0
 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();
 }
Exemplo n.º 5
0
 function load()
 {
     $this->values = array();
     $this->values[] = JHTML::_('select.option', 'orders', JText::_('ORDERS'));
     $this->values[] = JHTML::_('select.option', 'sales', JText::_('SALES'));
     $this->values[] = JHTML::_('select.option', 'taxes', JText::_('TAXES'));
     $this->values[] = JHTML::_('select.option', 'customers', JText::_('CUSTOMERS'));
     if (hikashop_level(2)) {
         $this->values[] = JHTML::_('select.option', 'partners', JText::_('PARTNERS'));
     }
 }
Exemplo n.º 6
0
 function load()
 {
     $this->values = array();
     $this->values[] = JHTML::_('select.option', 'gauge', JText::_('GAUGE'));
     $this->values[] = JHTML::_('select.option', 'graph', JText::_('GRAPH'));
     $this->values[] = JHTML::_('select.option', 'listing', JText::_('LISTING'));
     if (hikashop_level(2)) {
         $this->values[] = JHTML::_('select.option', 'map', JText::_('MAP'));
     }
     $this->values[] = JHTML::_('select.option', 'pie', JText::_('PIE'));
 }
Exemplo n.º 7
0
 function newentry()
 {
     if (hikashop_level(2)) {
         JHTML::_('behavior.formvalidation');
         $app = JFactory::getApplication();
         $fieldsClass = hikashop_get('class.field');
         $this->assignRef('fieldsClass', $fieldsClass);
         $null = null;
         $this->extraFields['entry'] = $fieldsClass->getFields('frontcomp', $null, 'entry');
         $this->assignRef('extraFields', $this->extraFields);
         $this->assignRef('entry', $null);
         $id = JRequest::getInt('id');
         $fieldsClass->suffix = '_' . $id;
         $this->assignRef('id', $id);
     }
 }
Exemplo n.º 8
0
 function downloadXML()
 {
     if (hikashop_level(1)) {
         $xml = $this->generateXML();
         @ob_clean();
         header("Pragma: public");
         header("Expires: 0");
         // set expiration time
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header("Content-Type: application/force-download");
         header("Content-Type: application/octet-stream");
         header("Content-Type: application/download");
         header("Content-Disposition: attachment; filename=Google_data_feed_" . time() . ".xml;");
         header("Content-Transfer-Encoding: binary");
         header('Content-Length: ' . strlen($xml));
         echo $xml;
         exit;
     }
 }
Exemplo n.º 9
0
 function display($tpl = null, $title = '', $menu_style = '')
 {
     $this->assignRef('title', $title);
     $this->assignRef('menu_style', $menu_style);
     if (!HIKASHOP_PHP5) {
         $doc =& JFactory::getDocument();
     } else {
         $doc = JFactory::getDocument();
     }
     $doc->addStyleSheet(HIKASHOP_CSS . 'menu.css');
     $config = hikashop_config();
     $function = $this->getLayout();
     if (method_exists($this, $function)) {
         $this->{$function}();
     }
     $plugin = JPluginHelper::getPlugin('system', 'hikashopaffiliate');
     $menus = array('system' => array('name' => JText::_('SYSTEM'), 'check' => 'ctrl=config', 'acl' => 'config', 'task' => 'manage', 'icon' => 'icon-16-config', 'url' => !HIKASHOP_J16 || JFactory::getUser()->authorise('core.admin', 'com_hikashop') ? hikashop_completeLink('config') : '#', 'children' => array(array('name' => JText::_('HIKA_CONFIGURATION'), 'check' => 'ctrl=config', 'acl' => 'config', 'task' => 'manage', 'icon' => 'icon-16-config', 'url' => hikashop_completeLink('config'), 'display' => !HIKASHOP_J16 || JFactory::getUser()->authorise('core.admin', 'com_hikashop')), array('name' => JText::_('ZONES'), 'check' => 'ctrl=zone', 'acl' => 'zone', 'icon' => 'icon-16-language', 'url' => hikashop_completeLink('zone')), array('name' => JText::_('PAYMENT_METHODS'), 'check' => array('ctrl' => 'plugins', 'plugin_type' => 'payment'), 'acl' => 'plugins', 'icon' => 'icon-16-plugin', 'url' => hikashop_completeLink('plugins&plugin_type=payment')), array('name' => JText::_('SHIPPING_METHODS'), 'check' => array('ctrl' => 'plugins', 'plugin_type' => 'shipping'), 'acl' => 'plugins', 'icon' => 'icon-16-plugin', 'url' => hikashop_completeLink('plugins&plugin_type=shipping')), array('name' => JText::_('PLUGINS'), 'check' => array('ctrl' => 'plugins', 'plugin_type' => 'plugin'), 'acl' => 'plugins', 'icon' => 'icon-16-plugin', 'url' => hikashop_completeLink('plugins&plugin_type=plugin')), array('name' => JText::_('WAREHOUSE'), 'check' => array('ctrl' => 'warehouse'), 'acl' => 'warehouse', 'icon' => 'icon-16-warehouse', 'url' => hikashop_completeLink('warehouse')), array('name' => JText::_('TAXES'), 'check' => array('ctrl' => 'taxation'), 'acl' => 'taxation', 'icon' => 'icon-16-tax', 'url' => hikashop_completeLink('taxation')), array('name' => JText::_('CURRENCIES'), 'check' => array('ctrl' => 'currency'), 'acl' => 'currency', 'icon' => 'icon-16-currency', 'url' => hikashop_completeLink('currency')), array('name' => JText::_('ORDER_STATUSES'), 'check' => array('ctrl' => 'category', 'filter_id' => 'status'), 'acl' => 'config', 'icon' => 'icon-16-order', 'url' => hikashop_completeLink('category&filter_id=status')), array('name' => JText::_('EMAILS'), 'check' => array('ctrl' => 'email'), 'acl' => 'email', 'url' => hikashop_completeLink('email'), 'icon' => 'icon-16-email', 'display' => hikashop_level(2)), array('name' => JText::_('HIKA_MASSACTION'), 'check' => 'ctrl=massaction', 'acl' => 'massaction', 'url' => hikashop_completeLink('massaction'), 'icon' => 'icon-16-massaction'))), 'products' => array('name' => JText::_('PRODUCTS'), 'check' => array('ctrl' => 'product', '!task' => array('add')), 'acl' => 'product', 'icon' => 'icon-16-product', 'url' => hikashop_completeLink('product'), 'children' => array(array('name' => JText::_('ADD_PRODUCT'), 'check' => array('ctrl' => 'procut', 'task' => 'add'), 'acl' => 'product', 'task' => 'manage', 'icon' => 'icon-16-addproduct', 'url' => hikashop_completeLink('product&task=add')), array('name' => JText::_('PRODUCTS'), 'check' => array('ctrl' => 'product', '!task' => array('add')), 'acl' => 'product', 'icon' => 'icon-16-product', 'url' => hikashop_completeLink('product')), array('name' => JText::_('HIKA_CATEGORIES'), 'check' => array('ctrl' => 'category', 'filter_id' => 'product'), 'acl' => 'category', 'icon' => 'icon-16-category', 'url' => hikashop_completeLink('category&filter_id=product')), array('name' => JText::_('CHARACTERISTICS'), 'check' => 'ctrl=characteristic', 'acl' => 'characteristic', 'icon' => 'icon-16-characteristic', 'url' => hikashop_completeLink('characteristic')), array('name' => JText::_('MANUFACTURERS'), 'check' => array('ctrl' => 'category', 'filter_id' => 'manufacturer'), 'acl' => 'category', 'icon' => 'icon-16-category', 'url' => hikashop_completeLink('category&filter_id=manufacturer')), array('name' => JText::_('HIKA_BADGES'), 'check' => 'ctrl=badge', 'acl' => 'badge', 'icon' => 'icon-16-badge', 'url' => hikashop_completeLink('badge')), array('name' => JText::_('LIMIT'), 'check' => 'ctrl=limit', 'icon' => 'icon-16-limit', 'acl' => 'limit', 'url' => hikashop_completeLink('limit'), 'display' => hikashop_level(1)), array('name' => JText::_('IMPORT'), 'check' => 'ctrl=import', 'acl' => 'import', 'icon' => 'icon-16-import', 'url' => hikashop_completeLink('import&task=show')))), 'customers' => array('name' => JText::_('CUSTOMERS'), 'check' => array('ctrl' => 'user', 'filter_partner' => 0, '!task' => array('clicks')), 'acl' => 'user', 'icon' => 'icon-16-user', 'url' => hikashop_completeLink('user&filter_partner=0'), 'children' => array(array('name' => JText::_('CUSTOMERS'), 'check' => array('ctrl' => 'user', 'filter_partner' => 0, '!task' => array('clicks')), 'acl' => 'user', 'icon' => 'icon-16-user', 'url' => hikashop_completeLink('user&filter_partner=0')), array('name' => JText::_('VOTE'), 'check' => 'ctrl=vote', 'acl' => 'vote', 'icon' => 'icon-16-vote', 'url' => hikashop_completeLink('vote')), array('name' => JText::_('HIKASHOP_CHECKOUT_CART'), 'check' => array('ctrl' => 'cart', 'cart_type' => 'cart'), 'acl' => 'cart', 'icon' => 'icon-16-cart', 'url' => hikashop_completeLink('cart&cart_type=cart'), 'display' => hikashop_level(1)), array('name' => JText::_('WISHLISTS'), 'check' => array('ctrl' => 'cart', 'cart_type' => 'wishlist'), 'acl' => 'wishlist', 'icon' => 'icon-16-wishlist', 'url' => hikashop_completeLink('cart&cart_type=wishlist'), 'display' => hikashop_level(1) && $config->get('enable_wishlist', 0)), array('name' => JText::_('HIKA_WAITLIST'), 'check' => array('ctrl' => 'waitlist'), 'acl' => 'waitlist', 'icon' => 'icon-16-wishlist', 'url' => hikashop_completeLink('waitlist'), 'display' => hikashop_level(1) && $config->get('product_waitlist', 1)))), 'orders' => array('name' => JText::_('ORDERS'), 'check' => array('ctrl' => 'order', 'filter_partner' => 0), 'acl' => 'order', 'icon' => 'icon-16-order', 'url' => hikashop_completeLink('order&order_type=sale&filter_partner=0'), 'children' => array(array('name' => JText::_('ORDERS'), 'check' => array('ctrl' => 'order', 'filter_partner' => 0), 'acl' => 'order', 'icon' => 'icon-16-order', 'url' => hikashop_completeLink('order&order_type=sale&filter_partner=0')), array('name' => JText::_('DISCOUNTS'), 'check' => array('ctrl=discount', 'filter_type' => 'discount'), 'acl' => 'discount', 'icon' => 'icon-16-discount', 'url' => hikashop_completeLink('discount&filter_type=discount')), array('name' => JText::_('COUPONS'), 'check' => array('ctrl=discount', 'filter_type' => 'coupon'), 'acl' => 'discount', 'icon' => 'icon-16-discount', 'url' => hikashop_completeLink('discount&filter_type=coupon')), array('name' => JText::_('HIKASHOP_ENTRIES'), 'check' => 'ctrl=entry', 'acl' => 'entry', 'icon' => 'icon-16-article', 'url' => hikashop_completeLink('entry'), 'display' => hikashop_level(2)), array('name' => JText::_('HIKASHOP_REPORTS'), 'check' => 'ctrl=report', 'acl' => 'report', 'icon' => 'icon-16-report', 'url' => hikashop_completeLink('report'), 'display' => hikashop_level(1)))), 'affiliates' => array('name' => JText::_('AFFILIATES'), 'check' => array('ctrl' => 'user', 'filter_partner' => '1'), 'acl' => 'affiliates', 'icon' => 'icon-16-affiliate', 'url' => hikashop_completeLink('user&filter_partner=1'), 'display' => !empty($plugin) && hikashop_level(2), 'children' => array(array('name' => JText::_('PARTNERS'), 'check' => array('ctrl' => 'user', 'filter_partner' => '1'), 'acl' => 'affiliates', 'icon' => 'icon-16-affiliate', 'url' => hikashop_completeLink('user&filter_partner=1')), array('name' => JText::_('HIKA_BANNERS'), 'check' => 'ctrl=banner', 'acl' => 'banner', 'icon' => 'icon-16-banner', 'url' => hikashop_completeLink('banner')), array('name' => JText::_('AFFILIATES_SALES'), 'check' => array('ctrl' => 'order', 'filter_partner' => '1'), 'acl' => 'order', 'icon' => 'icon-16-order', 'url' => hikashop_completeLink('order&order_type=sale&filter_partner=1')), array('name' => JText::_('CLICKS'), 'check' => array('ctrl' => 'user', 'task' => 'clicks'), 'acl' => 'order', 'icon' => 'icon-16-click', 'url' => hikashop_completeLink('user&task=clicks')))), 'display' => array('name' => JText::_('DISPLAY'), 'check' => 'ctrl=view', 'acl' => 'view', 'icon' => 'icon-16-views', 'url' => hikashop_completeLink('view'), 'children' => array(array('name' => JText::_('VIEWS'), 'check' => 'ctrl=view', 'acl' => 'view', 'icon' => 'icon-16-views', 'url' => hikashop_completeLink('view')), array('name' => JText::_('CONTENT_MENUS'), 'check' => 'ctrl=menus', 'acl' => 'menus', 'icon' => 'icon-16-menu', 'url' => hikashop_completeLink('menus'), 'display' => !HIKASHOP_J30), array('name' => JText::_('CONTENT_MODULES'), 'check' => 'ctrl=modules', 'acl' => 'modules', 'icon' => 'icon-16-module', 'url' => hikashop_completeLink('modules'), 'display' => !HIKASHOP_J30), array('name' => JText::_('FIELDS'), 'check' => 'ctrl=field', 'acl' => 'field', 'icon' => 'icon-16-field', 'url' => hikashop_completeLink('field')), array('name' => JText::_('FILTERS'), 'check' => 'ctrl=filter', 'acl' => 'filter', 'icon' => 'icon-16-filter', 'url' => hikashop_completeLink('filter'), 'display' => hikashop_level(2)))), 'help' => array('name' => JText::_('DOCUMENTATION'), 'check' => 'ctrl=documentation', 'acl' => 'documentation', 'icon' => 'icon-16-help', 'url' => hikashop_completeLink('documentation'), 'children' => array(array('name' => JText::_('DOCUMENTATION'), 'check' => 'ctrl=documentation', 'acl' => 'documentation', 'icon' => 'icon-16-help', 'url' => hikashop_completeLink('documentation')), array('name' => JText::_('UPDATE_ABOUT'), 'check' => 'ctrl=update', 'acl' => 'update_about', 'icon' => 'icon-16-install', 'url' => hikashop_completeLink('update')), array('name' => JText::_('FORUM'), 'options' => 'target="_blank"', 'acl' => 'forum', 'icon' => 'icon-16-info', 'url' => HIKASHOP_URL . 'support/forum.html'))));
     $this->_checkActive($menus);
     $this->assignRef('menus', $menus);
     parent::display($tpl);
 }
Exemplo n.º 10
0
 function load($type = '')
 {
     $this->allValues = array('text' => array('name' => JText::_('FIELD_TEXT'), 'options' => array("size", "required", "default", "columnname", "filtering", "maxlength", "readonly", "placeholder", "translatable", "attribute")), 'link' => array('name' => JText::_('LINK'), 'options' => array("size", "required", "default", "columnname", "filtering", "maxlength", "readonly", "attribute")), 'textarea' => array('name' => JText::_('FIELD_TEXTAREA'), 'options' => array("cols", "rows", "required", "default", "columnname", "filtering", "readonly", "maxlength", "placeholder", "translatable", "attribute")), 'wysiwyg' => array('name' => JText::_('WYSIWYG'), 'options' => array("cols", "rows", "required", "default", "columnname", "filtering", "translatable")), 'radio' => array('name' => JText::_('FIELD_RADIO'), 'options' => array("multivalues", "required", "default", "columnname", "attribute")), 'checkbox' => array('name' => JText::_('FIELD_CHECKBOX'), 'options' => array("multivalues", "required", "default", "columnname", "attribute")), 'singledropdown' => array('name' => JText::_('FIELD_SINGLEDROPDOWN'), 'options' => array("multivalues", "required", "default", "columnname", "attribute")), 'multipledropdown' => array('name' => JText::_('FIELD_MULTIPLEDROPDOWN'), 'options' => array("multivalues", "size", "default", "columnname", "attribute")), 'date' => array('name' => JText::_('FIELD_DATE'), 'options' => array("required", "format", "size", "default", "columnname", "allow")), 'zone' => array('name' => JText::_('FIELD_ZONE'), 'options' => array("required", "zone", "default", "columnname", "pleaseselect", "attribute")));
     if (hikashop_level(2)) {
         if ($type == 'entry' || empty($type)) {
             $this->allValues["coupon"] = array('name' => JText::_('HIKASHOP_COUPON'), 'options' => array("size", "required", "default", "columnname"));
         }
         $this->allValues["file"] = array('name' => JText::_('HIKA_FILE'), 'options' => array("required", "default", "columnname", "attribute"));
         $this->allValues["image"] = array('name' => JText::_('HIKA_IMAGE'), 'options' => array("required", "default", "columnname", "attribute"));
         $this->allValues['ajaxfile'] = array('name' => JText::_('FIELD_AJAX_FILE'), 'options' => array("required", "default", "columnname"));
         $this->allValues['ajaximage'] = array('name' => JText::_('FIELD_AJAX_IMAGE'), 'options' => array("required", "default", "columnname", "imagesize"));
     }
     $this->allValues["customtext"] = array('name' => JText::_('CUSTOM_TEXT'), 'options' => array("customtext"));
     if ($this->externalValues == null) {
         $this->externalValues = array();
         $this->externalOptions = array();
         JPluginHelper::importPlugin('hikashop');
         $dispatcher = JDispatcher::getInstance();
         $dispatcher->trigger('onFieldsLoad', array(&$this->externalValues, &$this->externalOptions));
     }
     if (!empty($this->externalValues)) {
         foreach ($this->externalValues as $value) {
             if (substr($value->name, 0, 4) != 'plg.') {
                 $value->name = 'plg.' . $value->name;
             }
             $this->allValues[$value->name] = array('name' => $value->text, 'options' => @$value->options);
         }
     }
     foreach ($this->allValues as $v) {
         if (!empty($v['options'])) {
             foreach ($v['options'] as $o) {
                 $this->options[$o] = $o;
             }
         }
     }
 }
Exemplo n.º 11
0
 function check(&$coupon, &$total, $zones, &$products, $display_error = true)
 {
     JPluginHelper::importPlugin('hikashop');
     $dispatcher = JDispatcher::getInstance();
     $error_message = '';
     $do = true;
     if (isset($coupon->discount_value)) {
         $coupon = $this->get($coupon->discount_id);
     }
     $dispatcher->trigger('onBeforeCouponCheck', array(&$coupon, &$total, &$zones, &$products, &$display_error, &$error_message, &$do));
     if ($do) {
         $user = hikashop_get('class.user');
         $currency = hikashop_get('class.currency');
         if (empty($coupon)) {
             $error_message = JText::_('COUPON_NOT_VALID');
         } elseif ($coupon->discount_start > time()) {
             $error_message = JText::_('COUPON_NOT_YET_USABLE');
         } elseif ($coupon->discount_end && $coupon->discount_end < time()) {
             $error_message = JText::_('COUPON_EXPIRED');
         } elseif (hikashop_level(2) && !empty($coupon->discount_access) && $coupon->discount_access != 'all' && ($coupon->discount_access == 'none' || !hikashop_isAllowed($coupon->discount_access))) {
             $error_message = JText::_('COUPON_NOT_FOR_YOU');
         } elseif (empty($error_message) && hikashop_level(1) && !empty($coupon->discount_quota) && $coupon->discount_quota <= $coupon->discount_used_times) {
             $error_message = JText::_('QUOTA_REACHED_FOR_COUPON');
         } elseif (empty($error_message) && hikashop_level(1)) {
             if (!empty($coupon->discount_quota_per_user)) {
                 $user_id = hikashop_loadUser();
                 if ($user_id) {
                     $db = JFactory::getDBO();
                     $config =& hikashop_config();
                     $cancelled_order_status = explode(',', $config->get('cancelled_order_status'));
                     $cancelled_order_status = "'" . implode("','", $cancelled_order_status) . "'";
                     $query = 'SELECT COUNT(order_id) AS already_used FROM ' . hikashop_table('order') . ' WHERE order_user_id=' . (int) $user_id . ' AND order_status NOT IN (' . $cancelled_order_status . ') AND order_discount_code=' . $db->Quote($coupon->discount_code) . ' GROUP BY order_id';
                     $db->setQuery($query);
                     $already_used = $db->loadResult();
                     if ($coupon->discount_quota_per_user <= $already_used) {
                         $error_message = JText::_('QUOTA_REACHED_FOR_COUPON');
                     }
                 }
             }
             if (empty($error_message) && $coupon->discount_zone_id) {
                 if (!is_array($coupon->discount_zone_id)) {
                     $coupon->discount_zone_id = explode(',', $coupon->discount_zone_id);
                 }
                 $class = hikashop_get('class.zone');
                 $zone = $class->getZones($coupon->discount_zone_id, 'zone_namekey', 'zone_namekey', true);
                 if ($zone && !count(array_intersect($zone, $zones))) {
                     $error_message = JText::_('COUPON_NOT_AVAILABLE_IN_YOUR_ZONE');
                 }
             }
             $ids = array();
             $qty = 0;
             foreach ($products as $prod) {
                 $qty += $prod->cart_product_quantity;
                 if (!empty($prod->product_parent_id)) {
                     $ids[$prod->product_parent_id] = (int) $prod->product_parent_id;
                 } else {
                     $ids[$prod->product_id] = (int) $prod->product_id;
                 }
             }
             if (empty($ids)) {
                 $error_message = JText::_('COUPON_NOT_FOR_EMPTY_CART');
             }
             if (!empty($coupon->discount_product_id) && is_string($coupon->discount_product_id)) {
                 $coupon->discount_product_id = explode(',', $coupon->discount_product_id);
             }
             if (empty($error_message) && !empty($coupon->discount_product_id) && count(array_intersect($ids, $coupon->discount_product_id)) == 0) {
                 $error_message = JText::_('COUPON_NOT_FOR_THOSE_PRODUCTS');
             }
             if (empty($error_message) && $coupon->discount_category_id) {
                 $db = JFactory::getDBO();
                 if (!is_array($coupon->discount_category_id)) {
                     $coupon->discount_category_id = explode(',', trim($coupon->discount_category_id, ','));
                 }
                 if ($coupon->discount_category_childs) {
                     $filters = array('b.category_type=\'product\'', 'a.product_id IN (' . implode(',', $ids) . ')');
                     $categoryClass = hikashop_get('class.category');
                     $categories = $categoryClass->getCategories($coupon->discount_category_id, 'category_left, category_right');
                     if (!empty($categories)) {
                         $categoriesFilters = array();
                         foreach ($categories as $category) {
                             $categoriesFilters[] = 'b.category_left >= ' . $category->category_left . ' AND b.category_right <= ' . $category->category_right;
                         }
                         if (count($categoriesFilters)) {
                             $filters[] = '((' . implode(') OR (', $categoriesFilters) . '))';
                             hikashop_addACLFilters($filters, 'category_access', 'b');
                             $select = 'SELECT a.product_id FROM ' . hikashop_table('category') . ' AS b LEFT JOIN ' . hikashop_table('product_category') . ' AS a ON b.category_id=a.category_id WHERE ' . implode(' AND ', $filters);
                             $db->setQuery($select);
                             $id = $db->loadRowList();
                             if (empty($id)) {
                                 $error_message = JText::_('COUPON_NOT_FOR_PRODUCTS_IN_THOSE_CATEGORIES');
                             }
                         }
                     }
                 } else {
                     JArrayHelper::toInteger($coupon->discount_category_id);
                     $filters = array('b.category_id IN (' . implode(',', $coupon->discount_category_id) . ')', 'a.product_id IN (' . implode(',', $ids) . ')');
                     hikashop_addACLFilters($filters, 'category_access', 'b');
                     $select = 'SELECT a.product_id FROM ' . hikashop_table('category') . ' AS b LEFT JOIN ' . hikashop_table('product_category') . ' AS a ON b.category_id=a.category_id WHERE ' . implode(' AND ', $filters);
                     $db->setQuery($select);
                     $id = $db->loadRowList();
                     if (empty($id)) {
                         $error_message = JText::_('COUPON_NOT_FOR_PRODUCTS_IN_THOSE_CATEGORIES');
                     }
                 }
             }
             $coupon->products = array();
             if (!empty($coupon->discount_product_id)) {
                 foreach ($products as $product) {
                     if (!in_array($product->product_id, $coupon->discount_product_id)) {
                         foreach ($products as $product2) {
                             if ($product2->cart_product_id == $product->cart_product_parent_id && in_array($product2->product_id, $coupon->discount_product_id)) {
                                 $coupon->products[] = $product;
                             }
                         }
                     } else {
                         $coupon->products[] = $product;
                     }
                 }
             } else {
                 if (!empty($id)) {
                     foreach ($products as $product) {
                         foreach ($id as $productid) {
                             if ($product->product_id !== $productid[0]) {
                                 foreach ($products as $product2) {
                                     if ($product2->cart_product_id == $product->cart_product_parent_id && $product2->product_id == $productid[0]) {
                                         $coupon->products[] = $product;
                                     }
                                 }
                             } else {
                                 $coupon->products[] = $product;
                             }
                         }
                     }
                 } else {
                     foreach ($products as $product) {
                         $coupon->products[] = $product;
                     }
                     $coupon->all_products = true;
                 }
             }
             if (empty($error_message) && bccomp($coupon->discount_minimum_order, 0, 5)) {
                 $currency->convertCoupon($coupon, $total->prices[0]->price_currency_id);
                 $config =& hikashop_config();
                 $discount_before_tax = $config->get('discount_before_tax');
                 $var = 'price_value_with_tax';
                 if ($discount_before_tax) {
                     $var = 'price_value';
                 }
                 $total_amount = 0;
                 if (!empty($coupon->products)) {
                     foreach ($coupon->products as $product) {
                         if ($product->cart_product_quantity > 0) {
                             $total_amount += @$product->prices[0]->{$var};
                         }
                     }
                 }
                 if ($coupon->discount_minimum_order > $total_amount) {
                     $error_message = JText::sprintf('ORDER_NOT_EXPENSIVE_ENOUGH_FOR_COUPON', $currency->format($coupon->discount_minimum_order, $coupon->discount_currency_id));
                 }
             }
             if (empty($error_message) && (int) $coupon->discount_minimum_products > 0) {
                 $qty = 0;
                 if (!empty($coupon->products)) {
                     foreach ($coupon->products as $product) {
                         $qty += $product->cart_product_quantity;
                     }
                 }
                 if ((int) $coupon->discount_minimum_products > $qty) {
                     $error_message = JText::sprintf('NOT_ENOUGH_PRODUCTS_FOR_COUPON', (int) $coupon->discount_minimum_products);
                 }
             }
         }
     }
     $dispatcher->trigger('onAfterCouponCheck', array(&$coupon, &$total, &$zones, &$products, &$display_error, &$error_message, &$do));
     if (!empty($error_message)) {
         $class = hikashop_get('class.cart');
         $class->update('', 0, 0, 'coupon');
         if ($display_error) {
             JRequest::setVar('coupon_error_message', $error_message);
         }
         return null;
     }
     JRequest::setVar('coupon_error_message', '');
     if ($do) {
         $currency->convertCoupon($coupon, $total->prices[0]->price_currency_id);
         if (!HIKASHOP_PHP5) {
             $coupon->total = $total;
         } else {
             if (!isset($coupon->total)) {
                 $coupon->total = new stdClass();
             }
             $coupon->total->prices = array(clone reset($total->prices));
         }
         $this->recalculateDiscountValue($coupon, $products, $id);
         switch (@$coupon->discount_coupon_nodoubling) {
             case 1:
             case 2:
                 $coupon = $this->addCoupon($coupon, $products, $currency, $coupon->discount_coupon_nodoubling);
                 break;
             default:
                 $currency->addCoupon($coupon->total, $coupon, $products, $id);
                 break;
         }
     }
     return $coupon;
 }
Exemplo n.º 12
0
 function contact()
 {
     $user = hikashop_loadUser(true);
     $this->assignRef('element', $user);
     $doc = JFactory::getDocument();
     $app = JFactory::getApplication();
     $product_id = (int) hikashop_getCID('product_id');
     $config =& hikashop_config();
     $this->assignRef('config', $config);
     $imageHelper = hikashop_get('helper.image');
     $this->assignRef('imageHelper', $imageHelper);
     $element = null;
     if (!empty($product_id)) {
         $filters = array('a.product_id=' . $product_id);
         hikashop_addACLFilters($filters, 'product_access', 'a');
         $query = 'SELECT 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) . ' LIMIT 1';
         $database = JFactory::getDBO();
         $database->setQuery($query);
         $element = $database->loadObject();
         if (!empty($element)) {
             if ($element->product_type == 'variant') {
                 $this->selected_variant_id = $product_id;
                 $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);
                 $element = $database->loadObject();
                 if (empty($element)) {
                     return;
                 }
                 $product_id = $element->product_id;
             }
             $productClass = hikashop_get('class.product');
             $productClass->addAlias($element);
             if (!$element->product_published) {
                 return;
             }
             $query = 'SELECT file_id, file_name, file_description, file_path FROM ' . hikashop_table('file') . ' AS file WHERE file.file_type = \'product\' AND file_ref_id = ' . (int) $product_id . ' ORDER BY file_ordering ASC';
             $database->setQuery($query);
             $element->images = $database->loadObjectList();
             global $Itemid;
             $url_itemid = '';
             if (!empty($Itemid)) {
                 $url_itemid = '&Itemid=' . $Itemid;
             }
             $product_url = hikashop_contentLink('product&task=show&cid=' . (int) $element->product_id . '&name=' . $element->alias . $url_itemid, $element);
             $this->assignRef('product_url', $product_url);
         }
     }
     if (hikashop_level(1)) {
         $fieldsClass = hikashop_get('class.field');
         $this->assignRef('fieldsClass', $fieldsClass);
         $contactFields = $fieldsClass->getFields('frontcomp', $element, 'contact', 'checkout&task=state');
         $null = array();
         $fieldsClass->addJS($null, $null, $null);
         $fieldsClass->jsToggle($contactFields, $element, 0);
         $extraFields = array('contact' => &$contactFields);
         $requiredFields = array();
         $validMessages = array();
         $values = array('contact' => $element);
         $fieldsClass->checkFieldsForJS($extraFields, $requiredFields, $validMessages, $values);
         $fieldsClass->addJS($requiredFields, $validMessages, array('contact'));
         $this->assignRef('contactFields', $contactFields);
     }
     $this->assignRef('product', $element);
     $js = "\nfunction checkFields(){\n\tvar send = true;\n\tvar name = document.getElementById('hikashop_contact_name');\n\tif(name != null){\n\t\tif(name.value == ''){\n\t\t\tname.className = name.className.replace('hikashop_red_border','') + ' hikashop_red_border';\n\t\t\tsend = false;\n\t\t}else{\n\t\t\tname.className=name.className.replace('hikashop_red_border','');\n\t\t}\n\t}\n\tvar email = document.getElementById('hikashop_contact_email');\n\tif(email != null){\n\t\tif(email.value == ''){\n\t\t\temail.className = email.className.replace('hikashop_red_border','') + ' hikashop_red_border';\n\t\t\tsend = false;\n\t\t}else{\n\t\t\temail.value = email.value.replace(/ /g,\"\");\n\t\t\tvar filter = /^([a-z0-9_'&\\.\\-\\+])+\\@(([a-z0-9\\-])+\\.)+([a-z0-9]{2,10})+\$/i;\n\t\t\tif(!email || !filter.test(email.value)){\n\t\t\t\temail.className = email.className.replace('hikashop_red_border','') + ' hikashop_red_border';\n\t\t\t\treturn false;\n\t\t\t}else{\n\t\t\t\temail.className=email.className.replace('hikashop_red_border','');\n\t\t\t}\n\t\t}\n\t}\n\tvar altbody = document.getElementById('hikashop_contact_altbody');\n\tif(altbody != null){\n\t\tif(altbody.value == ''){\n\t\t\taltbody.className = altbody.className.replace('hikashop_red_border','') + ' hikashop_red_border';\n\t\t\tsend = false;\n\t\t}else{\n\t\t\taltbody.className=altbody.className.replace('hikashop_red_border','');\n\t\t}\n\t}\n\tif(!hikashopCheckChangeForm('contact','hikashop_contact_form')){\n\t\tsend = false;\n\t}\n\tif(send == true){\n\t\tdocument.getElementById('toolbar').innerHTML='<img src=\"" . HIKASHOP_IMAGES . "spinner.gif\"/>';\n\t\twindow.hikashop.submitform('send_email', 'hikashop_contact_form');\n\t}\n}\nwindow.hikashop.ready(function(){\n\tvar name = document.getElementById('hikashop_contact_name');\n\tif(name != null){\n\t\tname.onclick=function(){\n\t\t\tname.className=name.className.replace('hikashop_red_border','');\n\t\t}\n\t}\n\tvar email = document.getElementById('hikashop_contact_email');\n\tif(email != null){\n\t\temail.onclick=function(){\n\t\t\temail.className=email.className.replace('hikashop_red_border','');\n\t\t}\n\t}\n\tvar altbody = document.getElementById('hikashop_contact_altbody');\n\tif(altbody != null){\n\t\taltbody.onclick=function(){\n\t\t\taltbody.className=altbody.className.replace('hikashop_red_border','');\n\t\t}\n\t}\n});\n\t\t";
     $doc->addScriptDeclaration($js);
 }
Exemplo n.º 13
0
 function getOrderAdditionalInfo(&$order)
 {
     if (hikashop_level(2)) {
         $query = 'SELECT * FROM ' . hikashop_table('entry') . ' WHERE order_id=' . $order->order_id;
         $this->database->setQuery($query);
         $order->entries = $this->database->loadObjectList();
     }
     $product_ids = array();
     if (isset($order->cart->products)) {
         $products =& $order->cart->products;
     } else {
         $products =& $order->products;
     }
     if (!empty($products)) {
         foreach ($products as $product) {
             if (!empty($product->product_id)) {
                 $product_ids[] = $product->product_id;
             }
         }
     }
     if (count($product_ids)) {
         $query = 'SELECT * FROM ' . hikashop_table('product') . ' WHERE product_id IN (' . implode(',', $product_ids) . ') AND product_type=\'variant\'';
         $this->database->setQuery($query);
         $productInfos = $this->database->loadObjectList();
         if (!empty($productInfos)) {
             foreach ($productInfos as $product) {
                 foreach ($products as $item) {
                     if ($product->product_id == $item->product_id && !empty($product->product_parent_id)) {
                         $item->product_parent_id = $product->product_parent_id;
                         $product_ids[] = $product->product_parent_id;
                     }
                 }
             }
         }
         $filters = array('a.file_ref_id IN (' . implode(',', $product_ids) . ')', 'a.file_type=\'file\'');
         $query = 'SELECT b.*,a.* FROM ' . hikashop_table('file') . ' AS a LEFT JOIN ' . hikashop_table('download') . ' AS b ON b.order_id=' . $order->order_id . ' AND a.file_id = b.file_id WHERE ' . implode(' AND ', $filters) . ' ORDER BY a.file_ref_id ASC, a.file_ordering ASC, b.file_pos ASC';
         $this->database->setQuery($query);
         $files = $this->database->loadObjectList();
         if (!empty($files)) {
             foreach ($products as $k => $product) {
                 $products[$k]->files = array();
                 foreach ($files as $file) {
                     if ($product->product_id == $file->file_ref_id) {
                         $this->_setDownloadFile($file, $products, $k);
                     }
                 }
                 if (empty($products[$k]->files) && !empty($product->product_parent_id)) {
                     foreach ($files as $file) {
                         if ($product->product_parent_id == $file->file_ref_id) {
                             $this->_setDownloadFile($file, $products, $k);
                         }
                     }
                 }
             }
         }
         $filters = array('a.file_ref_id IN (' . implode(',', $product_ids) . ')', 'a.file_type =\'product\'');
         $query = 'SELECT a.* FROM ' . hikashop_table('file') . ' AS a WHERE ' . implode(' AND ', $filters) . ' ORDER BY file_ref_id ASC, file_ordering ASC';
         $this->database->setQuery($query);
         $images = $this->database->loadObjectList();
         if (!empty($images)) {
             foreach ($products as $k => $product) {
                 $products[$k]->images = array();
                 foreach ($images as $image) {
                     if ($product->product_id == $image->file_ref_id) {
                         $products[$k]->images[] = $image;
                     }
                 }
                 if (empty($products[$k]->files) && !empty($product->product_parent_id)) {
                     foreach ($images as $image) {
                         if ($product->product_parent_id == $image->file_ref_id) {
                             $products[$k]->images[] = $image;
                         }
                     }
                 }
             }
         }
     }
 }
                }
            }
            $shippings_data[] = $shipping_data;
        }
        if (!empty($shippings_data)) {
            $vars['SHIPPING'] = '<ul><li>' . implode('</li><li>', $shippings_data) . '</li></ul>';
            $vars['SHIPPING_TXT'] = ' - ' . implode("\r\n - ", $shippings_data);
        }
    }
    unset($shippingClass);
} else {
    $vars['SHIPPING'] = '';
}
ob_start();
$sep = '';
if (hikashop_level(2)) {
    $fields = $fieldsClass->getFields('frontcomp', $data, 'order', '');
    foreach ($fields as $fieldName => $oneExtraField) {
        if (isset($data->{$fieldName}) && !isset($data->cart->{$fieldName})) {
            $data->cart->{$fieldName} = $data->{$fieldName};
        }
        if (empty($data->cart->{$fieldName})) {
            continue;
        }
        echo $sep . $fieldsClass->trans($oneExtraField->field_realname) . ' : ' . $fieldsClass->show($oneExtraField, $data->cart->{$fieldName}, 'user_email');
        $sep = '<br />';
    }
}
JPluginHelper::importPlugin('hikashop');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onAfterOrderProductsListingDisplay', array(&$data->cart, 'email_notification_html'));
Exemplo n.º 15
0
 function listing()
 {
     $db = JFactory::getDBO();
     $filter = '';
     if (hikashop_level(1)) {
         $app = JFactory::getApplication();
         $selectedType = $app->getUserStateFromRequest($this->paramBase . ".filter_table", 'filter_table', '', 'string');
         if (!empty($selectedType)) {
             $filter = ' WHERE a.field_table=' . $db->Quote($selectedType);
         }
         $table = hikashop_get('type.table');
         $this->assignRef('tabletype', $table);
     } else {
         $filter = ' WHERE a.field_table=\'address\' OR a.field_table LIKE \'plg.%\'';
     }
     $db->setQuery('SELECT a.* FROM ' . hikashop_table('field') . ' AS a' . $filter . ' ORDER BY a.`field_table` ASC, a.`field_ordering` ASC');
     $rows = $db->loadObjectList();
     $config =& hikashop_config();
     $manage = hikashop_isAllowed($config->get('acl_field_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_field_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => 'field-listing'), 'dashboard');
     $total = count($rows);
     $pagination = hikashop_get('helper.pagination', $total, 0, $total);
     hikashop_setTitle(JText::_('FIELDS'), 'field', 'field');
     $this->assignRef('rows', $rows);
     $toggle = hikashop_get('helper.toggle');
     $this->assignRef('toggleClass', $toggle);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('selectedType', $selectedType);
     $type = hikashop_get('type.fields');
     $type->load();
     $this->assignRef('fieldtype', $type);
     $fieldClass = hikashop_get('class.field');
     $this->assignRef('fieldsClass', $fieldClass);
 }
Exemplo n.º 16
0
 function store($new = false)
 {
     if (!HIKASHOP_PHP5) {
         $app =& JFactory::getApplication();
     } else {
         $app = JFactory::getApplication();
     }
     $app = JFactory::getApplication();
     JRequest::checkToken() || die('Invalid Token');
     $image = hikashop_get('class.file');
     $source = is_array($_POST['config']) ? 'POST' : 'REQUEST';
     //to avoid strange bugs on some web servers where the config array might be only in one of the two global variable :/
     $formData = JRequest::getVar('config', array(), $source, 'array');
     $aclcats = JRequest::getVar('aclcat', array(), '', 'array');
     if (!empty($aclcats)) {
         if (JRequest::getString('acl_config', 'all') != 'all' && !hikashop_isAllowed($formData['acl_config_manage'])) {
             $app->enqueueMessage(JText::_('ACL_WRONG_CONFIG'), 'notice');
             unset($formData['acl_config_manage']);
         }
         $deleteAclCats = array();
         $unsetVars = array('manage', 'delete', 'view');
         foreach ($aclcats as $oneCat) {
             if (JRequest::getString('acl_' . $oneCat) == 'all') {
                 foreach ($unsetVars as $oneVar) {
                     unset($formData['acl_' . $oneCat . '_' . $oneVar]);
                 }
                 $deleteAclCats[] = $oneCat;
             }
         }
     }
     $config =& hikashop_config();
     $nameboxes = array('simplified_registration', 'partner_valid_status', 'order_status_for_download', 'payment_capture_order_status', 'cancellable_order_status', 'cancelled_order_status', 'invoice_order_statuses', 'order_unpaid_statuses');
     foreach ($nameboxes as $namebox) {
         if (!isset($formData[$namebox])) {
             $formData[$namebox] = '';
         } elseif (is_array($formData[$namebox])) {
             $formData[$namebox] = implode($formData[$namebox], ',');
         }
     }
     $status = $config->save($formData);
     if (!empty($deleteAclCats)) {
         $db = JFactory::getDBO();
         $db->setQuery("DELETE FROM `#__hikashop_config` WHERE `config_namekey` LIKE 'acl_" . implode("%' OR `config_namekey` LIKE 'acl_", $deleteAclCats) . "%'");
         $db->query();
     }
     $ids = $image->storeFiles('default_image', 0);
     if (!empty($ids)) {
         $data = $image->get($ids[0]);
         $formData['default_image'] = $data->file_path;
     }
     if (hikashop_level(2)) {
         $ids = $image->storeFiles('watermark', 0, 'watermark');
         if (!empty($ids)) {
             $data = $image->get($ids[0]);
             $formData['watermark'] = $data->file_path;
         }
     }
     $formData['store_address'] = JRequest::getVar('config_store_address', '', '', 'string', JREQUEST_ALLOWRAW);
     if (!empty($formData['cart_item_limit']) && !is_numeric($formData['cart_item_limit'])) {
         $formData['cart_item_limit'] = 0;
     }
     if (!isset($this->wizard) && !$this->_checkWorkflow($formData)) {
         $app->enqueueMessage('Checkout workflow invalid. The modification is ignored. See <a style="font-size:1.2em;text-decoration:underline" href="http://www.hikashop.com/support/documentation/integrated-documentation/54-hikashop-config.html#main" target="_blank" >the documentation</a> for more information on how to configure that option.');
         unset($formData['checkout']);
     }
     if (!isset($this->wizard)) {
         if (empty($formData['category_sef_name']) && empty($formData['product_sef_name'])) {
             $app->enqueueMessage('No SEF category and product names entered. Please complete at least one of these two fields. The system put back the default values');
             $formData['category_sef_name'] = 'category';
             $formData['product_sef_name'] = 'product';
         }
     }
     if (!empty($formData['weight_symbols'])) {
         $symbols = explode(',', $formData['weight_symbols']);
         $weightHelper = hikashop_get('helper.weight');
         $possibleSymbols = array_keys($weightHelper->conversion);
         $possibleSymbols[] = 'l';
         $possibleSymbols[] = 'ml';
         $possibleSymbols[] = 'cl';
         $okSymbols = array();
         foreach ($symbols as $k => $symbol) {
             if (!in_array($symbol, $possibleSymbols)) {
                 $app->enqueueMessage('The weight unit "' . $symbol . '" is not in the list of possible units : ' . implode(',', $possibleSymbols));
             } else {
                 $okSymbols[] = $symbol;
             }
         }
         $formData['weight_symbols'] = implode(',', $okSymbols);
     }
     if (!isset($this->wizard) && empty($formData['weight_symbols'])) {
         $app->enqueueMessage('No valid weight unit entered. The system put back the default units.');
         $formData['weight_symbols'] = 'kg,g,mg,lb,oz,ozt';
     }
     if (!empty($formData['volume_symbols'])) {
         $symbols = explode(',', $formData['volume_symbols']);
         $weightHelper = hikashop_get('helper.volume');
         $possibleSymbols = array_keys($weightHelper->conversion);
         $okSymbols = array();
         foreach ($symbols as $k => $symbol) {
             if (!in_array($symbol, $possibleSymbols)) {
                 $app->enqueueMessage('The dimension unit "' . $symbol . '" is not in the list of possible units : ' . implode(',', $possibleSymbols));
             } else {
                 $okSymbols[] = $symbol;
             }
         }
         $formData['volume_symbols'] = implode(',', $okSymbols);
     }
     if (!isset($this->wizard) && empty($formData['volume_symbols'])) {
         $app->enqueueMessage('No valid dimension unit entered. The system put back the default units.');
         $formData['volume_symbols'] = 'm,dm,cm,mm,in,ft,yd';
     }
     if (!isset($this->wizard) && $formData['force_ssl'] == 'url' && empty($formData['force_ssl_url'])) {
         $formData['force_ssl'] = 'no';
         $app->enqueueMessage('No ssl url specified, force ssl parametre setted to no');
     }
     if (!empty($formData['order_number_format'])) {
         $formData['order_number_format'] = str_replace('&quot;}"', '"}', $formData['order_number_format']);
     }
     $config =& hikashop_config();
     $status = $config->save($formData);
     if ($status) {
         $app->enqueueMessage(JText::_('HIKASHOP_SUCC_SAVED'));
     } else {
         $app->enqueueMessage(JText::_('ERROR_SAVING'), 'error');
     }
     $pluginsClass = hikashop_get('class.plugins');
     $paramsPlugins = JRequest::getVar('params', array(), '', 'array');
     foreach ($paramsPlugins as $group => $paramsPluginsOneGroup) {
         foreach ($paramsPluginsOneGroup as $name => $paramsPlugin) {
             $plugin = $pluginsClass->getByName($group, $name);
             if (!empty($plugin)) {
                 $plugin->params = $paramsPlugin;
                 $pluginsClass->save($plugin);
             }
         }
     }
     $js = "\r\n\t\t\tfunction setVisible(value){\r\n\t\t\t\tvalue=parseInt(value);\r\n\t\t\t\tif(value==1){\r\n\t\t\t\t\tdocument.getElementById('sef_cat_name').style.display = '';\r\n\t\t\t\t\tdocument.getElementById('sef_prod_name').style.display = '';\r\n\t\t\t\t}else{\r\n\t\t\t\t\tdocument.getElementById('sef_cat_name').style.display = 'none';\r\n\t\t\t\t\tdocument.getElementById('sef_prod_name').style.display = 'none';\r\n\t\t\t\t}\r\n\t\t\t}";
     if (!HIKASHOP_PHP5) {
         $doc =& JFactory::getDocument();
     } else {
         $doc = JFactory::getDocument();
     }
     $doc->addScriptDeclaration($js);
     $config->load();
 }
Exemplo n.º 17
0
 function reorder()
 {
     if (!hikashop_level(1) || !$this->_check()) {
         return false;
     }
     $order_id = hikashop_getCID('order_id');
     if (empty($order_id)) {
         parent::listing();
         return false;
     }
     $class = hikashop_get('class.order');
     $order = $class->loadFullOrder($order_id, true);
     $app = JFactory::getApplication();
     if (empty($order->order_id)) {
         $app->enqueueMessage('The order ' . $order_id . ' could not be found');
         parent::listing();
         return false;
     }
     $cartClass = hikashop_get('class.cart');
     $cartClass->resetCart(false);
     $array = array();
     $hasOptions = array();
     foreach ($order->products as $product) {
         if (!empty($product->order_product_option_parent_id)) {
             $hasOptions[$product->order_product_option_parent_id] = $product->order_product_option_parent_id;
         }
     }
     $fieldsClass = hikashop_get('class.field');
     $row = null;
     $itemFields = $fieldsClass->getFields('frontcomp', $row, 'item', 'checkout&task=state');
     $done = array();
     foreach ($order->products as $product) {
         if (!empty($done[$product->order_product_id]) || empty($product->product_id) || !empty($product->order_product_option_parent_id)) {
             continue;
         }
         foreach ($product as $k => $v) {
             if (!is_object($v) && !is_array($v) && isset($itemFields[$k])) {
                 $_REQUEST['data']['item'][$k] = $v;
                 $_POST['data']['item'][$k] = $v;
                 $_GET['data']['item'][$k] = $v;
                 JRequest::setVar('data', $_REQUEST['data']);
                 JRequest::setVar('data', $_GET['data'], 'get');
                 JRequest::setVar('data', $_POST['data'], 'post');
             }
         }
         if (isset($hasOptions[$product->order_product_id])) {
             $cartClass->mainProduct = $product->product_id;
             $cartClass->options = array();
             foreach ($order->products as $option) {
                 if ($option->order_product_option_parent_id == $product->order_product_id) {
                     $cartClass->options[$option->product_id] = $product->order_product_quantity;
                     $done[$option->order_product_id] = $option->order_product_id;
                 }
             }
         }
         $cartClass->updateEntry($product->order_product_quantity, $array, $product->product_id, 0, false, 'product', 2);
         if (!empty($cartClass->options)) {
             foreach ($cartClass->options as $id => $qty) {
                 $cartClass->updateEntry($qty, $array, $id, 0, false);
             }
             $cartClass->options = array();
             $cartClass->mainProduct = null;
         }
         $done[$product->order_product_id] = $product->order_product_id;
     }
     if (!empty($order->order_discount_code)) {
         $cartClass->update($order->order_discount_code, 1, 0, 'coupon', false);
     }
     $cartClass->loadCart(0, true);
     $app->setUserState(HIKASHOP_COMPONENT . '.shipping_method', null);
     $app->setUserState(HIKASHOP_COMPONENT . '.shipping_id', null);
     $app->setUserState(HIKASHOP_COMPONENT . '.shipping_data', null);
     global $Itemid;
     $url = 'checkout';
     if (!empty($Itemid)) {
         $url .= '&Itemid=' . $Itemid;
     }
     $url = hikashop_completeLink($url, false, true);
     $app->redirect($url);
 }
Exemplo n.º 18
0
 function fields()
 {
     if (hikashop_level(2)) {
         JHTML::_('behavior.formvalidation');
         $app = JFactory::getApplication();
         $order = $app->getUserState(HIKASHOP_COMPONENT . '.checkout_fields', null);
         $fieldsClass = hikashop_get('class.field');
         $this->assignRef('fieldsClass', $fieldsClass);
         $cart = $this->initCart();
         $order->products =& $cart->products;
         $this->extraFields['order'] = $fieldsClass->getFields('frontcomp', $order, 'order');
         $this->assignRef('extraFields', $this->extraFields);
         $null = array();
         $fieldsClass->addJS($null, $null, $null);
         $fieldsClass->jsToggle($this->extraFields['order'], $order, 0);
         $this->assignRef('order', $order);
         $values = array('order' => $order);
         $fieldsClass->checkFieldsForJS($this->extraFields, $this->requiredFields, $this->validMessages, $values);
         $fieldsClass->addJS($this->requiredFields, $this->validMessages, array('order'));
     }
 }
Exemplo n.º 19
0
		</fieldset>
	</div>
	<div class="hikashopcpanel" id="hikashopcpanel">
<?php 
foreach ($this->buttons as $oneButton) {
    $url = hikashop_level($oneButton['level']) ? 'onclick="document.location.href=\'' . $oneButton['link'] . '\';"' : '';
    ?>
		<div <?php 
    echo $url;
    ?>
 class="icon hikashop_cpanel_icon_div icon hikashop_cpanel_icon_div_<?php 
    echo $oneButton['image'];
    ?>
">
			<a href="<?php 
    echo hikashop_level($oneButton['level']) ? $oneButton['link'] : '#';
    ?>
">
				<table class="hikashop_cpanel_icon_table">
					<tr>
						<td class="hikashop_cpanel_icon_image">
							<span class="hikashop_cpanel_icon_image_span icon-48-<?php 
    echo $oneButton['image'];
    ?>
" title="<?php 
    echo $oneButton['text'];
    ?>
"> </span>
							<span class="hikashop_cpanel_button_text"><?php 
    echo $oneButton['text'];
    ?>
Exemplo n.º 20
0
 function onAfterInitialise()
 {
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         return true;
     }
     $zone = 0;
     $components = $this->params->get('components', 'all');
     if ($components == 'all' || in_array($_REQUEST['option'], explode(',', $components))) {
         $blocked_zones = $this->params->get('blocked_zones', '');
         $authorized_zones = $this->params->get('authorized_zones', '');
         if (!empty($blocked_zones) || !empty($authorized_zones)) {
             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 true;
             }
             if (!hikashop_level(2)) {
                 return true;
             }
             $zone = $this->getZone();
             if (!empty($zone)) {
                 $zoneClass = hikashop_get('class.zone');
                 $parents = $zoneClass->getZoneParents($zone);
                 $db = JFactory::getDBO();
                 $zones = array();
                 foreach ($parents as $parent) {
                     $zones[] = $db->Quote($parent);
                 }
                 $db->setQuery('SELECT zone_id FROM ' . hikashop_table('zone') . ' WHERE zone_namekey IN (' . implode(',', $zones) . ')');
                 if (!HIKASHOP_J25) {
                     $zones = $db->loadResultArray();
                 } else {
                     $zones = $db->loadColumn();
                 }
                 $ok = false;
                 if (!empty($authorized_zones)) {
                     $authorized_zones = explode(',', $authorized_zones);
                     $valid_zones = array_intersect($zones, $authorized_zones);
                     if (!empty($valid_zones)) {
                         $ok = true;
                     }
                 } elseif (!empty($blocked_zones)) {
                     $ok = true;
                     $blocked_zones = explode(',', $blocked_zones);
                     $invalid_zones = array_intersect($zones, $blocked_zones);
                     if (!empty($invalid_zones)) {
                         $ok = false;
                     }
                 }
                 if (!$ok) {
                     $name = 'hikashopgeolocation_restricted.php';
                     $path = JPATH_THEMES . DS . $app->getTemplate() . DS . 'system' . DS . $name;
                     if (!file_exists($path)) {
                         if (version_compare(JVERSION, '1.6', '<')) {
                             $path = JPATH_PLUGINS . DS . 'system' . DS . $name;
                         } else {
                             $path = JPATH_PLUGINS . DS . 'system' . DS . 'hikashopgeolocation' . DS . $name;
                         }
                         if (!file_exists($path)) {
                             exit;
                         }
                     }
                     require $path;
                 }
             }
         }
     }
     $set_default_currency = $this->params->get('set_default_currency', 0);
     if ($set_default_currency) {
         $currency = $app->getUserState('com_hikashop.currency_id', 0);
         if (empty($currency)) {
             if (empty($zone)) {
                 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 true;
                 }
                 if (!hikashop_level(2)) {
                     return true;
                 }
                 $zone = $this->getZone();
             }
             $config =& hikashop_config();
             $toSetCurrency = (int) $config->get('main_currency', 1);
             if (!empty($zone)) {
                 $zoneClass = hikashop_get('class.zone');
                 $zone_currency_id = $zoneClass->getZoneCurrency($zone);
                 $currencyClass = hikashop_get('class.currency');
                 if (empty($zone_currency_id) && !empty($this->geolocation->currencyCode)) {
                     $zone_currency_id = $this->geolocation->currencyCode;
                 }
                 if (!empty($zone_currency_id)) {
                     $currencyData = $currencyClass->get($zone_currency_id);
                     if (!empty($currencyData) && ($currencyData->currency_published || $currencyData->currency_displayed)) {
                         $toSetCurrency = $currencyData->currency_id;
                     }
                 }
             }
             $app->setUserState(HIKASHOP_COMPONENT . '.currency_id', $toSetCurrency);
         }
     }
     return true;
 }
<?php

/**
 * @package    HikaShop for Joomla!
 * @version    2.3.1
 * @author    hikashop.com
 * @copyright    (C) 2010-2014 HIKARI SOFTWARE. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
if (hikashop_level(2) && !empty($this->extraFields['order'])) {
    ?>
    <div class="row">
        <div id="hikashop_checkout_additional_info" class="hikashop_checkout_additional_info col-md-12 col-ld-12">
            <fieldset class="input">
                <legend><?php 
    echo JText::_('ADDITIONAL_INFORMATION');
    ?>
</legend>
                <?php 
    if (!empty($this->extraFields['order'])) {
        JRequest::setVar('hikashop_check_order', 1);
        $this->setLayout('custom_fields');
        $this->type = 'order';
        echo $this->loadTemplate();
    }
    ?>
            </fieldset>
        </div>
    </div>
    <div style="clear:both"></div>
Exemplo n.º 22
0
Arquivo: show.php Projeto: rodhoff/MNW
</td>
							<td><?php 
        echo $this->fieldsClass->show($oneExtraField, $this->order->{$fieldName});
        ?>
</td>
						</tr>
<?php 
    }
    ?>
					</table>
				</fieldset>
			</td>
		</tr>
<?php 
}
if (hikashop_level(2) && !empty($this->order->entries)) {
    ?>
		<tr>
			<td>
				<fieldset class="htmlfieldset_entries">
					<legend><?php 
    echo JText::_('HIKASHOP_ENTRIES');
    ?>
</legend>
					<table class="hikashop_entries_table adminlist" cellpadding="1" width="100%">
						<thead>
							<tr>
								<th class="title titlenum"><?php 
    echo JText::_('HIKA_NUM');
    ?>
</th>
    ob_start();
    if ($data->cart->full_total->prices[0]->price_value_with_tax > 0) {
        echo '<p>' . JText::_('ORDER_VALID_AFTER_PAYMENT') . '</p>';
    }
    if (in_array($data->order_payment_method, array('banktransfer', 'check', 'purchaseorder'))) {
        $amount = $currencyHelper->format($data->cart->full_total->prices[0]->price_value_with_tax, $data->cart->order_currency_id);
        $paymentClass = hikashop_get('class.payment');
        $payment = $paymentClass->get($data->order_payment_id);
        $information = $payment->payment_params->information;
        if (preg_match('#^[a-z0-9_]*$#i', $information)) {
            $information = JText::_($information);
        }
        if ($data->order_payment_method == 'banktransfer') {
            echo '<p>' . JText::sprintf('PLEASE_TRANSFERT_MONEY', $amount) . '<br/>' . $information . '<br/>' . JText::sprintf('INCLUDE_ORDER_NUMBER_TO_TRANSFER', $data->order_number) . '</p>';
        } elseif ($data->order_payment_method == 'check') {
            echo '<p>' . JText::sprintf('PLEASE_SEND_CHECK', $amount) . '<br/>' . $information . '<br/>' . JText::sprintf('INCLUDE_ORDER_NUMBER_TO_CHECK', $data->order_number) . '</p>';
        } elseif ($data->order_payment_method == 'purchaseorder') {
            echo '<p>' . JText::sprintf('PLEASE_SEND_PURCHASEORDER', $amount) . '<br/>' . $information . '<br/>' . JText::sprintf('INCLUDE_ORDER_NUMBER_TO_PURCHASEORDER', $data->order_number) . '</p>';
        }
    } else {
        if ($data->cart->full_total->prices[0]->price_value_with_tax > 0 && hikashop_level(1) && $config->get('allow_payment_button', 1)) {
            $pay_url = hikashop_frontendLink('index.php?option=com_hikashop&ctrl=order&task=pay&order_id=' . $data->order_id . $url_itemid);
            if ($config->get('force_ssl', 0) && strpos('https://', $pay_url) === false) {
                $pay_url = str_replace('http://', 'https://', $pay_url);
            }
            echo '<p><a href="' . $pay_url . '">' . JText::_('PAY_NOW') . '</a></p>';
        }
    }
    $content = ob_get_clean();
    $vars['ORDER_SUMMARY'] .= $content;
}
Exemplo n.º 24
0
            $params = new HikaParameter($empty);
            echo $this->cart->displayButton(JText::_('ADD_ME_WAITLIST'), 'add_waitlist', $params, hikashop_completeLink('product&task=waitlist&cid=' . $this->row->product_id . $url_itemid), 'window.location=\'' . str_replace("'", "\\'", hikashop_completeLink('product&task=waitlist&cid=' . $this->row->product_id . $url_itemid)) . '\';return false;');
        }
        if (hikashop_level(1) && $this->params->get('add_to_wishlist') && $wishlistEnabled && !$hideForGuest && $this->config->get('display_add_to_wishlist_for_free_products', '1')) {
            if (!empty($this->row->has_options)) {
                if ($this->params->get('add_to_cart', 1)) {
                    echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'), 'choose_options', $this->params, hikashop_contentLink('product&task=show&product_id=' . $this->row->product_id . '&name=' . $this->row->alias . $url_itemid . $this->category_pathway, $this->row), 'window.location = \'' . str_replace("'", "\\'", hikashop_contentLink('product&task=show&product_id=' . $this->row->product_id . '&name=' . $this->row->alias . $url_itemid . $this->category_pathway, $this->row)) . '\';return false;', '');
                }
            } else {
                echo '<div class="hikashop_add_wishlist">';
                echo $this->cart->displayButton(JText::_('ADD_TO_WISHLIST'), 'add', $this->params, $url, $wishlistAjax, '', @$this->row->product_max_per_order, 1, '', false);
                echo '<span></span>';
                echo '</div>';
            }
        }
    }
    ?>
	</div>
<?php 
} elseif (hikashop_level(1) && $wishlistEnabled && $this->params->get('add_to_wishlist', '1') && $this->config->get('display_add_to_wishlist_for_free_products', '1') && !$hideForGuest && !$this->config->get('display_add_to_cart_for_free_products')) {
    if (!empty($this->row->has_options)) {
        if ($this->params->get('add_to_cart', 1)) {
            echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'), 'choose_options', $this->params, hikashop_contentLink('product&task=show&product_id=' . $this->row->product_id . '&name=' . $this->row->alias . $url_itemid . $this->category_pathway, $this->row), 'window.location = \'' . str_replace("'", "\\'", hikashop_contentLink('product&task=show&product_id=' . $this->row->product_id . '&name=' . $this->row->alias . $url_itemid . $this->category_pathway, $this->row)) . '\';return false;', '');
        }
    } else {
        $wishlistAjax = 'if(hikashopCheckChangeForm(\'item\'' . $formName . ')){ return hikashopModifyQuantity(\'' . (int) @$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\',' . $module_id . '); } else { return false; }';
        echo '<div class="hikashop_add_wishlist">';
        echo $this->cart->displayButton(JText::_('ADD_TO_WISHLIST'), 'add', $this->params, $url, $wishlistAjax, '', @$this->row->product_max_per_order, 1, '', false);
        echo '</div>';
    }
}
Exemplo n.º 25
0
Arquivo: form.php Projeto: rodhoff/MNW
							</td>
						</tr>
						<tr>
							<td class="key">
									<?php 
echo JText::_('DISCOUNT_END_DATE');
?>
							</td>
							<td>
								<?php 
echo JHTML::_('calendar', @$this->element->discount_end ? hikashop_getDate(@$this->element->discount_end, '%Y-%m-%d %H:%M') : '', 'data[discount][discount_end]', 'discount_end', '%Y-%m-%d %H:%M', array('size' => '20'));
?>
							</td>
						</tr>
<?php 
if (hikashop_level(1)) {
    echo $this->loadTemplate('restrictions');
} else {
    ?>
						<tr>
							<td class="key">
									<?php 
    echo JText::_('RESTRICTIONS');
    ?>
							</td>
							<td>
								<?php 
    echo hikashop_getUpgradeLink('essential');
    ?>
							</td>
						</tr>
Exemplo n.º 26
0
 function form()
 {
     $dashboard = false;
     $config =& hikashop_config();
     $widget_id = hikashop_getCID('widget_id');
     $class = hikashop_get('class.widget');
     $db = JFactory::getDBO();
     if (!empty($widget_id)) {
         $element = $class->get($widget_id);
         $task = 'edit';
     } else {
         $element = new stdClass();
         $element->widget_published = 1;
         $task = 'add';
         $element->widget_params = new stdClass();
         $element->widget_params->display = 'line';
         $element->widget_params->content = 'sales';
         $element->widget_params->date_group = '%j %Y';
         $element->widget_params->date_type = 'created';
         $element->widget_params->periodType = 'proposedPeriod';
         $element->widget_params->proposedPeriod = 'thisMonth';
         $element->widget_params->format = 'UTF-8';
         $element->widget_params->period_compare = 'none';
         $element->widget_name = 'New report ' . $widget_id;
         $element->widget_params->limit = '7';
     }
     $class->loadDatas($element);
     if (isset($element->widget_params->table)) {
         $row_id = count($element->widget_params->table);
         $this->assignRef('row_id', $row_id);
         foreach ($element->widget_params->table as $row) {
             $class->loadDatas($row);
         }
     } else {
         $row_id = 0;
         $this->assignRef('row_id', $row_id);
     }
     if ($element->widget_params->display != 'table') {
         if ($element->widget_params->display != 'listing' && ($element->widget_params->content == 'products' || $element->widget_params->content == 'categories' || $element->widget_params->content == 'discount')) {
             $element->widget_params->content = 'orders';
         }
     }
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&widget_id=' . $widget_id);
     $this->toolbar = array(array('name' => 'link', 'icon' => 'archive', 'alt' => JText::_('HIKA_EXPORT'), 'url' => hikashop_completeLink('report&task=csv&cid[]=' . $widget_id) . '&' . hikashop_getFormToken() . '=1', 'display' => hikashop_level(2) && !empty($widget_id) && hikashop_isAllowed($config->get('acl_report_view', 'all'))), '|', array('name' => 'save', 'display' => hikashop_isAllowed($config->get('acl_report_manage', 'all'))), array('name' => 'save2new', 'display' => version_compare(JVERSION, '1.7', '>=') && hikashop_isAllowed($config->get('acl_report_manage', 'all'))), array('name' => 'apply', 'display' => hikashop_isAllowed($config->get('acl_report_manage', 'all'))), 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form'));
     $this->assignRef('element', $element);
     $translation = false;
     $transHelper = hikashop_get('helper.translation');
     if ($transHelper && $transHelper->isMulti()) {
         $translation = true;
         $transHelper->load('hikashop_widget', @$element->widget_id, $element);
         $config =& hikashop_config();
         $multilang_display = $config->get('multilang_display', 'tabs');
         if ($multilang_display == 'popups') {
             $multilang_display = 'tabs';
         }
         $tabs = hikashop_get('helper.tabs');
         $this->assignRef('tabs', $tabs);
         $this->assignRef('transHelper', $transHelper);
     }
     $toggle = hikashop_get('helper.toggle');
     $this->assignRef('toggle', $toggle);
     $this->assignRef('translation', $translation);
     $currencyClass = hikashop_get('class.currency');
     $this->assignRef('currencyHelper', $currencyClass);
     $periodType = hikashop_get('type.period');
     $this->assignRef('periodType', $periodType);
     $widget_dataType = hikashop_get('type.widget_data');
     $this->assignRef('widget_dataType', $widget_dataType);
     $status = hikashop_get('type.categorysub');
     $status->type = 'status';
     $this->assignRef('status', $status);
     $delay = hikashop_get('type.delay');
     $this->assignRef('delay', $delay);
     $region = hikashop_get('type.region');
     $this->assignRef('region', $region);
     if (hikashop_level(2)) {
         $encoding = hikashop_get('type.charset');
         $this->assignRef('encoding', $encoding);
     }
     $widgetClass = hikashop_get('class.widget');
     $this->assignRef('widgetClass', $widgetClass);
     $dateGroup = hikashop_get('type.dategroup');
     $this->assignRef('dateGroup', $dateGroup);
     $dateType = hikashop_get('type.datetype');
     $this->assignRef('dateType', $dateType);
     $shippingMethods = hikashop_get('type.plugins');
     $shippingMethods->type = 'shipping';
     $shippingMethods->manualOnly = true;
     $this->assignRef('shippingMethods', $shippingMethods);
     $paymentMethods = hikashop_get('type.plugins');
     $paymentMethods->type = 'payment';
     $paymentMethods->manualOnly = true;
     $this->assignRef('paymentMethods', $paymentMethods);
     $dashboard = JRequest::getVar('dashboard');
     $this->assignRef('dashboard', $dashboard);
     $nameboxType = hikashop_get('type.namebox');
     $this->assignRef('nameboxType', $nameboxType);
     JHTML::_('behavior.modal');
     $script = "\r\n\tfunction deleteRow(divName,inputName,rowName){\r\n\t\tvar d = document.getElementById(divName);\r\n\t\tvar olddiv = document.getElementById(inputName);\r\n\t\tif(d && olddiv){\r\n\t\t\td.removeChild(olddiv);\r\n\t\t\tdocument.getElementById(rowName).style.display='none';\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tfunction updatePeriodSelection(){\r\n\t\tselectedPeriod = document.getElementById('display_proposed_period').checked;\r\n\t\tdocument.getElementById('period_start').disabled=false;\r\n\t\tdocument.getElementById('period_end').disabled=false;\r\n\t\tdocument.getElementById('delayvalue1').disabled=false;\r\n\t\tdocument.getElementById('delaytype1').disabled=false;\r\n\t\tdocument.getElementById('datawidgetwidget_paramsproposedPeriod').disabled=false;\r\n\t\tif(selectedPeriod==true){\r\n\t\t\tdocument.getElementById('period_start').disabled=true;\r\n\t\t\tdocument.getElementById('period_end').disabled=true;\r\n\t\t\tdocument.getElementById('delayvalue1').disabled=true;\r\n\t\t\tdocument.getElementById('delaytype1').disabled=true;\r\n\t\t}else{\r\n\t\t\tdocument.getElementById('datawidgetwidget_paramsproposedPeriod').disabled=true;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction updateCompare(){\r\n\t\tselectedCompare = document.getElementById('compare_with_values').checked;\r\n\t\tdocument.getElementById('compares_order_status').disabled=false;\r\n\t\tdocument.getElementById('compares_order_currency_id').disabled=false;\r\n\t\tdocument.getElementById('compares_order_payment_method').disabled=false;\r\n\t\tdocument.getElementById('compares_order_shipping_method').disabled=false;\r\n\t\tdocument.getElementById('compares_order_discount_code').disabled=false;\r\n\t\tdocument.getElementById('compares_products').disabled=false;\r\n\t\tdocument.getElementById('compares_categories').disabled=false;\r\n\t\tdocument.getElementById('compare_period').disabled=false;\r\n\t\tif(selectedCompare==true){\r\n\t\t\tdocument.getElementById('compare_period').disabled=true;\r\n\t\t}else{\r\n\t\t\tdocument.getElementById('compares_order_status').disabled=true;\r\n\t\t\tdocument.getElementById('compares_order_currency_id').disabled=true;\r\n\t\t\tdocument.getElementById('compares_order_payment_method').disabled=true;\r\n\t\t\tdocument.getElementById('compares_order_shipping_method').disabled=true;\r\n\t\t\tdocument.getElementById('compares_order_discount_code').disabled=true;\r\n\t\t\tdocument.getElementById('compares_products').disabled=true;\r\n\t\t\tdocument.getElementById('compares_categories').disabled=true;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction updateDisplayType(){\r\n\t\ttheType=false;\r\n\t\tvalues = new Array('gauge', 'column', 'graph', 'line', 'pie', 'area', 'map', 'listing', 'table');\r\n\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\tnewType = document.getElementById('widget_display_'+values[i]).checked;\r\n\t\t\tif(newType==true){\r\n\t\t\t\tdisplayType = document.getElementById('widget_display_'+values[i]).value;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(displayType=='pie'){\r\n\t\t\tvalues = new Array('orders', 'sales', 'taxes', 'partners', 'customers');\r\n\t\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\t\tnewType = document.getElementById('type_'+values[i]).checked;\r\n\t\t\t\tif(newType==true){\r\n\t\t\t\t\t\ttheType = document.getElementById('type_'+values[i]).value;\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(theType=='customers' || theType=='partners'){\r\n\t\t\t\t document.getElementById('type_orders').checked=true;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(displayType=='map'){\r\n\t\t\tvalues = new Array('orders', 'sales', 'taxes', 'partners', 'customers');\r\n\t\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\t\tnewType = document.getElementById('type_'+values[i]).checked;\r\n\t\t\t\tif(newType==true){\r\n\t\t\t\t\ttheType = document.getElementById('type_'+values[i]).value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tdocument.getElementById('map_options').style.display='none';\r\n\t\t\tdocument.getElementById('filters').style.display='';\r\n\t\t\tif(theType=='orders' || theType=='sales' ||  theType=='taxes'){\r\n\t\t\t\tdocument.getElementById('map_options').style.display='';\r\n\t\t\t}\r\n\t\t\tif(theType=='customers' ||  theType=='partners'){\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(displayType=='gauge' || displayType=='line' || displayType=='area' || displayType=='graph' || displayType=='column'){\r\n\t\t\tvalues = new Array('orders', 'sales', 'taxes', 'partners', 'customers');\r\n\t\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\t\tnewType = document.getElementById('type_'+values[i]).checked;\r\n\t\t\t\tif(newType==true){\r\n\t\t\t\t\t\ttheType = document.getElementById('type_'+values[i]).value;\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(theType==false){\r\n\t\t\t\ttheType='orders';\r\n\t\t\t \ttheType = document.getElementById('type_orders').checked=true;\r\n\t\t\t}\r\n\t\t\tdocument.getElementById('widget_compare').style.display='';\r\n\t\t\tif(theType=='orders' || theType=='sales' ||  theType=='taxes'){\r\n\t\t\t\tdocument.getElementById('widget_compare').style.display='';\r\n\t\t\t}\r\n\t\t\tif(theType=='customers' ||  theType=='partners'){\r\n\t\t\t\tdocument.getElementById('widget_compare').style.display='none';\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(displayType=='table'){\r\n\t\t\tdocument.getElementById('products_options').style.display='none';\r\n\t\t\tdocument.getElementById('filters').style.display='none';\r\n\t\t\tdocument.getElementById('customers_options').style.display='none';\r\n\t\t\tdocument.getElementById('partners_options').style.display='none';\r\n\t\t\tdocument.getElementById('orders_options').style.display='none';\r\n\t\t\tdocument.getElementById('product_datas').style.display='none';\r\n\t\t\tdocument.getElementById('widget_compare').style.display='none';\r\n\t\t\tdocument.getElementById('widget_limit').style.display='none';\r\n\t\t\tdocument.getElementById('widget_region').style.display='none';\r\n\t\t\tdocument.getElementById('map_options').style.display='none';\r\n\t\t}\r\n\t\tif(displayType!='listing'){ return 0; }\r\n\r\n\t\tvalues = new Array('orders', 'products', 'customers', 'partners', 'categories', 'discounts');\r\n\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\tnewType = document.getElementById('type_'+values[i]).checked;\r\n\t\t\tif(newType==true){\r\n\t\t\t\ttheType = document.getElementById('type_'+values[i]).value;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(!theType){\r\n\t\t\tdocument.getElementById('type_orders').checked=true;\r\n\t\t\ttheType='orders';\r\n\t\t}\r\n\t\tdocument.getElementById('products_options').style.display='none';\r\n\t\tdocument.getElementById('filters').style.display='none';\r\n\t\tdocument.getElementById('customers_options').style.display='none';\r\n\t\tdocument.getElementById('partners_options').style.display='none';\r\n\t\tdocument.getElementById('orders_options').style.display='none';\r\n\t\tdocument.getElementById('product_datas').style.display='none';\r\n\r\n\t\tif(theType=='orders' || theType=='products' || theType=='categories' || theType=='discounts' || theType=='customers' || theType== 'partners'){\r\n\t\t\tdocument.getElementById('filters').style.display='';\r\n\t\t\tdocument.getElementById('product_datas').style.display='';\r\n\t\t\tif(theType=='categories'){\r\n\t\t\t\tdocument.getElementById('data_hits').style.display='none';\r\n\t\t\t\tclicksValue = document.getElementById('data_clicks').checked;\r\n\t\t\t\tif(clicksValue==true){\r\n\t\t\t\t\tdocument.getElementById('data_orders').checked=true;\r\n\t\t\t\t}\r\n\t\t\t}else if(theType=='products'){\r\n\t\t\t\tdocument.getElementById('data_hits').style.display='';\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(theType=='discounts'){\r\n\t\t\tdocument.getElementById('product_datas').style.display='none';\r\n\t\t}\r\n\t\tif(theType=='products' || theType=='categories' || theType=='discounts'){\r\n\t\t\tdocument.getElementById('products_options').style.display='';\r\n\t\t}\r\n\t\tif(theType=='customers'){\r\n\t\t\tdocument.getElementById('customers_options').style.display='';\r\n\t\t}\r\n\t\tif(theType=='partners'){\r\n\t\t\tdocument.getElementById('partners_options').style.display='';\r\n\t\t}\r\n\t\tif(theType=='orders'){\r\n\t\t\tdocument.getElementById('orders_options').style.display='';\r\n\t\t}\r\n\r\n\t}\r\n\twindow.hikashop.ready( function(){ updateDisplayType(); });\r\n\twindow.hikashop.ready( function(){ updatePeriodSelection(); });\r\n\twindow.hikashop.ready( function(){ updateCompare(); });\r\n\r\n\t\t\t\t";
     if (!HIKASHOP_PHP5) {
         $doc =& JFactory::getDocument();
     } else {
         $doc = JFactory::getDocument();
     }
     $doc->addScriptDeclaration($script);
     $js = '';
     $params = $element;
     echo hikashop_getLayout('dashboard', 'widget', $params, $js);
 }
Exemplo n.º 27
0
 function &_order($type)
 {
     $order_id = hikashop_getCID('order_id');
     $app = JFactory::getApplication();
     if (empty($order_id)) {
         $order_id = $app->getUserState('com_hikashop.order_id');
     }
     if (!empty($order_id)) {
         $class = hikashop_get('class.order');
         $order = $class->loadFullOrder($order_id, $type == 'order' ? true : false);
     }
     if (empty($order)) {
         $app->redirect(hikashop_completeLink('order&task=listing', false, true));
     }
     $config =& hikashop_config();
     $this->assignRef('config', $config);
     $store = str_replace(array("\r\n", "\n", "\r"), array('<br/>', '<br/>', '<br/>'), $config->get('store_address', ''));
     if (JText::_($store) != $store) {
         $store = JText::_($store);
     }
     if (!empty($order->order_payment_id)) {
         $pluginsPayment = hikashop_get('type.plugins');
         $pluginsPayment->type = 'payment';
         $this->assignRef('payment', $pluginsPayment);
     }
     if (!empty($order->order_shipping_id)) {
         $pluginsShipping = hikashop_get('type.plugins');
         $pluginsShipping->type = 'shipping';
         $this->assignRef('shipping', $pluginsShipping);
         $shippingClass = hikashop_get('class.shipping');
         $this->assignRef('shippingClass', $shippingClass);
         if (empty($order->order_shipping_method)) {
             $shippings_data = array();
             $shipping_ids = explode(';', $order->order_shipping_id);
             foreach ($shipping_ids as $key) {
                 $shipping_data = '';
                 list($k, $w) = explode('@', $key);
                 $shipping_id = $k;
                 if (isset($order->shippings[$shipping_id])) {
                     $shipping = $order->shippings[$shipping_id];
                     $shipping_data = $shipping->shipping_name;
                 } else {
                     foreach ($order->products as $order_product) {
                         if ($order_product->order_product_shipping_id == $key) {
                             if (!is_numeric($order_product->order_product_shipping_id)) {
                                 $shipping_name = $this->getShippingName($order_product->order_product_shipping_method, $shipping_id);
                                 $shipping_data = $shipping_name;
                             } else {
                                 $shipping_method_data = $this->shippingClass->get($shipping_id);
                                 $shipping_data = $shipping_method_data->shipping_name;
                             }
                             break;
                         }
                     }
                     if (empty($shipping_data)) {
                         $shipping_data = '[ ' . $key . ' ]';
                     }
                 }
                 $shippings_data[] = $shipping_data;
             }
             $order->order_shipping_method = $shippings_data;
         }
     }
     $this->assignRef('store_address', $store);
     $this->assignRef('element', $order);
     $this->assignRef('order', $order);
     $this->assignRef('invoice_type', $type);
     $display_type = 'frontcomp';
     $this->assignRef('display_type', $display_type);
     $currencyClass = hikashop_get('class.currency');
     $this->assignRef('currencyHelper', $currencyClass);
     $fieldsClass = hikashop_get('class.field');
     $this->assignRef('fieldsClass', $fieldsClass);
     if (is_string($order->order_shipping_method)) {
         $currentShipping = hikashop_import('hikashopshipping', $order->order_shipping_method);
     } else {
         $currentShipping = hikashop_import('hikashopshipping', reset($order->order_shipping_method));
     }
     $this->assignRef('currentShipping', $currentShipping);
     $fields = array();
     if (hikashop_level(2)) {
         $null = null;
         $fields['entry'] = $fieldsClass->getFields('frontcomp', $null, 'entry');
         $fields['item'] = $fieldsClass->getFields('frontcomp', $null, 'item');
         $fields['order'] = $fieldsClass->getFields('', $null, 'order');
     }
     $this->assignRef('fields', $fields);
     return $order;
 }
Exemplo n.º 28
0
defined('_JEXEC') or die('Restricted access');
?>
<div id="cpanel">
<?php 
$tooltip_class = HIKASHOP_J30 ? 'hasTooltip' : 'hasTip';
if (HIKASHOP_J30) {
    JHtml::_('bootstrap.tooltip');
}
foreach ($this->buttonList as $btn) {
    if (empty($btn['url'])) {
        $btn['url'] = hikashop_completeLink($btn['link']);
    }
    if (empty($btn['icon'])) {
        $btn['icon'] = 'icon-48-' . $btn['image'];
    }
    if ($btn['level'] > 0 && !hikashop_level($btn['level'])) {
        $btn['url'] = 'javascript:void(0);';
    }
    if (false) {
        echo '<li><a href="' . $btn['url'] . '"><i class="icon-' . $btn['image'] . '"></i> ' . $btn['text'] . '</a></li>';
    } else {
        $desc = $this->descriptions[$btn['link']];
        if (is_array($desc)) {
            $desc = implode('<br/>', $desc);
        }
        ?>
		<div class="icon-wrapper">
			<div class="icon">
				<a class="<?php 
        echo $tooltip_class;
        ?>
Exemplo n.º 29
0
?>
" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="ctrl" value="<?php 
echo JRequest::getCmd('ctrl');
?>
" />
	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="filter_order" value="<?php 
echo $this->pageInfo->filter->order->value;
?>
" />
	<input type="hidden" name="filter_order_Dir" value="<?php 
echo $this->pageInfo->filter->order->dir;
?>
" />
	<?php 
echo JHTML::_('form.token');
?>
</form>
<?php 
if (hikashop_level(2) && !empty($this->fields) && !empty($this->rows) && empty($this->pageInfo->search) && empty($this->pageInfo->limit->start)) {
    foreach ($this->fields as $field) {
        if (in_array($field->field_type, array('radio', 'singledropdown', 'zone'))) {
            $this->fieldsClass->chart('entry', $field, $this->pageInfo->filter->filter_status, 450, 240);
        }
    }
}
?>
<br style="clear:both" />
Exemplo n.º 30
0
    }
}
$this->formName = $form;
if ($this->params->get('show_price')) {
    ?>
		<span id="hikashop_product_price_with_options_main" class="hikashop_product_price_with_options_main">
		</span>
	<?php 
}
?>
	<?php 
$contact = $this->config->get('product_contact', 0);
?>
	<div id="hikashop_product_contact_main" class="hikashop_product_contact_main">
		<?php 
if (hikashop_level(1) && ($contact == 2 || $contact == 1 && !empty($this->element->product_contact))) {
    $empty = '';
    $params = new HikaParameter($empty);
    global $Itemid;
    $url_itemid = '';
    if (!empty($Itemid)) {
        $url_itemid = '&Itemid=' . $Itemid;
    }
    echo $this->cart->displayButton(JText::_('CONTACT_US_FOR_INFO'), 'contact_us', $params, hikashop_completeLink('product&task=contact&cid=' . $this->element->product_id . $url_itemid), 'window.location=\'' . hikashop_completeLink('product&task=contact&cid=' . $this->element->product_id . $url_itemid) . '\';return false;');
}
?>
	</div>
	<?php 
if (!empty($this->element->extraData->rightMiddle)) {
    echo implode("\r\n", $this->element->extraData->rightMiddle);
}