♥raiwa Posted April 1, 2016 Share Posted April 1, 2016 (edited) @@Tsimi, Are you sure you modified the right file? For me it works, but I just had this issue. I removed them in teststore A and checked in teststore B o:) if ( !empty($quotes[$i]['error']) ) { $ShipTxt .= '<tr><td>' . $quotes[$i]['module'] . ' (' . $quotes[$i]['error'] . ')</td></tr>'; } else { if ( $selected_shipping['id'] == $thisquoteid) { $ShipTxt.='<tr class="success"><td onclick="return shipincart_submit(\''.$thisquoteid.'\');">' . tep_draw_radio_field('', true, true) . '<a href="_" title="' . MODULE_CONTENT_CART_SHIPPING_ESTIMATOR_SELECT_THIS_METHOD .'"> <strong>' . $quotes[$i]['module'] . ' '; $ShipTxt.= $quotes[$i]['methods'][0]['title'].'</strong> </a></td><td class="text-right"><strong>' . $currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], ((!empty($quotes[$i]['tax']))? $quotes[$i]['tax'] : null ))) . '</strong></td></tr>'; } else { $ShipTxt .= '<tr><td onclick="return shipincart_submit(\''.$thisquoteid.'\');">' . tep_draw_radio_field('', false, false) . '<a href="_" title="' . MODULE_CONTENT_CART_SHIPPING_ESTIMATOR_SELECT_THIS_METHOD . '"> ' . $quotes[$i]['module'] . ' '; $ShipTxt .= $quotes[$i]['methods'][0]['title'] . ' </a></td><td class="text-right">' . $currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], ((!empty($quotes[$i]['tax']))? $quotes[$i]['tax'] : null ))) . '</td></tr>'; } } // added to Display Message when No Shipping Options are Available $at_least_one_quote_printed = true; } elseif ( sizeof($quotes[$i]['methods'])>1 ) { // shipping method with sub methods (multipickup) for ( $j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++ ) { $thisquoteid = $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']; $ShipTxt .= ''; if ( $quotes[$i]['error'] ) { $ShipTxt .= '<tr><td>' . $quotes[$i]['module'] . ' (' . $quotes[$i]['error'] . ')</td></tr>'; } else { if ( $selected_shipping['id'] == $thisquoteid ) { $ShipTxt .= '<tr class="success"><td onclick="return shipincart_submit(\''.$thisquoteid.'\');"><a href="_" title="' . MODULE_CONTENT_CART_SHIPPING_ESTIMATOR_SELECT_THIS_METHOD .'">' . tep_draw_radio_field('', true, true) . ' <strong>'.$quotes[$i]['module'] . ' '; $ShipTxt .= $quotes[$i]['methods'][$j]['title'] . '</strong> </a></td><td class="text-right"><strong>' . $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . '</strong></td></tr>'; } else { $ShipTxt .='<tr><td onclick="return shipincart_submit(\''.$thisquoteid.'\');"><a href="_" title="' . MODULE_CONTENT_CART_SHIPPING_ESTIMATOR_SELECT_THIS_METHOD . '">' . tep_draw_radio_field('', false, false) . $quotes[$i]['module'] . ' '; $ShipTxt .= $quotes[$i]['methods'][$j]['title'] . ' </a></td><td class="text-right">' . $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . '</td></tr>'; } } } If yes, try to get a new passport with a different birthday :thumbsup: But serious: you are right these bracket should be removed or conditioned !empty($quotes[$i]['methods'][$j]['title'])... I'll do that in the next update. rgds Rainer Edited April 1, 2016 by raiwa Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥Tsimi Posted April 1, 2016 Share Posted April 1, 2016 (edited) @@raiwa yeah, looking at the right store, editing the right files. What you just explained, I've been there, done that. Those mistakes rarely happen but they do happen but this time I'm pretty sure that I am editing the right files and looking at the right store. Cursed are those brackets! Well, I'll just keep digging then... Danke! :) Edited April 1, 2016 by Tsimi Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted April 1, 2016 Share Posted April 1, 2016 @@Tsimi, Screenshot of my teststore before and after the change: Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥Tsimi Posted April 1, 2016 Share Posted April 1, 2016 @@raiwa Oh, I didn't mean those brackets. Those went away just fine I mean these. Quote Link to comment Share on other sites More sharing options...
♥Tsimi Posted April 1, 2016 Share Posted April 1, 2016 OK, it looks like that the checkout_shipping changes have no effect on your modules order totals. Usually if I uncomment this 'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'), the shipping should disappear from the order totals listing but it doesn't. So logically removing the brackets code inside the checkout_shipping.php has no effect inside the estimate module. Just a small visual issue and probably not really a big deal. But it might disturb one or the other person. Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted April 1, 2016 Share Posted April 1, 2016 @@Tsimi, I found it. The brackets are added here when it writes the shipping method into the order: $order->info['shipping_method'] = $selected_quote[0]['module'].' ('.$selected_quote[0]['methods'][0]['title'].')'; Tsimi 1 Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥Tsimi Posted April 1, 2016 Share Posted April 1, 2016 (edited) @@raiwa Still no luck. :mellow: I had removed those already, in fact I have removed every single non-code bracket in your module and checkout_shipping.php Still there that %#$&'%#(. :x Like I said not really a very big issue. If you stumble across some lost brackets just tell me please. Edited April 1, 2016 by Tsimi Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted April 1, 2016 Share Posted April 1, 2016 (edited) @@Tsimi, you need to change the selected shipping module at least once to get the change applied to the order and the ot updated. Edited April 1, 2016 by raiwa Tsimi 1 Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥Tsimi Posted April 1, 2016 Share Posted April 1, 2016 @@raiwa HA! That did the trick. Thanks for the super support! :thumbsup: raiwa 1 Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted April 1, 2016 Share Posted April 1, 2016 @@Tsimi, Thanks for the push, I'll include a !empty statement for all places in the next update. Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥Tsimi Posted April 2, 2016 Share Posted April 2, 2016 (edited) @@raiwa Rainer may I ask you for help on something? Regarding the Discount Code 3.2. Somehow it does not calculate the total correctly when adding discounts. In the confirmation page and inside the estimator. Tax calculation inside osC code-wise is not my forte. Shop setup: Display prices with tax = false Example: Sub-Total: 18.90 Discount (10%): -1.89 Flat Rate: 8.90 Tax (19%): 4.98 ------------------------------- Total: 31.19 The total is wrong it should say, 30.89. My guess is it calculates 19% tax on the discount price (1.89). It doesn't recognize the price as discount and as minus amount. I have a black out at the moment and cannot see what place does the calculation. I know you are busy and all but if you find some free time in between could you please take a look at it? Thanks. Edited April 2, 2016 by Tsimi Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted April 2, 2016 Share Posted April 2, 2016 Hello Lambros @@Tsimi, Could you please give this a fast try: if ( !empty($order->info['tax']) ) { $order->info['tax'] += $tax_val; } else { $order->info['tax'] = $tax_val; } if ( !empty($order->info['tax_groups']) ) { $order->info['tax_groups']["$products_tax_description"] += $tax_val; } else { $order->info['tax_groups']["$products_tax_description"] = $tax_val; } change to: $order->info['tax'] += $tax_val; $order->info['tax_groups']["$products_tax_description"] += $tax_val; maybe I messed something up with the undefined variable fix introduced in 2.4.8. Otherwise I'll have a deeper look when I find some time. rgds Rainer Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
Dan Cole Posted April 2, 2016 Share Posted April 2, 2016 @@raiwa Just wanted to say thanks to Rainer for both the excellent contributions and the support that the provides. He goes way above what you might expect in trying to resolve issues and generally help out. A BIG Thumbs up Rainer. :thumbsup: Dan raiwa and Tsimi 2 Quote Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
♥Tsimi Posted April 2, 2016 Share Posted April 2, 2016 (edited) Thanks @@raiwa I do not think that it is an issue in your addon but more in the Discount Code addon. I have an older version of your estimate addon (2.4.6) and the code you recommend is already there. I think something needs to be changed inside the ot_tax.php module to make it understand to not charge/calculate taxes on a discount or something that subtracts an amount. I will try to dig into it as soon I find more time. Need to get something else done first. Thanks again for looking into it. Gruss Tsimi @@Dan Cole Well said! :thumbsup: Edited April 2, 2016 by Tsimi raiwa 1 Quote Link to comment Share on other sites More sharing options...
Dan Cole Posted April 2, 2016 Share Posted April 2, 2016 @@Dan Cole Well said! :thumbsup: Now I just need to learn how to type....geezzzss. Dan Quote Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
♥raiwa Posted April 3, 2016 Share Posted April 3, 2016 (edited) Hello Lambros @@Tsimi, Sub-Total: 18.90 Discount (10%): -1.89 Flat Rate: 8.90 Tax (19%): 4.98 ------------------------------- Total: 31.19 The total is wrong it should say, 30.89. My guess is it calculates 19% tax on the discount price (1.89). It doesn't recognize the price as discount and as minus amount. I have a black out at the moment and cannot see what place does the calculation. I know you are busy and all but if you find some free time in between could you please take a look at it? Thanks. I think I found the fix. We have to loop through the products to accumulate a global tax correction applying the global discount to each products tax rate. Then apply the global tax correction to the orders total. ot_discount.php: $order_tax = 0; for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { if (!empty($order->products[$i]['tax'])) { $global_tax_correction += $this->format_raw($discount - $discount / (1.0 + $order->products[$i]['tax'] / 100)); } } $order->info['total'] -= $global_tax_correction; if (is_array($order->info['tax_groups']) && count($order->info['tax_groups']) > 0) { foreach ($order->info['tax_groups'] as $key => $value) { if (!empty($value)) { $order->info['tax_groups'][$key] = $this->format_raw(($order->info['subtotal'] - $discount) * ($value / $order->info['subtotal'])); $order_tax += $order->info['tax_groups'][$key]; } } } if (!empty($order_tax)) { $order->info['tax'] = $order_tax; } Maybe needs some clean up and additional checks. Hope this helps rgds Rainer Edited April 3, 2016 by raiwa Tsimi 1 Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥Tsimi Posted April 3, 2016 Share Posted April 3, 2016 (edited) Thanks @@raiwa I'll test that. Looking at the code above the place where yours goes there seems to be a tax_correction code. Not sure when that applies though. if (!empty($order->products[$i]['tax'])) { $tax_correction = $this->format_raw($products_discount - $products_discount / (1.0 + $order->products[$i]['tax'] / 100)); $order->info['tax'] -= $tax_correction; $order->info['tax_groups'][$order->products[$i]['tax_description']] -= $tax_correction; } $order->info['total'] -= $products_discount; $discount += $products_discount; Edited April 3, 2016 by Tsimi Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted April 3, 2016 Share Posted April 3, 2016 (edited) @@Tsimi, Yes, I know, but I got $tax_correction = null when I checked it. if (!empty($check['products_id']) || !empty($check['categories_id']) || !empty($check['manufacturers_id'])) { // products, categories, manufacturers based discount } elseif (!empty($check['orders_total'])) { //order totals based discount } Maybe I'm wrong, but it corrected the ot Edited April 3, 2016 by raiwa Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥raiwa Posted April 3, 2016 Share Posted April 3, 2016 @@jamo32, @@Tsimi, @@Dan Cole, I prepared the next update version 2.5. I included all the fixes for the issues you reported and some more which I found myself. - Added fix to keep the shipping address selected in address drop down if coming back from checkout.- Added hidden fields for country and zone to ensure the value is posted if these drop downs are disabled. Thanks to @@Dan Cole for the report- Added default Zip code configuration field to show it on first load if show zip code is enabled.- Enable shipping module selection if quote is 0 (zero). Thanks to @@jamo32 for the report.- Remove empty brackets in shipping module titles if shipping way text is empty. Thanks to @@Tsimi for the report. Could you please give it a try and cjheck if all works as it should. I'll then upload the new version. Please uninstall, upload, install again. There is a new configuration entry. Thank you a lot Rainer Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥Tsimi Posted April 3, 2016 Share Posted April 3, 2016 (edited) @@raiwa Your new file seems to work fine. :thumbsup: Still the tax or total issue persists. Damn tax calculations <_< Es ist zum Haare raus reisen. :x Can you once try the following situation. - Setup 19% tax - Set Show prices with tax to false - Add test product with $18.90 netto price - set flat rate shipping to $8.90 (taxable goods) - Create discount code 10% to the test product or all categories or all products - Order total setup; 1 Sub Total 2 Discount 3 Shipping 4 Tax 5 Total Tell me what total you get. When I try the above setup but create the discount code for order totals only then it works like a charm. Edited April 3, 2016 by Tsimi Quote Link to comment Share on other sites More sharing options...
♥Tsimi Posted April 3, 2016 Share Posted April 3, 2016 (edited) I think I got the total right at least. Replace this (ot_discount.php) $order->info['total'] -= $products_discount; $discount += $products_discount; } } with this $order->info['total'] -= $products_discount; $discount += $products_discount; } } $order->info['total'] -= $tax_correction; Now I get the right total but tax is still showing $4.98 instead of $4.92. Getting closer now... Edited April 3, 2016 by Tsimi Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted April 3, 2016 Share Posted April 3, 2016 @@Tsimi, I get the correct 30.89 with the subtotal discount and my posted modification. Subtotal discount: 1 x The Matrix $18.90 Sub-Total: $18.90 Discount: -$1.89 Flat Rate (): $8.90 FL TAX 19.0%: $4.92 Total: $30.89 Product discount: 1 x The Matrix $18.90 Sub-Total: $18.90 Discount: -$1.89 Flat Rate (): $8.90 FL TAX 19.0%: $4.98 Total: $31.19 Then it seems the old product discount tax correction needs to be fixed too. I tried the following: if (!empty($order->products[$i]['tax'])) { $tax_correction = $this->format_raw($products_discount - $products_discount / (1.0 + $order->products[$i]['tax'] / 100)); $global_tax_correction += $this->format_raw($products_discount - $products_discount / (1.0 + $order->products[$i]['tax'] / 100)); $order->info['tax'] -= $tax_correction; $order->info['tax_groups'][$order->products[$i]['tax_description']] -= $tax_correction; } $order->info['total'] -= $products_discount; $discount += $products_discount; } } $order->info['total'] -= $global_tax_correction; and it corrects the order total, tax is still wrong: product discount: 1 x The Matrix $18.90 Sub-Total: $18.90 Discount: -$1.89 Flat Rate (): $8.90 FL TAX 19.0%: $4.98 Total: $30.89 Tsimi 1 Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥Tsimi Posted April 3, 2016 Share Posted April 3, 2016 @@raiwa Yep that is what I got too thus far. Everything is right except that tax I don't really understand why it is not working though, the code seems to be right. But then again I am by far no expert. Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted April 3, 2016 Share Posted April 3, 2016 @@Tsimi I'm stuck in the same, I'll continue tomorrow. :lol: Tsimi 1 Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥Tsimi Posted April 3, 2016 Share Posted April 3, 2016 :lol: Yeah me too, 1:35am here and the beer doesn't help much either. A good nights sleep might help. Thanks again for your help, very, very appreciated. :thumbsup: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.