Example #1
0
    function listing()
    {
        hikashop_setTitle(JText::_('DOCUMENTATION'), 'help_header', 'documentation');
        if (!HIKASHOP_PHP5) {
            $bar =& JToolBar::getInstance('toolbar');
        } else {
            $bar = JToolBar::getInstance('toolbar');
        }
        $bar->appendButton('Link', 'hikashop', JText::_('HIKASHOP_CPANEL'), hikashop_completeLink('dashboard'));
        $config =& hikashop_config();
        $level = $config->get('level');
        $url = HIKASHOP_HELPURL . 'documentation&level=' . $level;
        if (hikashop_isSSL()) {
            $url = str_replace('http://', 'https://', $url);
        }
        $config =& hikashop_config();
        $menu_style = $config->get('menu_style', 'title_bottom');
        if (HIKASHOP_J30) {
            $menu_style = 'content_top';
        }
        if ($menu_style == 'content_top') {
            echo hikashop_getMenu('', $menu_style);
        }
        ?>
				<div id="hikashop_div">
						<iframe allowtransparency="true" scrolling="auto" height="450px" frameborder="0" width="100%" name="hikashop_frame" id="hikashop_frame" src="<?php 
        echo $url;
        ?>
">
						</iframe>
				</div>
<?php 
    }
 function onPaymentConfiguration(&$element)
 {
     $this->hikabitcoin = JRequest::getCmd('name', 'hikabitcoin');
     if (empty($element)) {
         $element = new stdClass();
         $element->payment_name = 'hikabitcoin';
         $element->payment_description = 'Pay with bitcoin';
         $element->payment_images = 'bitcoin.png';
         $element->payment_type = $this->hikabitcoin;
         $element->payment_params = new stdClass();
         $element->payment_params->apiKey = '';
         $element->payment_params->notificationEmail = '';
         $element->payment_params->transactionSpeed = 'low';
         $element->payment_params->paid_status = 'created';
         $element->payment_params->confirmed_status = 'created';
         $element->payment_params->complete_status = 'confirmed';
         $element = array($element);
     }
     $obj = reset($element);
     if (empty($obj->payment_params->apiKey)) {
         $app = JFactory::getApplication();
         $lang = JFactory::getLanguage();
         $locale = strtolower(substr($lang->get('tag'), 0, 2));
         $app->enqueueMessage(JText::sprintf('ENTER_INFO_REGISTER_IF_NEEDED', 'Bitcoin', 'Merchant apiKey', 'Merchant', 'https://bitpay.com/start'));
     }
     $this->toolbar = array('save', 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => 'payment-hikabitcoin-form'));
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         hikashop_setTitle('Bitcoin', 'plugin', 'plugins&plugin_type=payment&task=edit&name=' . $this->hikabitcoin);
     }
     $app->setUserState(HIKASHOP_COMPONENT . '.payment_plugin_type', $this->hikabitcoin);
     $this->address = hikashop_get('type.address');
     $this->category = hikashop_get('type.categorysub');
     $this->category->type = 'status';
 }
Example #3
0
 function form()
 {
     $warehouse_id = hikashop_getCID('warehouse_id');
     $class = hikashop_get('class.warehouse');
     if (!empty($warehouse_id)) {
         $element = $class->get($warehouse_id, true);
         $task = 'edit';
     } else {
         $element = new stdClass();
         $element->warehouse_published = 1;
         $task = 'add';
     }
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&warehouse=' . $warehouse_id);
     $this->toolbar = array('save', array('name' => 'save2new', 'display' => version_compare(JVERSION, '1.7', '>=')), 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'));
     $editor = hikashop_get('helper.editor');
     $editor->name = 'data[warehouse][warehouse_description]';
     $editor->content = @$element->warehouse_description;
     $this->assignRef('editor', $editor);
     $this->assignRef('element', $element);
     $toggle = hikashop_get('helper.toggle');
     $this->assignRef('toggle', $toggle);
     $warehouse = hikashop_get('type.warehouse');
     $this->assignRef('warehouse', $warehouse);
     $popup = hikashop_get('helper.popup');
     $this->assignRef('popup', $popup);
 }
Example #4
0
 function update()
 {
     hikashop_setTitle(JText::_('UPDATE_ABOUT'), 'install', 'update');
     if (!HIKASHOP_PHP5) {
         $bar =& JToolBar::getInstance('toolbar');
     } else {
         $bar = JToolBar::getInstance('toolbar');
     }
     $bar->appendButton('Link', 'hikashop', JText::_('HIKASHOP_CPANEL'), hikashop_completeLink('dashboard'));
     return $this->_iframe(HIKASHOP_UPDATEURL . 'update');
 }
Example #5
0
 function listing()
 {
     $this->toolbar = array();
     $this->widgets();
     $this->links();
     hikashop_setTitle(HIKASHOP_NAME, 'hikashop', 'dashboard');
     if (HIKASHOP_J16 && JFactory::getUser()->authorise('core.admin', 'com_hikashop')) {
         $this->toolbar[] = array('name' => 'preferences');
     }
     $this->toolbar[] = array('name' => 'pophelp', 'target' => 'dashboard');
     $toggle = hikashop_get('helper.toggle');
     $this->assignRef('toggleClass', $toggle);
 }
Example #6
0
 function form()
 {
     $characteristic_id = $this->editpopup();
     if (!empty($characteristic_id)) {
         $task = 'edit';
     } else {
         $task = 'add';
     }
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&characteristic_id=' . $characteristic_id);
     $this->toolbar = array('save', array('name' => 'save2new', 'display' => version_compare(JVERSION, '1.7', '>=')), 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form'));
     $popup = hikashop_get('helper.popup');
     $this->assignRef('popup', $popup);
 }
Example #7
0
 function wizard()
 {
     $db = JFactory::getDBO();
     hikashop_setTitle(JText::_('HIKA_WIZARD'), 'config', 'update&task=wizard');
     if (!HIKASHOP_PHP5) {
         $bar =& JToolBar::getInstance('toolbar');
     } else {
         $bar = JToolBar::getInstance('toolbar');
     }
     $bar->appendButton('Link', 'hikashop', JText::_('HIKA_SKIP'), hikashop_completeLink('update&task=post_install&fromversion=&update=0'));
     $languagesCodes = array();
     $languagesNames = array();
     if (HIKASHOP_J25) {
         $db->setQuery('SELECT * FROM ' . hikashop_table('languages', false) . ' WHERE `published` = 1');
         $languages = $db->loadObjectList();
         foreach ($languages as $language) {
             $path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $language->lang_code . DS . $language->lang_code . '.com_hikashop.ini';
             if (!JFile::exists($path)) {
                 $languagesCodes[] = $language->lang_code;
                 $languagesNames[] = $language->title;
             }
         }
     }
     if (!empty($languagesCodes)) {
         $languageCodes = implode('_', $languagesCodes);
     }
     if (!empty($languagesNames)) {
         $languagesNames = implode(', ', $languagesNames);
     }
     $this->assignRef('languageCodes', $languageCodes);
     $this->assignRef('languageNames', $languagesNames);
     $fieldsClass = hikashop_get('class.field');
     $this->assignRef('fieldsClass', $fieldsClass);
     static $Itemid;
     if (isset($Itemid) && !empty($Itemid)) {
         $url_itemid = '&item_id=' . $Itemid;
     } else {
         $url_itemid = '';
     }
     $address = new stdClass();
     $extraFields = array();
     $extraFields['address'] = $fieldsClass->getFields('frontcomp', $address, 'address', 'update&task=state' . $url_itemid);
     $this->assignRef('extraFields', $extraFields);
     $this->assignRef('address', $address);
     $db->setQuery('SELECT * FROM ' . hikashop_table('currency') . ' WHERE 1 ORDER BY `currency_code`');
     $currencies = $db->loadObjectList();
     $this->assignRef('currencies', $currencies);
     hikashop_loadJslib('jquery');
     $app = JFactory::getApplication();
     $app->enqueueMessage(JText::_('WELCOME_WIZARD', 'success'));
 }
Example #8
0
 function form()
 {
     $tabs = hikashop_get('helper.tabs');
     $email_log_id = hikashop_getCID('email_log_id');
     $email_logClass = hikashop_get('class.email_log');
     if (!empty($email_log_id)) {
         $element = $email_logClass->get($email_log_id, true);
         $task = 'edit';
     }
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&email_log=' . $email_log_id);
     $this->toolbar = array('cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'));
     $email_order_id = array('order_admin_notification', 'order_creation_notification', 'order_status_notification', 'order_notification', 'payment_notification', 'order_cancel');
     $email_product_id = array('contact_request', 'new_comment');
     $email_user_id = array('user_account', 'user_account_admin_notification');
     if (in_array($element->email_log_name, $email_product_id)) {
         $productClass = hikashop_get('class.product');
         $productClass->getProducts($element->email_log_ref_id);
         if (isset($productClass->products[$element->email_log_ref_id])) {
             $fullProduct = $productClass->products[$element->email_log_ref_id];
         } elseif (isset($productClass->all_products[$element->email_log_ref_id]) && isset($productClass->all_products[$element->email_log_ref_id]->product_parent_id)) {
             $productClass->getProducts($productClass->all_products[$element->email_log_ref_id]->product_parent_id);
             $fullProduct = $productClass->products[$productClass->all_products[$element->email_log_ref_id]->product_parent_id];
         }
         if (isset($fullProduct->product_name) && !empty($fullProduct->product_name)) {
             $this->assignRef('email_product_name', $fullProduct->product_name);
         }
     }
     if (in_array($element->email_log_name, $email_order_id)) {
         $orderClass = hikashop_get('class.order');
         $fullOrder = $orderClass->get($element->email_log_ref_id);
         if (isset($fullOrder->order_number) && !empty($fullOrder->order_number)) {
             $this->assignRef('email_order_number', $fullOrder->order_number);
         }
     }
     if (in_array($element->email_log_name, $email_user_id)) {
         $userClass = hikashop_get('class.user');
         $fullUser = $userClass->get($element->email_log_ref_id);
         if (isset($fullUser->name) && !empty($fullUser->name)) {
             $this->assignRef('email_user_name', $fullUser->name);
         }
     }
     $this->assignRef('email_order_id', $email_order_id);
     $this->assignRef('email_product_id', $email_product_id);
     $this->assignRef('email_user_id', $email_user_id);
     $this->assignRef('tabs', $tabs);
     $this->assignRef('element', $element);
 }
Example #9
0
 function form()
 {
     $banner_id = hikashop_getCID('banner_id');
     $class = hikashop_get('class.banner');
     if (!empty($banner_id)) {
         $element = $class->get($banner_id, true);
         $task = 'edit';
     } else {
         $element = new stdClass();
         $element->banner_url = HIKASHOP_LIVE;
         $element->banner_published = 1;
         $task = 'add';
     }
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&banner_id=' . $banner_id);
     $this->toolbar = array('save', array('name' => 'save2new', 'display' => version_compare(JVERSION, '1.7', '>=')), 'apply', '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_banner', @$element->banner_id, $element);
         jimport('joomla.html.pane');
         $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);
 }
Example #10
0
    function form()
    {
        $user_id = hikashop_getCID('user_id');
        $fieldsClass = hikashop_get('class.field');
        $addresses = array();
        $fields = null;
        $rows = array();
        $affiliates = array();
        if (!empty($user_id)) {
            $class = hikashop_get('class.user');
            $user = $class->get($user_id, 'hikashop', true);
            if (!empty($user)) {
                $class->loadPartnerData($user);
            }
            $fields['user'] = $fieldsClass->getFields('backend', $user, 'user', 'field&task=state');
            $addressClass = hikashop_get('class.address');
            $addresses = $addressClass->getByUser($user_id);
            if (!empty($addresses)) {
                $addressClass->loadZone($addresses, 'name', 'backend');
                $fields['address'] =& $addressClass->fields;
            }
            $db = JFactory::getDBO();
            $filters = array('order_user_id=' . $user_id);
            $query = 'SELECT * FROM ' . hikashop_table('order') . ' WHERE order_type=' . $db->Quote('sale') . ' AND (' . implode(' OR ', $filters) . ') ORDER BY order_id DESC';
            $db->setQuery($query);
            $orders = $db->loadObjectList();
            foreach ($orders as $order) {
                if ($order->order_user_id == $user_id) {
                    $rows[] = $order;
                }
            }
            $task = 'edit';
        } else {
            $user = new stdClass();
            $task = 'add';
        }
        $this->assignRef('rows', $rows);
        $this->assignRef('affiliates', $affiliates);
        $this->assignRef('user', $user);
        $this->assignRef('fields', $fields);
        $this->assignRef('addresses', $addresses);
        $this->assignRef('fieldsClass', $fieldsClass);
        $currencyHelper = hikashop_get('class.currency');
        $this->assignRef('currencyHelper', $currencyHelper);
        $currencyType = hikashop_get('type.currency');
        $this->assignRef('currencyType', $currencyType);
        $pluginClass = hikashop_get('class.plugins');
        $payments = $pluginClass->getMethods('payment');
        $newPayments = array();
        foreach ($payments as $payment) {
            $newPayments[$payment->payment_id] = $payment;
        }
        $this->assignRef('payments', $newPayments);
        $pluginClass = hikashop_get('class.plugins');
        $plugin = JPluginHelper::getPlugin('system', 'hikashopaffiliate');
        if (empty($plugin)) {
            $affiliate_active = false;
        } else {
            $affiliate_active = true;
        }
        $this->assignRef('affiliate_active', $affiliate_active);
        $popup = hikashop_get('helper.popup');
        $this->assignRef('popup', $popup);
        if (version_compare(JVERSION, '1.6', '<')) {
            $url_link = JRoute::_('index.php?option=com_users&task=edit&cid[]=' . $user->user_cms_id);
            $email_link = hikashop_completeLink('order&task=mail&user_id=' . $user_id, true);
        } else {
            $url_link = JRoute::_('index.php?option=com_users&task=user.edit&id=' . $user->user_cms_id);
            $email_link = hikashop_completeLink('order&task=mail&user_id=' . $user_id, true);
        }
        $history_link = empty($this->user->user_email) ? '' : hikashop_completeLink('email_log&search=' . $this->user->user_email);
        $this->toolbar = array(array('name' => 'link', 'icon' => 'upload', 'alt' => JText::_('JOOMLA_USER_OPTIONS'), 'url' => $url_link, 'display' => !empty($user->user_cms_id)), array('name' => 'popup', 'icon' => 'send', 'alt' => JText::_('HIKA_EMAIL'), 'url' => $email_link, 'display' => !empty($user_id)), array('name' => 'link', 'icon' => 'send', 'alt' => JText::_('EMAIL_HISTORY'), 'url' => $history_link, 'display' => !empty($user_id) && hikashop_level(2)), 'save', 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form'));
        $js = '
		function updateCustomFeesPanel(active){
			if(active==1){
				var displayFee = \'\';
			}else{
				var displayFee = \'none\';
			}
			document.getElementById(\'custom_fees_panel\').style.display=displayFee;
		}';
        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration($js);
        $order_info = '';
        $order_id = JRequest::getInt('order_id', 0);
        if (!empty($order_id)) {
            $order_info = '&order_id=' . $order_id;
        }
        hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&user_id=' . $user_id . $order_info);
    }
Example #11
0
 function listing()
 {
     $app = JFactory::getApplication();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $config =& hikashop_config();
     $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string');
     $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int');
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.user_id', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
     jimport('joomla.filesystem.file');
     $mail_folder = rtrim(str_replace('{root}', JPATH_ROOT, $config->get('mail_folder', HIKASHOP_MEDIA . 'mail' . DS)), '/\\') . DS;
     $files = array('cron_report', 'order_admin_notification', 'order_creation_notification', 'order_status_notification', 'order_notification', 'user_account', 'user_account_admin_notification', 'out_of_stock', 'order_cancel', 'waitlist_notification', 'waitlist_admin_notification', 'new_comment', 'contact_request', 'subscription_eot', 'massaction_notification');
     $plugin_files = array();
     JPluginHelper::importPlugin('hikashop');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onMailListing', array(&$plugin_files));
     if (!empty($plugin_files)) {
         $files = array_merge($files, $plugin_files);
     }
     $emails = array();
     foreach ($files as $file) {
         $folder = $mail_folder;
         $filename = $file;
         $email = new stdClass();
         if (is_array($file)) {
             $folder = $file['folder'];
             if (!empty($file['name'])) {
                 $email->name = $file['name'];
             }
             $filename = $file['filename'];
             $file = $file['file'];
         }
         $email->file = $file;
         $email->overriden_text = JFile::exists($folder . $filename . '.text.modified.php');
         $email->overriden_html = JFile::exists($folder . $filename . '.html.modified.php');
         $email->overriden_preload = JFile::exists($folder . $filename . '.preload.modified.php');
         $email->published = $config->get($file . '.published');
         $emails[] = $email;
     }
     $pageInfo->elements = new stdClass();
     $pageInfo->elements->total = count($emails);
     $emails = array_slice($emails, $pageInfo->limit->start, $pageInfo->limit->value);
     $pageInfo->elements->page = count($emails);
     $this->assignRef('rows', $emails);
     $this->assignRef('pageInfo', $pageInfo);
     hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
     $this->getPagination();
     $this->toolbar = array(array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard');
     $manage = hikashop_isAllowed($config->get('acl_email_manage', 'all'));
     $this->assignRef('manage', $manage);
     $delete = hikashop_isAllowed($config->get('acl_email_delete', 'all'));
     $this->assignRef('delete', $delete);
     jimport('joomla.client.helper');
     $ftp = JClientHelper::setCredentialsFromRequest('ftp');
     $this->assignRef('ftp', $ftp);
     $toggle = hikashop_get('helper.toggle');
     $this->assignRef('toggleClass', $toggle);
 }
Example #12
0
 function form()
 {
     $taxation_id = hikashop_getCID('taxation_id');
     $class = hikashop_get('class.taxation');
     if (!empty($taxation_id)) {
         $element = $class->get($taxation_id);
         $task = 'edit';
     } else {
         $element = new stdClass();
         $element->banner_url = HIKASHOP_LIVE;
         $task = 'add';
     }
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&taxation_id=' . $taxation_id);
     $this->toolbar = array('save', array('name' => 'save2new', 'display' => version_compare(JVERSION, '1.7', '>=')), 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form'));
     $this->assignRef('element', $element);
     $taxType = hikashop_get('type.tax');
     $this->assignRef('taxType', $taxType);
     $ratesType = hikashop_get('type.rates');
     $this->assignRef('ratesType', $ratesType);
     $category = hikashop_get('type.categorysub');
     $category->type = 'tax';
     $category->field = 'category_namekey';
     $this->assignRef('category', $category);
     $popup = hikashop_get('helper.popup');
     $this->assignRef('popup', $popup);
     $nameboxType = hikashop_get('type.namebox');
     $this->assignRef('nameboxType', $nameboxType);
 }
Example #13
0
 function form()
 {
     $tax_namekey = JRequest::getString('tax_namekey');
     if (empty($tax_namekey)) {
         $id = JRequest::getVar('cid', array(), '', 'array');
         if (is_array($id) && count($id)) {
             $tax_namekey = reset($id);
         } else {
             $tax_namekey = $id;
         }
     }
     $class = hikashop_get('class.tax');
     if (!empty($tax_namekey)) {
         $element = $class->get($tax_namekey);
         $task = 'edit';
     } else {
         $element = new stdClass();
         $element->banner_url = HIKASHOP_LIVE;
         $task = 'add';
         $tax_namekey = '';
     }
     $this->assignRef('element', $element);
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&tax_namekey=' . $tax_namekey);
     $this->toolbar = array('save', array('name' => 'save2new', 'display' => version_compare(JVERSION, '1.7', '>=')), 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form'));
     $return = JRequest::getString('return', '');
     $this->assignRef('return', $return);
 }
Example #14
0
    function show()
    {
        $app = JFactory::getApplication();
        $pageInfo = new stdClass();
        $pageInfo->filter = new stdClass();
        $pageInfo->filter->order = new stdClass();
        $pageInfo->limit = new stdClass();
        $config =& hikashop_config();
        hikashop_setTitle(JText::_('IMPORT'), $this->icon, $this->ctrl . '&task=show');
        $importIcon = 'upload';
        if (HIKASHOP_J30) {
            $importIcon = 'import';
        }
        $this->toolbar = array(array('name' => 'custom', 'icon' => $importIcon, 'alt' => JText::_('IMPORT'), 'task' => 'import', 'check' => false), '|', array('name' => 'pophelp', 'target' => $this->ctrl), 'dashboard');
        $importData = array();
        $import = new stdClass();
        $import->text = JText::_('PRODUCTS_FROM_CSV');
        $import->key = 'file';
        $importData[] = $import;
        $textArea = new stdClass();
        $textArea->text = JText::_('PRODUCTS_FROM_TEXTAREA');
        $textArea->key = 'textarea';
        $importData[] = $textArea;
        $folder = new stdClass();
        $folder->text = JText::_('PRODUCTS_FROM_FOLDER');
        $folder->key = 'folder';
        $importData[] = $folder;
        $database = JFactory::getDBO();
        $query = 'SHOW TABLES LIKE ' . $database->Quote($database->getPrefix() . substr(hikashop_table('virtuemart_products', false), 3));
        $database->setQuery($query);
        $table = $database->loadResult();
        if (empty($table)) {
            $query = 'SHOW TABLES LIKE ' . $database->Quote($database->getPrefix() . substr(hikashop_table('vm_product', false), 3));
            $database->setQuery($query);
            $table = $database->loadResult();
            if (empty($table)) {
                $vm_here = false;
            } else {
                $vm_here = true;
                $version = 1;
                $this->assignRef('vmversion', $version);
            }
        } else {
            $vm_here = true;
            $version = 2;
            $this->assignRef('vmversion', $version);
        }
        $this->assignRef('vm', $vm_here);
        $vm = new stdClass();
        $vm->text = JText::sprintf('PRODUCTS_FROM_X', 'Virtuemart');
        $vm->key = 'vm';
        $importData[] = $vm;
        $mijo = new stdClass();
        $mijo->text = JText::sprintf('PRODUCTS_FROM_X', 'Mijoshop');
        $mijo->key = 'mijo';
        $importData[] = $mijo;
        $query = 'SHOW TABLES LIKE ' . $database->Quote($database->getPrefix() . substr(hikashop_table('mijoshop_product', false), 3));
        $database->setQuery($query);
        $table = $database->loadResult();
        if (empty($table)) {
            $mijo_here = false;
        } else {
            $mijo_here = true;
        }
        $this->assignRef('mijo', $mijo_here);
        $reds = new stdClass();
        $reds->text = JText::sprintf('PRODUCTS_FROM_X', 'Redshop');
        $reds->key = 'redshop';
        $importData[] = $reds;
        $query = 'SHOW TABLES LIKE ' . $database->Quote($database->getPrefix() . substr(hikashop_table('redshop_product', false), 3));
        $database->setQuery($query);
        $table = $database->loadResult();
        if (empty($table)) {
            $reds_here = false;
        } else {
            $reds_here = true;
        }
        $this->assignRef('reds', $reds_here);
        $openc = new stdClass();
        $openc->text = JText::sprintf('PRODUCTS_FROM_X', 'Opencart');
        $openc->key = 'openc';
        $importData[] = $openc;
        JPluginHelper::importPlugin('hikashop');
        $dispatcher = JDispatcher::getInstance();
        $dispatcher->trigger('onDisplayImport', array(&$importData));
        $this->assignRef('importData', $importData);
        $importValues = array();
        foreach ($importData as $data) {
            if (!empty($data->key)) {
                $importValues[] = JHTML::_('select.option', $data->key, $data->text);
            }
        }
        $this->assignRef('importValues', $importValues);
        $importFolders = array(JHTML::_('select.option', 'images', JText::_('HIKA_IMAGES')), JHTML::_('select.option', 'files', JText::_('HIKA_FILES')), JHTML::_('select.option', 'both', JText::_('FILES') . ' & ' . JText::_('HIKA_IMAGES')));
        $this->assignRef('importFolders', $importFolders);
        $js = '
		var currentoption = \'file\';
		function updateImport(newoption){
			document.getElementById(currentoption).style.display = "none";
			document.getElementById(newoption).style.display = \'block\';
			currentoption = newoption;
		}
		var currentoptionFolder = \'images\';
		function updateImportFolder(newoption){
			document.getElementById(currentoptionFolder).style.display = "none";
			document.getElementById(newoption).style.display = \'block\';
			currentoptionFolder = newoption;
		}';
        if (!HIKASHOP_PHP5) {
            $doc =& JFactory::getDocument();
        } else {
            $doc = JFactory::getDocument();
        }
        $doc->addScriptDeclaration($js);
        JHTML::_('behavior.modal');
    }
Example #15
0
 function form()
 {
     $badge_id = hikashop_getCID('badge_id');
     $class = hikashop_get('class.badge');
     if (!empty($badge_id)) {
         $element = $class->get($badge_id, true);
         $task = 'edit';
     } else {
         $element = new stdClass();
         $element->banner_published = 1;
         $task = 'add';
     }
     $database = JFactory::getDBO();
     if (!empty($element->badge_discount_id)) {
         $query = 'SELECT * FROM ' . hikashop_table('discount') . ' WHERE discount_id = ' . (int) $element->badge_discount_id;
         $database->setQuery($query);
         $discount = $database->loadObject();
         if (!empty($discount)) {
             foreach (get_object_vars($discount) as $key => $val) {
                 $element->{$key} = $val;
             }
         }
     }
     if (empty($element->discount_code)) {
         $element->discount_code = JText::_('DISCOUNT_NOT_FOUND');
     }
     if (!empty($element->badge_category_id)) {
         $query = 'SELECT * FROM ' . hikashop_table('category') . ' WHERE category_id = ' . (int) $element->badge_category_id;
         $database->setQuery($query);
         $category = $database->loadObject();
         if (!empty($category)) {
             foreach (get_object_vars($category) as $key => $val) {
                 $element->{$key} = $val;
             }
         }
     }
     if (empty($element->category_name)) {
         $element->category_name = JText::_('CATEGORY_NOT_FOUND');
     }
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&badge_id=' . $badge_id);
     $this->toolbar = array('save', array('name' => 'save2new', 'display' => version_compare(JVERSION, '1.7', '>=')), 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'));
     $js = "\r\n\t\tfunction hikashopSizeUpdate(keep_size){\r\n\t\t\tif(keep_size>0){\r\n\t\t\t displayStatus ='none';\r\n\t\t\t}else{\r\n\t\t\t displayStatus = '';\r\n\t\t\t}\r\n\t\t\tvar el = document.getElementById('field_size');\r\n\t\t\tif(el){ el.style.display=displayStatus; }\r\n\t\t}\r\n\t\twindow.hikashop.ready( function(){ hikashopSizeUpdate(" . (int) @$element->badge_keep_size . "); });\r\n\t\t";
     $document = JFactory::getDocument();
     $document->addScriptDeclaration($js);
     $this->assignRef('element', $element);
     $translation = false;
     $transHelper = hikashop_get('helper.translation');
     if ($transHelper && $transHelper->isMulti()) {
         $translation = true;
         $transHelper->load('hikashop_badge', @$element->badge_id, $element);
         jimport('joomla.html.pane');
         $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);
     $image = hikashop_get('helper.image');
     $this->assignRef('image', $image);
     $badge = hikashop_get('type.badge');
     $this->assignRef('badge', $badge);
     $this->assignRef('translation', $translation);
     $popup = hikashop_get('helper.popup');
     $this->assignRef('popup', $popup);
     $nameboxType = hikashop_get('type.namebox');
     $this->assignRef('nameboxType', $nameboxType);
 }
Example #16
0
 function form()
 {
     $app = JFactory::getApplication();
     $entry_id = hikashop_getCID('entry_id');
     $entry = new stdClass();
     if (!empty($entry_id)) {
         $class = hikashop_get('class.entry');
         $entry = $class->get($entry_id);
         $task = 'edit';
     } else {
         $task = 'new';
     }
     $extraFields = array();
     $fieldsClass = hikashop_get('class.field');
     $this->assignRef('fieldsClass', $fieldsClass);
     $address = null;
     $extraFields['entry'] = $fieldsClass->getFields('backend', $address, 'entry', 'user&task=state');
     if (empty($extraFields['entry'])) {
         $app->enqueueMessage(JText::sprintf('ENTRIES_FIRST'));
     }
     $this->assignRef('extraFields', $extraFields);
     $this->assignRef('entry', $entry);
     $cart = hikashop_get('helper.cart');
     $this->assignRef('cart', $cart);
     jimport('joomla.html.parameter');
     $params = new HikaParameter('');
     $this->assignRef('params', $params);
     if (JRequest::getVar('tmpl', '') != 'component') {
         hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&entry_id=' . $entry_id);
         $this->toolbar = array('save', 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form'));
     }
 }
Example #17
0
 function form()
 {
     $vote_id = hikashop_getCID('currency_id', false);
     $item = new stdClass();
     $database = JFactory::getDBO();
     if (!empty($vote_id)) {
         $query = 'SELECT * FROM `#__hikashop_vote` WHERE vote_id = ' . (int) $vote_id . '';
         $database->setQuery($query);
         $rows = $database->loadObjectList();
         if (!empty($rows)) {
             foreach ($rows as $k => $v) {
                 $query2 = 'SELECT product_name FROM `#__hikashop_product` WHERE product_id  = ' . (int) $rows[$k]->vote_ref_id . '';
                 $database->setQuery($query2);
                 $product_names = $database->loadObjectList();
                 foreach ($product_names as $product_name) {
                     $rows[$k]->product_name = $product_name->product_name;
                 }
                 if ($rows[$k]->vote_pseudo == '0') {
                     $userClass = hikashop_get('class.user');
                     $userInfos = $userClass->get($rows[$k]->vote_user_id);
                     if (!empty($userInfos)) {
                         $rows[$k]->username = $userInfos->username;
                         $rows[$k]->email = $userInfos->email;
                     } else {
                         $rows[$k]->username = '';
                         $rows[$k]->email = '';
                     }
                 }
             }
         }
         $item->newItem = false;
     } else {
         $item->newItem = true;
     }
     $item->enabled = $this->isEnabled();
     $this->assignRef('rows', $rows);
     $this->assignRef('item', $item);
     $vote_id = hikashop_getCID('vote_id');
     $class = hikashop_get('class.vote');
     if (!empty($vote_id)) {
         $element = $class->get($vote_id, true);
         $task = 'edit';
     } else {
         $element = new stdClass();
         $element->vote_url = HIKASHOP_LIVE;
         $element->vote_published = 1;
         $task = 'add';
     }
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&vote_id=' . $vote_id);
     $this->toolbar = array('save', 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'));
     $this->assignRef('element', $element);
     $translation = false;
     $transHelper = hikashop_get('helper.translation');
     if ($transHelper && $transHelper->isMulti()) {
         $translation = true;
         $transHelper->load('hikashop_vote', @$element->vote_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);
     $nameboxType = hikashop_get('type.namebox');
     $this->assignRef('nameboxType', $nameboxType);
     $voteType = hikashop_get('type.vote');
     $this->assignRef('voteType', $voteType);
 }
Example #18
0
 function form()
 {
     JHTML::_('behavior.modal');
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $task = JRequest::getVar('task');
     $config = hikashop_config();
     $this->assignRef('config', $config);
     $toggle = hikashop_get('helper.toggle');
     $this->assignRef('toggle', $toggle);
     $popup = hikashop_get('helper.popup');
     $this->assignRef('popup', $popup);
     $this->content = '';
     $this->plugin_name = JRequest::getCmd('name', '');
     if (empty($this->plugin_name)) {
         hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
         return false;
     }
     $this->plugin_type = '';
     $type = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.plugin_type', 'plugin_type', 'shipping');
     if (in_array($type, array('shipping', 'payment', 'plugin'))) {
         if ($type == 'plugin') {
             $plugin = hikashop_import('hikashop', $this->plugin_name);
             if (!is_subclass_of($plugin, 'hikashopPlugin')) {
                 if (!HIKASHOP_J16) {
                     $url = 'index.php?option=com_plugins&view=plugin&client=site&task=edit&cid[]=';
                     $db->setQuery("SELECT id FROM `#__plugins` WHERE `folder` = 'hikashop' and element=" . $db->Quote($this->plugin_name));
                     $plugin_id = $db->loadResult();
                 } else {
                     $url = 'index.php?option=com_plugins&task=plugin.edit&extension_id=';
                     $db->setQuery("SELECT extension_id as id FROM `#__extensions` WHERE `folder` = 'hikashop' AND `type`='plugin' AND element=" . $db->Quote($this->plugin_name));
                     $plugin_id = $db->loadResult();
                 }
                 $app->redirect($url . $plugin_id);
             }
         } else {
             $plugin = hikashop_import('hikashop' . $type, $this->plugin_name);
         }
         if (!$plugin) {
             hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
             return false;
         }
         $this->plugin_type = $type;
     } else {
         hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
         return false;
     }
     $multiple_plugin = false;
     $multiple_interface = false;
     if (method_exists($plugin, 'isMultiple')) {
         $multiple_interface = true;
         $multiple_plugin = $plugin->isMultiple();
     }
     $subtask = JRequest::getCmd('subtask', '');
     if ($multiple_plugin && empty($subtask)) {
         $querySelect = array();
         $queryFrom = array();
         $queryWhere = array();
         $filters = array();
         JPluginHelper::importPlugin('hikashop');
         $dispatcher = JDispatcher::getInstance();
         $dispatcher->trigger('onHikaPluginListing', array($type, &$querySelect, &$queryFrom, &$queryWhere, &$filters));
         if (!empty($querySelect)) {
             $querySelect = ', ' . implode(',', $querySelect);
         } else {
             $querySelect = '';
         }
         if (!empty($queryFrom)) {
             $queryFrom = ', ' . implode(',', $queryFrom);
         } else {
             $queryFrom = '';
         }
         if (!empty($queryWhere)) {
             $queryWhere = ' AND (' . implode(') AND (', $queryWhere) . ') ';
         } else {
             $queryWhere = '';
         }
         $this->assignRef('filters', $filters);
     } else {
         $querySelect = '';
         $queryFrom = '';
         $queryWhere = '';
     }
     $query = 'SELECT plugin.* ' . $querySelect . ' FROM ' . hikashop_table($this->plugin_type) . ' as plugin ' . $queryFrom . ' WHERE (plugin.' . $this->plugin_type . '_type = ' . $db->Quote($this->plugin_name) . ') ' . $queryWhere . ' ORDER BY plugin.' . $this->plugin_type . '_ordering ASC';
     $db->setQuery($query);
     $elements = $db->loadObjectList($this->plugin_type . '_id');
     if (!empty($elements)) {
         $params_name = $this->plugin_type . '_params';
         foreach ($elements as $k => $el) {
             if (!empty($el->{$params_name})) {
                 $elements[$k]->{$params_name} = unserialize($el->{$params_name});
             }
         }
     }
     $function = 'pluginConfiguration';
     $ctrl = '&plugin_type=' . $this->plugin_type . '&task=' . $task . '&name=' . $this->plugin_name;
     if ($multiple_plugin === true) {
         $subtask = JRequest::getCmd('subtask', '');
         $ctrl .= '&subtask=' . $subtask;
         if (empty($subtask)) {
             $function = 'pluginMultipleConfiguration';
         } else {
             $typeFunction = 'on' . ucfirst($this->plugin_type) . 'Configuration';
             if (method_exists($plugin, $typeFunction)) {
                 $function = $typeFunction;
             }
         }
         $cid = hikashop_getCID($this->plugin_type . '_id');
         if (isset($elements[$cid])) {
             $this->assignRef('element', $elements[$cid]);
             $configParam =& $elements[$cid];
             $ctrl .= '&' . $this->plugin_type . '_id=' . $cid;
         } else {
             $configParam = new stdClass();
             $this->assignRef('element', $configParam);
         }
     } else {
         $configParam =& $elements;
         $element = null;
         if (!empty($elements)) {
             $element = reset($elements);
         }
         $this->assignRef('element', $element);
         $typeFunction = 'on' . ucfirst($this->plugin_type) . 'Configuration';
         if (method_exists($plugin, $typeFunction)) {
             $function = $typeFunction;
         }
     }
     $this->assignRef('elements', $elements);
     if ($multiple_interface && !isset($subtask) || !empty($subtask)) {
         $extra_config = array();
         $extra_blocks = array();
         JPluginHelper::importPlugin('hikashop');
         $dispatcher = JDispatcher::getInstance();
         $dispatcher->trigger('onHikaPluginConfiguration', array($type, &$plugin, &$this->element, &$extra_config, &$extra_blocks));
         $this->assignRef('extra_config', $extra_config);
         $this->assignRef('extra_blocks', $extra_blocks);
     }
     $setTitle = true;
     if (method_exists($plugin, $function)) {
         if (empty($plugin->title)) {
             $plugin->title = JText::_('HIKA_PLUGIN') . ' ' . $this->plugin_name;
         }
         ob_start();
         $plugin->{$function}($configParam);
         $this->content = ob_get_clean();
         $this->data = $plugin->getProperties();
         $setTitle = false;
     }
     if (isset($this->data['toolbar'])) {
         $this->toolbar = $this->data['toolbar'];
     } else {
         $this->toolbar = array('save', 'apply', 'cancel', '|');
     }
     $this->assignRef('name', $this->plugin_name);
     $this->assignRef('plugin', $plugin);
     $this->assignRef('multiple_plugin', $multiple_plugin);
     $this->assignRef('multiple_interface', $multiple_interface);
     $this->assignRef('content', $this->content);
     $this->assignRef('plugin_type', $this->plugin_type);
     $categoryType = hikashop_get('type.categorysub');
     $categoryType->type = 'tax';
     $categoryType->field = 'category_id';
     $this->assignRef('categoryType', $categoryType);
     if ($this->plugin_type == 'shipping') {
         $warehouseType = hikashop_get('type.warehouse');
         $this->assignRef('warehouseType', $warehouseType);
         if (!empty($this->element->shipping_params->override_tax_zone)) {
             $zoneClass = hikashop_get('class.zone');
             $this->element->shipping_params->override_tax_zone = $zoneClass->get($this->element->shipping_params->override_tax_zone);
         }
     }
     $this->_noForm($type, $elements);
     $currencies = hikashop_get('type.currency');
     $column_name = $type . '_currency';
     $this->element->{$column_name} = explode(',', trim(@$this->element->{$column_name}, ','));
     $this->assignRef('currencies', $currencies);
     if ($type == 'payment') {
         $this->_loadPayment();
     }
     if (empty($plugin->pluginView)) {
         $this->content .= $this->loadPluginTemplate(@$plugin->view, $type);
     }
     if ($setTitle) {
         hikashop_setTitle(JText::_('HIKA_PLUGIN') . ' ' . $this->name, $this->icon, $this->ctrl . $ctrl);
     }
     return true;
 }
Example #19
0
 function onPaymentConfiguration(&$element)
 {
     $this->ceca = JRequest::getCmd('name', 'ceca');
     if (empty($element)) {
         $element = new stdClass();
         $element->payment_name = 'CECA';
         $element->payment_description = 'Puede pagar con tarjeta con este método de pago';
         $element->payment_images = 'MasterCard,VISA,Credit_card,American_Express';
         $element->payment_type = $this->ceca;
         $element->payment_params = new stdClass();
         $list = null;
         $element->payment_params->verified_status = 'confirmed';
         $element = array($element);
     }
     $lang =& JFactory::getLanguage();
     $locale = strtoupper(substr($lang->get('tag'), 0, 2));
     $key = key($element);
     $element[$key]->payment_params->status_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=ceca&lang=' . strtolower($locale);
     $this->toolbar = array('save', 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => 'payment-bluepaid-form'));
     hikashop_setTitle('Ceca', 'plugin', 'plugins&plugin_type=payment&task=edit&name=' . $this->ceca);
     $app = JFactory::getApplication();
     $app->setUserState(HIKASHOP_COMPONENT . '.payment_plugin_type', $this->ceca);
     $this->address = hikashop_get('type.address');
     $this->category = hikashop_get('type.categorysub');
     $this->category->type = 'status';
 }
Example #20
0
 function form()
 {
     $id = JRequest::getString('id', '');
     $viewClass = hikashop_get('class.view');
     $obj = $viewClass->get($id);
     if ($obj) {
         jimport('joomla.filesystem.file');
         $obj->content = htmlspecialchars(JFile::read($obj->edit), ENT_COMPAT, 'UTF-8');
     }
     $this->toolbar = array('save', 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form'));
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=edit&id=' . $id);
     jimport('joomla.client.helper');
     $ftp = JClientHelper::setCredentialsFromRequest('ftp');
     $this->assignRef('ftp', $ftp);
     $this->assignRef('element', $obj);
     $editor = hikashop_get('helper.editor');
     $this->assignRef('editor', $editor);
 }
Example #21
0
 function form()
 {
     $currency_id = hikashop_getCID('currency_id', false);
     $class = hikashop_get('class.currency');
     if (!empty($currency_id)) {
         $element = $class->get($currency_id);
         $task = 'edit';
     } else {
         $element = JRequest::getVar('fail');
         if (empty($element)) {
             $element = new stdClass();
             $element->currency_published = 1;
             $element->currency_format = '%i';
             $element->currency_rate = 1.0;
             $element->currency_flat_fee = 0;
             $element->currency_percent_fee = 0;
             $class->checkLocale($element);
         }
         $task = 'add';
     }
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&currency_id=' . $currency_id);
     $this->toolbar = array('save', 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form'));
     $this->assignRef('element', $element);
     $signpos = hikashop_get('type.signpos');
     $this->assignRef('signpos', $signpos);
 }
Example #22
0
 function listing()
 {
     $app = JFactory::getApplication();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string');
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'id', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
     $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int');
     $database = JFactory::getDBO();
     $filters = array('(module = \'mod_hikashop\' OR module = \'mod_hikashop_cart\' OR module = \'mod_hikashop_wishlist\')');
     $searchMap = array('module', 'title');
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . hikashop_getEscaped(JString::strtolower(trim($pageInfo->search)), true) . '%\'';
         $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
     }
     $order = '';
     if (!empty($pageInfo->filter->order->value)) {
         $order = ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     if (!empty($filters)) {
         $filters = ' WHERE (' . implode(') AND (', $filters) . ')';
     } else {
         $filters = '';
     }
     $query = ' FROM ' . hikashop_table('modules', false) . ' ' . $filters . $order;
     $database->setQuery('SELECT *' . $query, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value);
     $rows = $database->loadObjectList();
     if (!empty($pageInfo->search)) {
         $rows = hikashop_search($pageInfo->search, $rows, 'id');
     }
     $database->setQuery('SELECT COUNT(*)' . $query);
     $pageInfo->elements = new stdClass();
     $pageInfo->elements->total = $database->loadResult();
     $pageInfo->elements->page = count($rows);
     $toggleClass = hikashop_get('helper.toggle');
     $this->assignRef('toggleClass', $toggleClass);
     $config =& hikashop_config();
     foreach ($rows as $k => $row) {
         $rows[$k]->hikashop_params = $config->get('params_' . $row->id);
         if (empty($rows[$k]->hikashop_params)) {
             $rows[$k]->hikashop_params = $config->get('default_params');
         }
     }
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
     $this->getPagination();
     $config =& hikashop_config();
     $manage = hikashop_isAllowed($config->get('acl_modules_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_modules_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard');
 }
Example #23
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);
 }
Example #24
0
 public function form()
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $ctrl = '';
     $this->paramBase = HIKASHOP_COMPONENT . '.' . $this->getName() . '.edit';
     $task = 'add';
     JHTML::_('behavior.tooltip');
     hikashop_loadJsLib('tooltip');
     $config = hikashop_config();
     $this->assignRef('config', $config);
     $product_id = hikashop_getCID('product_id');
     $productClass = hikashop_get('class.product');
     $main_currency = $config->get('main_currency', 1);
     $this->assignRef('main_currency_id', $main_currency);
     $this->loadRef(array('toggleClass' => 'helper.toggle', 'currencyClass' => 'class.currency', 'popup' => 'helper.popup', 'quantityType' => 'type.quantity', 'productsType' => 'type.products', 'nameboxType' => 'type.namebox', 'nameboxVariantType' => 'type.namebox', 'uploaderType' => 'type.uploader', 'imageHelper' => 'helper.image', 'currencyType' => 'type.currency', 'weight' => 'type.weight', 'volume' => 'type.volume', 'productDisplayType' => 'type.productdisplay', 'quantityDisplayType' => 'type.quantitydisplay'));
     $categoryType = hikashop_get('type.categorysub');
     $categoryType->type = 'tax';
     $categoryType->field = 'category_id';
     $this->assignRef('categoryType', $categoryType);
     hikashop_loadJslib('jquery');
     $product = new stdClass();
     $product->product_description = '';
     $product->product_id = $product_id;
     $template_id = 0;
     $variant_id = 0;
     $failed_product = JRequest::getVar('fail', null);
     if (!empty($product_id)) {
         $product = $productClass->getRaw($product_id, true);
     }
     if (!empty($product_id)) {
         $task = 'edit';
         if ((int) $product->product_parent_id > 0) {
             $parentProduct = $productClass->getRaw((int) $product->product_parent_id, true);
             if (!empty($parentProduct)) {
                 $variant_id = $product_id;
                 $product_id = (int) $product->product_parent_id;
                 unset($product);
                 $product = $parentProduct;
             } else {
                 unset($parentProduct);
             }
         }
         $query = 'SELECT b.* FROM ' . hikashop_table('product_category') . ' AS a LEFT JOIN ' . hikashop_table('category') . ' AS b ON a.category_id = b.category_id WHERE a.product_id = ' . (int) $product_id . ' ORDER BY a.product_category_id';
         $db->setQuery($query);
         $product->categories = $db->loadObjectList('category_id');
         $query = 'SELECT * FROM ' . hikashop_table('file') . ' WHERE file_ref_id = ' . (int) $product_id . ' AND file_type=\'product\' ORDER BY file_ordering, file_id';
         $db->setQuery($query);
         $product->images = $db->loadObjectList();
         $query = 'SELECT file.*, SUM(download.download_number) AS download_number FROM ' . hikashop_table('file') . ' AS file ' . ' LEFT JOIN ' . hikashop_table('download') . ' AS download ON file.file_id = download.file_id ' . ' WHERE file_ref_id = ' . (int) $product_id . ' AND file.file_type=' . $db->Quote('file') . ' ' . ' GROUP BY file.file_id ' . ' ORDER BY file.file_ordering, file.file_id';
         $db->setQuery($query);
         $product->files = $db->loadObjectList('file_id');
         $query = 'SELECT a.*,b.* FROM ' . hikashop_table('product_related') . ' AS a LEFT JOIN ' . hikashop_table('product') . ' AS b ON a.product_related_id=b.product_id WHERE a.product_related_type=\'related\' AND a.product_id = ' . (int) $product_id . ' ORDER BY a.product_related_ordering';
         $db->setQuery($query);
         $product->related = $db->loadObjectList();
         $query = 'SELECT a.*,b.* FROM ' . hikashop_table('product_related') . ' AS a LEFT JOIN ' . hikashop_table('product') . ' AS b ON a.product_related_id=b.product_id WHERE a.product_related_type=\'options\' AND a.product_id = ' . (int) $product_id . ' ORDER BY a.product_related_ordering';
         $db->setQuery($query);
         $product->options = $db->loadObjectList();
         $query = 'SELECT variant.*, characteristic.* FROM ' . hikashop_table('variant') . ' as variant LEFT JOIN ' . hikashop_table('characteristic') . ' as characteristic ON variant.variant_characteristic_id = characteristic.characteristic_id WHERE variant.variant_product_id = ' . (int) $product_id . ' ORDER BY variant.ordering ASC, characteristic.characteristic_ordering ASC, ordering ASC';
         $db->setQuery($query);
         $product->characteristics = $db->loadObjectList('characteristic_id');
         $query = 'SELECT p.* FROM ' . hikashop_table('product') . ' as p WHERE p.product_type = ' . $db->Quote('variant') . ' AND p.product_parent_id = ' . (int) $product_id;
         $db->setQuery($query);
         $product->variants = $db->loadObjectList('product_id');
         if (!empty($product->variants)) {
             $variant_ids = array_keys($product->variants);
             $query = 'SELECT * FROM ' . hikashop_table('price') . ' WHERE price_product_id IN (' . (int) $product_id . ',' . implode(',', $variant_ids) . ')';
             $db->setQuery($query);
             $prices = $db->loadObjectList();
             $product->prices = array();
             foreach ($prices as $price) {
                 $ppid = (int) $price->price_product_id;
                 if ($ppid == $product_id) {
                     $product->prices[] = $price;
                 } elseif (isset($product->variants[$ppid])) {
                     if (empty($product->variants[$ppid]->prices)) {
                         $product->variants[$ppid]->prices = array();
                     }
                     $product->variants[$ppid]->prices[] = $price;
                 }
             }
             unset($prices);
             $query = 'SELECT v.*, c.* FROM ' . hikashop_table('variant') . ' AS v ' . ' INNER JOIN ' . hikashop_table('characteristic') . ' AS c ON c.characteristic_id = v.variant_characteristic_id ' . ' WHERE v.variant_product_id IN (' . implode(',', $variant_ids) . ')' . ' ORDER BY v.ordering ASC, c.characteristic_ordering ASC, v.variant_product_id ASC, v.variant_characteristic_id ASC';
             $db->setQuery($query);
             $variant_data = $db->loadObjectList();
             foreach ($variant_data as $d) {
                 $ppid = (int) $d->variant_product_id;
                 if (!isset($product->characteristics[$d->characteristic_parent_id])) {
                     continue;
                 }
                 if (!isset($product->variants[$ppid])) {
                     continue;
                 }
                 if (empty($product->variants[$ppid]->characteristics)) {
                     $product->variants[$ppid]->characteristics = array();
                 }
                 $pcid = $product->characteristics[$d->characteristic_parent_id]->characteristic_id;
                 $value = new stdClass();
                 $value->id = $d->characteristic_id;
                 $value->value = $d->characteristic_value;
                 $product->variants[$ppid]->characteristics[$pcid] = $value;
             }
         } else {
             $query = 'SELECT * FROM ' . hikashop_table('price') . ' WHERE price_product_id = ' . (int) $product_id;
             $db->setQuery($query);
             $product->prices = $db->loadObjectList();
         }
     } else {
         if (!empty($failed_product)) {
             $product = $failed_product;
             if (!empty($product->related)) {
                 $tmp_ids = array();
                 foreach ($product->related as $v) {
                     $tmp_ids[(int) $v->product_related_id] = (int) $v->product_related_ordering;
                 }
                 $query = 'SELECT p.* FROM ' . hikashop_table('product') . ' AS p WHERE p.product_id IN (' . implode(',', array_keys($tmp_ids)) . ')';
                 $db->setQuery($query);
                 $product->related = $db->loadObjectList();
                 foreach ($product->related as $k => $v) {
                     $product->related[$k]->product_related_id = $v->product_id;
                     $product->related[$k]->product_related_ordering = $tmp_ids[$v->product_id];
                 }
             }
             if (!empty($element->options)) {
                 $tmp_ids = array();
                 foreach ($product->options as $v) {
                     $rel_ids[(int) $v->product_related_id] = (int) $v->product_related_ordering;
                 }
                 $query = 'SELECT p.* FROM ' . hikashop_table('product') . ' AS p WHERE p.product_id IN (' . implode(',', array_keys($tmp_ids)) . ')';
                 $db->setQuery($query);
                 $product->options = $db->loadObjectList();
                 foreach ($product->options as $k => $v) {
                     $product->options[$k]->product_related_id = $v->product_id;
                     $product->options[$k]->product_related_ordering = $tmp_ids[$v->product_id];
                 }
             }
             if (!empty($product->characteristics)) {
                 $tmp_ids = array();
                 foreach ($product->characteristics as $k => $v) {
                     $tmp_ids[(int) $v->characteristic_id] = $k;
                 }
                 $query = 'SELECT c.* FROM ' . hikashop_table('characteristic') . ' AS c WHERE c.characteristic_id IN (' . implode(',', array_keys($tmp_ids)) . ')';
                 $db->setQuery($query);
                 $characteristics = $db->loadObjectList();
                 foreach ($characteristics as $char) {
                     $product->characteristics[$tmp_ids[$char->characteristic_id]]->characteristic_value = $char->characteristic_value;
                 }
                 unset($characteristics);
             }
             if (!empty($product->categories)) {
                 JArrayHelper::toInteger($product->categories);
                 $query = 'SELECT c.* FROM ' . hikashop_table('category') . ' AS c WHERE c.category_id IN (' . implode(',', $product->categories) . ')';
                 $db->setQuery($query);
                 $product->categories = $db->loadObjectList('category_id');
             }
         } else {
             $product = new stdClass();
             $product->product_published = 1;
             $product->product_type = 'main';
             $product->product_quantity = -1;
             $product->product_description = '';
             $categoryClass = hikashop_get('class.category');
             $mainTaxCategory = 'tax';
             $categoryClass->getMainElement($mainTaxCategory);
             $query = 'SELECT category_id FROM ' . hikashop_table('category') . ' WHERE category_type = ' . $db->Quote('tax') . ' AND category_parent_id = ' . (int) $mainTaxCategory . ' ORDER BY category_ordering DESC';
             $db->setQuery($query);
             $product->product_tax_id = $db->loadResult();
         }
     }
     if (empty($product_id) && empty($product->categories)) {
         $rootCategory = 0;
         $categoryClass = hikashop_get('class.category');
         $category_explorer = $config->get('show_category_explorer', 1);
         if ($category_explorer) {
             $rootCategory = JRequest::getVar('filter_id', '1');
         }
         if (empty($rootCategory) || $rootCategory == 1) {
             $rootCategory = 'product';
             $categoryClass->getMainElement($rootCategory);
         }
         if (!empty($rootCategory)) {
             if (empty($product->categories)) {
                 $product->categories = array($rootCategory => $categoryClass->get($rootCategory));
             } else {
                 $product->categories[$rootCategory] = $categoryClass->get($rootCategory);
             }
         }
     }
     if (!empty($product->product_tax_id)) {
         $main_tax_zone = explode(',', $config->get('main_tax_zone', ''));
         if (count($main_tax_zone)) {
             $main_tax_zone = array_shift($main_tax_zone);
         }
     }
     $price_currencies = array();
     if (!empty($product->prices)) {
         foreach ($product->prices as $key => $price) {
             if (empty($price->price_value)) {
                 unset($product->prices[$key]);
             }
             $price_currencies[(int) $price->price_currency_id] = (int) $price->price_currency_id;
         }
         if (!empty($product->product_tax_id)) {
             foreach ($product->prices as &$price) {
                 $price->price_value_with_tax = $this->currencyClass->getTaxedPrice($price->price_value, $main_tax_zone, $product->product_tax_id);
             }
         } else {
             foreach ($product->prices as $key => $price) {
                 $price->price_value_with_tax = $price->price_value;
             }
         }
     }
     if (empty($product->prices)) {
         $obj = new stdClass();
         $obj->price_value = 0;
         $obj->price_value_with_tax = 0;
         $obj->price_currency_id = $main_currency;
         $product->prices = array($obj);
     }
     $editor = hikashop_get('helper.editor');
     $editor->setEditor($config->get('editor', ''));
     $editor->name = 'product_description';
     $editor->content = $product->product_description;
     $editor->height = 200;
     $this->assignRef('editor', $editor);
     if (!isset($product->product_quantity) || $product->product_quantity < 0) {
         $product->product_quantity = JText::_('UNLIMITED');
     }
     if (!isset($product->product_max_per_order) || $product->product_max_per_order <= 0) {
         $product->product_max_per_order = JText::_('UNLIMITED');
     }
     $this->assignRef('product', $product);
     if (hikashop_level(2)) {
         hikashop_loadJslib('otree');
         $joomlaAcl = hikashop_get('type.joomla_acl');
         $this->assignRef('joomlaAcl', $joomlaAcl);
     }
     $translationHelper = hikashop_get('helper.translation');
     if ($translationHelper && $translationHelper->isMulti()) {
         $translationHelper->load('hikashop_product', @$product->product_id, $product);
         $this->assignRef('translationHelper', $translationHelper);
     }
     $manufacturerType = hikashop_get('type.categorysub');
     $manufacturerType->type = 'manufacturer';
     $manufacturerType->field = 'category_id';
     $this->assignRef('manufacturerType', $manufacturerType);
     $main_currency = (int) $config->get('main_currency');
     $this->currencyType->load($main_currency);
     $currencies = $this->currencyType->currencies;
     $this->assignRef('currencies', $currencies);
     $default_currency = $this->currencyType->currencies[$main_currency];
     $this->assignRef('default_currency', $default_currency);
     if (!empty($price_currencies)) {
         $missing_currencies = array_diff($price_currencies, array_keys($currencies));
         if (!empty($missing_currencies)) {
             $this->currencyType->currencies = array();
             $this->currencyType->load($price_currencies);
             $currencies = $this->currencyType->currencies;
             $missing_currencies_codes = array();
             foreach ($missing_currencies as $k) {
                 $missing_currencies_codes[] = $currencies[$k]->currency_code;
             }
             $app->enqueueMessage(JText::sprintf('PRICES_USING_UNPUBLISHED_CURRENCY', implode(',', $missing_currencies_codes)), 'warning');
         }
     }
     $fieldsClass = hikashop_get('class.field');
     $fields = $fieldsClass->getFields('backend', $product, 'product', 'field&task=state');
     $null = array();
     $fieldsClass->addJS($null, $null, $null);
     $fieldsClass->jsToggle($fields, $product, 0);
     $this->assignRef('fieldsClass', $fieldsClass);
     $this->assignRef('fields', $fields);
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&product_id=' . $product_id);
     if (!HIKASHOP_J16) {
         $url = hikashop_completeLink('product&task=updatecart&cid=' . $product_id, true);
     } else {
         $url = 'index.php?option=com_hikashop&ctrl=product&task=updatecart&tmpl=component&cid=' . $product_id;
     }
     $this->toolbar = array(array('name' => 'popup', 'icon' => 'upload', 'alt' => JText::_('ADD_TO_CART_HTML_CODE'), 'url' => $url), '|', 'save', array('name' => 'save2new', 'display' => HIKASHOP_J17), 'apply', 'cancel' => 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form'));
     $cancel_url = JRequest::getVar('cancel_redirect');
     if (!empty($cancel_url)) {
         $url = base64_decode($cancel_url);
         $this->toolbar['cancel'] = array('name' => 'link', 'icon' => 'cancel', 'alt' => JText::_('HIKA_BACK'), 'url' => $url);
     }
     $cancel_action = JRequest::getCmd('cancel_action', '');
     $this->assignRef('cancel_action', $cancel_action);
     $cancel_url = JRequest::getCmd('cancel_url', '');
     $this->assignRef('cancel_url', $cancel_url);
 }
Example #25
0
 function form()
 {
     $popup = hikashop_get('helper.popup');
     $this->assignRef('popup', $popup);
     $category_id = hikashop_getCID('category_id');
     $class = hikashop_get('class.category');
     if (!empty($category_id)) {
         $element = $class->get($category_id, true);
         $task = 'edit';
     } else {
         $element = JRequest::getVar('fail');
         if (empty($element)) {
             $element = new stdClass();
             $element->category_published = 1;
             $app = JFactory::getApplication();
             $filter_id = $app->getUserStateFromRequest($this->paramBase . ".filter_id", 'filter_id', '', 'string');
             if (!is_numeric($filter_id)) {
                 $class->getMainElement($filter_id);
             }
             $element->category_parent_id = (int) $filter_id;
         }
         $task = 'add';
     }
     if (!empty($element->category_parent_id)) {
         $parentData = $class->get($element->category_parent_id);
         $element->category_parent_name = $parentData->category_name;
         if (empty($element->category_type) && $parentData->category_type != 'root') {
             $element->category_type = $parentData->category_type;
         }
     }
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&category_id=' . $category_id);
     $this->toolbar = array('save', array('name' => 'save2new', 'display' => version_compare(JVERSION, '1.7', '>=')), 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form'));
     $this->_addCustom($element);
     $this->assignRef('element', $element);
     $categoryType = hikashop_get('type.category');
     $this->assignRef('categoryType', $categoryType);
     $mainCategory = !empty($element->category_parent_id) ? 0 : 1;
     $this->assignRef('mainCategory', $mainCategory);
     JHTML::_('behavior.modal');
     $config =& hikashop_config();
     $translation = false;
     $transHelper = hikashop_get('helper.translation');
     if ($transHelper && $transHelper->isMulti()) {
         $translation = true;
         $transHelper->load('hikashop_category', @$element->category_id, $element);
         $this->assignRef('transHelper', $transHelper);
     }
     $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('config', $config);
     $toggle = hikashop_get('helper.toggle');
     $this->assignRef('toggle', $toggle);
     $this->assignRef('translation', $translation);
     $editor = hikashop_get('helper.editor');
     $editor->name = 'category_description';
     $editor->content = @$element->category_description;
     $this->assignRef('editor', $editor);
     $productDisplayType = hikashop_get('type.productdisplay');
     $this->assignRef('productDisplayType', $productDisplayType);
     $category_image = $config->get('category_image', 1);
     if ($category_image) {
         $image = hikashop_get('helper.image');
         $this->assignRef('image', $image);
     }
     if (!empty($element->category_type) && ($element->category_type == 'tax' || $element->category_type == 'status')) {
         $category_image = false;
     }
     $this->assignRef('category_image', $category_image);
     $quantityDisplayType = hikashop_get('type.quantitydisplay');
     $this->assignRef('quantityDisplayType', $quantityDisplayType);
     $nameboxType = hikashop_get('type.namebox');
     $this->assignRef('nameboxType', $nameboxType);
 }
Example #26
0
 function select_coupon()
 {
     $badge = JRequest::getVar('badge', 'false');
     $this->assignRef('badge', $badge);
     $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.discount_id', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
     $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string');
     $pageInfo->search = JString::strtolower(trim($pageInfo->search));
     $pageInfo->filter->filter_type = $app->getUserStateFromRequest($this->paramBase . ".filter_type", 'filter_type', '', 'string');
     $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     if (empty($pageInfo->limit->value)) {
         $pageInfo->limit->value = 500;
     }
     $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int');
     $database = JFactory::getDBO();
     $searchMap = array('a.discount_code', 'a.discount_id');
     $filters = array();
     if ($badge != 'false') {
         $filters[] = 'a.discount_type="discount"';
     }
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . hikashop_getEscaped($pageInfo->search, true) . '%\'';
         $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
     }
     $query = ' FROM ' . hikashop_table('discount') . ' AS a';
     if ($badge == 'false' && !empty($pageInfo->filter->filter_type)) {
         switch ($pageInfo->filter->filter_type) {
             case 'all':
                 break;
             default:
                 $filters[] = 'a.discount_type = ' . $database->Quote($pageInfo->filter->filter_type);
                 break;
         }
     }
     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();
     if (!empty($pageInfo->search)) {
         $rows = hikashop_search($pageInfo->search, $rows, 'discount_id');
     }
     $database->setQuery('SELECT count(*)' . $query);
     $pageInfo->elements = new stdClass();
     $pageInfo->elements->total = $database->loadResult();
     $pageInfo->elements->page = count($rows);
     if ($pageInfo->limit->value == 500) {
         $pageInfo->limit->value = 100;
     }
     hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
     $config =& hikashop_config();
     $manage = hikashop_isAllowed($config->get('acl_discount_manage', 'all'));
     $this->assignRef('manage', $manage);
     $this->toolbar = array(array('name' => 'custom', 'icon' => 'copy', 'task' => 'copy', 'alt' => JText::_('HIKA_COPY'), 'display' => $manage), array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_discount_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard');
     $discountType = hikashop_get('type.discount');
     $this->assignRef('filter_type', $discountType);
     $toggleClass = hikashop_get('helper.toggle');
     $this->assignRef('toggleClass', $toggleClass);
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->getPagination();
     $currencyHelper = hikashop_get('class.currency');
     $this->assignRef('currencyHelper', $currencyHelper);
 }
Example #27
0
    function form()
    {
        $massaction_id = hikashop_getCID('massaction_id');
        $class = hikashop_get('class.massaction');
        if (!empty($massaction_id)) {
            $element = $class->get($massaction_id, true);
            $task = 'edit';
        } else {
            $element = new stdClass();
            $element->massaction_published = 1;
            $element->massaction_table = 'product';
            $task = 'add';
        }
        hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&massaction_id=' . $massaction_id);
        $this->toolbar = array(array('name' => 'confirm', 'check' => false, 'msg' => JText::_('PROCESS_WARNING'), 'icon' => 'upload', 'alt' => JText::_('PROCESS'), 'task' => 'process'), '|', 'save', array('name' => 'save2new', 'display' => version_compare(JVERSION, '1.7', '>=')), 'apply', '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_massaction', @$element->massaction_id, $element);
            jimport('joomla.html.pane');
            $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);
        $tables = array();
        JPluginHelper::importPlugin('hikashop');
        $dispatcher = JDispatcher::getInstance();
        $dispatcher->trigger('onMassactionTableLoad', array(&$tables));
        $loadedData = $element;
        foreach ($tables as $k => $table) {
            $tables[$k]->triggers = array();
            $tables[$k]->triggers_html = array();
            $dispatcher->trigger('onMassactionTableTriggersLoad', array(&$tables[$k], &$tables[$k]->triggers, &$tables[$k]->triggers_html, &$loadedData));
            $tables[$k]->filters = array();
            $tables[$k]->filters_html = array();
            $dispatcher->trigger('onMassactionTableFiltersLoad', array(&$tables[$k], &$tables[$k]->filters, &$tables[$k]->filters_html, &$loadedData));
            $tables[$k]->actions = array();
            $tables[$k]->actions_html = array();
            $dispatcher->trigger('onMassactionTableActionsLoad', array(&$tables[$k], &$tables[$k]->actions, &$tables[$k]->actions_html, &$loadedData));
            $table->typevaluesTriggers = array();
            $table->typevaluesFilters = array();
            $table->typevaluesActions = array();
            $table->typevaluesTriggers[] = JHTML::_('select.option', '', JText::_('TRIGGER_SELECT'));
            $table->typevaluesFilters[] = JHTML::_('select.option', '', JText::_('FILTER_SELECT'));
            $table->typevaluesActions[] = JHTML::_('select.option', '', JText::_('ACTION_SELECT'));
            foreach ($tables[$k]->triggers as $oneType => $oneName) {
                $table->typevaluesTriggers[] = JHTML::_('select.option', $oneType, $oneName);
            }
            foreach ($tables[$k]->filters as $oneType => $oneName) {
                $table->typevaluesFilters[] = JHTML::_('select.option', $oneType, $oneName);
            }
            foreach ($tables[$k]->actions as $oneType => $oneName) {
                $table->typevaluesActions[] = JHTML::_('select.option', $oneType, $oneName);
            }
        }
        $this->assignRef('tables', $tables);
        $this->assignRef('loadedData', $loadedData);
        $js = "\r\n\r\n\t\t\tfunction updateMassAction(type,table,filterNum){\r\n\t\t\t\tvar w = window, d = w.document, currentFilterType = d.getElementById(type+table+'type'+filterNum).value;\r\n\t\t\t\tif(!currentFilterType){\r\n\t\t\t\t\td.getElementById(table+type+'area_'+filterNum).innerHTML = '';\r\n\t\t\t\t\tif(type=='filter') d.getElementById(table+'countresult_'+filterNum).innerHTML = '';\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tvar filterArea = table+type+'__num__'+currentFilterType;\r\n\t\t\t\tif(d.getElementById(filterArea))\r\n\t\t\t\t\t\tw.Oby.updateElem( d.getElementById(table+type+'area_'+filterNum), d.getElementById(filterArea).innerHTML.replace(/__num__/g,filterNum));\r\n\t\t\t\telse d.getElementById(table+type+'area_'+filterNum).innerHTML = '';\r\n\t\t\t}\r\n\r\n\t\t\t";
        $js .= "\r\n\t\t\tvar numTriggers = {};\r\n\t\t\tvar numFilters = {};\r\n\t\t\tvar numActions = {};\r\n\t\t\tvar triggerId = {};\r\n\t\t\tvar filterId = {};\r\n\t\t\tvar actionId = {};\r\n\t\t";
        foreach ($tables as $k => $table) {
            if (empty($loadedData->massaction_triggers) || $table->table != $loadedData->massaction_table) {
                $js .= "numTriggers['" . $table->table . "'] = 1;";
                $js .= "triggerId['" . $table->table . "'] = 1;";
            } else {
                $triggerId = max(array_keys($loadedData->massaction_triggers));
                if (!is_int($triggerId)) {
                    $triggerId = 1;
                } else {
                    $triggerId++;
                }
                $countTrigger = 1;
                foreach ($loadedData->massaction_triggers as $trigger) {
                    if (is_int($k)) {
                        $countTrigger++;
                    }
                }
                $js .= "numTriggers['" . $table->table . "'] = " . $countTrigger . ";";
                $js .= "triggerId['" . $table->table . "'] = " . $triggerId . ";";
            }
            if (empty($loadedData->massaction_filters) || $table->table != $loadedData->massaction_table) {
                $js .= "numFilters['" . $table->table . "'] = 1;";
                $js .= "filterId['" . $table->table . "'] = 1;";
            } else {
                $filterId = max(array_keys($loadedData->massaction_filters));
                if (!is_int($filterId)) {
                    $filterId = 1;
                } else {
                    $filterId++;
                }
                $countFilter = 1;
                foreach ($loadedData->massaction_filters as $k => $filter) {
                    if (is_int($k)) {
                        $countFilter++;
                    }
                }
                $js .= "numFilters['" . $table->table . "'] = " . $countFilter . ";";
                $js .= "filterId['" . $table->table . "'] = " . $filterId . ";";
            }
            if (empty($loadedData->massaction_actions) || $table->table != $loadedData->massaction_table) {
                $js .= "numActions['" . $table->table . "'] = 0;";
                $js .= "actionId['" . $table->table . "'] = 0;";
            } else {
                $actionId = max(array_keys($loadedData->massaction_actions));
                if (!is_int($actionId)) {
                    $actionId = 0;
                } else {
                    $actionId++;
                }
                $countAction = 0;
                foreach ($loadedData->massaction_actions as $k => $action) {
                    if (is_int($k)) {
                        $countAction++;
                    }
                }
                $js .= "numActions['" . $table->table . "'] = " . $countAction . ";";
                $js .= "actionId['" . $table->table . "'] = " . $actionId . ";";
            }
        }
        $js .= "\r\n\t\t\t\tfunction addHikaMassAction(table,type){\r\n\t\t\t\t\tvar newdiv = document.createElement('div');\r\n\t\t\t\t\tif(type=='filter'){\r\n\t\t\t\t\t\tvar count=numFilters[table]-1;\r\n\t\t\t\t\t\tvar theId=filterId[table];\r\n\t\t\t\t\t}else if(type=='trigger'){\r\n\t\t\t\t\t\tvar count=numTriggers[table];\r\n\t\t\t\t\t\tvar theId=triggerId[table];\r\n\t\t\t\t\t}else if(type=='action'){\r\n\t\t\t\t\t\tvar count=numActions[table];\r\n\t\t\t\t\t\tvar theId=actionId[table];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tnewdiv.id = table+type+theId;\r\n\t\t\t\t\tnewdiv.className = 'plugarea';\r\n\t\t\t\t\tnewdiv.innerHTML = '';\r\n\t\t\t\t\tif(count > 0) newdiv.innerHTML += '" . JText::_('HIKA_AND') . "';\r\n\t\t\t\t\tnewdiv.innerHTML += document.getElementById(table+'_'+type+'s_original').innerHTML.replace(/__num__/g, theId);\r\n\t\t\t\t\tif(document.getElementById('all'+table+type+'s')){\r\n\t\t\t\t\t\tdocument.getElementById('all'+table+type+'s').appendChild(newdiv);\r\n\t\t\t\t\t\tupdateMassAction(type,table,theId);\r\n\t\t\t\t\t\tif(type=='filter'){\r\n\t\t\t\t\t\t\tnumFilters[table]++;\r\n\t\t\t\t\t\t\tfilterId[table]++;\r\n\t\t\t\t\t\t}else if(type=='trigger'){\r\n\t\t\t\t\t\t\tnumTriggers[table]++;\r\n\t\t\t\t\t\t\ttriggerId[table]++;\r\n\t\t\t\t\t\t}else if(type=='action'){\r\n\t\t\t\t\t\t\tnumActions[table]++;\r\n\t\t\t\t\t\t\tactionId[table]++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t";
        if (HIKASHOP_J30) {
            $js .= '
				function refreshSelect(table,type, id){
					if(type=="filter"){
						var count=filterId[table];
					}else if(type=="trigger"){
						var count=triggerId[table];
					}else if(type=="action"){
						var count=actionId[table];
					}
					if(id!=-1){
						var count = id;
					}else{
						count=count-1;
					}
				}
			';
        } else {
            $js .= 'function refreshSelect(table,type, id){}';
        }
        if (!HIKASHOP_J16) {
            $js .= 'function submitbutton(pressbutton){
						if (pressbutton != \'save\') {
							submitform( pressbutton );
							return;
						}';
        } else {
            $js .= 'Joomla.submitbutton = function(pressbutton) {
						if (pressbutton != \'save\') {
							Joomla.submitform(pressbutton,document.adminForm);
							return;
						}';
        }
        if (!HIKASHOP_J16) {
            $js .= "submitform( pressbutton );";
        } else {
            $js .= "Joomla.submitform(pressbutton,document.adminForm);";
        }
        $js .= "}";
        $js .= "\r\n\t\t\t\tfunction countresults(table,num){\r\n\t\t\t\t\tdocument.getElementById(table+'countresult_'+num).innerHTML = '<span class=\"onload\"></span>';\r\n\t\t\t\t\tvar form = document.id('adminForm');\r\n\t\t\t\t\tvar data = form.toQueryString();\r\n\t\t\t\t\tdata += '&task=countresults&ctrl=massaction';\r\n\t\t\t\t\ttry{\r\n\t\t\t\t\t\tnew Ajax('index.php?option=com_hikashop&tmpl=component&ctrl=massaction&task=countresults&table='+table+'&num='+num,{\r\n\t\t\t\t\t\t\tmethod: 'post',\r\n\t\t\t\t\t\t\tdata: data,\r\n\t\t\t\t\t\t\tupdate: document.getElementById(table+'countresult_'+num)\r\n\t\t\t\t\t\t}).request();\r\n\t\t\t\t\t}catch(err){\r\n\t\t\t\t\t\tnew Request({\r\n\t\t\t\t\t\t\tmethod: 'post',\r\n\t\t\t\t\t\t\tdata: data,\r\n\t\t\t\t\t\t\turl: 'index.php?option=com_hikashop&tmpl=component&ctrl=massaction&task=countresults&table='+table+'&num='+num,\r\n\t\t\t\t\t\t\tonSuccess: function(responseText, responseXML) {\r\n\t\t\t\t\t\t\t\tdocument.getElementById(table+'countresult_'+num).innerHTML = responseText;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}).send();\r\n\t\t\t\t\t}\r\n\t\t\t\t}";
        if (!isset($loadedData->massaction_table)) {
            $currentTable = 'product';
        } else {
            $currentTable = $loadedData->massaction_table;
        }
        $js .= '
		var currentoption = \'' . $currentTable . '\';
		function updateData(newoption){
			document.getElementById(currentoption).style.display = "none";
			document.getElementById(newoption).style.display = \'block\';
			currentoption = newoption;
		}';
        if (!HIKASHOP_PHP5) {
            $doc =& JFactory::getDocument();
        } else {
            $doc = JFactory::getDocument();
        }
        if (!empty($_POST['html_results'])) {
            $html_results = $_POST['html_results'];
        }
        $this->assignRef('html_results', $html_results);
        $doc->addScriptDeclaration($js);
        hikashop_loadJslib('mootools');
    }
Example #28
0
 function form()
 {
     $this->setName();
     $cart_id = hikashop_getCID('cart_id', false) ? hikashop_getCID('cart_id', false) : 0;
     if (empty($cart_id)) {
         $cart_id = JRequest::getInt('cart_id', 0);
     }
     $cartClass = hikashop_get('class.cart');
     if (!empty($cart_id)) {
         $cartClass->cart = new stdClass();
         $cartClass->cart->cart_id = (int) $cart_id;
         $cartClass->cart->cart_type = JRequest::getVar('cart_type', 'cart');
         $element = $cartClass->loadFullCart(true, true, true);
         $cart = $cartClass->cart;
         $rows = $element->products;
         $task = 'edit';
     } else {
         $element = $cart = new stdClass();
         $cart->cart_id = 0;
         $cart->cart_name = '';
         $cart->cart_type = JRequest::getVar('cart_type', 'cart');
         $cart->cart_modified = time();
         $rows = null;
         $task = 'add';
     }
     $this->assignRef('rows', $rows);
     $user = null;
     if (!is_null($cart) && isset($cart->user_id) && $cart->user_id != 0) {
         $userClass = hikashop_get('class.user');
         $user = $userClass->get($cart->user_id, 'cms');
         if (is_null($user)) {
             $user = $userClass->get($cart->user_id);
         }
     }
     $this->assignRef('user', $user);
     $this->assignRef('cart', $cart);
     $this->assignRef('element', $element);
     $popup = hikashop_get('helper.popup');
     $this->assignRef('popup', $popup);
     $toggle = hikashop_get('helper.toggle');
     $this->assignRef('toggle', $toggle);
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&cart_id=' . $cart_id);
     $this->toolbar = array('save', 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'));
 }
Example #29
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);
 }
Example #30
0
 function form()
 {
     $zone_id = hikashop_getCID('zone_id', false);
     if (!empty($zone_id)) {
         $class = hikashop_get('class.zone');
         $element = $class->get($zone_id);
         $task = 'edit';
     } else {
         $element = JRequest::getVar('fail');
         if (empty($element)) {
             $element = new stdClass();
             $app = JFactory::getApplication();
             $element->zone_type = $app->getUserState($this->paramBase . ".filter_type");
         }
         $task = 'add';
     }
     hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&zone_id=' . $zone_id);
     $this->toolbar = array('save', array('name' => 'save2new', 'display' => version_compare(JVERSION, '1.7', '>=')), 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form'));
     $zoneType = hikashop_get('type.zone');
     $this->assignRef('element', $element);
     $this->assignRef('type', $zoneType);
     $control = JRequest::getWord('type');
     $this->assignRef('control', $control);
     $popup = hikashop_get('helper.popup');
     $this->assignRef('popup', $popup);
     $this->_childZones($zone_id, @$element->zone_namekey);
 }