peter3

Members
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

1 Follower

About peter3

Profile Information

  • Real Name
    Ken
  • Gender
    Male
  • Location
    Germany
  1. Hi Jutta, your contribution is really great. Thank you! There are some bugfixes and minor improvements in the code attached (the diff patch as code and the whole file as attachment). Please consider importing them into your code so me and others won't have to fix them again. They are all explained after the "FIXED" markers. Most important issue seems to me the missing new tax calculation if the shipping address (the country) has changed. There are still some issues I could not fix until now: 1. Sometimes the shipping costs are not displayed in the subtotal section the first time the checkout page is opened. This changes after selecting the (single, already selected) shipping method or after submitting/reloading the page. 2. When editing an address, the gender radio buttons appear even if this was turned off in the configuration. 3. I would wish to add support for an optional bank account section between the addresses and the comment which shows up if a special payment option was selected (bank withdrawal - "Bankeinzug" in Germany). Now users can specify their bank account in the comment section only, not in a specific form, and therefore no check on this bank data is possible. 389a390,410 > if (is_array($sendto) && !empty($sendto)) { // FIXED - BEGIN: consider tax after shipping address change > $shipping_address = array('entry_firstname' => $sendto['firstname'], > 'entry_lastname' => $sendto['lastname'], > 'entry_company' => $sendto['company'], > 'entry_street_address' => $sendto['street_address'], > 'entry_suburb' => $sendto['suburb'], > 'entry_postcode' => $sendto['postcode'], > 'entry_city' => $sendto['city'], > 'entry_zone_id' => $sendto['zone_id'], > 'zone_name' => $sendto['zone_name'], > 'entry_country_id' => $sendto['country_id'], > 'countries_id' => $sendto['country_id'], > 'countries_name' => $sendto['country_name'], > 'countries_iso_code_2' => $sendto['country_iso_code_2'], > 'countries_iso_code_3' => $sendto['country_iso_code_3'], > 'address_format_id' => $sendto['address_format_id'], > 'entry_state' => $sendto['zone_name']); > } elseif (is_numeric($sendto)) { > $shipping_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)$sendto . "'"); > $shipping_address = tep_db_fetch_array($shipping_address_query); > } // FIXED - END 391a413 > <div class="left wid40"> </div> <!-- // FIXED: insert spacing between article image and article title --> 393c415 < <div class="left wid75 t-center">' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id'])) . '</div> --- > <div class="left wid75 t-center">' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id'], $shipping_address['entry_country_id'], $shipping_address['entry_zone_id'])) . '</div> </div> <!-- // FIXED: consider tax after shipping address change --> 395c417 < <div class="left wid75 t-center">' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</div> --- > <div class="left wid75 t-center">' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id'], $shipping_address['entry_country_id'], $shipping_address['entry_zone_id']), $products[$i]['quantity']) . '</div> <!-- // FIXED: consider tax after shipping address change --> 743a766 > checkout.totalsRefresh(); // FIXED (?): recalculate totals after sendto variable set in checkout.RowsRefresh('shipping') some lines above 802c825,826 < if ($(this).val().length < $('#checkout').data($(this).attr('name')).len) checkout.errMessage('error', $('#checkout').data($(this).attr('name')).msg); --- > if ( (checkout.ctype == 'create') || !($(this).attr('name') == 'pass') ) // FIXED: password length check only for creating a new account > if ($(this).val().length < $('#checkout').data($(this).attr('name')).len) checkout.errMessage('error', $('#checkout').data($(this).attr('name')).msg); 833,837c857,862 < if ($(this).val().length < $('#checkout').data('pass').len) < { < checkout.errMessage('error', $('#checkout').data('pass').msg); < $(this).val('').blur(); < } --- > if ( (checkout.ctype == 'create') || !($(this).attr('name') == 'pass') ) // FIXED: password length check only for creating a new account > if ($(this).val().length < $('#checkout').data('pass').len) > { > checkout.errMessage('error', $('#checkout').data('pass').msg); > $(this).val('').blur(); > } 970,971c995,996 < if ($('.required_icon:visible', $('#' + type)).size() > 0) alert('Please fill in all required fields'); < else if ($('.error_icon:visible', $('#' + type)).size() > 0) alert('Please correct fields with errors'); --- > if ($('.required_icon:visible', $('#' + type)).size() > 0) alert("<?php echo TEXT_COMPLETE_FORM; ?>"); // FIXED: internationalization > else if ($('.error_icon:visible', $('#' + type)).size() > 0) alert("<?php echo TEXT_ERROR_FORM; ?>"); // FIXED: internationalization 1029c1054,1055 < checkout.AddressRefresh(checkout.addressType); --- > checkout.AddressRefresh('shipping'); // FIXED - BEGIN: update both addresses since other might have changed too (address edit) > checkout.AddressRefresh('payment'); // FIXED - END 1030a1057,1062 > if (checkout.addressType == 'shipping') // FIXED - BEGIN: recalculate taxes after shipping address change > { > checkout.cartRefresh(); > checkout.totalsRefresh(); > checkout.RowsRefresh('payment'); > } // FIXED - END 1037,1038c1069,1070 < if ($('.required_icon:visible', $('#AddressEdit')).size() > 0) alert('Please fill in all required fields'); < else if ($('.error_icon:visible', $('#AddressEdit')).size() > 0) alert('Please correct fields with errors'); --- > if ($('.required_icon:visible', $('#AddressEdit')).size() > 0) alert("<?php echo TEXT_COMPLETE_FORM; ?>"); // FIXED: internationalization > else if ($('.error_icon:visible', $('#AddressEdit')).size() > 0) alert("<?php echo TEXT_ERROR_FORM; ?>"); // FIXED: internationalization 1056,1057c1088,1089 < if ($('.required_icon:visible', $('#AddressNew')).size() > 0) alert('Please fill in all required fields'); < else if ($('.error_icon:visible', $('#AddressNew')).size() > 0) alert('Please correct fields with errors'); --- > if ($('.required_icon:visible', $('#AddressNew')).size() > 0) alert("<?php echo TEXT_COMPLETE_FORM; ?>"); // FIXED: internationalization > else if ($('.error_icon:visible', $('#AddressNew')).size() > 0) alert("<?php echo TEXT_ERROR_FORM; ?>"); // FIXED: internationalization 1237,1238c1269,1270 < if ($('input[name=payment]:checked').size() == 0) alert('Please select a payment method'); < else if ($('#shipping').is(':visible') && $('input[name=shipping]:checked').size() == 0) alert('Please select a shipping method'); --- > if ($('input[name=payment]:checked').size() == 0) alert("<?php echo TEXT_COMPLETE_PAYMENT; ?>"); // FIXED: internationalization > else if ($('#shipping').is(':visible') && $('input[name=shipping]:checked').size() == 0) alert("<?php echo TEXT_COMPLETE_SHIPPING; ?>"); // FIXED: internationalization 1382a1415 > $('input[name=email]', $('#create')).val($('input[name=email]', $('#login')).val()); // FIXED: do not remove email address typed in by user 1416a1450 > $('input[name=email]', $('#create')).val($('input[name=email]', $('#login')).val()); // FIXED: do not remove email address typed in by user 1519a1554 > <div class="left wid40"> </div> <!-- // FIXED: insert spacing between article image and article title --> 1546c1581 < <div class="contentText" id="changeShippingAddress"><?php echo tep_draw_button('Change Address'); ?></div> --- > <div class="contentText" id="changeShippingAddress"><?php echo tep_draw_button(TEXT_CHANGE_ADDRESS); ?></div> <!-- // FIXED: internationalization --> 1562c1597 < <div class="contentText" id="changeBillingAddress"><?php echo tep_draw_button('Change Address'); ?></div> --- > <div class="contentText" id="changeBillingAddress"><?php echo tep_draw_button(TEXT_CHANGE_ADDRESS); ?></div> <!-- // FIXED: internationalization --> 1619c1654 < <p id="gender"><?php echo tep_draw_radio_field('gender', 'm', false); ?> MALE <?php echo tep_draw_radio_field('gender', 'f', false); ?> FEMALE <?php echo (tep_not_null(ENTRY_GENDER_TEXT) ? '<span class="required_icon iconred">✹</span>' : ''); ?></p> --- > <p id="gender"><?php echo tep_draw_radio_field('gender', 'm', false) . ' ' . MALE . ' ' . tep_draw_radio_field('gender', 'f', false) . ' ' . FEMALE . ' '; ?><?php echo (tep_not_null(ENTRY_GENDER_TEXT) ? '<span class="required_icon iconred">✹</span>' : ''); ?></p> <!-- // FIXED: use variable (raw texts "MALE" and "FEMALE" appeared previously) --> checkout.php