function store() { require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'language.php'; // load basic stuff: OPCLang::loadLang(); $user = JFactory::getUser(); jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); jimport('joomla.filesystem.archive'); jimport('joomla.archive.archive'); $msg = ''; $db = JFactory::getDBO(); $data = JRequest::get('post'); jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); foreach ($data as $k => $d) { 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'; } } } } } return true; }
<script src="<?php echo JHTMLOPC::getFullUrl('onepage.js', 'components/com_onepage/assets/js/'); ?> " type="text/javascript"></script> <script src="<?php echo JHTMLOPC::getFullUrl('tabcontent.js', $path, false); ?> " type="text/javascript"></script> <script src="<?php echo JHTMLOPC::getFullUrl('jquery.mobile.stepper.js', 'components/com_onepage/themes/extra/jQuery-Mobile-Stepper-Widget-master/', false); ?> " type="text/javascript"></script> <title><?php echo OPCLang::_('COM_VIRTUEMART_CART_TITLE'); ?> </title> <script src="/components/com_virtuemart/assets/js/jquery.ui.datepicker.min.js" type="text/javascript"></script> <script src="/components/com_virtuemart/assets/js/i18n/jquery.ui.datepicker-en-GB.js" type="text/javascript"></script> <script src="/components/com_virtuemart/assets/js/vmcreditcard.js" type="text/javascript"></script> <script src="/components/com_onepage/ext/doublemail/js/doublemail.js?opcversion=2_0_257_268_140914" type="text/javascript"></script> <script src="/cache/com_onepage/opc_dynamic_en-GB_2ff4261d13f52233a0d498969562a168.js?opcversion=2_0_257_268_140914" type="text/javascript"></script> </head> <body> <div data-role="page" data-quicklinks="false" data-add-back-btn="true" data-back-btn-text="Back" data-theme="d" class="page-0">
<?php } ?> <!-- end show TOS and checkbox before button --> <div style="float: left;"> <button type="submit" autocomplete="off" <?php echo $op_onclick; ?> id="confirmbtn_button" ><span class="op_round"><span id="confirmbtn" style="width: 250px;"><?php echo OPCLang::_('COM_VIRTUEMART_ORDER_CONFIRM_MNU'); ?> </span></span></button> </div> <br style="clear: both;"/> </div> <?php echo $captcha; ?> <!-- end of submit button --> </div>
public static function getRegistrationHhtml(&$obj, &$OPCloader) { // if (!empty($no_login_in_template)) return ""; include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php'; if (!class_exists('VirtueMartCart')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php'; } if (!empty($obj->cart)) { $cart =& $obj->cart; } else { $cart = VirtueMartCart::getCart(); } $type = 'BT'; // for unlogged $virtuemart_userinfo_id = 0; $new = 1; $fieldtype = $type . 'address'; /* if (method_exists($cart, 'prepareAddressDataInCart')) $cart->prepareAddressDataInCart($type, $new); */ require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'userfields.php'; OPCUserFields::populateCart($cart, $type, true); /* if (method_exists($cart, 'prepareAddressFieldsInCart')) $cart->prepareAddressFieldsInCart(); */ OPCloader::setRegType(); if (!class_exists('VirtuemartModelUserfields')) { require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'userfields.php'; } $corefields = VirtueMartModelUserfields::getCoreFields(); $userFields = $cart->{$fieldtype}; require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php'; $layout = 'default'; foreach ($userFields['fields'] as $key => $uf) { if (!in_array($key, $corefields) || $key == 'agreed') { unset($userFields['fields'][$key]); continue; } if (!empty($opc_email_in_bt) || $OPCloader->isNoLogin() || $OPCloader->isNoLogin()) { if ($userFields['fields'][$key]['name'] == 'email') { unset($userFields['fields'][$key]); continue; } } if ($key == 'email') { $user = JFactory::getUser(); $uid = $user->get('id'); // user is logged, but does not have a VM account if (!OPCloader::logged($cart) && !empty($uid)) { // the user is logged in only in joomla, but does not have an account with virtuemart $userFields['fields'][$key]['formcode'] = str_replace('/>', ' readonly="readonly" />', $userFields['fields'][$key]['formcode']); } } } require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'userfields.php'; OPCUserFields::getUserFields($userFields, $OPCloader, $cart); // lets move email to the top $copy = array(); // we will reorder the fields, so the email is first when used as username $u = OPCLang::_('COM_VIRTUEMART_REGISTER_UNAME'); //$e = OPCLang::_('COM_VIRTUEMART_USER_FORM_EMAIL'); // disable when used for logged in if (!empty($userFields['fields'])) { /* if (empty($opc_email_in_bt) && (!empty($double_email))) { // email is in BT, let's check for double mail $email2 = $userFields['fields']['email']; $email2['name'] = 'email2'; $title = OPCLang::_('COM_ONEPAGE_EMAIL2'); if ($title != 'COM_ONEPAGE_EMAIL2') $email2['title'] = $title; $email2['formcode'] = str_replace('"email', '"email2', $email2['formcode']); $email2['formcode'] = str_replace('id=', ' onblur="javascript: doublemail_checkMail();" id=', $email2['formcode']); $h = '<span style="display: none; position: relative; color: red; font-size: 10px; background: none; border: none; padding: 0; margin: 0;" id="email2_info" class="email2_class">'; $emailerr = OPCLang::_('COM_ONEPAGE_EMAIL_DONT_MATCH'); if ($emailerr != 'COM_ONEPAGE_EMAIL_DONT_MATCH') $h .= $emailerr; else $h .= "Emails don't match!"; $h .= '</span>'; $email2['formcode'] .= $h; } */ /* if (!empty($opc_check_username)) if ((!OPCloader::logged($cart)) && (empty($uid))) if (!empty($userFields['fields']['username'])) { $un = $userFields['fields']['username']['formcode']; $un = str_replace('id=', ' onblur="javascript: Onepage.username_check(this);" id=', $un); $un .= '<span class="username_already_exist" style="display: none; position: relative; color: red; font-size: 10px; background: none; border: none; padding: 0; margin: 0;" id="username_already_exists">'; $un .= OPCLang::sprintf('COM_VIRTUEMART_STRING_ERROR_NOT_UNIQUE_NAME', $u); $un .= '</span>'; $userFields['fields']['username']['formcode'] = $un; } */ /* if (!empty($opc_check_email)) if ((!OPCloader::logged($cart)) && (empty($uid))) if (!empty($userFields['fields']['email'])) { $un = $userFields['fields']['email']['formcode']; $un = str_replace('id=', ' onblur="javascript: Onepage.email_check(this);" id=', $un); $un .= '<span class="email_already_exist" style="display: none; position: relative; color: red; font-size: 10px; background: none; border: none; padding: 0; margin: 0;" id="email_already_exists">'; $un .= OPCLang::sprintf('COM_ONEPAGE_EMAIL_ALREADY_EXISTS', OPCLang::_('COM_VIRTUEMART_USER_FORM_EMAIL')); $un .= '</span>'; $userFields['fields']['email']['formcode'] = $un; } */ } /* $OPCloader->reorderFields($userFields); */ if (count($userFields['fields']) === 0) { // no fields found return ''; } //if (empty($opc_email_in_bt) && (!empty($double_email))) //$OPCloader->insertAfter($userFields['fields'], 'email', $email2, 'email2'); $vars = array('rowFields' => $userFields, 'cart' => $obj, 'is_registration' => true); $html = $OPCloader->fetch($OPCloader, 'list_user_fields.tpl', $vars); $html = str_replace("'password'", "'opc_password'", $html); $html = str_replace("password2", "opc_password2", $html); if (strpos($html, 'email_field') !== false) { $html .= '<input type="hidden" name="email_in_registration" value="1" id="email_in_registration" />'; } else { $html .= '<input type="hidden" name="email_in_registration" value="0" id="email_in_registration" />'; } return $html; }
echo $item['title']; ?> </div> <div class="valueForm"> <?php //var_dump($item['value']); // prior 2.0.116: echo $this->escape($item['value']) echo $item['value']; ?> </div> </div> <?php } } ?> <div> <div style="clear:both; width:100%;text-align:center;"><a href="<?php echo $edit_link; ?> "> (<?php echo OPCLang::_('COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_LBL'); ?> )</a> </div> </div> </div> <!-- customer information ends -->
} else { echo '<div class="formLabel"> <input type="checkbox" autocomplete="off" id="register_account" name="register_account" value="1" class="inputbox" onclick="return Onepage.showFields( this.checked, new Array('; if (empty($op_usernameisemail)) { echo '\'username\', \'password\', \'password2\''; } else { echo '\'password\', \'password2\''; } echo ') );" '; if (empty($op_create_account_unchecked)) { echo ' checked="checked" '; } echo '/> </div> <div class="formField"> <label for="register_account">' . OPCLang::_('COM_VIRTUEMART_ORDER_REGISTER') . '</label> </div> '; } } elseif ($field['name'] == 'username') { echo '<input type="hidden" id="register_account" name="register_account" value="1" />'; } // a delimiter marks the beginning of a new fieldset and // the end of a previous fieldset /* if( $field['type'] == 'delimiter') { if( $delimiter > 0) { echo "</fieldset>\n"; } if( VM_REGISTRATION_TYPE == 'SILENT_REGISTRATION' && $field['title'] == OPCLang::_('COM_VIRTUEMART_ORDER_PRINT_CUST_INFO_LBL') && $page == 'checkout.index' ) { continue;
echo '<label for="' . $field['name'] . '_field">' . $field['title'] . '</label>'; $count = 0; $field['formcode'] = str_replace('class="', 'class="checkbox inline ', $field['formcode'], $count); if (empty($count)) { $field['formcode'] = str_replace('type="', 'class="checkbox " type="', $field['formcode'], $count); } } } else { echo '<label for="' . $field['name'] . '_field">' . $field['title'] . '</label>'; $count = 0; $field['formcode'] = str_replace('class="', 'class="checkbox inline ', $field['formcode'], $count); if (empty($count)) { $field['formcode'] = str_replace('type="', 'class="checkbox " type="', $field['formcode'], $count); } } if ($isPlaceholder) { $field['formcode'] = str_replace('type="', ' alt="' . $field['title'] . '" placeholder="' . $field['title'] . '" type="', $field['formcode']); } else { $field['formcode'] = str_replace('type="', ' alt="' . $field['title'] . '" type="', $field['formcode']); } echo ' </div>'; } } } if ($delimiter > 0) { if (!empty($required_fields)) { echo '<div style="padding:5px;text-align:center;"><strong>(* = ' . OPCLang::_('CMN_REQUIRED') . ')</strong></div>'; } echo "</fieldset>\n"; } echo '</div>';
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. * */ ?> <div class="cart-view"> <div> <div class="width:50%; float:left;"> <h1><?php echo OPCLang::_('COM_VIRTUEMART_CART_TITLE'); ?> </h1> </div> <?php echo OPCLang::_('COM_VIRTUEMART_EMPTY_CART'); ?> </div> <?php echo '<a class="continue_link" href="' . $continue_link . '" >' . OPCLang::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>'; ?> </div>
public static function checkLoad() { $app = JFactory::getApplication(); // if we are not at FE, do not alter anything if ($app->getName() != 'site') { return false; } require_once JPATH_SITE . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'compatibility.php'; // if (!class_exists('VmConfig')) // require(JPATH_ADMINISTRATOR.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_virtuemart'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'config.php'); if (!file_exists(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'language.php')) { return false; } // test format: $format = JRequest::getVar('format', 'html'); $option = JRequest::getCmd('option'); $tmpl = JRequest::getVar('tmpl', ''); if ($tmpl == 'component' && $format != 'opchtml') { return false; } // speed up json requests $okformat = array('opchtml', 'html'); if (!in_array($format, $okformat)) { return false; } $doc = JFactory::getDocument(); $class = get_class($doc); $class = strtolower($class); $format = str_replace('jdocument', '', $class); if (!in_array($format, $okformat)) { return; } if ($app->isAdmin()) { return false; } require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'language.php'; // load basic stuff: OPCLang::loadLang(); if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (!defined('JPATH_OPC')) { define('JPATH_OPC', JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage'); } //VmConfig::loadConfig(); return true; }
* 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. * * THIS FILE RENDERS THE SELECT THE CHECKBOX AND THE SINGLE SHIPPING ADDRESS * * TO FORMAT EDITING OF THE ADDRESS USE list_user_fields_shipping.tpl.php WHICH IS USED FOR UNLOGGED AS WELL * * This file is loaded from \components\com_onepage\helpers\loader.php function getUserInfoST * * This file is used by unlogged or by logged when single shipping address is enabled */ // MISSING LANGUAGE STRINGS $CLICK_HERE_TO_ADD_SHIPPING_ADDRESS = OPCLang::_('COM_ONEPAGE_CLICK_HERE_TO_ADD_SHIPPING_ADDRESS'); //Verzendadres wijkt van contact adres af ?> <div id="ship_to_wrapper"> <div class="arrowup"><div class="opc_arrow_up"> </div></div> <div class="opc_heading" ><button name="stbutton" onkeypress="return showSA2(this, 'idsa');" class="button_checkbox_uned" onclick="javascript: return showSA2(this, 'idsa');" autocomplete="off" > <div class="chckbx" > </div> <span class="opc_title"><?php echo $CLICK_HERE_TO_ADD_SHIPPING_ADDRESS; ?> </span></button> <?php // echo OPCLang::_('COM_VIRTUEMART_USER_FORM_SHIPTO_LBL'); // OR echo OPCLang::_('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL'); ?> </div>
" name="acylistsdisplayed_dispall" /> <input type="checkbox" id="acy_list_<?php echo $opc_acy_id; ?> " class="acymailing_checkbox" name="acysub[]" value="<?php echo $opc_acy_id; ?> "/> <input type="hidden" name="allVisibleLists" value="<?php echo $opc_acy_id; ?> " /> </div> <div style="width: 95%; float:left;"><label for="acy_list_<?php echo $opc_acy_id; ?> " style="float: none; white-space: normal;"><span style="font-weight:bold;"><?php echo OPCLang::_('COM_VIRTUEMART_FIELDS_NEWSLETTER'); ?> </span><br /> <?php echo OPCLang::_('COM_ONEPAGE_NEWSLETTER_SUBSCRIPTION_DESC'); ?> </label></div> </div> <!-- END italian privacy checkbox -->
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; }
function sendRegistrationMail($user) { // Compile the notification mail values. $data = $user->getProperties(); $config = JFactory::getConfig(); if (method_exists($config, 'get')) { $data['fromname'] = $config->get('fromname'); $data['mailfrom'] = $config->get('mailfrom'); $data['sitename'] = $config->get('sitename'); } else { $data['fromname'] = $config->getValue('config.fromname'); $data['mailfrom'] = $config->getValue('config.mailfrom'); $data['sitename'] = $config->getValue('config.sitename'); } $data['siteurl'] = JUri::base(); $usersConfig = JComponentHelper::getParams('com_users'); $useractivation = $usersConfig->get('useractivation'); // Handle account activation/confirmation emails. if ($useractivation == 2) { // Set the link to confirm the user email. $uri = JURI::getInstance(); $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port')); $data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false); $emailSubject = OPCLang::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']); $emailBody = OPCLang::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $data['username'], $data['password_clear']); } elseif ($useractivation == 1) { // Set the link to activate the user account. $uri = JURI::getInstance(); $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port')); $data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false); $emailSubject = OPCLang::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']); $emailBody = OPCLang::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $data['username'], $data['password_clear']); } else { $emailSubject = OPCLang::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']); $emailBody = OPCLang::sprintf('COM_USERS_EMAIL_REGISTERED_BODY', $data['name'], $data['sitename'], $data['siteurl']); } // Send the registration email. $return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody); }
echo '<div class="field_wrapper ' . $field['type'] . '" '; // special case $fn = str_replace('shipto_', '', $field['name']); if (!empty($business_fields) || !empty($custom_rendering_fields)) { if (in_array($fn, $custom_rendering_fields) || in_array('virtuemart_country_id', $custom_rendering_fields) && $fn == 'virtuemart_state_id') { echo ' id="opc_business_' . $field['name'] . '" style="display: none;'; echo '" '; } } echo '>'; // a delimiter marks the beginning of a new fieldset and // the end of a previous fieldset $title = false; echo '<div id="' . $field['name'] . '_div" class="formLabel '; if (stristr($missing, $field['name'])) { echo OPCLang::_('COM_ONEPAGE_MISSING'); } echo '">'; // added as placeholder css3 $arr = array('select', 'dropdown', 'multicheckbox', 'multiselect', 'radio', 'checkbox'); if (in_array($field['type'], $arr)) { echo '<label class="label_selects" style="clear: both; " for="' . $field['name'] . '_field">'; echo $field['title']; echo '</label>'; } // input ... $field['formcode'] = str_replace('type="', ' title="' . $field['title'] . '" alt="' . $field['title'] . '" placeholder="' . $field['title'] . '" type="', $field['formcode']); if (!empty($field['required'])) { } echo ' </div> <div class="formField ';
<?php if (!defined('_VALID_MOS') && !defined('_JEXEC')) { 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. * */ ?> <div class="cart-view"> <h3 class="module-title"><span><span><?php echo OPCLang::_('COM_VIRTUEMART_CART_TITLE'); ?> </span></span></h3> <?php echo OPCLang::_('COM_VIRTUEMART_EMPTY_CART'); ?> </div>
<a target="_blank" href="<?php echo $tos_link; ?> " onclick="javascript: return op_openlink(this); " >(<?php echo JText::_('COM_VIRTUEMART_CART_TOS'); ?> ) *</a><?php } ?> </label> </div> <div id="onepage_submit_section" class="newclass"> <input type="submit" value="<?php echo OPCLang::_('PHPSHOP_ORDER_CONFIRM_MNU'); ?> " id="confirmbtn" class="buttonopc" <?php echo $op_onclick; ?> /> </div> </div> <br style="clear: both;"/> </form> <!-- end of submit button --> <!-- end of checkout form --> <!-- end of main onepage div, if javascript fails it will remain hidden -->
echo OPCloader::slash(JText::_('COM_ONEPAGE_ITALIAN_AGREE_ERROR')); ?> "; function validateItalian() { d = document.getElementById('italianagreed_field'); if (d != null) if (!d.checked) { alert(italagreeerr); return false; } return true; } addOpcTriggerer('callSubmitFunct', 'validateItalian'); </script> <input value="1" type="checkbox" id="italianagreed_field" name="italianagreed" <?php if (!empty($agree_checked)) { echo ' checked="checked" '; } ?> class="terms-of-service required" required="required" autocomplete="off" /> </div> <div style="width: 95%; float:left;"><label for="italianagreed_field" style="float: none; white-space: normal;"><span style="font-weight:bold;"><?php echo OPCLang::_('COM_ONEPAGE_ITALIAN_AGREE_LABEL') . '</span><br />'; echo OPCLang::_('COM_ONEPAGE_ITALIAN_AGREE_DESC'); ?> </label></div> </div> <!-- END italian privacy checkbox -->
?> " /> </div> </div> </div> </div> <div id="couponcode_field_txt_discount" > <span <?php if (empty($coupon_display)) { echo ' style="display: none;" '; } ?> id="tt_order_discount_after_div_basket"> <span id="tt_order_discount_after_txt_basket"><?php echo OPCLang::_('COM_VIRTUEMART_COUPON_DISCOUNT'); ?> </span> </span> </div> <div id="couponcode_field_discount"> <span> <span id="tt_order_discount_after_basket"><?php echo $coupon_display; ?> </span> </span> </div>
: </div> <div class="discount_desc" ><?php echo $opc_show_weight_display; ?> </div> </div> <?php } ?> <div class="op_basket_row totals dynamic_lines vmsectiontableentry1" id="tt_genericwrapper_basket" style="display: none;"> <div class="discount_label dynamic_col1" >{dynamic_name}: </div> <div class="discount_desc dynamic_col2" >{dynamic_value}</div> </div> <div class="vmsectiontableentry2" id="tt_total_basket_div_basket"> <div class="discount_label"><?php echo OPCLang::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL'); ?> : </div> <div class="discount_desc" id="tt_total_basket"><?php echo $order_total_display; ?> </div> </div> </div> </div>
public static function renderNamed(&$BTaddressNamed, $adr1, &$cart, $OPCloader, $virtuemart_userinfo_id, $returnHtml = false) { $uid = JFactory::getUser()->get('id'); // will load all the shipping addresses $ada = array(); foreach ($adr1 as $k => $v) { $ada[$k] = $v; $ada['shipto_' . $k] = $v; } $cart->ST = $ada; //do_dump($ref->cart->ST); echo '<br /><br />'; $adr1->edit_link = '#" onclick="return Onepage.op_showEditST(' . $adr1->virtuemart_userinfo_id . ')'; $i = 2; $adr1 = $OPCloader->setCountryAndState($adr1); $arr = array('ST' => $adr1, 'bt_user_info_id' => $virtuemart_userinfo_id, 'BTaddress' => $BTaddressNamed, 'uid' => $uid, 'cart' => $cart, 'i' => $i); $html2_1 = $OPCloader->fetch($OPCloader, 'get_shipping_address_v2.tpl', $arr); if (empty($html2_1)) { // theme file not found, please create or copy /overrides/get_shipping_address_v2.tpl.php /// ************** start of customer info / shipping address foreach ($BTaddressNamed as $key => $val) { if (!empty($adr1->{$key})) { $BTaddressNamed[$key]['value'] = $adr1->{$key}; } else { unset($BTaddressNamed[$key]); } } $vars = array('BTaddress' => $BTaddressNamed, 'edit_link' => $adr1->edit_link); $html2_1 = $OPCloader->fetch($OPCloader, 'customer_info.tpl', $vars); $edit_label = OPCLang::_('JACTION_EDIT'); if ($edit_label == 'JACTION_EDIT') { $edit_label = OPCLang::_('EDIT'); } $html2_1 = str_replace(OPCLang::_('COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_LBL'), $edit_label, $html2_1); /// ************** end of customer info } if (!empty($cart->ST['virtuemart_country_id'])) { $dc = $cart->ST['virtuemart_country_id']; } else { $dc = OPCloader::getDefaultCountry($cart, true); } $hasmissing = $OPCloader->hasMissingFieldsST($cart->ST); $html2_id = '<div '; if (empty($hasmissing)) { $html2_id .= ' style="display: none;" '; } $html2_id .= ' id="opc_stedit_' . $adr1->virtuemart_userinfo_id . '">'; $html2_id .= ' <input type="hidden" name="st_complete_list" value="' . $adr1->virtuemart_userinfo_id . '" />'; $gf = $OPCloader->getSTfields($OPCloader, true, true, $dc); //do_dump($gf); echo '<br /><br />'; $html2_id .= $gf; $html2_id .= '</div>'; $html2_id = str_replace('id="', 'id="REPLACE' . $adr1->virtuemart_userinfo_id . 'REPLACE', $html2_id); $html2_id = str_replace('name="', 'name="REPLACE' . $adr1->virtuemart_userinfo_id . 'REPLACE', $html2_id); $html2 = '<input type="hidden" id="opc_st_changed_' . $adr1->virtuemart_userinfo_id . '" name="opc_st_changed_' . $adr1->virtuemart_userinfo_id . '" value="'; if (!empty($hasmissing)) { $html2 .= '1'; } else { $html2 .= '0'; } $html2 .= '" />'; $html2 .= '<div '; if (!empty($hasmissing)) { $html2 .= ' style="display: none;" '; } $html2 .= ' id="opc_st_' . $adr1->virtuemart_userinfo_id . '">' . $html2_1 . '</div>' . $html2_id; if ($i == 1) { $i++; } elseif ($i == 2) { $i--; } if (!empty($STaddressList)) { $html2 .= '<input type="hidden" name="shipto_logged" value="' . $adr1->virtuemart_userinfo_id . '" />'; } else { $html2 .= '<input type="hidden" name="shipto_logged" value="new" />'; } $html2 = '<div id="hidden_st_' . $adr1->virtuemart_userinfo_id . '" style="display: none;">' . $html2 . '</div>'; if ($returnHtml) { return $html2; } if (!isset(OPCloader::$extrahtml)) { OPCloader::$extrahtml = ''; } OPCloader::$extrahtml .= $html2; return $html2; }
?> "> </a> </div> <div style="position:absolute; top:0; height:30px; left:30px; min-width: 70px; max-width: 70px; width:100px; display:inline-block;"> <input style="min-width: 70px; max-width: 70px;" type="text" title="<?php echo OPCLang::_('COM_VIRTUEMART_CART_UPDATE'); ?> " class="inputbox" size="3" name="quantity" id="quantity_for_<?php echo md5($product->cart_item_id); ?> " value="<?php echo $product->quantity; ?> " style="margin: 0;" /> </div> <div style="position:absolute; height:30px; top:0; left:130px; min-width: 30px; display:block; width: 30px; "> <a style="width: 20px; height: 20px;" class="updatebtn" title="<?php echo OPCLang::_('COM_VIRTUEMART_CART_UPDATE'); ?> " href="#" rel="<?php echo $product->cart_item_id . '|' . md5($product->cart_item_id); ?> "> </a> </div> </div>
public static function getBasket(&$ref, $OPCloader, $withwrapper = true, &$op_coupon = '', $shipping = '', $payment = '', $isexpress = false) { include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php'; $has_k2 = OPCloader::tableExists('k2mart'); if (!class_exists('ShopFunctions')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php'; } if (!method_exists('ShopFunctions', 'convertWeightUnit')) { $opc_show_weight = false; } /* if (!class_exists('VirtueMartModelProduct')) require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'product.php'); */ require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php'; $productClass = OPCmini::getModel('product'); //new VirtueMartModelProduct(); if (!class_exists('CurrencyDisplay')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php'; } $currencyDisplay = CurrencyDisplay::getInstance($ref->cart->pricesCurrency); $google_html = ''; $VM_LANG = new op_languageHelper(); $product_rows = array(); $p2 = $ref->cart->products; if (empty($ref->cart)) { $ref->cart = VirtueMartCart::getCart(); } $vm2015 = false; $ref->cart->prices = $ref->cart->pricesUnformatted = OPCloader::getCheckoutPrices($ref->cart, false, $vm2015, 'opc'); $useSSL = VmConfig::get('useSSL', 0); $action_url = $OPCloader->getActionUrl($OPCloader, true); $xi = 0; if (isset($currencyDisplay->_priceConfig)) { $savedConfig = $currencyDisplay->_priceConfig; } if (empty($product_price_display)) { $product_price_display = 'salesPrice'; } //$test_product_price_display = array($product_price_display, 'salesPrice', 'basePrice', 'priceWithoutTax', 'basePriceWithTax', 'priceBeforeTax', 'costPrice'); $test_product_price_display = array($product_price_display, 'salesPrice', 'basePrice', 'priceWithoutTax', 'basePriceWithTax', 'priceBeforeTax'); // check price config $testf = false; foreach ($test_product_price_display as $product_price_display_test) { $test = $currencyDisplay->createPriceDiv($product_price_display, '', '10', false, false, 1); if (empty($test)) { if (isset($currencyDisplay->_priceConfig)) { if (isset($currencyDisplay->_priceConfig[$product_price_display_test])) { if (empty($currencyDisplay->_priceConfig[$product_price_display_test][0])) { $currencyDisplay->_priceConfig[$product_price_display_test] = array(1, -1, 1); } } } $testf = true; } else { if (!isset($product_price_display_test2)) { $product_price_display_test2 = $product_price_display_test; } } } if (empty($testf)) { $product_price_display = $product_price_display_test2; } $totalw = 0; $to_weight_unit = VmConfig::get('weight_unit_default', 'KG'); foreach ($ref->cart->products as $pkey => $prow) { if ($opc_show_weight) { $totalw += ShopFunctions::convertWeightUnit((double) $prow->product_weight, $prow->product_weight_uom, $to_weight_unit) * (double) $prow->quantity; } $product = array(); $id = $prow->virtuemart_media_id; if (empty($id)) { $imgf = ''; } else { if (is_array($id)) { $id = reset($id); } $imgf = $OPCloader->getImageFile($id); } $product['product_full_image'] = $imgf; if (!empty($opc_only_parent_links)) { if (!empty($prow->product_parent_id)) { $parent = $prow->product_parent_id; $prow->url = JRoute::_('index.php?option=com_virtuemart&virtuemart_product_id=' . $parent . '&view=productdetails', true); } } // check if k2 exists: if (!isset($prow->url)) { if (isset($prow->link)) { $prow->url = $prow->link; if (strpos($prow->url, '&') === false) { $prow->url = str_replace('&', '&', $prow->url); } } else { $prow->url = JRoute::_('index.php?option=com_virtuemart&virtuemart_product_id=' . $prow->virtuemart_product_id . '&view=productdetails', true); } } if ($has_k2) { $db = JFactory::getDBO(); $q = 'select baseID from #__k2mart where referenceID = ' . (int) $prow->virtuemart_product_id . ' limit 0,1'; $db->setQuery($q); $k2_id = $db->loadResult(); if (!empty($k2_id)) { $prow->url = JRoute::_('index.php?option=com_k2&id=' . $k2_id . '&view=item', true); } } $product['product_name'] = JHTML::link($prow->url, $prow->product_name, ' class="opc_product_name" '); if ((!defined('VM_VERSION') || VM_VERSION < 3) && (isset($prow->customfields) && !is_array($prow->customfields))) { if (!empty($opc_editable_attributes)) { $product['product_attributes'] = '<div style="clear:both;">' . OPCrenderer::getCustomFields($prow->virtuemart_product_id, $prow->cart_item_id, $prow->quantity) . '</div>'; } else { $product['product_attributes'] = $prow->customfields; } } else { $product['product_attributes'] = ''; } /* var_dump($prow->customfields); $cart = VirtuemartCart::getCart(); $p = array(); foreach ($cart->products as $k=>$v) { $p[$k] = $v; } unset($cart->products); unset($cart->ST); unset($cart->BT); unset($cart->BTaddress); unset($cart->STaddress); $cart->products = $p; $cart->setCartIntoSession(); var_dump($cart->products); die(); var_dump($cart); JFactory::getApplication()->close(); */ if (defined('VM_VERSION') && VM_VERSION >= 3) { } if (isset($prow->customfields) && is_array($prow->customfields)) { $customfieldsModel = OPCmini::getModel('Customfields'); $product['product_attributes'] = $customfieldsModel->CustomsFieldCartDisplay($prow); } $product['product_sku'] = $prow->product_sku; // end price test if (isset($prow->quantity)) { $product['product_quantity'] = $prow->quantity; } if (isset($prow->min_order_level)) { $product['min_order_level'] = $prow->min_order_level; } if (isset($prow->max_order_level)) { $product['max_order_level'] = $prow->max_order_level; } //$product_model = $OPCloader->getModel('product'); $xi++; if (empty($no_extra_product_info)) { $prowcopy = $productClass->getProduct($prow->virtuemart_product_id, true); } else { $prowcopy = $prow; } $product['info'] = $prowcopy; $product['product'] = $prow; if (isset($ref->cart->prices[$pkey])) { $currentPrice = $ref->cart->prices[$pkey]; } else { if (isset($prow->prices)) { $currentPrice = $prow->prices; } } if ($product_price_display == 'salesPrice') { if (isset($prow->prices)) { $product['product_price'] = $currentPrice['salesPrice']; } else { if (isset($prow->salesPrice)) { $product['product_price'] = $prow->salesPrice; } else { if (isset($prow->basePriceWithTax)) { $product['product_price'] = $prow->basePriceWithTax; } else { if (isset($prow->basePrice)) { $product['product_price'] = $prow->basePrice; } } } } } else { if (isset($prow->prices)) { $product['product_price'] = $currentPrice[$product_price_display]; } else { if (isset($prow->{$product_price_display})) { $product['product_price'] = $prow->{$product_price_display}; } else { if (isset($prow->salesPrice)) { $product['product_price'] = $prow->salesPrice; } } } } if (!isset($product['product_price'])) { $price = $ref->cart->pricesUnformatted[$pkey]; $product['product_price'] = $price[$product_price_display]; } if (empty($product['product_price'])) { $product_price_display = 'salesPrice'; $price = $ref->cart->pricesUnformatted[$pkey]; $product['product_price'] = $price['salesPrice']; } $price_raw = $product['product_price']; // the quantity is not working up to 2.0.4 $product['product_id'] = $prow->virtuemart_product_id; $google_html .= '<input type="hidden" name="prod_id" value="' . $prow->virtuemart_product_id . '" /> <input type="hidden" name="prodsku_' . $prow->virtuemart_product_id . '" id="prodsku_' . $prow->virtuemart_product_id . '" value="' . OPCloader::slash($prow->product_sku, false) . '" /> <input type="hidden" name="prodname_' . $prow->virtuemart_product_id . '" id="prodname_' . $prow->virtuemart_product_id . '" value="' . OPCloader::slash($prow->product_name, false) . '" /> <input type="hidden" name="prodq_' . $prow->virtuemart_product_id . '" id="prodq_' . $prow->virtuemart_product_id . '" value="' . $prow->quantity . '" /> <input type="hidden" name="produprice_' . $prow->virtuemart_product_id . '" id="produprice_' . $prow->virtuemart_product_id . '" value="' . $price_raw . '" /> <input type="hidden" name="prodcat_' . $prow->virtuemart_product_id . '" id="prodcat_' . $prow->virtuemart_product_id . '" value="' . $prow->category_name . '" /> '; if (isset($ref->cart->pricesUnformatted[$pkey])) { $price = $ref->cart->pricesUnformatted[$pkey]; } else { $price = $prow->prices; } $product['prices'] = $price; $product['prices_formatted'] = array(); if ($vm2015) { foreach ($price as $key => $pricev) { //if (!isset($price[$key])) if (!empty($pricev)) { $product['prices_formatted'][$key] = $currencyDisplay->createPriceDiv($key, '', $price, false, true, 1); } } } $product['product_price'] = $currencyDisplay->createPriceDiv($product_price_display, '', $price, false, true, 1); /* if (false) if (empty($product['product_price'])) { // ok, we have a wrong type selected here if ($product_price_display == 'salesPrice') $product['product_price'] = $currencyDisplay->createPriceDiv('basePrice','', $price,false,false, 1); if (empty($product['product_price'])) $product['product_price'] = $currencyDisplay->createPriceDiv('priceWithoutTax','', $price,false,false, 1); if (empty($product['product_price'])) $product['product_price'] = $currencyDisplay->createPriceDiv('basePriceWithTax','', $price,false,false, 1); if (empty($product['product_price'])) $product['product_price'] = $currencyDisplay->createPriceDiv('priceBeforeTax','', $price,false,false, 1); if (empty($product['product_price'])) $product['product_price'] = $currencyDisplay->createPriceDiv('costPrice','', $price,false,false, 1); } */ $product['product_price'] = str_replace('class="', 'class="opc_price_general opc_', $product['product_price']); if (!isset($prow->cart_item_id)) { $prow->cart_item_id = $pkey; } $v = array('product' => $prow, 'action_url' => $action_url, 'use_ssl' => $useSSL, 'useSSL' => $useSSL); if (!empty($ajaxify_cart)) { $update_form = $OPCloader->fetch($OPCloader, 'update_form_ajax.tpl', $v); $delete_form = $OPCloader->fetch($OPCloader, 'delete_form_ajax.tpl', $v); } else { $update_form = $OPCloader->fetch($OPCloader, 'update_form.tpl', $v); $delete_form = $OPCloader->fetch($OPCloader, 'delete_form.tpl', $v); $op_coupon_ajax = ''; } if (empty($update_form)) { if (!empty($ajaxify_cart)) { $product['update_form'] = '<input type="text" title="' . OPCLang::_('COM_VIRTUEMART_CART_UPDATE') . '" class="inputbox" size="3" name="quantity" id="quantity_for_' . md5($prow->cart_item_id) . '" value="' . $prow->quantity . '" /><a class="updatebtn" title="' . OPCLang::_('COM_VIRTUEMART_CART_DELETE') . '" href="#" rel="' . $prow->cart_item_id . '|' . md5($prow->cart_item_id) . '"> </a>'; $product['delete_form'] = '<a class="deletebtn" title="' . OPCLang::_('COM_VIRTUEMART_CART_DELETE') . '" href="#" rel="' . $prow->cart_item_id . '"> </a>'; } else { $product['update_form'] = '<form action="' . $action_url . '" method="post" style="display: inline;"> <input type="hidden" name="option" value="com_virtuemart" /> <input type="text" title="' . OPCLang::_('COM_VIRTUEMART_CART_UPDATE') . '" class="inputbox" size="3" name="quantity" value="' . $prow->quantity . '" /> <input type="hidden" name="view" value="cart" /> <input type="hidden" name="task" value="update" /> <input type="hidden" name="cart_virtuemart_product_id" value="' . $prow->cart_item_id . '" /> <input type="submit" class="updatebtn" name="update" title="' . OPCLang::_('COM_VIRTUEMART_CART_UPDATE') . '" value=" "/> </form>'; if (defined('VM_VERSION') && VM_VERSION >= 3) { $product['delete_form'] = '<a class="deletebtn" title="' . OPCLang::_('COM_VIRTUEMART_CART_DELETE') . '" href="' . JRoute::_('index.php?option=com_virtuemart&view=cart&task=delete.' . $prow->cart_item_id . '&cart_virtuemart_product_id=' . $prow->cart_item_id, true, $useSSL) . '"> </a>'; } else { $product['delete_form'] = '<a class="deletebtn" title="' . OPCLang::_('COM_VIRTUEMART_CART_DELETE') . '" href="' . JRoute::_('index.php?option=com_virtuemart&view=cart&task=delete&cart_virtuemart_product_id=' . $prow->cart_item_id, true, $useSSL) . '"> </a>'; } } } else { $product['update_form'] = $update_form; $product['delete_form'] = $delete_form; } if (!empty($ajaxify_cart)) { $product['update_form'] = str_replace('href=', 'onclick="return Onepage.updateProduct(this);" href=', $product['update_form']); $product['delete_form'] = str_replace('href=', 'onclick="return Onepage.deleteProduct(this);" href=', $product['delete_form']); } //vm3 update: if (defined('VM_VERSION') && VM_VERSION >= 3) { $product['update_form'] = str_replace('name="quantity"', 'name="quantity[' . $prow->cart_item_id . ']"', $product['update_form']); $product['update_form'] = str_replace('value="update"', 'value="updatecart"', $product['update_form']); } $product['subtotal'] = $prow->quantity * $price_raw; //else //$product['subtotal'] = $prow->subtotal_with_tax; // this is fixed from 2.0.4 and would not be needed if (isset($ref->cart->pricesUnformatted[$pkey])) { $copy = $ref->cart->pricesUnformatted[$pkey]; } else { $copy = $prow->prices; } //$copy['salesPrice'] = $copy['subtotal_with_tax']; $copy[$product_price_display] = $product['subtotal']; $product['subtotal'] = $currencyDisplay->createPriceDiv($product_price_display, '', $copy, false, true, 1); $product['subtotal'] = str_replace('class="', 'class="opc_', $product['subtotal']); // opc vars $product_rows[] = $product; //break; } //$shipping_inside_basket = false; $shipping_select = $shipping; $payment_select = $payment; if (!empty($ref->cart->prices['salesPriceCoupon'])) { if (empty($coupon_price_display)) { $coupon_price_display = 'salesPriceCoupon'; } $coupon_display = $currencyDisplay->createPriceDiv($coupon_price_display, '', $ref->cart->prices, false, true, 1); //$ref->cart->prices['salesPriceCoupon']; $coupon_display = str_replace('class="', 'class="opc_', $coupon_display); } else { $coupon_display = ''; } if (!empty($coupon_display)) { $discount_after = true; } else { $discount_after = false; } if (empty($other_discount_display)) { $other_discount_display = 'billDiscountAmount'; } switch ($other_discount_display) { case 'billDiscountAmount': $coupon_display_before = $currencyDisplay->createPriceDiv('billDiscountAmount', '', $ref->cart->prices, false, false, 1); if (empty($ref->cart->prices['billDiscountAmount'])) { $coupon_display_before = ''; } break; case 'discountAmount': $coupon_display_before = $currencyDisplay->createPriceDiv('discountAmount', '', $ref->cart->prices, false, false, 1); if (empty($ref->cart->prices['discountAmount'])) { $coupon_display_before = ''; } case 'minus': $billD = abs($ref->cart->prices['billDiscountAmount']); foreach ($ref->cart->prices as $key => $val) { if (!empty($ref->cart->products[$key])) { if (is_array($val)) { $billD -= abs($val['subtotal_discount']); } } } $billD = abs($billD) * -1; $prices_new['billTotal'] = $billD; if (!empty($billD)) { $coupon_display_before = $currencyDisplay->createPriceDiv('billTotal', '', $prices_new, false, false, 1); } else { $coupon_display_before = ''; } break; case 'sum': $billD = 0; foreach ($ref->cart->prices as $key => $val) { if (!empty($ref->cart->products[$key])) { if (is_array($val)) { $billD += $val['subtotal_discount']; } } } $billD = abs($billD) * -1; $prices_new['billTotal'] = $billD; if (!empty($billD)) { $coupon_display_before = $currencyDisplay->createPriceDiv('billTotal', '', $prices_new, false, false, 1); } else { $coupon_display_before = ''; } break; } $coupon_display_before = str_replace('class="', 'class="opc_', $coupon_display_before); //else $coupon_display_before = ''; $opc_show_weight_display = ''; if (!empty($opc_show_weight) && !empty($totalw)) { $dec = $currencyDisplay->getDecimalSymbol(); $th = $currencyDisplay->getThousandsSeperator(); $w = VmConfig::get('weight_unit_default', 'KG'); $w = strtoupper($w); if ($w == 'OZ') { $w = 'OUNCE'; } $unit = JText::_('COM_VIRTUEMART_UNIT_SYMBOL_' . $w); if ($unit == 'COM_VIRTUEMART_UNIT_SYMBOL_' . $w) { $unit = $w = VmConfig('weight_unit_default', 'kg'); } $opc_show_weight_display = number_format($totalw, 2, $dec, $th) . ' ' . $unit; } if (!empty($ajaxify_cart)) { $coupon_text = $ref->cart->couponCode ? OPCLang::_('COM_VIRTUEMART_COUPON_CODE_CHANGE') : OPCLang::_('COM_VIRTUEMART_COUPON_CODE_ENTER'); $vars = array('coupon_text' => $coupon_text, 'coupon_display' => $coupon_display); $op_coupon_ajax = $OPCloader->fetch($OPCloader, 'couponField_ajax', $vars); if (stripos($op_coupon_ajax, 'Onepage.setCouponAjax') === false) { $op_coupon_ajax = str_replace('type="button', 'onclick="return Onepage.setCouponAjax(this);" type="button', $op_coupon_ajax); } } if (empty($subtotal_price_display)) { $subtotal_price_display = 'salesPrice'; } if ($subtotal_price_display != 'diffTotals') { $subtotal_display = $currencyDisplay->createPriceDiv($subtotal_price_display, '', $ref->cart->prices, false, false, 1); if ($subtotal_price_display == 'basePriceWithTax') { if (stripos($subtotal_display, ' ></span') !== false) { $subtotal_price_display = 'salesPrice'; $subtotal_display = $currencyDisplay->createPriceDiv($subtotal_price_display, '', $ref->cart->prices, false, false, 1); } } } else { $subtotal = $ref->cart->prices['billTotal'] - $ref->cart->prices['billTaxAmount']; $arr = array('diffTotals' => $subtotal); $subtotal_display = $currencyDisplay->createPriceDiv($subtotal_price_display, '', $arr, false, false, 1); } //$ref->cart->prices['salesPrice']; $subtotal_display = str_replace('class="', 'class="opc_', $subtotal_display); $prices = $ref->cart->prices; if (!isset($prices[$subtotal_price_display . 'Shipment'])) { if ($subtotal_price_display != 'salesPrice') { $order_shipping = $prices['shipmentValue']; } else { $order_shipping = $prices['salesPriceShipment']; } } else { $order_shipping = $prices[$subtotal_price_display . 'Shipment']; } if (!empty($order_shipping)) { $virtuemart_currency_id = OPCloader::getCurrency($ref->cart); $order_shipping = $currencyDisplay->convertCurrencyTo($virtuemart_currency_id, $order_shipping, false); $test = $currencyDisplay->createPriceDiv($product_price_display, '', $order_shipping, false, true, 1); if (!empty($test)) { $order_shipping = $test; } $order_shipping = str_replace('class="', 'class="opc_', $order_shipping); } else { $order_shipping = ''; } $continue_link = $OPCloader->getContinueLink($ref); $order_total_display = $currencyDisplay->createPriceDiv('billTotal', '', $ref->cart->prices, false, false, 1); //$ref->cart->prices['billTotal']; $order_total_display = str_replace('class="', 'class="opc_', $order_total_display); // this will need a little tuning foreach ($ref->cart->cartData['taxRulesBill'] as $rule) { $rulename = $rule['calc_name']; if (!empty($ref->cart->prices[$rule['virtuemart_calc_id'] . 'Diff'])) { $tax_display = $currencyDisplay->createPriceDiv($rule['virtuemart_calc_id'] . 'Diff', '', $ref->cart->prices, false, false, 1); //$ref->cart->prices[$rule['virtuemart_calc_id'].'Diff']; $tax_display = str_replace('class="', 'class="opc_', $tax_display); } else { $tax_display = ''; } } $op_disable_shipping = OPCloader::getShippingEnabled($ref->cart); if (!empty($payment_discount_before) && !empty($coupon_display_before)) { $discount_before = true; } else { $discount_before = false; } $disable_couponns = VmConfig::get('coupons_enable', true); if (empty($disable_couponns)) { $op_coupon = $op_coupon_ajax = ''; } if (!empty($op_coupon_ajax)) { $op_coupon = $op_coupon_ajax; } if ($isexpress) { $payment_inside_basket = false; } if (empty($payment_inside_basket)) { $payment_select = ''; } if (empty($shipping_inside_basket)) { $shipping_select = ''; } if (empty($tax_display)) { $tax_display = ''; } if (empty($op_disable_shipping)) { $op_disable_shipping = false; } $no_shipping = $op_disable_shipping; $vars = array('product_rows' => $product_rows, 'payment_inside_basket' => $payment_inside_basket, 'shipping_select' => $shipping_select, 'payment_select' => $payment_select, 'shipping_inside_basket' => $shipping_inside_basket, 'coupon_display' => $coupon_display, 'subtotal_display' => $subtotal_display, 'no_shipping' => $no_shipping, 'order_total_display' => $order_total_display, 'tax_display' => $tax_display, 'VM_LANG' => $VM_LANG, 'op_coupon_ajax' => $op_coupon_ajax, 'continue_link' => $continue_link, 'coupon_display_before' => $coupon_display_before, 'discount_before' => $discount_before, 'discount_after' => $discount_after, 'order_shipping' => $order_shipping, 'cart' => $ref->cart, 'op_coupon' => $op_coupon, 'opc_show_weight_display' => $opc_show_weight_display); //original cart support: $ref->cart->cartData['shipmentName'] = ''; $ref->cart->cartData['paymentName'] = ''; $totalInPaymentCurrency = $ref->getTotalInPaymentCurrency(); $cd = CurrencyDisplay::getInstance($ref->cart->pricesCurrency); $layoutName = 'default'; $confirm = 'confirm'; $shippingText = ''; $paymentText = ''; $checkout_link_html = ''; $useSSL = VmConfig::get('useSSL', 0); $useXHTML = true; $checkoutAdvertise = ''; if (!class_exists('OPCrenderer')) { require JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'renderer.php'; } $renderer = OPCrenderer::getInstance(); if (method_exists($renderer, 'assignRef')) { $renderer->assignRef('cart', $renderer->cart); $renderer->assignRef('totalInPaymentCurrency', $totalInPaymentCurrency); $renderer->assignRef('layoutName', $layoutName); $renderer->assignRef('select_shipment_text', $shippingText); $renderer->assignRef('checkout_task', $confirm); $renderer->assignRef('currencyDisplay', $cd); $renderer->assignRef('select_payment_text', $paymentText); $renderer->assignRef('checkout_link_html', $checkout_link_html); $renderer->assignRef('useSSL', $useSSL); $renderer->assignRef('useXHTML', $useXHTML); $renderer->assignRef('totalInPaymentCurrency', $totalInPaymentCurrency); $renderer->assignRef('checkoutAdvertise', $checkoutAdvertise); } if (empty($use_original_basket)) { $html = $renderer->fetch($OPCloader, 'basket.html', $vars); } else { $html = $renderer->fetchBasket($OPCloader, 'basket.html', $vars); } if ($withwrapper) { $html = '<div id="opc_basket">' . $html . '</div>'; } if (!empty($op_no_basket)) { $html = '<div style="display: none;">' . $html . '</div>'; } if (isset($currencyDisplay->_priceConfig)) { $currencyDisplay->_priceConfig = $savedConfig; } $ret = $html . $google_html; return $ret; }
public static function getPayment(&$ref, &$OPCloader, &$num, $ajax = false, $isexpress = false) { if ($isexpress) { $reta = array(); $reta['html'] = '<input type="hidden" name="virtuemart_paymentmethod_id" value="' . $ref->cart->virtuemart_paymentmethod_id . '" />'; $reta['extra'] = ''; return $reta; } include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php'; $payment_not_found_text = ''; $payments_payment_rates = array(); if (!class_exists('OPCrenderer')) { require JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'renderer.php'; } $renderer = OPCrenderer::getInstance(); if (!$renderer->checkPaymentMethodsConfigured()) { if (method_exists($renderer, 'assignRef')) { $renderer->assignRef('paymentplugins_payments', $payments_payment_rates); $renderer->assignRef('found_payment_method', $found_payment_method); } } $p = JRequest::getVar('payment_method_id', $payment_default); if (empty($p)) { $selectedPayment = empty($ref->cart->virtuemart_paymentmethod_id) ? 0 : $ref->cart->virtuemart_paymentmethod_id; } else { $selectedPayment = $p; } // set missing fields for klarna OPCloader::prepareBT($ref->cart); $dpps = array(); $shipping = JRequest::getVar('shipping_rate_id', ''); //if ($ajax) if (!empty($shipping)) { if (!empty($disable_payment_per_shipping)) { $session = JFactory::getSession(); $dpps = $session->get('dpps', null); if (empty($dpps)) { $OPCloader->getShipping($ref, $ref->cart, true); } $dpps = $session->get('dpps', null); if (!empty($dpps)) { } } } // if (!empty($shipping)) { if (!empty($shipping)) { $ref->cart->virtuemart_shipmentmethod_id = $shipping; } $vm2015 = false; $ref->cart->prices = $ref->cart->pricesUnformatted = OPCloader::getCheckoutPrices($ref->cart, false, $vm2015, 'opc'); } $paymentplugins_payments = array(); if ($p === 'none') { $p = 0; } if ($payment_default === 'none') { $paymentplugins = array(); $psel = '<input onclick="javascript: Onepage.runPay(\'\',\'\',op_textinclship, op_currency, 0)" type="radio" name="virtuemart_paymentmethod_id" id="payment_id_0" value="0" not_a_valid_payment="not_a_valid_payment" '; if (empty($p) || $p === 'none') { $psel .= ' selected="selected" '; $payment_default = 0; } $psel .= ' /> <label for="payment_id_0"><span class="vmpayment"><span class="vmpayment_name">-' . OPCLang::_('COM_VIRTUEMART_CART_EDIT_PAYMENT') . '- </span></span></label>'; $paymentplugins[] = $psel; } if (!class_exists('vmPSPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'; } JPluginHelper::importPlugin('vmpayment'); $dispatcher = JDispatcher::getInstance(); require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'ajaxhelper.php'; $bhelper = new basketHelper(); //$bhelper->createDefaultAddress($ref, $ref->cart); //old: 2.0.208 and prior: $returnValues = $dispatcher->trigger('plgVmDisplayListFEPayment', array($ref->cart, $selectedPayment, &$paymentplugins_payments)); //plgVmDisplayListFEPaymentOPCNocache $returnValues = $dispatcher->trigger('plgVmDisplayListFEPaymentOPCNocache', array(&$ref->cart, $selectedPayment, &$paymentplugins_payments)); if (empty($returnValues)) { $returnValues = $dispatcher->trigger('plgVmDisplayListFEPayment', array($ref->cart, $selectedPayment, &$paymentplugins_payments)); } // if no payment defined $found_payment_method = false; $n = 0; $debug = ''; foreach ($paymentplugins_payments as $p1) { if (is_array($p1)) { $n += count($p1); } } if ($n > 0) { $found_payment_method = true; } $num = $n; if (!$found_payment_method) { $link = ''; // todo $payment_not_found_text = OPCLang::sprintf('COM_VIRTUEMART_CART_NO_PAYMENT_METHOD_PUBLIC', '<a href="' . $link . '">' . $link . '</a>'); } require_once JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'ajaxhelper.php'; $bhelper = new basketHelper(); require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'transform.php'; $ret = array(); if ($found_payment_method) { if (!empty($payment_inside)) { $ret2 = OPCTransform::paymentToSelect($paymentplugins_payments, $shipping, $dpps); if (!empty($ret2)) { $ret = array($ret2['select']); $extra = $ret2['extra']; /* foreach ($ret['extra'] as $key=>$val) { $extra[$key] = $val; } */ } } if (empty($payment_inside) || empty($ret)) { $sorted = array(); $unknown = array(); foreach ($paymentplugins_payments as $paymentplugin_payments) { if (is_array($paymentplugin_payments)) { foreach ($paymentplugin_payments as $paymentplugin_payment) { $id = OPCTransform::getFT($paymentplugin_payment, 'input', 'virtuemart_paymentmethod_id', 'name', 'virtuemart_paymentmethod_id', '>', 'value'); if (is_array($id)) { $id = reset($id); } $paymentplugin_payment = str_replace('class="vmpayment_description"', 'class="vmpayment_description vmpayment_description_' . $id . '"', $paymentplugin_payment); //vmpayment_cardinfo $paymentplugin_payment = str_replace('class="vmpayment_cardinfo"', 'class="vmpayment_cardinfo vmpayment_cardinfo_' . $id . '"', $paymentplugin_payment); //ccDetails $paymentplugin_payment = str_replace('class="ccDetails"', 'class="ccDetails ccDetails_' . $id . '"', $paymentplugin_payment); OPCloader::opcDebug('checking shipping ' . $shipping); OPCloader::opcDebug('dpps:'); OPCloader::opcDebug($dpps); OPCloader::opcDebug('dpps_disable:'); OPCloader::opcDebug($dpps_disable); if (!empty($shipping)) { if (!empty($dpps)) { if (!empty($disable_payment_per_shipping)) { foreach ($dpps_disable as $k => $v) { if (!empty($dpps[$k])) { foreach ($dpps[$k] as $y => $try) { if ((int) $dpps[$k][$y] == (int) $shipping) { if ($dpps_disable[$k] == $id) { OPCloader::opcDebug('disabling payment id ' . $id . ' for shipping id ' . $shipping); $paymentplugin_payment = ''; continue 3; } } } } } } } } // PPL Pro fix $paymentplugin_payment = str_replace('<br/><a href="' . JRoute::_('index.php?option=com_virtuemart&view=cart&task=editpayment&Itemid=' . JRequest::getInt('Itemid'), false) . '">' . JText::_('VMPAYMENT_PAYPAL_CC_ENTER_INFO') . '</a>', '', $paymentplugin_payment); $paymentplugin_payment = str_replace('name="virtuemart_paymentmethod_id"', 'name="virtuemart_paymentmethod_id" onclick="javascript: Onepage.runPay(\'\',\'\',op_textinclship, op_currency, 0)" ', $paymentplugin_payment); $ret[] = $paymentplugin_payment; if ($n === 1 && !empty($hide_payment_if_one)) { $paymentplugin_payment = str_replace('type="radio"', 'type="hidden"', $paymentplugin_payment); } if (is_numeric($id)) { $ind = (int) $id; if (empty($sorted[$ind])) { $sorted[$ind] = $paymentplugin_payment; } else { $unknown[] = $paymentplugin_payment; } } else { if (is_numeric($id[0])) { $ind = (int) $id[0]; if (empty($sorted[$ind])) { $sorted[$ind] = $paymentplugin_payment; } else { $unknown[] = $paymentplugin_payment; } } else { $unknown[] = $paymentplugin_payment; } } } } } if (!empty($sorted)) { $dbj = JFactory::getDBO(); $dbj->setQuery("select * from #__virtuemart_paymentmethods where published = '1' order by ordering asc limit 999"); $list = $dbj->loadAssocList(); $msg = $dbj->getErrorMsg(); if (!empty($msg)) { echo $msg; } $sortedfinal = array(); if (!empty($list)) { foreach ($list as $pme) { if (!empty($sorted[$pme['virtuemart_paymentmethod_id']])) { $sortedfinal[] = $sorted[$pme['virtuemart_paymentmethod_id']]; } } if (empty($unknown)) { $unknown = array(); } if (!empty($sortedfinal)) { $ret = array_merge($sortedfinal, $unknown); } } } } } else { $ret[] = $payment_not_found_text . '<input type="hidden" name="virtuemart_paymentmethod_id" id="opc_missing_payment" value="0" />'; } if (empty($payment_inside)) { if (!empty($ret)) { if (!empty($paymentplugins)) { $ret = array_merge($paymentplugins, $ret); } } } $vars = array('payments' => $ret, 'cart' => $ref->cart); $html = $OPCloader->fetch($OPCloader, 'list_payment_methods.tpl', $vars); $pid = JRequest::getVar('payment_method_id', ''); if (!empty($pid) && is_numeric($pid)) { if (strpos($html, 'value="' . $pid . '"') !== false) { $html = str_replace('checked="checked"', '', $html); $html = str_replace(' checked', ' ', $html); $html = str_replace('value="' . $pid . '"', 'value="' . $pid . '" checked="checked" ', $html); } } else { if (strpos($html, 'value="' . $payment_default . '"') !== false) { $html = str_replace('checked="checked"', '', $html); $html = str_replace(' checked', ' ', $html); $html = str_replace('value="' . $payment_default . '"', 'value="' . $payment_default . '" checked="checked" ', $html); } } $html = str_replace('"radio"', '"radio" autocomplete="off" ', $html); if (!$payment_inside) { if (strpos($html, 'checked') === false) { $x1 = strpos($html, 'name="virtuemart_paymentmethod_id"'); if ($x1 !== false) { $html = substr($html, 0, $x1) . ' checked="checked" ' . substr($html, $x1); } else { // we've got no method here ! } } } // klarna compatibility $count = 0; $html = str_replace('name="klarna_paymentmethod"', 'name="klarna_paymentmethod_opc"', $html, $count); $html .= '<input type="hidden" name="opc_payment_method_id" id="opc_payment_method_id" value="" />'; if ($count > 0) { if (!defined('klarna_opc_id')) { $html .= '<input type="hidden" name="klarna_opc_method" id="klarna_opc_method" value="" />'; define('klarna_opc_id', 1); } } $reta = array(); $reta['html'] = $html; if (!empty($extra)) { $reta['extra'] = $extra; } else { $reta['extra'] = ''; } return $reta; }
public static function paymentToSelect($htmla, $shipping, $dpps) { include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php'; $pid = JRequest::getVar('payment_method_id', $payment_default); if ($payment_default === 'none') { $payment_default = 0; $adds = true; } $options = ''; if (!empty($adds)) { $options .= '<option not_a_valid_payment="not_a_valid_payment" value="0" id="payment_id_0">' . OPCLang::_('COM_VIRTUEMART_LIST_EMPTY_OPTION') . '</option>'; } $extra = array(); foreach ($htmla as $paymentplugin_payments) { if (is_array($paymentplugin_payments)) { foreach ($paymentplugin_payments as $paymentplugin_payment) { $id = self::getFT($paymentplugin_payment, 'input', 'virtuemart_paymentmethod_id', 'name', 'virtuemart_paymentmethod_id', '>', 'value'); OPCloader::opcDebug('checking shipping ' . $shipping); OPCloader::opcDebug('dpps:'); OPCloader::opcDebug($dpps); OPCloader::opcDebug('dpps_disable:'); OPCloader::opcDebug($dpps_disable); if (!empty($shipping)) { if (!empty($dpps)) { if (!empty($disable_payment_per_shipping)) { $idp = $id[0]; foreach ($dpps_disable as $k => $v) { if (!empty($dpps[$k])) { foreach ($dpps[$k] as $y => $try) { if ((int) $dpps[$k][$y] == (int) $shipping) { OPCloader::opcDebug('found shipping ' . $dpps[$k][$y] . ' testing payment id' . $idp); if ($dpps_disable[$k] == $idp) { OPCloader::opcDebug('disabling payment id ' . $idp . ' for shipping id ' . $shipping); $paymentplugin_payment = ''; continue 3; } } } } } } } } $html = self::getInnerTag('label', $paymentplugin_payment); // remove description: $xd = stripos($html, '<span class="vmpayment_description">'); if ($xd !== false) { $s1 = stripos($html, '</span>', $xd); $len = strlen('</span>'); $html = substr($html, 0, $xd) . substr($html, $s1 + $len); } $x = str_replace($html, '', $paymentplugin_payment); $t1 = strip_tags($x); $t2 = trim($t1); $hasextra = false; if (!empty($t2)) { $x2 = self::getUnclosedTag('input', $x, 'virtuemart_paymentmethod_id'); // remove the payment input $x = str_replace($x2, '', $x); $extra[$id[0]] = '<div class="payment_extra" style="display: none;" id="extra_payment_' . $id[0] . '">' . $x . '</div>'; $hasextra = true; } else { $extra[$id[0]] = ''; } $html = strip_tags($html); $options .= '<option value="' . $id[0] . '"'; if ($id[0] == $pid) { $options .= ' selected="selected" '; } if ($hasextra) { $options .= ' rel="' . $id[0] . '" '; } $options .= '>' . $html . '</option>'; } } } $select = '<select autocomplete="off" id="opcPaymentSelect" class="opcPaymentSelect" onchange="javascript: Onepage.runPaySelect(this);" name="virtuemart_paymentmethod_id">' . $options . '</select>'; //$extra['-1'] = $select; $a2 = array(); $a2['extra'] = ''; $a2['select'] = $select; /* foreach ($extra as $key=>$l) $a2['extra'] .= $l; */ if (empty($extra)) { $extra = array(); } $a2['extra'] = $extra; return $a2; }
</div> <?php } ?> <?php if (!empty($continue_link)) { ?> <div class="op_basket_row"> <div style="width: 100%; clear: both;"> <a href="<?php echo $continue_link; ?> " class="continue_link_ice" ><span> <?php echo OPCLang::_('COM_VIRTUEMART_CONTINUE_SHOPPING'); ?> </span> </a> </div> </div> <?php } ?> </div> </div> </div></div></div></div> </div> </div>
function getCoupon(&$obj) { if (!VmConfig::get('coupons_enable')) { return ""; } $this->couponCode = isset($this->cart->couponCode) ? $this->cart->couponCode : ''; $coupon_text = $obj->cart->couponCode ? OPCLang::_('COM_VIRTUEMART_COUPON_CODE_CHANGE') : OPCLang::_('COM_VIRTUEMART_COUPON_CODE_ENTER'); if (!class_exists('OPCrenderer')) { require JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'renderer.php'; } $renderer = OPCrenderer::getInstance(); $renderer->assignRef('coupon_text', $coupon_text); return $this->fetch($obj, 'couponField.tpl', array(), 'coupon'); }
<input type="text" name="coupon_code" autocomplete="off" id="coupon_code" size="20" class="coupon_input" alt="<?php echo $this->coupon_text; ?> " value="<?php echo $this->coupon_text; ?> " onblur="if(this.value=='') this.value='<?php echo $this->coupon_text; ?> ';" onfocus="if(this.value=='<?php echo $this->coupon_text; ?> ') this.value='';" /> </div> <span class="detailsbutton_opc"> <input class="buttonopc" id="submit_coupon_button" type="submit" value="<?php echo OPCLang::_('COM_VIRTUEMART_SAVE'); ?> " /> </span> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="view" value="cart" /> <input type="hidden" name="task" value="setcoupon" /> <input type="hidden" name="controller" value="cart" /> </div> </form> </div> <div style="width: 100%; clear: both;"></div>
</div> <?php } } echo '</div>'; echo '</label> </div> </div>' . "\n"; if ($i == 1) { $i++; } elseif ($i == 2) { $i--; } } // BT vm204: index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=BT // vm204 ?option=com_virtuemart&view=user&task=editaddresscart&addrtype=ST&cid[]=0 // vm206: index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=ST&cid[]=51&virtuemart_userinfo_id=12 // vm206 new ST: index.php?option=com_virtuemart&view=user&task=editaddresscart&new=1&addrtype=ST&cid[]=51 ?> <div><div style="width: 100%; clear: both; text-align: center;"> <a href="<?php echo $new_address_link; ?> "> <?php echo OPCLang::_('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL'); ?> </div></div> </a> </div> </div>
echo OPCLang::_('COM_VIRTUEMART_CART_UPDATE'); ?> " class="inputbox_update quantity-input" size="3" name="quantity" value="<?php echo $product->quantity; ?> " /> <input type="hidden" name="view" value="cart" /> <input type="hidden" name="task" value="update" /> <input type="hidden" name="cart_virtuemart_product_id" value="<?php echo $product->cart_item_id; ?> " /> <input type="submit" class="vmicon vm2-add_quantity_cart" name="update" title="<?php echo OPCLang::_('COM_VIRTUEMART_CART_UPDATE'); ?> " value=" <?php echo JText::_('COM_VIRTUEMART_CART_UPDATE'); ?> "/> <a class="vmicon vm2-remove_from_cart" title="<?php echo OPCLang::_('COM_VIRTUEMART_CART_DELETE'); ?> " href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=cart&task=delete&cart_virtuemart_product_id=' . $product->cart_item_id, true, $useSSL); ?> "><?php echo JText::_('COM_VIRTUEMART_CART_DELETE'); ?> </a> </form>
if (version_compare(JVERSION, '2.5.0', 'ge')) { // Joomla! 2.5 code here $plugin_short_path = 'plugins/system/bit_vm_check_vatid/bitvatidchecker/'; } elseif (version_compare(JVERSION, '1.7.0', 'ge')) { // Joomla! 1.7 code here $plugin_short_path = 'plugins/system/bit_vm_check_vatid/bitvatidchecker/'; } elseif (version_compare(JVERSION, '1.6.0', 'ge')) { // Joomla! 1.6 code here $plugin_short_path = 'plugins/system/bit_vm_check_vatid/bitvatidchecker/'; } else { // Joomla! 1.5 code here $plugin_short_path = 'plugins/system/bitvatidchecker/'; } require_once JPATH_SITE . DS . $plugin_short_path . 'classes/euvatcheck.class.php'; $error_msg = OPCLang::setGet('COM_ONEPAGE_VAT_CHECKER_INVALID', $error_msg); $vies_down_error_msg = OPCLang::setGet('COM_ONEPAGE_VAT_CHECKER_DOWN', $vies_down_error_msg); $session = JFactory::getSession(); $vatids = $session->get('opc_vat', array()); if (!is_array($vatids)) { $vatids = unserialize($vatids); } $vatids['field'] = $fname; $vatid = strtoupper($vatid); $vatid = preg_replace("/[^a-zA-Z0-9]/", "", $vatid); $country = JRequest::getVar('virtuemart_country_id'); $vathash = $country . '_' . $vatid; // vatid must start with country: $invalid = false; $str = substr($vatid, 0, 2); $test = preg_replace("/[a-zA-Z]/", "", $str); if (!empty($test)) {