* THIS FILE RENDERS THE SELECT DROP DOWN FOR LOGGED IN USERS * * TO FORMAT INDIVIDUAL ADDRESS USE get_shipping_address_v2.tpl.php * 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 */ $html3 = '<div class="before_select"></div><div class="middle_select" style=""><div class="after_select" style="" > </div><select class="" name="ship_to_info_id" id="id' . $virtuemart_userinfo_id . '" onchange="return Onepage.changeST(this);" >'; $html3 .= '<option value="' . $virtuemart_userinfo_id . '">' . OPCLang::_('COM_VIRTUEMART_USER_FORM_ST_SAME_AS_BT') . '</option>'; foreach ($STaddressList as $stlist) { $html3 .= '<option value="' . $stlist->virtuemart_userinfo_id . '">'; if (!empty($stlist->address_type_name)) { $html3 .= $stlist->address_type_name; } /* if (isset($stlist->first_name)) $html3 .= $stlist->first_name.' '; if (isset($stlist->last_name)) $html3 .= $stlist->last_name.' '; */ if (isset($stlist->address_1)) { $html3 .= ',' . $stlist->address_1; } if (isset($stlist->city)) { $html3 .= ',' . $stlist->city; } $html3 .= '</option>'; } $html3 .= '<option value="new">' . OPCLang::_('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL') . '</option>'; $html3 .= '</select></div>'; echo $html3;
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; }
<?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>
} 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 $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 -->
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>
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>';
" 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 -->
* 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>
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 ';
/** * Save the user info. The saveData function dont use the userModel store function for anonymous shoppers, because it would register them. * We make this function private, so we can do the tests in the tasks. * * @author Max Milbers * @author Valérie Isaksen * * @param boolean Defaults to false, the param is for the userModel->store function, which needs it to determin how to handle the data. * @return String it gives back the messages. */ private function saveData(&$cart = false, $register = false, $disable_duplicit = false, &$data) { include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php'; $mainframe = JFactory::getApplication(); $currentUser = JFactory::getUser(); $msg = ''; //store email: $data['email'] = str_replace(array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $data['email']); $user_id = JFactory::getUser()->get('id'); if (empty($user_id)) { JFactory::getUser()->set('email', $data['email']); } if (empty($data['shipto_address_type_name'])) { $data['shipto_address_type_name'] = OPCLang::_('COM_VIRTUEMART_ORDER_PRINT_SHIPPING_LBL'); } if (empty($data['address_type'])) { $data['address_type'] = 'BT'; } $at = JRequest::getWord('addrtype'); if (!empty($at)) { $data['address_type'] = $at; } $r = JRequest::getVar('register_account', ''); if (!empty($r) || VmConfig::get('oncheckout_only_registered', 0)) { $register = true; } //if ($data['address_type'] == 'ST') $register = false; $this->addModelPath(JPATH_VM_ADMINISTRATOR . DS . 'models'); require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php'; $userModel = OPCmini::getModel('user'); if ($currentUser->id != 0 || $register) { $data['user_is_vendor'] = 0; //It should always be stored, stAn: it will, but not here if ($currentUser->id == 0 || empty($data['ship_to_info_id'])) { if (!empty($data['email'])) { if (empty($data['shipto_email'])) { $data['shipto_email'] = $data['email']; } } // check for duplicit registration feature if ($allow_duplicit && empty($disable_duplicit)) { // set the username if appropriate if (empty($data['username'])) { if (!empty($currentUser->id)) { $data['username'] = $username = $currentUser->username; JRequest::setVar('username', $username); $data['email'] = $email = $this->getEmail(); JRequest::setVar('email', $email); } else { $username = $data['email']; $email = $data['email']; } } else { $username = $data['username']; if (!empty($data['email'])) { $email = $data['email']; } else { // support for 3rd party exts if (strpos($username, '@') !== false) { $email = $username; } } } $db = JFactory::getDBO(); $q = "select * from #__users where email LIKE '" . $this->getEscaped($db, $email) . "' limit 0,1"; //or username = '******' "; $db->setQuery($q); $res = $db->loadAssoc(); $is_dup = false; if (!empty($res)) { //ok, the customer already used the same email address $is_dup = true; $duid = $res['id']; $GLOBALS['is_dup'] = $duid; $GLOBALS['opc_new_user'] = $duid; $data['address_type'] = 'BT'; $data['virtuemart_user_id'] = $duid; $data['shipto_virtuemart_user_id'] = $duid; $this->saveToCart($data, $cart); // we will not save the user into the jos_virtuermart_userinfos if ($currentUser->id != 0) { // ok, we have a joomla registration + logged in users // but the user might not be registered with virtuemart if ($currentUser->id == $duid) { // yes we are talking about the same user // let's associate his data in the cart with his data in VM tables $q = "select * from #__virtuemart_userinfos where virtuemart_user_id = " . $duid . " "; $db->setQuery($q); $res = $db->loadAssocList(); if (empty($res)) { foreach ($res as $row) { // ok, he has no BT address assigned if ($row['address_type'] == 'BT') { $forceregister = true; } if ($row['address_type'] == 'ST') { $forceregisterst = true; } } } else { // he is already logged in and all we have to do is to store his data in the order details, not the userinfos return true; } } } else { return true; } // ok, we've got a duplict registration here if (empty($currentUser->id)) { if (!empty($data['password']) && !empty($data['username'])) { // if we showed the password fields, let try to log him in // we can try to log him in if he entered password $credentials = array('username' => $username, 'password' => $data['password']); // added by stAn, so we don't ge an error $ret = false; if (empty($op_never_log_in)) { $options = array('silent' => true); $mainframe = JFactory::getApplication(); ob_start(); $ret = $mainframe->login($credentials, $options); // test123 /* if (false) { ob_start(); $options = array('silent' => true, 'skip_joomdlehooks'=>true ); $mainframe->logout($user->id, $options); ob_get_clean(); $return = $mainframe->login($credentials, $options); } */ } // refresh user data: // refresh user data: // refresh user data: /* $session = JFactory::getSession(); $user = JFactory::getUser(); $id = (int)$user->id; $user = new JUser($id); $session->clear('user'); $user = new JUser($id); */ // end of refresh // end of refresh // end of refresh $xxy = ob_get_clean(); unset($xxy); if ($ret === false) { // the login was not sucessfull } else { // login was sucessfull $dontproceed = true; } } } // did he check: shipping address is different? if (method_exists($cart, 'prepareAddressDataInCart')) { $cart->prepareAddressDataInCart('BT', 1); } if (method_exists($cart, 'prepareAddressFieldsInCart')) { $cart->prepareAddressFieldsInCart(); } if (!class_exists('VirtuemartModelUserfields')) { require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'userfields.php'; } $corefields = VirtueMartModelUserfields::getCoreFields(); $fieldtype = 'BTaddress'; $userFields = $cart->{$fieldtype}; if (method_exists($cart, 'prepareAddressDataInCart')) { $cart->prepareAddressDataInCart('ST', 1); } if (method_exists($cart, 'prepareAddressFieldsInCart')) { $cart->prepareAddressFieldsInCart(); } $fieldtype = 'STaddress'; $userFieldsst = $cart->{$fieldtype}; if (!empty($data['sa']) && $data['sa'] == 'adresaina') { // yes, his data are in the shipto_ fields $address = array(); foreach ($data as $ksa => $vsa) { if (strpos($ksa, 'shipto_') === 0) { $address[$ksa] = $vsa; } } } else { // load the proper BT address $q = "select * from #__virtuemart_userinfos where virtuemart_user_id = '" . $duid . "' and address_type = 'BT' limit 0,1"; $db->setQuery($q); $bta = $db->loadAssoc(); if (!empty($bta)) { $address = array(); // no, his data are in the BT address and therefore we need to copy them and set a proper BT address foreach ($userFieldsst['fields'] as $key => $uf) { $uf['name'] = str_replace('shipto_', '', $uf['name']); // POST['variable'] is prefered form userinfos.variable in db if (empty($bta[$uf['name']])) { $bta[$uf['name']] = ''; } if (!isset($data[$uf['name']])) { $data[$uf['name']] = ''; } if (empty($data['address_type_name'])) { $data['address_type_name'] = OPCLang::_('COM_VIRTUEMART_ORDER_PRINT_SHIPPING_LBL'); } if (empty($data['shipto_address_type_name'])) { $data['shipto_address_type_name'] = OPCLang::_('COM_VIRTUEMART_ORDER_PRINT_SHIPPING_LBL'); } if (empty($data['name'])) { $data['name'] = $bta[$uf['name']]; } JRequest::setVar('shipto_' . $uf['name'], $data[$uf['name']], 'post'); // this will set the new BT address in the cart later on and in the order details as well if (!empty($bta[$uf['name']])) { JRequest::setVar($uf['name'], $bta[$uf['name']], 'post'); } $address['shipto_' . $uf['name']] = $data[$uf['name']]; } } } // ok, we've got the ST addres here, let's check if there is anything similar $q = "select * from #__virtuemart_userinfos where virtuemart_user_id = '" . $duid . "'"; $db->setQuery($q); $res = $db->loadAssocList(); $ign = array('virtuemart_userinfo_id', 'virtuemart_user_id', 'address_type', 'address_type_name', 'name', 'agreed', '', 'created_on', 'created_by', 'modified_on', 'modified_by', 'locked_on', 'locked_by'); if (function_exists('mb_strtolower')) { $cf = 'mb_strtolower'; } else { $cf = 'strtolower'; } $e = $db->getErrorMsg(); if (!empty($res)) { // user is already registered, but we need to fill some of the system fields foreach ($res as $k => $ad) { $match = false; foreach ($ad as $nn => $val) { if (!in_array($nn, $ign)) { if (!isset($address['shipto_' . $nn])) { $address['shipto_' . $nn] = ''; } if ($cf($val) != $cf($address['shipto_' . $nn])) { $match = false; break; } else { $match = true; $lastuid = $ad['virtuemart_userinfo_id']; $lasttype = $ad['address_type']; } } } if (!empty($match)) { // we've got a ST address already registered if ($lasttype == 'BT') { // let's set STsameAsBT JRequest::setVar('sa', null); // we don't have to do anything as the same data will be saved } else { JRequest::setVar('shipto_virtuemart_userinfo_id', $lastuid); $new_shipto_virtuemart_userinfo_id = $lastuid; } break; } } // the user is registered and logged in, but he wants to checkout with a new address. he might still be in the guest mode if (empty($match) || !empty($new_shipto_virtuemart_userinfo_id)) { // we need to store it as a new ST address $address['address_type'] = 'ST'; $address['virtuemart_user_id'] = $duid; $address['shipto_virtuemart_user_id'] = $duid; if (empty($new_shipto_virtuemart_userinfo_id)) { $address['shipto_virtuemart_userinfo_id'] = 0; $address['shipto_virtuemart_userinfo_id'] = $this->OPCstoreAddress($cart, $address, $duid); // let's set ST address here } else { $address['shipto_virtuemart_userinfo_id'] = $new_shipto_virtuemart_userinfo_id; } if (!isset($address['agreed'])) { $address['agreed'] = JRequest::getBool('agreed', 1); } // empty radios fix start //Notice: Undefined index: name in /srv/www/clients/client1/web90/web/svn/2072/virtuemart/components/com_virtuemart/helpers/cart.php on line 1030 //Notice: Undefined index: agreed in /srv/www/clients/client1/web90/web/svn/2072/virtuemart/components/com_virtuemart/helpers/cart.php on line 1030 //Notice: Undefined index: myradio in /srv/www/clients/client1/web90/web/svn/2072/virtuemart/components/com_virtuemart/helpers/cart.php on line 1030 //Notice: Undefined index: testcheckbox in /srv/www/clients/client1/web90/web/svn/2072/virtuemart/components/com_virtuemart/helpers/cart.php on line 1030 require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php'; $userFieldsModel = OPCmini::getModel('userfields'); $prefix = ''; $prepareUserFieldsBT = $userFieldsModel->getUserFieldsFor('cart', 'BT'); $prepareUserFieldsBT = $userFieldsModel->getUserFieldsFor('cart', 'ST'); if (!empty($prepareUserFieldsBT)) { foreach ($prepareUserFieldsBT as $fldb) { $name = $fldb->name; if (!isset($btdata[$name])) { $btdata[$name] = ''; } } } if (!empty($prepareUserFieldsST)) { foreach ($prepareUserFieldsST as $flda) { $name = $flda->name; // we need to add empty values for checkboxes and radios if (!isset($address['shipto_' . $name])) { $address['shipto_' . $name] = ''; } } } // empty radios fix end if (defined('VM_VERSION') && VM_VERSION >= 3) { $cart->saveAddressInCart($address, 'ST', true, 'shipto_'); } else { $cart->saveAddressInCart($address, 'ST', true); } //$cart->saveAddressInCart($address, 'ST'); $btdata = JRequest::get('post'); $btdata['virtuemart_user_id'] = $duid; $btdata['address_type'] = 'BT'; if (!isset($btdata['agreed'])) { $btdata['agreed'] = JRequest::getBool('agreed', 1); } $cart->saveAddressInCart($btdata, 'BT'); return; } } } } if (empty($dontproceed)) { if (empty($currentUser->id)) { if (empty($data['username'])) { $data['username'] = $data['email']; } if (empty($data['password']) && !VmConfig::get('oncheckout_show_register', 0)) { $data['password'] = $data['password2'] = uniqid(); } } if (!empty($data['first_name'])) { $data['name'] = $data['first_name'] . ' ' . $data['last_name']; } else { if (!empty($data['last_name'])) { $data['name'] = $data['last_name']; } else { $data['name'] = ' '; } } if (!empty($data['shipto_first_name']) && !empty($data['shipto_last_name'])) { $data['shipto_name'] = $data['shipto_first_name'] . ' ' . $data['shipto_last_name']; } else { if (!empty($data['shipto_last_name'])) { $data['shipto_name'] = $data['shipto_last_name']; } else { $data['shipto_name'] = ' '; } } if (empty($_POST['name'])) { $_POST['name'] = $data['name']; } // Bind the post data to the JUser object and the VM tables, then saves it, also sends the registration email if (empty($unlog_all_shoppers)) { if (empty($currentUser->id)) { $data['guest'] = 0; } } $usersConfig = JComponentHelper::getParams('com_users'); // OPC can still register, but will unlog the shopper immidiately when no login is enabled if ($usersConfig->get('allowUserRegistration') != '0') { $ret = $this->userStore($data, $userModel); // here virtuemart logs in the user, so we need to unlog him /* since opc 2.0.231 VM cannot login the customer, therefore we do not need to unlog him if (!empty($op_never_log_in)) { $mainframe = JFactory::getApplication(); $options = array('silent' => true, 'skip_joomdlehooks'=>true ); $user = JFactory::getUser(); $mainframe->logout($user->id, $options); $unlog_all_shoppers = true; } */ } else { $ret['success'] = true; $user = JFactory::getUser(); $unlog_all_shoppers = true; } $data['address_type'] = 'ST'; // this gives error on shipping address save // this section is used purely for unlogged customers if (!empty($data['sa']) && $data['sa'] == 'adresaina') { $this->userStoreAddress($userModel, $data); } $user = $ret['user']; $ok = $ret['success']; $user = JFactory::getUser(); // we will not send this again if (empty($unlog_all_shoppers)) { if ($user->id == 0) { $msg = is_array($ret) ? $ret['message'] : $ret; $usersConfig = JComponentHelper::getParams('com_users'); $useractivation = $usersConfig->get('useractivation'); if (empty($op_never_log_in)) { if (is_array($ret) && $ret['success'] && (empty($useractivation) || !empty($opc_no_activation))) { // Username and password must be passed in an array $credentials = array('username' => $ret['user']->username, 'password' => $ret['user']->password_clear); $options = array('silent' => true); $return = $mainframe->login($credentials, $options); //test123 /* if (false) { // this part of code fixes the _levels caching issue on joomla 1.7 to 2.5 ob_start(); $options = array('silent' => true, 'skip_joomdlehooks'=>true ); $mainframe->logout($user->id, $options); ob_get_clean(); $return = $mainframe->login($credentials, $options); } */ // refresh user data: // refresh user data: /* $session = JFactory::getSession(); $user = JFactory::getUser(); $id = (int)$user->id; $user = new JUser($id); $session->clear('user'); $user = new JUser($id); */ // end of refresh // end of refresh } } } } } } else { // the user is logged in and we want to update his address $data['address_type'] = 'ST'; // this gives error on shipping address save $new_shipto = JRequest::getVar('opc_st_changed_new', false); if (!empty($data['sa']) && $data['sa'] == 'adresaina' || $new_shipto) { $data['address_type'] = 'ST'; //$data['shipto_virtuemart_userinfo_id'] = null; if (empty($data['email']) && !empty($currentUser->email)) { $data['email'] = $currentUser->email; $data['shipto_email'] = $currentUser->email; } if ($data['shipto_address_type_name'] == OPCLang::_('COM_VIRTUEMART_ORDER_PRINT_SHIPPING_LBL')) { $data['shipto_address_type_name'] .= '(' . @$data['first_name'] . ' ' . @$data['last_name'] . ' ' . @$data['address_1'] . ' ' . @$data['city'] . ')'; } if (empty($data['name'])) { $data['name'] = ''; if (!empty($data['first_name'])) { $data['name'] .= $data['first_name']; } if (!empty($data['last_name'])) { $data['name'] .= $data['last_name']; } } if (empty($data['user_id'])) { $data['user_id'] = $currentUser->id; $data['virtuemart_user_id'] = $currentUser->id; } if (empty($data['username']) && !empty($currentUser->username)) { $data['username'] = $currentUser->username; } // to create a new one: $data['shipto_virtuemart_userinfo_id'] = 0; $this->OPCstoreAddress($cart, $data); } $bt = JRequest::getVar('ship_to_info_id_bt', ''); if (!empty($bt)) { $changed = JRequest::getVar('opc_st_changed_' . $bt, ''); if (!empty($changed)) { $data['address_type'] = 'BT'; $data['shipto_virtuemart_userinfo_id'] = null; if (empty($data['email']) && !empty($currentUser->email)) { $data['email'] = $currentUser->email; } if (empty($data['name'])) { $data['name'] = ''; if (!empty($data['first_name'])) { $data['name'] .= $data['first_name']; } if (!empty($data['last_name'])) { $data['name'] .= $data['last_name']; } } if (empty($data['user_id'])) { $data['user_id'] = $currentUser->id; $data['virtuemart_user_id'] = $currentUser->id; } if (empty($data['username']) && !empty($currentUser->username)) { $data['username'] = $currentUser->username; } $this->userStoreAddress($userModel, $data); //$userModel->storeAddress($data); } } } } $data['address_type'] = 'BT'; $this->saveToCart($data, $cart); return $msg; }
<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">
/** * Original function from customFields.php * We need to update custom attributes when using add to cart as link * * @author Patrick Kohl * @param obj $product product object * @return html code */ public static function getProductCustomsFieldCart($product) { if (OPCJ3) { return array(); } $db = JFactory::getDBO(); // group by virtuemart_custom_id $query = 'SELECT C.`virtuemart_custom_id`, `custom_title`, C.`custom_value`,`custom_field_desc` ,`custom_tip`,`field_type`,field.`virtuemart_customfield_id`,`is_hidden` FROM `#__virtuemart_customs` AS C LEFT JOIN `#__virtuemart_product_customfields` AS field ON C.`virtuemart_custom_id` = field.`virtuemart_custom_id` Where `virtuemart_product_id` =' . (int) $product->virtuemart_product_id . ' and `field_type` != "G" and `field_type` != "R" and `field_type` != "Z"'; $query .= ' and is_cart_attribute = 1 group by virtuemart_custom_id'; $db->setQuery($query); $groups = $db->loadObjectList(); if (!class_exists('VmHTML')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php'; } $row = 0; if (!class_exists('CurrencyDisplay')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php'; } $currency = CurrencyDisplay::getInstance(); if (!class_exists('calculationHelper')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php'; } $calculator = calculationHelper::getInstance(); if (!class_exists('vmCustomPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php'; } $reta = array(); $free = OPCLang::_('COM_VIRTUEMART_CART_PRICE_FREE'); // render select list if (!empty($groups)) { foreach ($groups as $group) { // $query='SELECT field.`virtuemart_customfield_id` as value ,concat(field.`custom_value`," :bu ", field.`custom_price`) AS text $query = 'SELECT field.`virtuemart_product_id`, `custom_params`,`custom_element`, field.`virtuemart_custom_id`, field.`virtuemart_customfield_id`,field.`custom_value`, field.`custom_price`, field.`custom_param` FROM `#__virtuemart_customs` AS C LEFT JOIN `#__virtuemart_product_customfields` AS field ON C.`virtuemart_custom_id` = field.`virtuemart_custom_id` Where `virtuemart_product_id` =' . (int) $product->virtuemart_product_id; $query .= ' and is_cart_attribute = 1 and C.`virtuemart_custom_id`=' . (int) $group->virtuemart_custom_id; // We want the field to be ordered as the user defined $query .= ' ORDER BY field.`ordering`'; $db->setQuery($query); $options = $db->loadObjectList(); //vmdebug('getProductCustomsFieldCart options',$options); $group->options = array(); foreach ($options as $option) { $group->options[$option->virtuemart_customfield_id] = $option; } if ($group->field_type == 'V') { $default = current($group->options); foreach ($group->options as $productCustom) { if ((double) $productCustom->custom_price) { $price = strip_tags($currency->priceDisplay($calculator->calculateCustomPriceWithTax($productCustom->custom_price))); } else { $price = $productCustom->custom_price === '' ? '' : $free; } $productCustom->text = $productCustom->custom_value . ' ' . $price; } $r = array(); $r['name'] = 'customPrice[' . $row . '][' . $group->virtuemart_custom_id . ']'; $r['value'] = $default->custom_value; $reta[] = $r; //$group->display = VmHTML::select ('customPrice[' . $row . '][' . $group->virtuemart_custom_id . ']', $group->options, $default->custom_value, '', 'virtuemart_customfield_id', 'text', FALSE); } else { if ($group->field_type == 'G') { $group->display .= ''; // no direct display done by plugin; } else { if ($group->field_type == 'E') { $group->display = ''; foreach ($group->options as $k => $productCustom) { if ((double) $productCustom->custom_price) { $price = $currency->priceDisplay($calculator->calculateCustomPriceWithTax($productCustom->custom_price)); } else { $price = $productCustom->custom_price === '' ? '' : $free; } $productCustom->text = $productCustom->custom_value . ' ' . $price; $productCustom->virtuemart_customfield_id = $k; if (!class_exists('vmCustomPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php'; } //legacy, it will be removed 2.2 $productCustom->value = $productCustom->virtuemart_customfield_id; JPluginHelper::importPlugin('vmcustom'); $dispatcher = JDispatcher::getInstance(); $fieldsToShow = $dispatcher->trigger('plgVmOnDisplayProductVariantFE', array($productCustom, &$row, &$group)); $group->display .= '<input type="hidden" value="' . $productCustom->virtuemart_customfield_id . '" name="customPrice[' . $row . '][' . $productCustom->virtuemart_custom_id . ']" /> '; $r = array(); $r['name'] = 'customPrice[' . $row . '][' . $productCustom->virtuemart_custom_id . ']'; $r['value'] = $productCustom->virtuemart_customfield_id; $reta[] = $r; if (!empty($currency->_priceConfig['variantModification'][0]) and $price !== '') { $group->display .= '<div class="price-plugin">' . OPCLang::_('COM_VIRTUEMART_CART_PRICE') . '<span class="price-plugin">' . $price . '</span></div>'; } $row++; } $row--; } else { if ($group->field_type == 'U') { foreach ($group->options as $productCustom) { if ((double) $productCustom->custom_price) { $price = $currency->priceDisplay($calculator->calculateCustomPriceWithTax($productCustom->custom_price)); } else { $price = $productCustom->custom_price === '' ? '' : $free; } $productCustom->text = $productCustom->custom_value . ' ' . $price; $group->display .= '<input type="text" value="' . OPCLang::_($productCustom->custom_value) . '" name="customPrice[' . $row . '][' . $group->virtuemart_custom_id . '][' . $productCustom->value . ']" /> '; $r = array(); $r['name'] = 'customPrice[' . $row . '][' . $group->virtuemart_custom_id . '][' . $productCustom->value . ']'; $r['value'] = OPCLang::_($productCustom->custom_value); $reta[] = $r; // only the first is used here //continue; if (false) { if (!empty($currency->_priceConfig['variantModification'][0]) and $price !== '') { $group->display .= '<div class="price-plugin">' . OPCLang::_('COM_VIRTUEMART_CART_PRICE') . '<span class="price-plugin">' . $price . '</span></div>'; } } } } else { if ($group->field_type == 'A') { $group->display = ''; foreach ($group->options as $productCustom) { /* if ((float)$productCustom->custom_price) { $price = $currency->priceDisplay ($calculator->calculateCustomPriceWithTax ($productCustom->custom_price)); } else { $price = ($productCustom->custom_price === '') ? '' : $free; }*/ $productCustom->field_type = $group->field_type; $productCustom->is_cart = 1; // only the first is used here continue; $checked = ''; } } else { $group->display = ''; $checked = 'checked="checked"'; foreach ($group->options as $productCustom) { //vmdebug('getProductCustomsFieldCart',$productCustom); if (false) { if ((double) $productCustom->custom_price) { $price = $currency->priceDisplay($calculator->calculateCustomPriceWithTax($productCustom->custom_price)); } else { $price = $productCustom->custom_price === '' ? '' : $free; } } $productCustom->field_type = $group->field_type; $productCustom->is_cart = 1; // $group->display .= '<input id="' . $productCustom->virtuemart_custom_id . '" ' . $checked . ' type="radio" value="' . // $productCustom->virtuemart_custom_id . '" name="customPrice[' . $row . '][' . $productCustom->virtuemart_customfield_id . ']" /><label // for="' . $productCustom->virtuemart_custom_id . '">' . $this->displayProductCustomfieldFE ($productCustom, $row) . ' ' . $price . '</label>'; //MarkerVarMods $r['name'] = 'customPrice[' . $row . '][' . $group->virtuemart_customfield_id . ']'; $r['value'] = $productCustom->virtuemart_custom_id; $reta[] = $r; //only the first here continue; $checked = ''; } } } } } } $row++; } } return $reta; }
public static function getUserFields(&$userFields, &$OPCloader, &$cart, $remove = array(), $only = array(), $skipreorder = array()) { include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php'; $user = JFactory::getUser(); $uid = $user->get('id'); //$userFields = $userFieldsOrig; if (!empty($userFields)) { foreach ($userFields['fields'] as $key => $uf) { $userFields['fields'][$key]['formcode'] = str_replace('vm-chzn-select', '', $userFields['fields'][$key]['formcode']); $userFields['fields'][$key]['formcode'] = str_replace('maxlength', 'disabledmaxlength', $userFields['fields'][$key]['formcode']); if ($key == 'password') { $userFields['fields'][$key]['required'] = true; } if ($key == 'password2') { $userFields['fields'][$key]['required'] = true; } $arr = array('name', 'username'); if (in_array($key, $arr)) { $userFields['fields'][$key]['required'] = 1; } if (!empty($custom_rendering_fields)) { if (in_array($userFields['fields'][$key]['name'], $custom_rendering_fields)) { unset($userFields['fields'][$key]); continue; } } if ($key != 'email') { $userFields['fields'][$key]['formcode'] = str_replace('/>', ' autocomplete="off" />', $userFields['fields'][$key]['formcode']); } if ($key == 'email') { if (!empty($cart->BT['email'])) { $userFields['fields'][$key]['formcode'] = str_replace('value=""', ' value="' . $cart->BT['email'] . '"', $userFields['fields'][$key]['formcode']); $userFields['fields'][$key]['formcode'] = str_replace('type="text"', 'type="email"', $userFields['fields'][$key]['formcode']); } } $userFields['fields'][$key]['formcode'] = str_replace('size="0"', '', $userFields['fields'][$key]['formcode']); // get proper state listing: if ($key == 'virtuemart_state_id') { if (!empty($cart->BT['virtuemart_country_id'])) { $c = $cart->BT['virtuemart_country_id']; } else { $c = $default_shipping_country; } if (empty($c)) { $vendor = $OPCloader->getVendorInfo($cart); $c = $vendor['virtuemart_country_id']; } require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'commonhtml.php'; $html = OPCCommonHtml::getStateHtmlOptions($cart, $c, 'BT'); if (!empty($cart->BT['virtuemart_state_id'])) { $html = str_replace('value="' . $cart->BT['virtuemart_state_id'] . '"', 'value="' . $cart->BT['virtuemart_state_id'] . '" selected="selected"', $html); } // if (!empty($userFields['fields']['virtuemart_state_id']['required'])) { $userFields['fields']['virtuemart_state_id']['formcode'] = '<select class="inputbox multiple opcrequired" id="virtuemart_state_id" opcrequired="opcrequired" size="1" name="virtuemart_state_id" >' . $html . '</select>'; } else { $userFields['fields']['virtuemart_state_id']['formcode'] = '<select class="inputbox multiple" id="virtuemart_state_id" size="1" name="virtuemart_state_id" >' . $html . '</select>'; } //$userFields['fields'][$key]['formcode'] = '<select class="inputbox multiple" id="virtuemart_state_id" size="1" name="virtuemart_state_id" >'.$html.'</select>'; } // add klarna button: if (!empty($klarna_se_get_address)) { if ($key == 'socialNumber') { $newhtml = '<input type="button" id="klarna_get_address_button" onclick="return Onepage.send_special_cmd(this, \'get_klarna_address\' );" value="' . OPCLang::_('COM_ONEPAGE_KLARNA_GET_ADDRESS') . '" />'; //$userFields['fields'][$key]['formcode'] = str_replace('name="socialNumber"', ' style="width: 70%;" name="socialNumber"', $userFields['fields'][$key]['formcode']).$newhtml; $userFields['fields'][$key]['formcode'] .= $newhtml; } } // mark email read only when logged in if ($key == 'email') { // 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']); } else { $userFields['fields'][$key]['formcode'] = str_replace('type="text"', 'type="email"', $userFields['fields'][$key]['formcode']); } } // remove autocomplete for multi dependant fields if ($key == 'virtuemart_country_id') { $userFields['fields'][$key]['formcode'] = str_replace('name=', ' autocomplete="off" name=', $userFields['fields'][$key]['formcode']); } // set required properly: if (isset($userFields['fields'][$key]['name'])) { if (!empty($uf['required']) && strpos($uf['formcode'], 'required') === false) { if ($userFields['fields'][$key]['name'] != 'virtuemart_state_id') { $x1 = strpos($uf['formcode'], 'class="'); if ($x1 !== false) { $userFields['fields'][$key]['formcode'] = str_replace('class="', 'class="required ', $uf['formcode']); } else { $userFields['fields'][$key]['formcode'] = str_replace('name="', 'class="required" name="', $uf['formcode']); } } } } if ($uf['type'] == 'date') { $userFields['fields'][$key]['formcode'] = str_replace(OPCLang::_('COM_VIRTUEMART_NEVER'), $userFields['fields'][$key]['title'], $userFields['fields'][$key]['formcode']); } if (!empty($op_no_display_name)) { if ($userFields['fields'][$key]['name'] == 'name') { unset($userFields['fields'][$key]); continue; } } if ($key == 'username') { if (!empty($op_usernameisemail) && $userFields['fields'][$key]['name'] == 'username') { unset($userFields['fields'][$key]); continue; } } if ($key == 'password') { $userFields['fields']['opc_password'] = $userFields['fields'][$key]; $userFields['fields']['opc_password']['formcode'] = str_replace('password', 'opc_password', $userFields['fields']['opc_password']['formcode']); $userFields['fields']['opc_password']['formcode'] = str_replace('type="opc_password"', 'type="password" autocomplete="off" ', $userFields['fields']['opc_password']['formcode']); $userFields['fields']['opc_password']['name'] = 'opc_password'; //unset($userFields['fields'][$key]); if (!empty($password_clear_text)) { $userFields['fields']['opc_password']['formcode'] = str_replace('type="password"', 'type="text" ', $userFields['fields']['opc_password']['formcode']); } unset($userFields['fields']['password']); //$l = $userFields['fields']['opc_password']; } if ($key == 'password2') { if (!empty($password_clear_text)) { $userFields['fields']['password2']['formcode'] = str_replace('type="password"', 'type="text" ', $userFields['fields']['password2']['formcode']); } $userFields['fields']['opc_password2'] = $userFields['fields']['password2']; unset($userFields['fields']['password2']); } if ($key == 'email') { $userFields['fields'][$key]['formcode'] = str_replace('class="required', 'class="required email ', $userFields['fields']['email']['formcode']); $userFields['fields'][$key]['formcode'] = str_replace('type="text"', 'type="email"', $userFields['fields'][$key]['formcode']); if (!empty($double_email)) { $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']); $email2['formcode'] = str_replace('type="email2"', 'type="email"', $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_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; } } } } if ($key == 'EUVatID' || $key == 'eu_vat_id') { $h = '<br /><span style="display: none; position: relative; float: left; clear: both; color: red; font-size: 10px; background: none; border: none; padding: 0; margin: 0;" id="vat_info" class="vat_info">'; $h .= '</span>'; $userFields['fields'][$key]['formcode'] .= $h; } if ($key == 'opc_vat') { if (!empty($opc_euvat)) { if (!empty($userFields['fields']['opc_vat'])) { $un = $userFields['fields']['opc_vat']['formcode']; if (!empty($opc_euvat_button)) { $un .= '<br /><input type="button" value="' . OPCLang::_('COM_ONEPAGE_VALIDATE_VAT_BUTTON') . '" onclick="javascript: Onepage.validateOpcEuVat(this);" class="opc_euvat_button" />'; } $un .= '<br /><span class="vat_info" style="display: none; position: relative; color: red; font-size: 10px; background: none; border: none; padding: 0; margin: 0;" id="vat_info">'; $un .= OPCLang::_('COM_ONEPAGE_VAT_CHECKER_INVALID'); $un .= '</span>'; $userFields['fields']['opc_vat']['formcode'] = $un; } } } if ($key == 'username') { if (!empty($opc_check_username)) { if (!OPCloader::logged($cart) && empty($uid)) { if (!empty($userFields['fields']['username'])) { $u = OPCLang::_('COM_VIRTUEMART_REGISTER_UNAME'); $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_ONEPAGE_EMAIL_ALREADY_EXISTS', $u); $un .= '</span>'; $userFields['fields']['username']['formcode'] = $un; } } } } } } if (!empty($email2)) { $userFields['fields']['email2'] = $email2; } if (!defined('OPC_IN_REGISTRATION_MODE')) { jimport('joomla.html.parameter'); $plugin = JPluginHelper::getPlugin('system', 'vm_mailchimp'); if (!empty($plugin)) { if (class_exists('JParameter')) { $params = new JParameter($plugin->params); } else { $params = new JRegistry($plugin->params); } $opc = $params->get('disable_in_opc', false); if (!empty($opc)) { unset($userFields['fields']['mailchimp']); } } } if (!empty($userFields)) { self::reorderFields($userFields, $skipreorder); } }
<?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>
public static function getStateList(&$ref) { /* if (!class_exists('VirtueMartModelState')) require(JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'state.php'); if (!class_exists('VirtueMartModelCountry')) require(JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'country.php'); */ $db = JFactory::getDBO(); $q = 'select count(*) as count from #__virtuemart_states where 1'; $db->setQuery($q); $count = $db->loadResult(); $js_filename = 'opc_states_' . VMLANG . '_' . $count . '.js'; $js_file = JPATH_SITE . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'dynamic_scripts' . DS . $js_filename; $js_path = 'components/com_onepage/config/dynamic_scripts/'; $js = ' var OPCStates = { ' . "\n"; require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php'; $countryModel = OPCmini::getModel('country'); //new VirtueMartModelCountry(); $list = $countryModel->getCountries(true, true, false); $countries = array(); $states = array(); $stateModel = OPCmini::getModel('state'); //new VirtueMartModelState(); // if state is set in BT, let's make it default if (!empty($ref->cart->BT) && !empty($ref->cart->BT['virtuemart_state_id'])) { $cs = $ref->cart->BT['virtuemart_state_id']; } else { $cs = ''; } //$html = '<div style="display: none;">'; $counts = count($list); $ci = 0; foreach ($list as $c) { if (empty($c->published)) { continue; } $ci++; $states[$c->virtuemart_country_id] = $stateModel->getStates($c->virtuemart_country_id, true, true); unset($state); //$html .= '<input type="hidden" name="opc_state_list" id="state_for_'.$c->virtuemart_country_id.'" value="" />'; if (!empty($states[$c->virtuemart_country_id])) { $js .= ' state_for_' . $c->virtuemart_country_id . ': { ' . "\n"; //$html .= '<select id="state_for_'.$c->virtuemart_country_id.'">'; //$html .= '<option value="">'.OPCLang::_('COM_VIRTUEMART_LIST_EMPTY_OPTION').'</option>'; $counts2 = count($states[$c->virtuemart_country_id]); $ci2 = 0; foreach ($states[$c->virtuemart_country_id] as $state) { if (empty($state->published)) { continue; } $ci2++; //$js .= ' state_for_'.$c->virtuemart_country_id.'['.$state->virtuemart_state_id.']: "'.str_replace('"', '\"', $state->state_name).'",'."\n"; $js .= $state->virtuemart_state_id . ': "' . str_replace('"', '\\"', $state->state_name) . '"'; if ($ci2 != $counts2) { $js .= ', '; } $js .= "\n"; //$html .= '<option '; //if ($state->virtuemart_state_id == $cs) $html .= ' selected="selected" '; //$html .= ' value="'.$state->virtuemart_state_id.'">'.$state->state_name.'</option>'; } $js .= ' }'; if ($ci != $counts) { $js .= ', '; } $js .= "\n"; //$html .= '</select>'; } // debug } $js .= ' }; '; $html = '<div style="display: none;">'; $html .= '<select id="no_states" name="no_states">'; $html .= '<option value="">' . OPCLang::_('COM_VIRTUEMART_LIST_EMPTY_OPTION') . '</option>'; $html .= '</select>'; $html .= '</div>'; //$html .= '</div>'; //alert(OPCStates.state_for_10[373]); if (!empty($ref->cart->BT) && !empty($ref->cart->BT['virtuemart_state_id'])) { $cs = $ref->cart->BT['virtuemart_state_id']; } else { $cs = ''; } if (!empty($ref->cart->ST) && !empty($ref->cart->ST['virtuemart_state_id'])) { $css = $ref->cart->ST['virtuemart_state_id']; } else { $css = ''; } $html .= '<script type="text/javascript"> var selected_bt_state = \'' . $cs . '\'; var selected_st_state = \'' . $css . '\'; </script>'; //$html = '<script>'.$js.'</script>'; jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); if (JFile::write($js_file, $js) !== false) { JHTMLOPC::script($js_filename, $js_path); } else { $html .= ' <script type="text/javascript"> //<![CDATA[ ' . $js . ' //]]> </script> '; } return $html; return ''; }