Exemple #1
0
 public function __construct()
 {
     parent::__construct();
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     $enabled = OPCconfig::getValue('xmlexport_config', 'xml_general_enable', 0, false);
     if (empty($enabled)) {
         die('XML Export not enabled');
     }
     $this->enabled = $enabled;
 }
 function onAfterRoute()
 {
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         return;
     }
     if (!defined('DS')) {
         define('DS', DIRECTORY_SEPARATOR);
     }
     if (!file_exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_geolocator' . DS . 'assets' . DS . 'helper.php')) {
         return;
     }
     include_once JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_geolocator' . DS . 'assets' . DS . 'helper.php';
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     $can_change = OPCconfig::getValueNoCache('currency_config', 'can_change', 0, true);
     if (empty($can_change)) {
         $ci = JRequest::getVar('virtuemart_currency_id');
         $session = JFactory::getSession();
         if (!empty($ci)) {
             //currency was set elsewhere
             $session->set('opc_currency', $ci);
             return;
         }
         $ci2 = $session->get('opc_currency');
         if (!empty($ci2)) {
             return;
         }
     }
     //debug:
     if ($_SERVER['REMOTE_ADDR'] == '192.168.122.122') {
         $_SERVER['REMOTE_ADDR'] = '92.240.237.203';
     }
     if (class_exists('geoHelper')) {
         $c2c = geoHelper::getCountry2Code();
     }
     if (empty($c2c)) {
         return;
     }
     $default = 0;
     $c_int = OPCconfig::getValueNoCache('currency_config', $c2c, 0, $default);
     if (empty($c_int)) {
         return;
     }
     $c_int = (int) $c_int;
     // set global request variable
     JRequest::setVar('virtuemart_currency_id', $c_int);
     $app->setUserState('virtuemart_currency_id', $c_int);
     $app->setUserState('com_virtuemart.virtuemart_currency_id', $c_int);
     // $virtuemart_currency_id = $app->getUserStateFromRequest( "virtuemart_currency_id", 'virtuemart_currency_id',JRequest::getVar('virtuemart_currency_id',$currencyDisplay->_vendorCurrency) );
 }
Exemple #3
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $model = $this->getModel();
     //$config = JController::getModel('config', 'JModel');
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'config.php';
     $config = new JModelConfig();
     $config->loadVmConfig();
     $model->getGeneral($this);
     //var_dump($config); die();
     $this->avai = $model->getAvai();
     $this->model =& $model;
     $this->numprods = $model->getNumProducts();
     $this->trackingfiles = $model->getPhpExportThemes();
     $this->forms = $model->getJforms($this->trackingfiles);
     $this->shoppergroups = $model->getShopperGroups();
     $this->langs = $model->getLanguages();
     $this->isEnabled = $model->isEnabled();
     $model->checkCompression($this);
     $this->xml_export_customs = OPCconfig::getValue('xmlexport_config', 'xml_export_customs', 0, false);
     //debug_zval_dump ($this->forms['adwordstracking']); die();
     parent::display($tpl);
 }
Exemple #4
0
 public static function setItemid()
 {
     $view = JRequest::getWord('view');
     if ('cart' == $view || 'opc' == $view) {
         //include(JPATH_ROOT.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_onepage'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'onepage.cfg.php');
         require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
         $newitemid = OPCconfig::getValue('opc_config', 'newitemid', 0, 0, true);
         if (!empty($newitemid)) {
             $GLOBALS['Itemid'] = $newitemid;
             $_REQUEST['Itemid'] = $newitemid;
             $_POST['Itemid'] = $newitemid;
             $_GET['Itemid'] = $newitemid;
             JRequest::setVar('Itemid', $newitemid);
         }
     }
 }
Exemple #5
0
 function display($tpl = null)
 {
     if (!class_exists('VmConfig')) {
         require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
     }
     VmConfig::loadConfig(true);
     if (file_exists(JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php')) {
         include JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
     }
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'config.php';
     $model = new JModelConfig();
     //$limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'));
     //limitstart = JRequest::getVar('limitstart', 0);
     /*
     if (!file_exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'classes'.DS.'ps_onepage.php'))
     {
      $model->install(true);
     }
     */
     $model->loadVmConfig('config');
     require_once JPATH_COMPONENT . DS . 'assets' . DS . 'export_helper.php';
     $this->ehelper = new OnepageTemplateHelper();
     $this->opcexts = $model->getOPCExtensions();
     $countries = $model->getShippingCountries();
     $pms = $model->getPaymentMethods();
     $sty = $model->getClassNames();
     $default_country = $model->getDefaultC();
     $dis = $model->getDisabledOPC();
     $this->assignRef('disable_onepage', $dis);
     $model->checkLangFiles();
     $trackingfiles = $model->getPhpTrackingThemes();
     $this->assignRef('trackingfiles', $trackingfiles);
     $model->getExtLangVars();
     $langs = $model->getLanguages();
     $css = $model->retCss();
     $php = $model->retPhp();
     $sids = $model->getShippingRates();
     if (empty($sids)) {
         $sids = array();
     }
     $coref = array();
     $ulist = $model->getUserFieldsLists($coref);
     $this->assignRef('clist', $coref);
     $this->assignRef('ulist', $ulist);
     $langse = array();
     $exts = array();
     $lext = $model->listExts($exts, $langse);
     $adminxts = array();
     $langse2 = array();
     $lext2 = $model->listExtsaAdmin($adminxts, $langse2);
     $this->assignRef('exts', $exts);
     $this->assignRef('adminxts', $adminxts);
     $this->assignRef('extlangs', $langse);
     $langerr = $model->getlangerr();
     $this->assignRef('langerr', $langerr);
     //$lang_vars = $model->getLangVars();
     $templates = $model->getTemplates();
     $errors = $model->getErrMsgs();
     $statuses = $model->getOrderStatuses();
     $codes = $model->getJLanguages();
     $exthtml = $model->getExtensions();
     $groups = $model->listShopperGroups();
     $vatgroups = $model->listShopperGroupsSelect();
     $lfields = $model->listUserfields();
     //function getArticleSelector($name, $value, $required=false)
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     $this->lang_thank_youpage = OPCconfig::getValue('ty_page', 'ty_page', 0, array(0 => ''));
     $this->model =& $model;
     $this->assignRef('groups', $groups);
     $this->assignRef('vatgroups', $vatgroups);
     $this->assignRef('lfields', $lfields);
     $this->assignRef('exthtml', $exthtml);
     $this->assignRef('codes', $codes);
     $this->assignRef('statuses', $statuses);
     $this->assignRef('errors', $errors);
     $this->assignRef('templates', $templates);
     //$this->assignRef('lang_vars', $lang_vars);
     if (empty($pms)) {
         $pms = array();
     }
     $this->assignRef('pms', $pms);
     $this->assignRef('sty', $sty);
     $this->assignRef('countries', $countries);
     $this->assignRef('default_country', $default_country);
     $this->assignRef('langs', $langs);
     // ok
     $this->assignRef('css', $css);
     $this->assignRef('php', $php);
     $this->assignRef('sids', $sids);
     $model2 = $this->getModel();
     $model2->checkTable();
     // $currencies = $model->getAllCurrency($limitstart, $limit);
     // $total = $model->countRows();
     jimport('joomla.html.pagination');
     //$pageNav = new JPagination($total, $limitstart, $limit);
     //$this->assignRef('currencies', $currencies);
     //$this->assignRef('pageNav', $pageNav);
     parent::display($tpl);
 }
 * One Page checkout is free software released under GNU/GPL and uses some code from VirtueMart
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * 
 */
if (!defined('_VALID_MOS') && !defined('_JEXEC')) {
    die('Direct Access to ' . basename(__FILE__) . ' is not allowed.');
}
$document = JFactory::getDocument();
ob_start();
echo '<div id="vmMainPageOPC">';
include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
$newitemid = OPCconfig::getValue('opc_config', 'newitemid', 0, 0, true);
if (OPCloader::checkOPCSecret()) {
    $selected_template .= '_preview';
}
$currentUser = JFactory::getUser();
$uid = $currentUser->get('id');
if (!empty($uid)) {
    $no_login_in_template = true;
}
JHTMLOPC::stylesheet('onepage.css', 'components/com_onepage/themes/' . $selected_template . '/', array());
//JHTML::_('behavior.formvalidation');
JHTMLOPC::stylesheet('vmpanels.css', 'components/com_virtuemart/assets/css/', array());
if (!empty($load_min_bootstrap)) {
    JHTMLOPC::stylesheet('bootstrap.min.css', 'components/com_onepage/themes/extra/bootstrap/', array());
}
if (VM_REGISTRATION_TYPE == 'NO_REGISTRATION') {
Exemple #7
0
    function store()
    {
        require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'language.php';
        require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
        // load basic stuff:
        OPCLang::loadLang();
        $this->removeCache();
        $this->loadVmConfig();
        $user = JFactory::getUser();
        $this->storeRegistration();
        $opc_load_jquery = JRequest::getVar('opc_load_jquery', false);
        if (!empty($opc_load_jquery)) {
            $opc_load_jquery = true;
        }
        OPCConfig::store('opc_load_jquery', '', 0, $opc_load_jquery);
        if (!class_exists('JFile')) {
            require JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'filesystem' . DIRECTORY_SEPARATOR . 'file.php';
        }
        if (!class_exists('JFolder')) {
            require JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'filesystem' . DIRECTORY_SEPARATOR . 'folder.php';
        }
        $msg = '';
        $rename = JRequest::getVar('rename_to_custom', false);
        if ($rename) {
            $msg .= $this->renameTheme();
        }
        $db = JFactory::getDBO();
        $data = JRequest::get('post');
        $this->storeTY($data);
        $cfg = urldecode('%3C%3Fphp') . '
if( !defined( \'_VALID_MOS\' ) && !defined( \'_JEXEC\' ) ) die( \'Direct Access to \'.basename(__FILE__).\' is not allowed.\' );
/*
*      One Page Checkout configuration file
*      Copyright RuposTel s.r.o. under GPL license
*      Version 2 of date 31.March 2012
*      Feel free to modify this file according to your needs
*
*
*     @copyright Copyright (C) 2007 - 2012 RuposTel - All rights reserved.
*     @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*     One Page checkout is free software released under GNU/GPL and uses code from VirtueMart
*     VirtueMart is free software. This version may have been modified pursuant
*     to the GNU General Public License, and as distributed it includes or
*     is derivative of works licensed under the GNU General Public License or
*     other free or open source software licenses.
* 
*/




';
        $cfg .= '
		  if (!class_exists(\'VmConfig\'))
		  require(JPATH_ADMINISTRATOR.DS.\'components\'.DS.\'com_virtuemart\'.DS.\'helpers\'.DS.\'config.php\'); 
		  VmConfig::loadConfig(); 

';
        if (!empty($data['delete_ht'])) {
            if (JFile::delete(JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'assets' . DS . 'js' . DS . '.htaccess') === false) {
                $msg .= JText::sprintf('COM_VIRTUEMART_STRING_DELETED_ERROR', JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'assets' . DS . 'js' . DS . '.htaccess');
            }
        }
        if (!empty($data['opc_cr_type'])) {
            $cfg .= ' $opc_cr_type = \'' . $data['opc_cr_type'] . '\'; ';
        }
        $data['do_not_show_opcregistration'] = (int) $data['do_not_show_opcregistration'];
        if (!empty($data['do_not_show_opcregistration'])) {
            $cfg .= ' $do_not_show_opcregistration = 1; ';
        }
        if (isset($data['bt_fields_from'])) {
            $cfg .= ' $bt_fields_from = \'' . $data['bt_fields_from'] . '\'; ';
        }
        if (isset($data['op_default_shipping_search'])) {
            $cfg .= ' $op_default_shipping_search = array(); ';
            if (is_array($data['op_default_shipping_search'])) {
                $i = 0;
                foreach ($data['op_default_shipping_search'] as $key => $val) {
                    if (empty($val)) {
                        continue;
                    }
                    $cfg .= ' $op_default_shipping_search[' . $i . '] = "' . str_replace('"', '\\"', $val) . '"; ';
                    $i++;
                }
            } else {
                $cfg .= ' $op_default_shipping_search[0] = "' . str_replace('"', '\\"', $val) . '"; ';
            }
        }
        if (!empty($data['home_vat_countries'])) {
            $home = str_replace('"', '', $data['home_vat_countries']);
            $cfg .= ' $home_vat_countries = "' . $home . '"; ';
        }
        if (isset($data['opc_payment_refresh'])) {
            $cfg .= '$opc_payment_refresh = true;
    ';
        }
        if (isset($data['use_original_basket'])) {
            $cfg .= '$use_original_basket = true;
    ';
        } else {
            $cfg .= '$use_original_basket = false; 
    ';
        }
        //opc_php_js
        //theme_fix1
        if (isset($data['theme_fix1'])) {
            $cfg .= '$theme_fix1 = true;
    ';
        } else {
            $cfg .= '$theme_fix1 = false; 
    ';
        }
        if (isset($data['opc_override_registration'])) {
            $cfg .= '$opc_override_registration = true; 
    ';
            $this->enableOpcRegistration(true);
        } else {
            $this->enableOpcRegistration(false);
        }
        if (isset($data['opc_euvat'])) {
            $cfg .= '$opc_euvat = true;
    ';
            $coref = array();
            $ulist = $this->getUserFieldsLists($coref);
            $found = false;
            $published = 1;
            $datau = array();
            $datau2 = array();
            foreach ($ulist as $key => $val) {
                if ($val->name == 'opc_vat') {
                    $published = $val->published;
                    $found = true;
                    if (empty($published)) {
                        foreach ($val as $key2 => $v) {
                            $datau[$key2] = $v;
                        }
                    }
                }
                if ($val->name == 'opc_vat_info') {
                    $published2 = $val->published;
                    $found = true;
                    if (empty($published2)) {
                        foreach ($val as $key2 => $v) {
                            $datau2[$key2] = $v;
                        }
                    }
                }
            }
            if (!$found || (empty($published) || empty($published2))) {
                $modelu = new VirtueMartModelUserfields();
                if (empty($datau)) {
                    $datau = array('virtuemart_userfield_id' => '0', 'virtuemart_vendor_id' => '0', 'userfield_jplugin_id' => '0', 'name' => 'opc_vat', 'title' => 'COM_ONEPAGE_EUVAT_FIELD', 'description' => '', 'type' => 'text', 'maxlength' => '25', 'size' => '30', 'required' => '0', 'cols' => '0', 'rows' => '0', 'value' => '', 'default' => NULL, 'registration' => '1', 'shipment' => '0', 'account' => '1', 'readonly' => '0', 'calculated' => '0', 'sys' => '0', 'params' => '', 'ordering' => '99', 'shared' => '0', 'published' => '1', 'created_on' => '0000-00-00 00:00:00', 'created_by' => '0', 'modified_on' => '0000-00-00 00:00:00', 'modified_by' => '0', 'locked_on' => '0000-00-00 00:00:00', 'locked_by' => '0');
                } else {
                    $datau['published'] = 1;
                }
                if (empty($datau2)) {
                    $datau2 = array('virtuemart_userfield_id' => '0', 'virtuemart_vendor_id' => '0', 'userfield_jplugin_id' => '0', 'name' => 'opc_vat_info', 'title' => 'COM_ONEPAGE_EUVAT_FIELD_INFO', 'description' => '', 'type' => 'hidden', 'maxlength' => '1000', 'size' => NULL, 'required' => '0', 'cols' => '0', 'rows' => '0', 'value' => '', 'default' => NULL, 'registration' => '1', 'shipment' => '0', 'account' => '1', 'readonly' => '0', 'calculated' => '0', 'sys' => '0', 'params' => '', 'ordering' => '99', 'shared' => '0', 'published' => '1', 'created_on' => '0000-00-00 00:00:00', 'created_by' => '0', 'modified_on' => '0000-00-00 00:00:00', 'modified_by' => '0', 'locked_on' => '0000-00-00 00:00:00', 'locked_by' => '0');
                } else {
                    $datau2['published'] = 1;
                }
                $modelu->store($datau);
                $modelu->store($datau2);
            }
        } else {
            $q = 'update #__virtuemart_userfields set published = 0 where name LIKE "opc_vat" or name LIKE "opc_vat_info"';
            $db = JFactory::getDBO();
            $db->setQuery($q);
            $db->query();
        }
        if (isset($data['opc_euvat_button'])) {
            $cfg .= '$opc_euvat_button = true;
    ';
        }
        if (isset($data['opc_euvat_contrymatch'])) {
            $cfg .= '$opc_euvat_contrymatch = true;
    ';
        }
        //disable_check
        if (isset($data['opc_no_activation'])) {
            $cfg .= '$opc_no_activation = true;
    ';
        } else {
            $cfg .= '$opc_no_activation = false; 
    ';
        }
        //disable_check
        if (isset($data['disable_check'])) {
            $cfg .= '$disable_check = true;
    ';
        } else {
            $cfg .= '$disable_check = false; 
    ';
        }
        if (isset($data['opc_php_js2'])) {
            $cfg .= '$opc_php_js2 = true;
    ';
        } else {
            $cfg .= '$opc_php_js2 = false; 
    ';
        }
        //only_one_shipping_address_hidden
        if (isset($data['only_one_shipping_address_hidden'])) {
            $cfg .= '$only_one_shipping_address_hidden = true;
    ';
        } else {
            $cfg .= '$only_one_shipping_address_hidden = false; 
    ';
        }
        if (isset($data['opc_only_parent_links'])) {
            $cfg .= '$opc_only_parent_links = true;
    ';
        } else {
            $cfg .= '$opc_only_parent_links = false; 
    ';
        }
        //opc_show_weight
        if (isset($data['opc_show_weight'])) {
            $cfg .= '$opc_show_weight = true;
    ';
        } else {
            $cfg .= '$opc_show_weight = false; 
    ';
        }
        if (isset($data['opc_dynamic_lines'])) {
            $cfg .= '$opc_dynamic_lines = true;
    ';
        } else {
            $cfg .= '$opc_dynamic_lines = false; 
    ';
        }
        if (isset($data['opc_editable_attributes'])) {
            $cfg .= '$opc_editable_attributes = true;
    ';
        } else {
            $cfg .= '$opc_editable_attributes = false; 
    ';
        }
        if (isset($data['op_customer_shipping'])) {
            $cfg .= '$op_customer_shipping = true;
    ';
        } else {
            $cfg .= '$op_customer_shipping = false; 
    ';
        }
        //allow_sg_update
        if (isset($data['allow_sg_update'])) {
            $cfg .= '$allow_sg_update = true;
    ';
        } else {
            $cfg .= '$allow_sg_update = false; 
    ';
        }
        if (isset($data['allow_sg_update_logged'])) {
            $cfg .= '$allow_sg_update_logged = true;
    ';
        } else {
            $cfg .= '$allow_sg_update_logged = false; 
    ';
        }
        if (isset($data['do_not_allow_gift_deletion'])) {
            $cfg .= '$do_not_allow_gift_deletion = true;
    ';
        } else {
            $cfg .= '$do_not_allow_gift_deletion = false; 
    ';
        }
        $gift_order_statuses = JRequest::getVar('gift_order_statuses', array());
        if (empty($gift_order_statuses)) {
            $cfg .= ' $gift_order_statuses = array(); ';
        } else {
            $str = var_export($gift_order_statuses, true);
            $cfg .= "\n" . ' $gift_order_statuses = ' . $str . ';' . "\n";
        }
        //opc_async
        if (isset($data['opc_async'])) {
            $cfg .= '$opc_async = true;
    ';
        } else {
            $cfg .= '$opc_async = false; 
    ';
        }
        if (isset($data['use_free_text'])) {
            $cfg .= '$use_free_text = true;
    ';
        } else {
            $cfg .= '$use_free_text = false; 
    ';
        }
        if (isset($data['disable_op'])) {
            $cfg .= '$disable_onepage = true;
    ';
        } else {
            $cfg .= '$disable_onepage = false; 
    ';
        }
        if (isset($data['opc_italian_checkbox'])) {
            $cfg .= '$opc_italian_checkbox = true;
    ';
        } else {
            $cfg .= '$opc_italian_checkbox = false; 
    ';
        }
        if (isset($data['opc_acymailing_checkbox'])) {
            $cfg .= '$opc_acymailing_checkbox = true;
    ';
        } else {
            $cfg .= '$opc_acymailing_checkbox = false; 
    ';
        }
        $data['opc_acy_id'] = (int) $data['opc_acy_id'];
        $cfg .= ' $opc_acy_id = (int)"' . $data['opc_acy_id'] . '"; ';
        //opc_do_not_alter_registration
        if (isset($data['opc_do_not_alter_registration'])) {
            $cfg .= '$opc_do_not_alter_registration = true;
    ';
        } else {
            $cfg .= '$opc_do_not_alter_registration = false; 
    ';
        }
        if (isset($data['opc_debug'])) {
            $cfg .= '$opc_debug = true;
    ';
        } else {
            $cfg .= '$opc_debug = false; 
    ';
        }
        if (isset($data['opc_debug2'])) {
            $cfg .= '$opc_debug2 = true;
    ';
        }
        if (!empty($data['blank_screens_email'])) {
            $cfg .= ' $blank_screens_email = \'' . addslashes($data['blank_screens_email']) . '\'; ';
        }
        if (isset($data['opc_memory'])) {
            $cfg .= ' $opc_memory = \'' . addslashes($data['opc_memory']) . '\'; ';
        }
        if (isset($data['rupostel_email'])) {
            $cfg .= ' $rupostel_email = \'' . addslashes($data['rupostel_email']) . '\'; ';
        }
        if (isset($data['opc_plugin_order']) && is_numeric($data['opc_plugin_order'])) {
            $cfg .= '$opc_plugin_order = \'' . $data['opc_plugin_order'] . '\';
    ';
        } else {
            $cfg .= '$opc_plugin_order = -9999; 
    ';
        }
        //
        if (isset($data['opc_disable_for_mobiles'])) {
            $cfg .= '$opc_disable_for_mobiles = true;
    ';
        } else {
            $cfg .= '$opc_disable_for_mobiles = false; 
    ';
        }
        if (isset($data['opc_request_cache'])) {
            $cfg .= '$opc_request_cache = true;
    ';
        } else {
            $cfg .= '$opc_request_cache = false; 
    ';
        }
        if (isset($data['opc_check_username'])) {
            $cfg .= '$opc_check_username = true;';
        } else {
            $cfg .= '$opc_check_username = false;';
        }
        if (isset($data['opc_rtl'])) {
            $cfg .= '$opc_rtl = true;';
        } else {
            $cfg .= '$opc_rtl = false;';
        }
        if (!empty($data['opc_no_duplicit_username']) && empty($data['op_usernameisemail'])) {
            $cfg .= '$opc_no_duplicit_username = true;
    ';
            $cfg .= '$opc_check_username = true;';
        } else {
            $cfg .= '$opc_no_duplicit_username = false; 
    ';
        }
        if (isset($data['klarna_se_get_address'])) {
            $cfg .= '$klarna_se_get_address = true;';
        } else {
            $cfg .= '$klarna_se_get_address = false;';
        }
        if (isset($data['ajaxify_cart'])) {
            $cfg .= '$ajaxify_cart = true;';
        } else {
            $cfg .= '$ajaxify_cart = false;';
        }
        if (isset($data['opc_check_email'])) {
            $cfg .= '$opc_check_email = true;';
        } else {
            $cfg .= '$opc_check_email = false;';
        }
        if (!empty($data['opc_no_duplicit_email'])) {
            $cfg .= '$opc_no_duplicit_email = true;
    ';
            $cfg .= '$opc_check_email = true;';
            $cfg .= '$allow_duplicit = false;';
        } else {
            $cfg .= '$opc_no_duplicit_email = false; 
    ';
        }
        //show_single_tax
        if (!empty($data['show_single_tax'])) {
            $cfg .= '$show_single_tax = true;
    ';
        } else {
            $cfg .= '$show_single_tax = false; 
    ';
        }
        if (!empty($data['opc_calc_cache'])) {
            $cfg .= '$opc_calc_cache = true;
    ';
        } else {
            $cfg .= '$opc_calc_cache = false; 
    ';
        }
        if (!empty($data['visitor_shopper_group'])) {
            $cfg .= '$visitor_shopper_group = "' . $data['visitor_shopper_group'] . '";
    ';
        } else {
            $cfg .= '$visitor_shopper_group = 0; 
    ';
        }
        if (!empty($data['no_coupon_ajax'])) {
            $cfg .= '$no_coupon_ajax = true;
    ';
        } else {
            $cfg .= '$no_coupon_ajax = false; 
    ';
        }
        if (!empty($data['business_shopper_group'])) {
            $cfg .= '$business_shopper_group = "' . $data['business_shopper_group'] . '";
    ';
        } else {
            $cfg .= '$business_shopper_group = 0; 
    ';
        }
        if (!empty($data['zero_total_status'])) {
            $cfg .= '$zero_total_status = "' . $data['zero_total_status'] . '";
    ';
        } else {
            $cfg .= '$zero_total_status = "C"; 
    ';
        }
        //op_never_log_in
        //option_sgroup
        if (!empty($data['option_sgroup'])) {
            $cfg .= '$option_sgroup = ' . (int) $data['option_sgroup'] . ';;
    ';
        } else {
            $cfg .= '$option_sgroup = false; 
    ';
        }
        if (!empty($data['op_never_log_in'])) {
            $cfg .= '$op_never_log_in = true;
    ';
        } else {
            $cfg .= '$op_never_log_in = false; 
    ';
        }
        //no_alerts
        if (!empty($data['no_alerts'])) {
            $cfg .= '$no_alerts = true;
    ';
        } else {
            $cfg .= '$no_alerts = false; 
    ';
        }
        if (!empty($data['disable_ship_to_on_zero_weight'])) {
            $cfg .= '$disable_ship_to_on_zero_weight = true;
    ';
        } else {
            $cfg .= '$disable_ship_to_on_zero_weight = false; 
    ';
        }
        //
        if (!empty($data['op_use_geolocator'])) {
            $cfg .= '$op_use_geolocator = true;
    ';
        } else {
            $cfg .= '$op_use_geolocator = false; 
    ';
        }
        if (!empty($data['append_details'])) {
            $cfg .= '$append_details = true;
    ';
        } else {
            $cfg .= '$append_details = false; 
    ';
        }
        if (!empty($data['op_redirect_joomla_to_vm'])) {
            $cfg .= '$op_redirect_joomla_to_vm = true;
    ';
        } else {
            $cfg .= '$op_redirect_joomla_to_vm = false; 
    ';
        }
        if (!empty($data['password_clear_text'])) {
            $cfg .= '$password_clear_text = true;
    ';
        } else {
            $cfg .= '$password_clear_text = false; 
    ';
        }
        $cfg .= ' $dpps_search = array(); $dpps_disable = array(); $dpps_default=array(); ' . "\n";
        if (!empty($data['disable_payment_per_shipping'])) {
            $search = JRequest::getVar('dpps_search');
            $cfg .= ' $disable_payment_per_shipping = true; ';
            foreach ($search as $i => $v) {
                if (!empty($data['dpps_disable'][$i]) && !empty($v)) {
                    $val = urlencode($v);
                    $val = str_replace("'", "\\'", $val);
                    $cfg .= ' $dpps_search[' . $i . '] = ' . "'" . $val . "';\n";
                    $cfg .= ' $dpps_disable[' . $i . '] = ' . "'" . $data['dpps_disable'][$i] . "';\n";
                    if ($data['dpps_default'][$i] != $data['dpps_disable'][$i]) {
                        $cfg .= ' $dpps_default[' . $i . '] = ' . "'" . $data['dpps_default'][$i] . "';\n";
                    } else {
                        $cfg .= ' $dpps_default[' . $i . '] = \'\'; ';
                    }
                }
            }
        } else {
            $cfg .= ' $disable_payment_per_shipping = false; ';
        }
        if (!empty($data['euvat_shopper_group'])) {
            $cfg .= '$euvat_shopper_group = "' . $data['euvat_shopper_group'] . '";
    ';
        } else {
            $cfg .= '$euvat_shopper_group = 0; 
    ';
        }
        if (!empty($data['payment_discount_before'])) {
            $cfg .= '$payment_discount_before = true;
    ';
        } else {
            $cfg .= '$payment_discount_before = false; 
    ';
        }
        if (!empty($data['only_one_shipping_address'])) {
            $cfg .= '$only_one_shipping_address = true;
    ';
        } else {
            $cfg .= '$only_one_shipping_address = false; 
    ';
        }
        if (isset($data['no_extra_product_info'])) {
            $cfg .= '$no_extra_product_info = true;
    ';
        } else {
            $cfg .= '$no_extra_product_info = false; 
    ';
        }
        if (isset($data['enable_captcha_unlogged'])) {
            $cfg .= '$enable_captcha_unlogged = true;
    ';
        } else {
            $cfg .= '$enable_captcha_unlogged = false; 
    ';
        }
        if (isset($data['send_pending_mail'])) {
            $cfg .= '$send_pending_mail = true;
    ';
        } else {
            $cfg .= '$send_pending_mail = false; 
    ';
        }
        if (isset($data['enable_captcha_logged'])) {
            $cfg .= '$enable_captcha_logged = true;
    ';
        } else {
            $cfg .= '$enable_captcha_logged = false; 
    ';
        }
        if (isset($data['hide_advertise'])) {
            $cfg .= '$hide_advertise = true;
    ';
        } else {
            $cfg .= '$hide_advertise = false; 
    ';
        }
        if (isset($data['hide_payment_if_one'])) {
            $cfg .= '$hide_payment_if_one = true;
    ';
        } else {
            $cfg .= '$hide_payment_if_one = false; 
    ';
        }
        if (!empty($data['disable_op'])) {
            if (version_compare(JVERSION, '1.7.0', 'ge') || version_compare(JVERSION, '1.6.0', 'ge') || version_compare(JVERSION, '2.5.0', 'ge')) {
                $q = "update #__extensions set enabled = 0 where element = 'opc' and type = 'plugin' limit 2 ";
            } else {
                $q = "update #__plugins set published = 0 where element = 'opc'  limit 2 ";
            }
            $db = JFactory::getDBO();
            $db->setQuery($q);
            $db->query();
            $e = $db->getErrorMsg();
            if (!empty($e)) {
                echo $msg .= $e;
            }
        } else {
            if (version_compare(JVERSION, '1.7.0', 'ge') || version_compare(JVERSION, '1.6.0', 'ge') || version_compare(JVERSION, '2.5.0', 'ge')) {
                $q = "update #__extensions set enabled = 1 where element = 'opc' and type = 'plugin' and folder = 'system' limit 2 ";
                // disable other opc solutions:
                $q2 = "update #__extensions set enabled = 0 where element = 'onestepcheckout' and type = 'plugin' and folder = 'system' ";
                $q3 = "update #__extensions set enabled = 0 where element = 'vponepagecheckout' and type = 'plugin' and folder = 'system' ";
            } else {
                $q = "update #__plugins set published = 1 where element = 'opc' and folder = 'system'  limit 2 ";
                $q2 = "update #__plugins set published = 0 where element = 'onestepcheckout' and folder = 'system' ";
                $q3 = "update #__plugins set published = 0 where element = 'vponepagecheckout' and folder = 'system' ";
            }
            $db = JFactory::getDBO();
            $db->setQuery($q);
            $db->query();
            $e = $db->getErrorMsg();
            if (!empty($e)) {
                echo $msg .= $e;
            }
            $db = JFactory::getDBO();
            $db->setQuery($q2);
            $db->query();
            $db = JFactory::getDBO();
            $db->setQuery($q3);
            $db->query();
        }
        $cfg .= "\n/* If user in Optional, normal, silent registration sets email which already exists and is registered \n* and you set this to true\n* his order details will be saved but he will not be added to joomla registration and checkout can continue\n* if registration type allows username and password which is already registered but his new password is not the same as in DB then checkout will return error\n*/\n";
        if (isset($data['email_after'])) {
            $cfg .= '$email_after = true;
      ';
        } else {
            $cfg .= '$email_after = false;
      ';
        }
        if (empty($data['opc_link_type'])) {
            $cfg .= '$opc_link_type = 0;
      ';
        } else {
            $cfg .= '$opc_link_type = ' . $data['opc_link_type'] . '; 
      ';
        }
        if (!empty($data['business_fields'])) {
            foreach ($data['business_fields'] as $k => $line) {
                $data['business_fields'][$k] = "'" . $line . "'";
            }
            // special cases
            if (in_array('password', $data['business_fields'])) {
                $data['business_fields'][] = 'opc_password';
            }
            if (in_array('username', $data['business_fields'])) {
                $data['business_fields'][] = 'opc_username';
            }
            $newa = implode(',', $data['business_fields']);
            $cfg .= ' $business_fields = array(' . $newa . '); ';
        } else {
            $cfg .= ' $business_fields = array(); ';
        }
        if (!empty($data['custom_rendering_fields'])) {
            foreach ($data['custom_rendering_fields'] as $k => $line) {
                $data['custom_rendering_fields'][$k] = "'" . $line . "'";
            }
            $newa = implode(',', $data['custom_rendering_fields']);
            $cfg .= ' $custom_rendering_fields = array(' . $newa . '); ';
        } else {
            $cfg .= ' $custom_rendering_fields = array(); ';
        }
        if (!empty($data['shipping_obligatory_fields'])) {
            foreach ($data['shipping_obligatory_fields'] as $k => $line) {
                $data['shipping_obligatory_fields'][$k] = "'" . $line . "'";
            }
            $newa = implode(',', $data['shipping_obligatory_fields']);
            $cfg .= ' $shipping_obligatory_fields = array(' . $newa . '); ';
        } else {
            $cfg .= ' $shipping_obligatory_fields = array(); ';
        }
        if (!empty($data['op_disable_shipping'])) {
            $cfg .= '$op_disable_shipping = true;
      ';
        } else {
            $cfg .= '$op_disable_shipping = false;
      ';
        }
        if (!empty($data['op_disable_shipto'])) {
            $cfg .= '$op_disable_shipto = true;
      ';
        } else {
            $cfg .= '$op_disable_shipto = false;
      ';
        }
        if (!empty($data['op_no_display_name'])) {
            $cfg .= '$op_no_display_name = true;
      ';
        } else {
            $cfg .= '$op_no_display_name = false;
      ';
        }
        if (!empty($data['op_create_account_unchecked'])) {
            $cfg .= '$op_create_account_unchecked = true;
      ';
        } else {
            $cfg .= '$op_create_account_unchecked = false;
      ';
        }
        /*	  
          	  if (!empty($data['tos_itemid']))
            $cfg .= ' $tos_itemid = "'.$data['tos_itemid'].'"; '; 
        */
        if (!empty($data['product_price_display'])) {
            $cfg .= ' $product_price_display = "' . $data['product_price_display'] . '";' . "\n";
        }
        if (!empty($data['subtotal_price_display'])) {
            $cfg .= ' $subtotal_price_display = "' . $data['subtotal_price_display'] . '";' . "\n";
        }
        if (!empty($data['opc_usmode'])) {
            $cfg .= ' $opc_usmode = true; ';
        } else {
            $cfg .= ' $opc_usmode = false; ';
        }
        if (!empty($data['full_tos_logged'])) {
            $cfg .= ' $full_tos_logged = true; ';
        } else {
            $cfg .= ' $full_tos_logged = false; ';
        }
        if (!empty($data['tos_scrollable'])) {
            $cfg .= ' $tos_scrollable = true; ';
        } else {
            $cfg .= ' $tos_scrollable = false; ';
        }
        $legal_info = VmConfig::get('oncheckout_show_legal_info', '1');
        if (!empty($data['full_tos_unlogged'])) {
            $cfg .= ' $full_tos_unlogged = true; ';
        } else {
            $cfg .= ' $full_tos_unlogged = false; ';
        }
        $tosx = VmConfig::get('agree_to_tos_onorder', '1');
        if (!empty($data['tos_logged'])) {
            $cfg .= ' $tos_logged = true; ';
        } else {
            $cfg .= ' $tos_logged = false; ';
        }
        if (!empty($data['tos_unlogged'])) {
            $cfg .= ' $tos_unlogged = true; ';
        } else {
            $cfg .= ' $tos_unlogged = false; ';
        }
        if (!empty($data['opc_email_in_bt'])) {
            $cfg .= ' $opc_email_in_bt = true; ';
        } else {
            $cfg .= ' $opc_email_in_bt = false; ';
        }
        if (!empty($data['double_email'])) {
            $cfg .= ' $double_email = true; ';
        } else {
            $cfg .= ' $double_email = false; ';
        }
        if (!empty($data['coupon_price_display'])) {
            $cfg .= ' $coupon_price_display = "' . $data['coupon_price_display'] . '";' . "\n";
        }
        if (!empty($data['other_discount_display'])) {
            $cfg .= ' $other_discount_display = "' . $data['other_discount_display'] . '";' . "\n";
        }
        if (isset($data['agreed_notchecked'])) {
            $cfg .= '$agreed_notchecked = true;
      ';
        } else {
            $cfg .= '$agreed_notchecked = false;
      ';
        }
        if ((int) $data['opc_default_shipping'] === 1) {
            $cfg .= '
	  $opc_default_shipping = 1; 
	  $op_default_shipping_zero = true;
	  $shipping_inside_choose = false; 
      ';
        } else {
            if ((int) $data['opc_default_shipping'] === 3) {
                $cfg .= ' $shipping_inside_choose = true; 
	    $opc_default_shipping = 3; 
	   ';
            } else {
                $cfg .= '
	   $op_default_shipping_zero = false;
	   $opc_default_shipping = ' . (int) $data['opc_default_shipping'] . ';
       $shipping_inside_choose = false;
	  ';
            }
        }
        if (!empty($data['never_count_tax_on_shipping'])) {
            $cfg .= '$never_count_tax_on_shipping = true;
      ';
        } else {
            $cfg .= '$never_count_tax_on_shipping = false;
      ';
        }
        if (!empty($data['save_shipping_with_tax'])) {
            $cfg .= '$save_shipping_with_tax = true;
      ';
        } else {
            $cfg .= '$save_shipping_with_tax = false;
      ';
        }
        if (isset($data['op_no_basket'])) {
            $cfg .= '$op_no_basket = true;
      ';
        } else {
            $cfg .= '$op_no_basket = false;
      ';
        }
        if (!empty($data['utm_payment'])) {
            $utm_p = (array) $data['utm_payment'];
        } else {
            $utm_p = array();
        }
        $utm_p2 = array();
        if (!empty($utm_p)) {
            foreach ($utm_p as $ku => $vu) {
                $utm_p2[(int) $ku] = (int) $vu;
            }
        }
        //$utm_p = OPCConfig::getValue('opc_config', 'utm_payments', 0, $default, false, false);
        OPCconfig::store('opc_config', 'utm_payments', 0, $utm_p2);
        if (isset($data['shipping_template'])) {
            $cfg .= '$shipping_template = true;
      ';
        } else {
            $cfg .= '$shipping_template = false;
      ';
        }
        $opclang = JRequest::getVar('opc_lang_orig', '');
        require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
        $currency_config = JRequest::getVar('country_currency', array());
        $aset = array();
        OPCconfig::clearConfig('currency_config');
        if (!empty($currency_config)) {
            foreach ($currency_config as $cid => $arr) {
                if (!empty($arr)) {
                    foreach ($arr as $country_id) {
                        if (!empty($aset[$country_id])) {
                            continue;
                        }
                        $aset[$country_id] = $country_id;
                        $q = 'select country_2_code from #__virtuemart_countries where virtuemart_country_id = ' . (int) $country_id . ' limit 0,1';
                        $db = JFactory::getDBO();
                        $db->setQuery($q);
                        $c2c = $db->loadResult();
                        if (!empty($c2c)) {
                            OPCconfig::store('currency_config', $c2c, 0, (int) $cid);
                        }
                    }
                }
            }
        }
        if (!empty($data['currency_plg_can_change'])) {
            OPCconfig::store('currency_config', 'can_change', 0, true);
        } else {
            OPCconfig::store('currency_config', 'can_change', 0, false);
        }
        if (!empty($data['currency_plg'])) {
            $this->setPluginEnabled('opc_currency', 'system', true);
        } else {
            $this->setPluginEnabled('opc_currency', 'system', false);
        }
        OPCconfig::store('opc_config', 'op_articleid' . $opclang, 0, $data['op_articleid']);
        OPCconfig::store('opc_config', 'adc_op_articleid' . $opclang, 0, $data['adc_op_articleid']);
        OPCconfig::store('opc_config', 'tos_itemid' . $opclang, 0, $data['tos_itemid']);
        OPCconfig::store('opc_config', 'newitemid' . $opclang, 0, $data['newitemid']);
        OPCconfig::store('opc_config', 'op_customitemidty' . $opclang, 0, $data['op_customitemidty']);
        /*
        	  if (!empty($data['op_customitemidty']))
         {
          $cfg .= '$op_customitemidty = "'.(int)trim($data['op_customitemidty']).'";
              ';
         }
        */
        /* 
        if (!empty($data['newitemid']))
         $cfg .= '$newitemid = "'.trim($data['newitemid']).'";
              ';
              else $cfg .= '$newitemid = "";
              ';
        */
        //
        /*
        	  if (!empty($data['op_articleid']))
         $cfg .= '$op_articleid = "'.$data['op_articleid'].'";
        	  ';
        	  else $cfg .= '$op_articleid = "";
        	  ';
        	  
        
        	  	  if (!empty($data['adc_op_articleid']))
         $cfg .= '$adc_op_articleid = "'.$data['adc_op_articleid'].'";
        	  ';
        	  else $cfg .= '$adc_op_articleid = "";
        	  ';
        */
        if (isset($data['op_sum_tax'])) {
            $cfg .= '$op_sum_tax = true;
      ';
        } else {
            $cfg .= '$op_sum_tax = false;
      ';
        }
        if (isset($data['op_last_field'])) {
            $cfg .= '$op_last_field = true;
      ';
        } else {
            $cfg .= '$op_last_field = false;
      ';
        }
        if (!empty($data['op_default_zip'])) {
            $cfg .= '$op_default_zip = "' . urlencode($data['op_default_zip']) . '"; 
	';
        } else {
            if ($data['op_default_zip'] === '0' || $data['op_default_zip'] === 0) {
                $cfg .= '$op_default_zip = 0; ';
            } else {
                $cfg .= '$op_default_zip = "99999";
	';
            }
        }
        if (!empty($data['op_numrelated']) && is_numeric($data['op_numrelated'])) {
            $cfg .= '$op_numrelated = "' . $data['op_numrelated'] . '"; 
      ';
        } else {
            $cfg .= '$op_numrelated = false;
      ';
        }
        $cfg .= '
// auto config by template
$cut_login = false;
      ';
        if (isset($data['op_delay_ship'])) {
            $cfg .= '$op_delay_ship = true;
      ';
        } else {
            $cfg .= '$op_delay_ship = false;
      ';
        }
        if (isset($data['op_loader'])) {
            $cfg .= '$op_loader = true;
      ';
        } else {
            $cfg .= '$op_loader = false;
      ';
        }
        if (isset($data['op_usernameisemail'])) {
            $cfg .= '$op_usernameisemail = true;
      ';
        } else {
            $cfg .= '$op_usernameisemail = false;
      ';
        }
        if (isset($data['no_continue_link_bottom'])) {
            $cfg .= '$no_continue_link_bottom = true;
      ';
        } else {
            $cfg .= '$no_continue_link_bottom = false;
      ';
        }
        if (isset($data['op_default_state'])) {
            $cfg .= '$op_default_state = true;
      ';
        } else {
            $cfg .= '$op_default_state = false;
      ';
        }
        if (isset($data['list_userfields_override'])) {
            $cfg .= '$list_userfields_override = true;
      ';
        } else {
            $cfg .= '$list_userfields_override = false;
      ';
        }
        if (isset($data['no_jscheck'])) {
            $cfg .= '$no_jscheck = true;
      ';
        } else {
            $cfg .= '$no_jscheck = true;
      ';
        }
        if (isset($data['op_dontloadajax'])) {
            $cfg .= '$op_dontloadajax = true;
      		   $no_jscheck = true;
      ';
        } else {
            $cfg .= '$op_dontloadajax = false;
      ';
        }
        if (isset($data['shipping_error_override'])) {
            $serr = urlencode($data['shipping_error_override']);
            $cfg .= '$shipping_error_override = "' . $serr . '";
      ';
        } else {
            $cfg .= '$shipping_error_override = "";
      ';
        }
        if (isset($data['op_zero_weight_override'])) {
            $cfg .= '$op_zero_weight_override = true;
      ';
        } else {
            $cfg .= '$op_zero_weight_override = false;
      ';
        }
        if (isset($data['email_after'])) {
            $cfg .= '$email_after = true;
      ';
        } else {
            $cfg .= '$email_after = false;
      ';
        }
        if (isset($data['override_basket'])) {
            $cfg .= '$override_basket = true;
      ';
        } else {
            $cfg .= '$override_basket = false;
      ';
        }
        if ($data['selected_template'] != 'default') {
            $data['selected_template'] = JFile::makeSafe($data['selected_template']);
            $cfg .= '$selected_template = "' . $data['selected_template'] . '";
	    if (empty($is_admin))
		{
		$selected_template_override = JRequest::getVar(\'opc_theme\', \'\'); 
		if (!empty($selected_template_override))
		{
		$test = str_replace(\'_\', \'\', $selected_template_override); 
		if (ctype_alnum($test))
		 {
		   $selected_template = $selected_template_override; 
		 }
		}
		}
		
      ';
        } else {
            $cfg .= '$selected_template = ""; 
       ';
        }
        if (!empty($data['mobile_template'])) {
            $data['mobile_template'] = JFile::makeSafe($data['mobile_template']);
            $cfg .= ' 
  $is_mobile = false; 
  $mobile_template = "' . $data['mobile_template'] . '";
  if (empty($is_admin))
  if (empty($selected_template_override))
  {
$app = JFactory::getApplication(); 
$jtouch = $app->getUserStateFromRequest(\'jtpl\', \'jtpl\', -1, \'int\');
if (($jtouch > 0) || (defined(\'OPC_DETECTED_DEVICE\') && ((constant(\'OPC_DETECTED_DEVICE\')==\'MOBILE\') || ((constant(\'OPC_DETECTED_DEVICE\')==\'TABLET\')))))
 {
   $is_mobile = true; 
   $selected_template = $mobile_template; 
 }
 
 
 }
  
  ';
        }
        if (!isset($data['adwords_timeout'])) {
            $data['adwords_timeout'] = 4;
        }
        $op_timeout = (int) $data['adwords_timeout'];
        $cfg .= ' $adwords_timeout = ' . $op_timeout . '; ';
        if (isset($data['dont_show_inclship'])) {
            $cfg .= '$dont_show_inclship = true;
      ';
        } else {
            $cfg .= '$dont_show_inclship = false;
      ';
        }
        if (isset($data['no_continue_link'])) {
            $cfg .= '$no_continue_link = true;
      ';
        } else {
            $cfg .= '$no_continue_link = false;
      ';
        }
        require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'tracking.php';
        $modelT = new JModelTracking();
        $modelT->setEnabled();
        // removed in 2.0.207
        /*
        	 if (false)
        if (isset($data['adwords_enabled_0']) && (!empty($_POST['adwords_code_0'])))
        {
          jimport('joomla.filesystem.folder');
          jimport('joomla.filesystem.file');
        	
         $code = JRequest::getVar('adwords_code_0', '', 'post', 'string', JREQUEST_ALLOWRAW); // $_POST['adwords_code_0']; $code = $_POST['adwords_code_0'];
          if (JFile::write(JPATH_ROOT.DS.'components'.DS.'com_onepage'.DS.'trackers'.DS.'body.html', $code) === false)
          {
               $msg .= 'Cannot write to: '.JPATH_ROOT.DS.'components'.DS.'com_onepage'.DS.'trackers'.DS.'body.html<br />';
          }
          else
          {
          $cfg .= '
          $adwords_name = array(); $adwords_code = array(); $adwords_amount = array();
        	$adwords_name[0] = "body.html";
        	
              
         		$adwords_amount[0] = "'.$data['adwords_amount_0'].'";
              $adwords_enabled[0] = true;
         	';
        }
        }
        else
        {
         $cfg .= '
         	$adwords_name = array(); $adwords_code = array(); $adwords_amount = array();
         	$adwords_name[0] = "body.html";
         	$adwords_amount[0] = "'.$data['adwords_amount_0'].'";
         	';
        	
        	jimport('joomla.filesystem.file');
        	$code = ""; 
        	if (JFile::write(JPATH_ROOT.DS.'components'.DS.'com_onepage'.DS.'trackers'.DS.'body.html', $code) === false)
          {
               $msg .= 'Cannot write to: '.JPATH_ROOT.DS.'components'.DS.'com_onepage'.DS.'trackers'.DS.'body.html';
          }
        	
        }
        */
        if (isset($data['no_login_in_template'])) {
            $cfg .= '$no_login_in_template = true;
      ';
        } else {
            $cfg .= '$no_login_in_template = false;
      ';
        }
        $cfg . '


/* Following variables are to change shipping or payment to select boxes
*/
';
        if (isset($data['shipping_inside'])) {
            $cfg .= '$shipping_inside = true;
      ';
        } else {
            $cfg .= '$shipping_inside = false;
      ';
        }
        if (isset($data['payment_inside'])) {
            $cfg .= '$payment_inside = true;
      ';
        } else {
            $cfg .= '$payment_inside = false;
      ';
        }
        if (isset($data['payment_saveccv'])) {
            $cfg .= '$payment_saveccv = true;
      ';
        } else {
            $cfg .= '$payment_saveccv = false;
      ';
        }
        if (isset($data['payment_advanced'])) {
            $cfg .= '$payment_advanced = true;
      ';
        } else {
            $cfg .= '$payment_advanced = false;
      ';
        }
        if (isset($data['fix_encoding'])) {
            $cfg .= '$fix_encoding = true;
      ';
        } else {
            $cfg .= '$fix_encoding = false;
      ';
        }
        if (isset($data['fix_encoding_utf8'])) {
            $cfg .= '$fix_encoding_utf8 = true;
$fix_encoding = false;
      ';
        } else {
            $cfg .= '$fix_encoding_utf8 = false;
      ';
        }
        if (isset($data['shipping_inside_basket'])) {
            $cfg .= '$shipping_inside_basket = true;
      ';
        } else {
            $cfg .= '$shipping_inside_basket = false;
      ';
        }
        if (isset($data['payment_inside_basket'])) {
            $cfg .= '$payment_inside_basket = true;
      ';
        } else {
            $cfg .= '$payment_inside_basket = false;
      ';
        }
        if (isset($data['email_only_pok'])) {
            $cfg .= '$email_only_pok = true;
      ';
        } else {
            $cfg .= '$email_only_pok = false;
      ';
        }
        if (!empty($data['no_taxes_show'])) {
            $cfg .= '$no_taxes_show = true;
      ';
        } else {
            $cfg .= '$no_taxes_show = false;
      ';
        }
        if (!empty($data['use_order_tax'])) {
            $cfg .= '$use_order_tax = true;
      ';
        } else {
            $cfg .= '$use_order_tax = false;
      ';
        }
        if (isset($data['no_taxes'])) {
            $cfg .= '$no_taxes = true;
      ';
        } else {
            $cfg .= '$no_taxes = false;
      ';
        }
        if (isset($data['never_show_total'])) {
            $cfg .= '$never_show_total = true;
      ';
        } else {
            $cfg .= '$never_show_total = false;
      ';
        }
        if (isset($data['email_dontoverride'])) {
            $cfg .= '$email_dontoverride = true;
      ';
        } else {
            $cfg .= '$email_dontoverride = false;
      ';
        }
        if (isset($data['allow_duplicit'])) {
            $cfg .= '$allow_duplicit = true;
      ';
        } else {
            $cfg .= '$allow_duplicit = false;
      ';
        }
        if (isset($data['show_only_total'])) {
            $cfg .= '$show_only_total = true;
      ';
        } else {
            $cfg .= '$show_only_total = false;
      ';
        }
        if (isset($data['show_andrea_view'])) {
            $cfg .= '$show_andrea_view = true;
      ';
        } else {
            $cfg .= '$show_andrea_view = false;
      ';
        }
        if (isset($data['always_show_tax'])) {
            $cfg .= '$always_show_tax = true;
';
        } else {
            $cfg .= '$always_show_tax = false;
';
        }
        if (isset($data['always_show_all'])) {
            $cfg .= '$always_show_all = true;
';
        } else {
            $cfg .= '$always_show_all = false;
';
        }
        if (isset($data['add_tax'])) {
            $cfg .= '$add_tax = true;
      ';
        } else {
            $cfg .= '$add_tax = false;
      ';
        }
        if (isset($data['add_tax_to_shipping_problem'])) {
            $cfg .= '$add_tax_to_shipping_problem = true;
      ';
        } else {
            $cfg .= '$add_tax_to_shipping_problem = false;
      ';
        }
        if (isset($data['add_tax_to_shipping'])) {
            $cfg .= '$add_tax_to_shipping = true;
      ';
        } else {
            $cfg .= '$add_tax_to_shipping = false;
      ';
        }
        if (isset($data['custom_tax_rate'])) {
            $cfg .= '$custom_tax_rate = "' . addslashes($data['custom_tax_rate']) . '"; 
      ';
        } else {
            $cfg .= '$custom_tax_rate = 0;
      ';
        }
        if (isset($data['opc_auto_coupon'])) {
            $cfg .= '$opc_auto_coupon = "' . addslashes($data['opc_auto_coupon']) . '"; 
      ';
        } else {
            $cfg .= '$opc_auto_coupon = \'\';
      ';
        }
        if (isset($data['no_decimals'])) {
            $cfg .= '$no_decimals = true;';
        } else {
            $cfg .= '$no_decimals = false;';
        }
        if (isset($data['curr_after'])) {
            $cfg .= '$curr_after = true;';
        } else {
            $cfg .= '$curr_after = false;';
        }
        //
        if (isset($data['load_min_bootstrap'])) {
            $cfg .= '$load_min_bootstrap = true;';
        } else {
            $cfg .= '$load_min_bootstrap = false;';
        }
        $cfg .= "\n/*\nSet this to true to unlog (from Joomla) all shoppers after purchase\n*/\n";
        if (isset($data['unlog_all_shoppers'])) {
            $cfg .= '$unlog_all_shoppers = true;
		$no_login_in_template = true; 
';
        } else {
            $cfg .= '$unlog_all_shoppers = false;
';
        }
        // vat_input_id, eu_vat_always_zero, move_vat_shopper_group, zerotax_shopper_group
        if (!empty($data['vat_input_id'])) {
            $cfg .= '$vat_input_id = "' . $data['vat_input_id'] . '"; ';
        } else {
            $cfg .= '$vat_input_id = ""; ';
        }
        if (!empty($data['eu_vat_always_zero'])) {
            $cfg .= '$eu_vat_always_zero = "' . $data['eu_vat_always_zero'] . '"; ';
        } else {
            $cfg .= '$eu_vat_always_zero = ""; ';
        }
        if (empty($data['vat_except'])) {
            $data['vat_except'] = '';
        }
        $te = strtoupper($data['vat_except']);
        $eu = array('AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK');
        if (!empty($data['vat_except'])) {
            if (!in_array($te, $eu)) {
                $msg .= 'Country code is not valid for EU ! Code used:' . $data['vat_except'] . '<br />';
                $msg .= "These are valid codes : 'AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK' without apostrophies <br />";
            }
            $cfg .= '$vat_except = "' . $data['vat_except'] . '"; ';
        } else {
            $cfg .= '$vat_except = ""; ';
        }
        if (!empty($data['move_vat_shopper_group'])) {
            $cfg .= '$move_vat_shopper_group = "' . $data['move_vat_shopper_group'] . '"; ';
        } else {
            $cfg .= '$move_vat_shopper_group = ""; ';
        }
        if (!empty($data['zerotax_shopper_group'])) {
            $str = '';
            foreach ($data['zerotax_shopper_group'] as $g) {
                if (!empty($str)) {
                    $str .= ',' . $g . '';
                } else {
                    $str = "" . $g . "";
                }
            }
            $cfg .= ' $zerotax_shopper_group = array(' . $str . '); ';
        } else {
            $cfg .= ' $zerotax_shopper_group = array(); ';
        }
        $cfg .= " \n/* set this to true if you don't accept other than valid EU VAT id */\n";
        if (!empty($data['must_have_valid_vat'])) {
            $cfg .= '$must_have_valid_vat = true; ';
        } else {
            $cfg .= '$must_have_valid_vat = false; ';
        }
        $cfg .= "\n/*\n* Set this to true to unlog (from Joomla) all shoppers after purchase\n*/\n";
        if (isset($data['unlog_all_shoppers'])) {
            $cfg .= ' $unlog_all_shoppers = true;
      ';
        } else {
            $cfg .= ' $unlog_all_shoppers = false;
     ';
        }
        $cfg .= "\n/* This will disable positive messages on Thank You page in system info box */\n\n";
        $cfg .= "\n/* please check your source code of your country list in your checkout and get exact virtuemart code for your country\n* all incompatible shipping methods will be hiddin until customer choses other country\n* this will also be preselected in registration and shipping forms\n* Your shipping method cannot have 0 index ! Otherwise it will not be set as default\n*/     \n";
        if (isset($data['default_country'])) {
            $cfg .= ' $default_shipping_country = "' . $data['default_country'] . '";
      ';
        } else {
            $cfg .= ' $default_shipping_country = "";
     ';
        }
        /*
        $cfg .= '
        if (!defined("DEFAULT_COUNTRY"))
        {
         if (file_exists(JPATH_SITE.DS."administrator".DS."components".DS."com_geolocator".DS."assets".DS."helper.php"))
         {
          require_once(JPATH_SITE.DS."administrator".DS."components".DS."com_geolocator".DS."assets".DS."helper.php"); 
          if (class_exists("geoHelper"))
           {
             $country_2_code = geoHelper::getCountry2Code(""); 
        	 if (!empty($country_2_code))
        	 {
        	 $db= JFactory::getDBO(); 
        	 $db->setQuery("select virtuemart_country_id from #__virtuemart_countries where country_2_code = \'".$country_2_code."\' "); 
        	 $r = $db->loadResult(); 
        	 if (!empty($r)) 
        	 $default_shipping_country = $r; 
        	 }
             //$default_shipping_country = 
           }
         }
          define("DEFAULT_COUNTRY", $default_shipping_country); 
         }
         else
         {
          $default_shipping_country = DEFAULT_COUNTRY; 
         
         }
        ';  
        */
        $cfg .= "\n/* since VM 1.1.5 there is paypal new api which can be clicked on image instead of using checkout process\n* therefore we can hide it from payments\n* These payments will be hidden all the time\n* example:  " . '$payments_to_hide = "4,3,5,2";
*/
';
        $cfg .= "\n/* default payment option id\n* leave commented or 0 to let VM decide\n*/\n";
        $pd = $data['default_payment'];
        if (!isset($data['default_payment']) || $pd == 'default') {
            $pd = '""';
        }
        $cfg .= '$payment_default = \'' . $pd . '\';
	';
        $cfg .= "\n/* turns on google analytics tracking, set to false if you don't use it */\n";
        /*
        	if ($data['g_analytics']=='1')
        	{
        	  $cfg .= ' $g_analytics = true;
        ';
        	}
        	else 
        	  $cfg .= ' $g_analytics = false;
        ';
        */
        $cfg .= "\n/* set this to false if you don't want to show full TOS\n* if you set show_full_tos, set this variable to one of theses:\n* use one of these values:\n* 'shop.tos' to read tos from your VirtueMart configuration\n* '25' if set to number it will search for article with this ID, extra lines will be removed automatically\n* both will be shown without any formatting\n*/\n";
        /* disabled, now differenciated between logged and unlogged within the loader file which is further sent to the template
         	if (isset($data['show_full_tos']))
         	{
         	  $cfg .= ' $show_full_tos = true; 
        ';
         	} else  	  $cfg .= ' $show_full_tos = false; 
        ';
        */
        //tos_config
        $opclang = JRequest::getVar('opc_lang_orig', '');
        require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
        OPCconfig::store('opc_config', 'tos_config' . $opclang, 0, $data['tos_config']);
        /*
        $t = $data['tos_config'];
        $t = trim(strtolower($t));
        $cfg .= ' $tos_config = "'.$t.'"; 
        ';
        */
        /*
         	if (isset($data['op_show_others']))
         	{
         	  $cfg .= ' $op_show_others = true; 
        ';
         	} else  	  $cfg .= ' $op_show_others = false; 
        
        
        
        ';
        */
        if (isset($data['op_fix_payment_vat'])) {
            $cfg .= ' $op_fix_payment_vat = true; 
';
        } else {
            $cfg .= ' $op_fix_payment_vat = false; 
';
        }
        if (isset($data['op_free_shipping'])) {
            $cfg .= ' $op_free_shipping = true; 
';
        } else {
            $cfg .= ' $op_free_shipping = false; 
';
        }
        $cfg .= "\n/* change this variable to your real css path of '>> Proceed to Checkout'\n* let's hide 'Proceed to checkout' by CSS\n* if it doesn't work, change css path accordingly, i recommend Firefox Firebug to get the path\n* but this works for most templates, but if you see 'Proceed to checkout' link, contact me at stan@rupostel.sk\n* for rt_mynxx_j15 template use '.cart-checkout-bar {display: none; }'\n*/\n";
        $cfg .= '
$payment_info = array();
$payment_button = array();
$default_country_array = array();
';
        $cfg .= "\n" . ' /* URLs fetched after checkout encoded by base64_encode */' . "\n";
        $cfg .= ' $curl_url = array(';
        $arr = array();
        foreach ($data as $key => $val) {
            if (strpos($key, 'curl_url_') !== false) {
                if (!empty($val)) {
                    $arr[] = "'" . base64_encode($val) . "'";
                }
            }
        }
        $arrt = implode(',', $arr);
        if (empty($arr)) {
            $arrt = '';
        }
        $cfg .= $arrt . ');' . "\n";
        $payment_info = array();
        $payment_button = array();
        // needs update:
        $langs = array();
        foreach ($langs as $l) {
            $langcfg[$l] = "";
        }
        $exts = $this->getExt();
        if (!class_exists('JFile')) {
            require JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'filesystem' . DIRECTORY_SEPARATOR . 'file.php';
        }
        if (!class_exists('JFolder')) {
            require JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'filesystem' . DIRECTORY_SEPARATOR . 'folder.php';
        }
        /*
        if (!empty($exts))
        foreach($exts as $ext)
        {
           if (isset($data['opext_'.$ext['name']]))
           {
             //if (!JFile::write($ext['path'].DS.'enabled.html')) 
               if (JFile::write($ext['path'].DS.'enabled.html', ' ')===false)
               {
                 $msg .= 'Cannot write to: '.$ext['path'].DS.'<br />';
               }
             
           }
           else 
            {
            if (file_exists($ext['path'].DS.'enabled.html'))
            {
              if (JFile::delete($ext['path'].DS.'enabled.html')===false)
              {
               $msg .= 'Delete file \'enabled.html\' manually: '.$ext['path'].DS.'enabled.html<br />';
              }
            }
            //else $msg .= 'Cannot find: '.$ext['path'].DS.'enabled.';
            }
           
        }
        */
        if (!class_exists('JFile')) {
            require JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'filesystem' . DIRECTORY_SEPARATOR . 'file.php';
        }
        if (!class_exists('JFolder')) {
            require JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'filesystem' . DIRECTORY_SEPARATOR . 'folder.php';
        }
        foreach ($data as $k => $d) {
            /*
             if (strpos($k, 'payment_contentid_')!==false)
             {
               $pid = str_replace('payment_contentid_', '', $k); 
               $ofolder = JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'classes'.DS.'payment'.DS.'onepage';
               $filename = $ofolder.DS.$pid.'.part.html';
               if (is_numeric($pid))
               {
                $dt = JRequest::getVar('payment_content_'.$pid, '', 'post', 'string', JREQUEST_ALLOWRAW);
                $dt = str_replace('<p>', '', $dt); 
                $dt = str_replace('</p>', '<br />', $dt);
                if (!empty($dt))
                if (JFile::write($filename, $dt)===false)
                {
                 $msg .= 'Cannot save payment content to: '.$filename.'<br />';
                }
               }
             }
            */
            // ok we will add a default country for a lang
            if (strpos($k, 'op_lang_code_') !== false) {
                $id = str_replace('op_lang_code_', '', $k);
                if (!empty($data[$k]) && !empty($data['op_selc_' . $id])) {
                    $cfg .= '
$default_country_array["' . $data[$k] . '"] = "' . $data['op_selc_' . $id] . '"; 
';
                }
            }
            if (strpos($k, 'op_group_') !== false) {
                $id = str_replace('op_group_', '', $k);
                if (!empty($data[$k]) && !empty($data['op_group_' . $id])) {
                    if (!empty($data['op_lang_code2_' . $id])) {
                        $cfg .= '
$lang_shopper_group["' . $data['op_lang_code2_' . $id] . '"] = "' . $data['op_group_' . $id] . '"; 
';
                    }
                }
            }
            if (strpos($k, 'op_selc2_') !== false) {
                $id = str_replace('op_selc2_', '', $k);
                if (isset($data[$k]) && !empty($data['op_group_ip_' . $id])) {
                    if (isset($data['op_selc2_' . $id])) {
                        $cfg .= '
$lang_shopper_group_ip["' . $data['op_selc2_' . $id] . '"] = "' . $data['op_group_ip_' . $id] . '"; 
';
                    }
                }
            }
            if (strpos($k, 'hidepsid_') !== false) {
                $ida = explode('_', $k, 2);
                $ida = $ida[1];
                $id = $data[$k];
                //$id = $d;
                if ($id != 'del' && count($data["hidep_" . $ida]) > 0) {
                    $def = $data["hidepdef_" . $ida];
                    $cfg .= ' $hidep["' . $id . '"] = "';
                    if (isset($data["hidep_" . $ida])) {
                        foreach ($data["hidep_" . $ida] as $h) {
                            $cfg .= $h . '/' . $def . ',';
                        }
                    } else {
                    }
                    $cfg .= '";
';
                }
            }
            if (strpos($k, 'ONEPAGE_PAYMENT_EXTRA_INFO') !== false) {
                $arr = explode('_', $k);
                $lang = $arr[1];
                $id = $arr[count($arr) - 1];
                if (!isset($payment_info[$id])) {
                    $payment_info[$id] = $id;
                    $cfg .= '$payment_info["' . $id . '"] = JText::_("COM_ONEPAGE_PAYMENT_EXTRA_INFO_' . $id . '"); 
';
                }
            }
            if (strpos($k, 'ONEPAGE_PAYMENT_EXTRA_INFO_BUTTON') !== false) {
                $arr = explode('_', $k);
                $lang = $arr[1];
                $id = $arr[count($arr) - 1];
                if (!isset($payment_button[$id])) {
                    $payment_button[$id] = $id;
                    $cfg .= '$payment_button["' . $id . '"] = JText::_("COM_ONEPAGE_PAYMENT_EXTRA_INFO_BUTTON_' . $id . '"); 
';
                }
            }
            if (strpos($k, 'tid_') !== false && strpos($k, 'payment_contentid') === false) {
                /* we have a standard variable:
                	  tid_special_, tid_ai_, tid_num_, tid_back_,  tid_forward_
                	  tid_nummax_, tid_itemmax_
                	  tid_type_
                	  */
                if (!defined($k)) {
                    $this->setTemplateSetting($k, $data[$k]);
                    //echo 'template setting: '.$k.'value: '.$data[$k];
                    define($k, $data[$k]);
                }
                $a = explode('_', $k);
                if (count($a) == 3) {
                    $tid = $a[2];
                    $checkboxes = array('tid_special_', 'tid_ai_', 'tid_num_', 'tid_forward_', 'tid_back_', 'tid_enabled_', 'tid_foreign_', 'tid_email_', 'tid_autocreate_');
                    foreach ($checkboxes as $ch) {
                        if (!isset($data[$ch . $tid]) && !defined($ch . $tid)) {
                            $this->setTemplateSetting($ch . $tid, 0);
                            define($ch . $tid, '0');
                            //echo ':'.$ch.$tid.' val: 0';
                        }
                    }
                }
            }
        }
        $cfg .= '
if (defined(\'OPC_THEME_OVERRIDE\') && (constant(\'OPC_THEME_OVERRIDE\'))) include(OPC_THEME_OVERRIDE); 
else
if (!empty($selected_template) && (file_exists(JPATH_ROOT.DS."components".DS."com_onepage".DS."themes".DS.$selected_template.DS."overrides".DS."onepage.cfg.php")))
{
  define(\'OPC_THEME_OVERRIDE\', JPATH_ROOT.DS."components".DS."com_onepage".DS."themes".DS.$selected_template.DS."overrides".DS."onepage.cfg.php"); 
  include(JPATH_ROOT.DS."components".DS."com_onepage".DS."themes".DS.$selected_template.DS."overrides".DS."onepage.cfg.php");
 
}
else
if (!defined(\'OPC_THEME_OVERRIDE\'))
define(\'OPC_THEME_OVERRIDE\', false); 


';
        $conf_file = JPATH_ROOT . DS . "components" . DS . "com_onepage" . DS . "config" . DS . "onepage.cfg.php";
        $ret = true;
        if (!class_exists('JFile')) {
            require JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'filesystem' . DIRECTORY_SEPARATOR . 'file.php';
        }
        if (!class_exists('JFolder')) {
            require JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'filesystem' . DIRECTORY_SEPARATOR . 'folder.php';
        }
        if (JFile::write($conf_file, $cfg) === false) {
            $msg .= JText::_('COM_ONEPAGE_ACCESS_DENIED_CONFIG') . ' ' . $conf_file . '<br />';
            $ret = false;
            // lets test if it is php valid
        } else {
            //unset($disable_onepage);
            if (eval('?>' . file_get_contents($conf_file)) === false) {
                $msg .= JText::_('COM_ONEPAGE_CONFIG_VALIDATION_ERROR') . ' <br />';
                $ret = false;
                // we have a big problem here, generated file is not valid
                if (!JFile::copy(JPATH_ROOT . DS . "components" . DS . "com_onepage" . DS . "config" . DS . "onepage.cfg.php", JPATH_ROOT . DS . "components" . DS . "com_onepage" . DS . "config" . DS . "onepage.invalid.cfg.php")) {
                }
                if (!JFile::copy(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'default' . DS . 'onepage.cfg.php', JPATH_ROOT . DS . "components" . DS . "com_onepage" . DS . "config" . DS . "onepage.cfg.php")) {
                    $msg .= 'Copying of default onepage.cfg.php was not successfull <br />';
                }
            }
        }
        if (VmConfig::get('oncheckout_only_registered', 0)) {
            if (VmConfig::get('oncheckout_show_register', 0)) {
                define('VM_REGISTRATION_TYPE', 'NORMAL_REGISTRATION');
            } else {
                define('VM_REGISTRATION_TYPE', 'SILENT_REGISTRATION');
            }
        } else {
            if (VmConfig::get('oncheckout_show_register', 0)) {
                define('VM_REGISTRATION_TYPE', 'OPTIONAL_REGISTRATION');
            } else {
                define('VM_REGISTRATION_TYPE', 'NO_REGISTRATION');
            }
        }
        $reg_type = $data['opc_registraton_type'];
        $set = array();
        switch ($reg_type) {
            case 'NO_REGISTRATION':
                $set['oncheckout_only_registered'] = 0;
                $set['oncheckout_show_register'] = 0;
                break;
            case 'OPTIONAL_REGISTRATION':
                $set['oncheckout_only_registered'] = 0;
                $set['oncheckout_show_register'] = 1;
                break;
            case 'SILENT_REGISTRATION':
                $set['oncheckout_only_registered'] = 1;
                $set['oncheckout_show_register'] = 0;
                break;
            default:
                $set['oncheckout_only_registered'] = 1;
                $set['oncheckout_show_register'] = 1;
                break;
        }
        if (!empty($data['use_ssl'])) {
            $set['useSSL'] = 1;
        } else {
            $set['useSSL'] = 0;
        }
        if (!empty($data['full_tos_unlogged'])) {
            $set['oncheckout_show_legal_info'] = 1;
        } else {
            $set['oncheckout_show_legal_info'] = 0;
        }
        if (!empty($data['tos_logged']) && !empty($data['tos_unlogged'])) {
            $set['agree_to_tos_onorder'] = 1;
        } else {
            $set['agree_to_tos_onorder'] = 0;
        }
        if (!empty($data['op_disable_shipping'])) {
            $set['automatic_shipment'] = 0;
        }
        $this->updateVmConfig($set);
        /*
        require_once(JPATH_SITE.DS.'components'.DS.'com_onepage'.DS.'helpers'.DS.'mini.php'); 
        
        $configm = OPCmini::getModel('Config'); 
        
            $c = VmConfig::get('coupons_enable', true); 
        VmConfig::set('coupons_enable', 10); 
        
        
        
        $test = VmConfig::get('coupons_enable'); 
        VmConfig::set('coupons_enable', $c); 
        
        
        if ($test != 10)
         {
           $isadmin =false; 
         }
         else $isadmin = true; 
         
         if ((method_exists('VmConfig', 'isAtLeastVersion')) || (!$isadmin))
         {
           $msg .= 'Notice: You are running an old version of Virtuemart or you are not logged in as shop Administrator. Some Virtuemart settings cannot be updated with OPC. Please update TOS, registration type, SSL in your virtuemart configuration. (oncheckout_show_register, oncheckout_only_registered, agree_to_tos_onorder, automatic_shipment, oncheckout_show_legal_info, useSSL)  '; 
           
           $isadmin = false; 
         }
        if ($isadmin)
        if (!$configm->store($set))
        {
        	//$msg .= 'Error saving virtuemart configuration'; 
        }
        
        VmConfig::loadConfig(true); 
        */
        if (empty($_SESSION['onepage_err'])) {
            $_SESSION['onepage_err'] = serialize($msg);
        } else {
            $_SESSION['onepage_err'] = serialize($msg . unserialize($_SESSION['onepage_err']));
        }
        return $ret;
    }
Exemple #8
0
 function getJforms($files)
 {
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'jformrender.php';
     /*
     if (!OPCJ3)
     {
       require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_onepage'.DS.'helpers'.DS.'opcparameters.php'); 
     }
     */
     $ret = array();
     foreach ($files as $file) {
         $path = JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'trackers' . DS . 'php' . DS . $file . '.xml';
         if (!file_exists($path)) {
             continue;
         }
         $default = new stdClass();
         //$data->adwords_id = 1;
         $data = OPCconfig::getValue('tracking_config', $file, 0, $default);
         $title = $description = '';
         if (function_exists('simplexml_load_file')) {
             $fullxml = simplexml_load_file($path);
             $title = $fullxml->name;
             $description = $fullxml->description;
         }
         $xml = file_get_contents($path);
         $xml = str_replace('extension', 'form', $xml);
         $xml = str_replace('params', 'fieldset', $xml);
         $xml = str_replace('<fieldset', '<fields name="' . $file . '"><fieldset name="test" label="' . $title . '" ', $xml);
         $xml = str_replace('param', 'field', $xml);
         $xml = str_replace('</fieldset>', '</fieldset></fields>', $xml);
         //$fullxml = simplexml_load_string($xml);
         // removes BOM:
         $bom = pack('H*', 'EFBBBF');
         $text = preg_replace("/^{$bom}/", '', $xml);
         if (!empty($text)) {
             $xml = $text;
         }
         $t1 = simplexml_load_string($xml);
         if ($t1 === false) {
             continue;
         }
         $test = JForm::getInstance($file, $xml, array(), true);
         //$test->bind($data);
         foreach ($data as $k => $vl) {
             $test->setValue($k, $file, $vl);
         }
         $fieldSets = $test->getFieldsets();
         $test = OPCparametersJForm::render($test);
         $ret[$file]['params'] = $test;
         if (empty($title)) {
             $ret[$file]['title'] = $file . '.php';
         } else {
             $ret[$file]['title'] = (string) $title;
         }
         $ret[$file]['description'] = (string) $description;
     }
     return $ret;
 }
Exemple #9
0
 function getTos(&$ref)
 {
     include JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
     $link = $this->getTosLink($ref);
     if (!empty($link)) {
         if (!empty($tos_scrollable)) {
             $start = '<iframe src="' . $link . '" class="tos_iframe" >';
             $end = '</iframe>';
             return $start . $end;
         }
     }
     $start = '';
     $end = '';
     if (empty($ref->cart->vendor->vendor_terms_of_service)) {
         require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php';
         $vendorModel = OPCmini::getModel('vendor');
         $vendor = $vendorModel->getVendor();
         $ref->cart->vendor->vendor_terms_of_service = $vendor->vendor_terms_of_service;
     }
     $tos_config = OPCconfig::getValue('opc_config', 'tos_config', 0, 0, true);
     if (empty($tos_config)) {
         return $ref->cart->vendor->vendor_terms_of_service;
     }
     if (!is_numeric($tos_config)) {
         return $start . $ref->cart->vendor->vendor_terms_of_service . $end;
     }
     if (is_numeric($tos_config)) {
         $article = JTable::getInstance("content");
         $article->load($tos_config);
         $intro = $article->get('introtext');
         $full = $article->get("fulltext");
         // and/or fulltext
         JPluginHelper::importPlugin('content');
         $dispatcher = JDispatcher::getInstance();
         $mainframe = JFactory::getApplication();
         $params = $mainframe->getParams('com_content');
         $title = '<div class="componentheading' . $params->get('pageclass_sfx') . '">' . $article->get('title') . '</div>';
         if (empty($article->text)) {
             $article->text = $title . $intro . $full;
         }
         $results = $dispatcher->trigger('onPrepareContent', array(&$article, &$params, 0));
         $results = $dispatcher->trigger('onContentPrepare', array('text', &$article, &$params, 0));
         return $start . $article->get('text') . $end;
     }
     return "";
 }
Exemple #10
0
			
			<select style="min-width: 150px; " data-placeholder="<?php 
            echo JText::_('COM_VIRTUEMART_COUNTRY_S');
            ?>
" multiple="multiple" name="country_currency[<?php 
            echo $c->virtuemart_currency_id;
            ?>
][]" class="vm-chzn-select"  id="country_currency_<?php 
            echo $c->virtuemart_currency_id;
            ?>
">
			<?php 
            $default = 0;
            if (!empty($this->countries)) {
                foreach ($this->countries as $p) {
                    $c_int = (int) OPCconfig::getValue('currency_config', $p['country_2_code'], 0, $default);
                    $p['virtuemart_country_id'] = (int) $p['virtuemart_country_id'];
                    ?>
				    <option value=<?php 
                    echo '"' . $p['virtuemart_country_id'] . '"';
                    if ($c_int == $c->virtuemart_currency_id) {
                        echo ' selected="selected" ';
                    }
                    ?>
><?php 
                    echo $p['country_name'];
                    ?>
</option>
				 
				 <?php 
                }
Exemple #11
0
 public function __construct($orderID, $params2, $status, $params, $file = '')
 {
     $this->errorMsg = '';
     if (empty(OPCtrackingHelper::$config[$status])) {
         $this->errorMsg .= 'Config not found for status: ' . $status . "<br />\n";
         $this->error = true;
         return;
     }
     $this->params = new stdClass();
     if (!empty($params)) {
         $this->params = $params;
     }
     //$this->pingUrl = JRoute::_('index.php?option=com_onepage&task=ping&nosef=1&format=raw&tmpl=component', false);
     $this->pingUrl = OPCtrackingHelper::getUrl() . 'index.php?option=com_onepage&task=ping&nosef=1&format=raw&tmpl=component';
     if (method_exists('JApplication', 'getHash')) {
         $hashn = JApplication::getHash('opctracking');
     } else {
         $hashn = JUtility::getHash('opctracking');
     }
     $opchash = JRequest::getVar($hashn, false, 'COOKIE');
     $this->cookieHash = $opchash;
     $this->pingData = 'hash=' . $this->escapeSingle(str_replace('&', '&amp;', $opchash));
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php';
     $orderModel = OPCmini::getModel('orders');
     $this->order = $orderModel->getOrder($orderID);
     if (empty($this->order)) {
         $this->errorMsg .= 'Order not found: ' . var_export($config, true) . "<br />\n";
         $this->error = true;
         return;
     }
     if (empty($this->order['items']) || !is_array($this->order['items'])) {
         $this->errorMsg .= 'Order items not found: ' . var_export($config, true) . "<br />\n";
         $this->error = true;
         return;
     }
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     $negative_statuses = OPCconfig::getValue('tracking_negative', 'negative_statuses', 0, array());
     if (!empty($negative_statuses)) {
         $copy_negative_statuses = array();
         foreach ($negative_statuses as $key => $ng) {
             $copy_negative_statuses[$key] = $ng;
         }
         $negative_statuses = $copy_negative_statuses;
         if (is_array($negative_statuses)) {
             if (isset($this->order['details']['BT'])) {
                 if (in_array($this->order['details']['BT']->order_status, $negative_statuses)) {
                     OPCtrackingHelper::getNegativeOrder($this->order);
                 }
             }
         }
     }
     if (empty($this->order['details'])) {
         $this->errorMsg .= 'Order details not found: ' . var_export($config, true) . "<br />\n";
         $this->error = true;
         return;
     }
     // check if the tracking was enabled before or after the order was created
     if (is_array($this->order)) {
         if (!empty($this->order['details']['BT'])) {
             $c = $this->order['details']['BT']->created_on;
             $sql = $c;
             $date = new JDate($sql);
             $time = $date->toUnix();
             if (!empty(OPCtrackingHelper::$config)) {
                 if (!empty(OPCtrackingHelper::$config[$status])) {
                     // opc update, old codee:
                     $key = 'since' . $file;
                     if (!empty(OPCtrackingHelper::$config[$status]->{$key})) {
                         $since = OPCtrackingHelper::$config[$status]->{$key};
                         if ($since > $time) {
                             $this->errorMsg .= 'OPC tracking was created AFTER the order was created: ' . var_export(OPCtrackingHelper::$config, true) . 'order created on ' . $c . date(DATE_RFC2822, $time) . ' tracking created on ' . $since . date(DATE_RFC2822, $since) . " <br />\n";
                             $this->error = true;
                             return;
                         }
                     }
                     $key = $file . '_since';
                     if (!empty(OPCtrackingHelper::$config[$status]->{$key})) {
                         $since = OPCtrackingHelper::$config[$status]->{$key};
                         if ($since > $time) {
                             $this->errorMsg .= 'OPC tracking system plugin was set up AFTER the order was created: ' . var_export(OPCtrackingHelper::$config, true) . 'order created on ' . $c . ' ' . date(DATE_RFC2822, $time) . ' tracking created on ' . $since . date(DATE_RFC2822, $since) . " <br />\n";
                             $this->error = true;
                             return;
                         }
                     }
                 }
             }
         }
     }
     $this->error = false;
     $this->pingData .= '&order_status=' . $status;
     $this->pingData .= '&order_id=' . $orderID;
     OPCtrackingHelper::getTextFields($this->order);
     $this->vendor = OPCtrackingHelper::getVendorInfo($this->order['details']['BT']->virtuemart_vendor_id);
 }
Exemple #12
0
 function getThemeConfig($file)
 {
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     $default = new stdClass();
     $data = OPCconfig::getValue('xmlexport_config', $file, 0, $default);
     $generalconfig = new stdClass();
     $this->getGeneral($generalconfig);
     if (!isset($data->xmlfile)) {
         $data->xmlfile = $file . '.xml';
     }
     if (empty($data->xmlfile)) {
         $data->xmlpath = $generalconfig->xml_export_path . $file . '.xml';
     } else {
         $data->xmlpath = $generalconfig->xml_export_path . $data->xmlfile;
     }
     $data->xmlurl = $this->getXMLUrl($generalconfig, $data);
     if (!isset($data->cname)) {
         $data->cname = $file;
     }
     return $data;
 }
Exemple #13
0
 public function store()
 {
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     $theme = OPCconfig::get('selected_template');
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $theme = JFile::makeSafe($theme);
     $data = JRequest::get('post');
     $config = OPCconfig::buildObject($data[$theme]);
     if (!is_object($config)) {
         $config = new stdClass();
     }
     $prevConfig = OPCconfig::getValue('theme_config', $theme, 0, $config);
     OPCconfig::store('theme_config', $theme, 0, $config);
     $data = OPCconfig::getValue('theme_config', $file, 0, $default, false);
     return '';
 }
Exemple #14
0
 public static function getTosLink(&$ref, &$OPCloader)
 {
     $cart = $ref->cart;
     include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php';
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     $opclang = JFactory::getLanguage()->getTag();
     $tos_config = OPCconfig::getValue('opc_config', 'tos_config', 0, 0, true);
     if (empty($tos_config) || !is_numeric($tos_config)) {
         $itemid = JRequest::getVar('Itemid', '');
         if (!empty($itemid)) {
             $itemid = '&Itemid=' . $itemid;
         } else {
             $itemid = '';
         }
         $tos_link = OPCloader::getUrl() . 'index.php?nosef=1&format=html&option=com_virtuemart&view=vendor&layout=tos&virtuemart_vendor_id=' . $cart->vendor->virtuemart_vendor_id . '&tmpl=component' . $itemid;
         require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'version.php';
         $x = VmVersion::$RELEASE;
         if (strpos($x, '${PHING.VM.RELEASE}') === false) {
             if (!version_compare($x, '2.0.2', '>=')) {
                 return "";
             }
         }
     } else {
         //if (!empty($newitemid))
         //$tos_link = JRoute::_('index.php?option=com_content&view=article&id='.$tos_config.'&tmpl=component&Itemid='.$newitemid);
         //else
         $tos_itemid = OPCconfig::getValue('opc_config', 'tos_itemid', 0, 0, true);
         if (!empty($tos_itemid)) {
             $tos_link = JRoute::_('index.php?option=com_content&view=article&id=' . $tos_config . '&tmpl=component&Itemid=' . $tos_itemid);
         } else {
             $tos_link = JRoute::_('index.php?option=com_content&view=article&id=' . $tos_config . '&tmpl=component');
         }
     }
     $b1 = JURI::root(true);
     if (!empty($b1)) {
         if (strpos($tos_link, $b1) === 0) {
             $tos_link = substr($tos_link, strlen($b1));
         }
     }
     if (strpos($tos_link, 'http') !== 0) {
         $base = JURI::root();
         if (substr($base, -1) == '/') {
             $base = substr($base, 0, -1);
         }
         if (substr($tos_link, 0, 1) !== '/') {
             $tos_link = '/' . $tos_link;
         }
         $tos_link = $base . $tos_link;
     }
     if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) {
         $tos_link = str_replace('http:', 'https:', $tos_link);
     }
     return $tos_link;
 }
Exemple #15
0
 function renderOption($entity, $vmCat, $refCat, $txt)
 {
     $data = array();
     $data['entity'] = $entity;
     $data['vmcat'] = $vmCat;
     $data['refcat'] = $refCat;
     $data['reftxt'] = $txt;
     $json = urlencode(json_encode($data));
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     $default = new stdClass();
     $res = OPCconfig::getValue('xmlexport_pairing', $entity, $vmCat, $default);
     $ret = '<option value="' . $refCat . '" ';
     if (!empty($res)) {
         if (isset($res->id)) {
             if ($res->id == $refCat) {
                 $ret .= ' selected="selected" ';
             }
         }
     }
     $ret .= ' data="' . $json . '">' . $txt . '</option>';
     return $ret;
 }
Exemple #16
0
 public static function addItem($product, $vm1m)
 {
     // internal error:
     if (empty($product->virtuemart_product_id)) {
         return;
     }
     foreach (OPCXmlExport::$classes as $class) {
         if (method_exists($class, 'addItem')) {
             // check the shopper group:
             if (empty($product->shoppergroups) || in_array($class->config->shopper_group, $product->shoppergroups)) {
                 if (in_array($class->config->child_type, $product->child_type)) {
                     $product2 = $product;
                     OPCXmlExport::updateProduct($product2, $class, $vm1);
                     //get pairing info:
                     //if (!empty($product->categories))
                     if (!empty($vm1['cats'])) {
                         //$product2->paired_category_name = reset($vm1['cats']);
                         $deepestcat = $vm1['longest_cats'][count($vm1['longest_cats']) - 1];
                         $product2->paired_category_name = $deepestcat;
                         if (!empty($vm1['longest_cat_id'])) {
                             // take the first:
                             $cat_id = $vm1['longest_cat_id'];
                             //$product->categories[0];
                             $default = new stdClass();
                             $entity = $class->entity;
                             $res = OPCconfig::getValue('xmlexport_pairing', $entity, $cat_id, $default);
                             if (!empty($res) && !empty($res->txt)) {
                                 $product2->paired_category_name = $res->txt;
                             }
                             $product2->pairedObj = $res;
                         }
                     } else {
                         $product2->paired_category_name = '';
                     }
                     $ret = $class->addItem($product2, $vm1);
                     $class->writer->write($ret);
                 }
             }
         }
     }
 }
    die('Direct Access to ' . basename(__FILE__) . ' is not allowed.');
}
/*
*
* @copyright Copyright (C) 2007 - 2010 RuposTel - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* One Page checkout is free software released under GNU/GPL and uses code from VirtueMart
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* 
*/
require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
$default = new stdClass();
$config = OPCconfig::getValue('theme_config', $selected_template, 0, $default, false);
$has_guest_tab = true;
if (!empty($config) && isset($config->one_step)) {
    $use_multi_step = $config->one_step;
    $has_guest_tab = $config->has_guest_tab;
} else {
    $use_multi_step = true;
}
if (empty($registration_html)) {
    $no_login_in_template = true;
}
echo $intro_article;
if (!empty($paypal_express_button)) {
    ?>
<div id="op_paypal_express" style="float: right; clear: both; width: 100%; padding-top: 10px;">
 <?php 
Exemple #18
0
 public static function updateHtml($html, &$order, $afterrender = false)
 {
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
     $ty_page = OPCconfig::getValue('ty_page', 'ty_page', 0, array());
     if (empty($ty_page)) {
         return;
     }
     if (empty($order)) {
         return;
     }
     if (is_array($order)) {
         if (isset($order['details'])) {
             $order = $order['details']['BT'];
         }
     }
     //we must reload order here in case any plugin had changed it in meantime:
     $id = $order->virtuemart_order_id;
     if (!empty($id)) {
         require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php';
         $orderModel = OPCmini::getModel('orders');
         $order_full = $orderModel->getOrder($id);
         if (empty($order_full)) {
             return;
         }
         $order = $order_full['details']['BT'];
     }
     $status = $order->order_status;
     if (!is_object($order)) {
         return;
     }
     $payment_id = $order->virtuemart_paymentmethod_id;
     if (empty($order->order_language)) {
         $jlang = JFactory::getLanguage();
         $cl = $jlang->getTag();
         $cl = strtolower(str_replace('-', '_', $cl));
     } else {
         $cl = $order->order_language;
     }
     // check conditions:
     $orightml = $html;
     $todo = array();
     foreach ($ty_page as $k => $ty) {
         if (!is_object($ty)) {
             continue;
         }
         if ($ty->payment_id != $payment_id) {
             continue;
         }
         if (!empty($ty->language)) {
             if ($ty->language != $cl) {
                 continue;
             }
         }
         if ($ty->order_status != $status) {
             continue;
         }
         $todo[] = $ty;
     }
     if (empty($todo)) {
         return;
     }
     /*
     	  COM_ONEPAGE_TY_MODE_0="Prepend to payment generated html"
     COM_ONEPAGE_TY_MODE_1="Append to payment generated html"
     COM_ONEPAGE_TY_MODE_2="Replace payment generated html"
     */
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'loader.php';
     require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'opctracking.php';
     $repvals = array();
     $order_object = new stdClass();
     OPCtrackingHelper::getOrderVars($id, $repvals, $order_object, false);
     foreach ($todo as $ty2) {
         $htmla = OPCloader::getArticle($ty2->article_id, $repvals);
         if (empty($ty2->mode)) {
             $html = $htmla . '<br />' . $html;
         } else {
             if ($ty2->mode == 1) {
                 $html = $html . '<br />' . $htmla;
             } else {
                 if ($ty->mode == 2) {
                     $html = $htmla;
                 }
             }
         }
     }
     if (defined('TYMODDONE')) {
         return $html;
     } else {
         define('TYMODDONE', true);
     }
     if ($orightml != $html) {
         if (!$afterrender) {
             JRequest::setVar('html', $html);
         } else {
             $buffer = JResponse::getBody();
             $buffer = str_replace($orightml, $html, $buffer);
             JResponse::setBody($buffer);
         }
     }
     return $html;
 }
Exemple #19
0
error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_DEPRECATED);
$app->initialise();
//disable buffer:
echo @ob_get_clean();
echo @ob_get_clean();
echo @ob_get_clean();
echo @ob_get_clean();
echo @ob_get_clean();
echo @ob_get_clean();
echo @ob_get_clean();
define('JPATH_COMPONENT', JPATH_SITE . DS . 'components' . DS . 'com_onepage');
require_once JPATH_SITE . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'compatibility.php';
JRequest::setVar('view', 'xmlexport');
JRequest::setVar('option', 'com_onepage');
JRequest::setVar('format', 'opchtml');
JRequest::setVar('tmpl', 'component');
JRequest::setVar('template', 'system');
//ini_set('memory_limit','256Mb');
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_onepage' . DS . 'models' . DS . 'xmlexport.php';
require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'controllers' . DS . 'xmlexport.php';
$livesite = OPCconfig::getValue('xmlexport_config', 'xml_live_site', 0, '');
$livesite = substr($livesite, strpos($livesite, '//') + 2, -1);
$_SERVER['HTTP_HOST'] = $livesite;
require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'config.php';
require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'xmlexport.php';
$VirtueMartControllerXmlexport = new VirtueMartControllerXmlexport();
$VirtueMartControllerXmlexport->createXml();
echo "\n";
$app->close();
die(0);
Exemple #20
0
	    <input id="adwords_amount_0" type="text" name="adwords_amount_0" value="<?php 
if (!empty($adwords_amount[0])) {
    echo $adwords_amount[0];
}
?>
"/>
	    </td><td><?php 
echo JText::_('COM_ONEPAGE_TRACKING_ADWORDS_AMOUNT_NAME');
?>
</td>
		</tr>
		
		
		<tr >
	   <?php 
$negative_statuses = OPCconfig::getValue('tracking_negative', 'negative_statuses', 0, array());
if (empty($negative_statuses)) {
    $negative_statuses = array('X', 'R');
}
?>
	    <td>
	     <select name="negative_statuses[]" multiple="multiple" style="width: 150px;" class="vm-chzn-select" >
		 <?php 
foreach ($this->statuses as $k => $s) {
    echo '<option ';
    if (!empty($negative_statuses)) {
        if (in_array($s['order_status_code'], $negative_statuses)) {
            echo ' selected="selected" ';
        }
    }
    echo ' value="' . $s['order_status_code'] . '">' . JText::_($s['order_status_name']) . '</option>';