Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Jan 2019
    Location
    UK
    Posts
    72
    Plugin Contributions
    0

    Default Strange problem with prices displayed at final stage of checkout

    I was just doing some final testing before going live and I noticed some strange behaviour with the prices displayed at the final stage of checkout. I'm not sure if the problem is being generated by the template I'm using (ZCA Bootstrap-4) or the mod for displaying prices with and without VAT, but on the default green template it does appear to show everything correctly.

    Test 1 - A dummy test product with a cost of 1.00 (1.20 inc vat), the correct information is show at each stage of the checkout process.
    Click image for larger version. 

Name:	test1.jpg 
Views:	38 
Size:	30.7 KB 
ID:	19586

    Test 2 - A syringe which costs 2.75 (3.30 inc vat). The prices are shown correctly on the product info page and in the shopping cart. But the final stage of the checkout process it has changed the products base price to 3.00. The total price at the bottom is correct but the inc vat and ex vat prices are both wrong.
    Click image for larger version. 

Name:	test2.jpg 
Views:	36 
Size:	34.4 KB 
ID:	19587

    I'm using store collection on both test to keep things simple.

  2. #2
    Join Date
    Jul 2012
    Posts
    16,487
    Plugin Contributions
    17

    Default Re: Strange problem with prices displayed at final stage of checkout

    When you say "last stage" of checkout, can you clarify? Would this be checkout_success?

    As far as the template goes, what checkout relate pages in the template or modules within includes/modules/YOUR_TEMPLATE are/were modified as compared to the base fileset and how are they different? Is it just formatting or are there notifiers and other data processing features missing/different?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jan 2019
    Location
    UK
    Posts
    72
    Plugin Contributions
    0

    Default Re: Strange problem with prices displayed at final stage of checkout

    Sorry, it's 'step 2 of 3 - payment information' (index.php?main_page=checkout_payment) which is showing the wrong information. It looks like the ex vat price at the top is rounding to the nearest full GBP. If I set the products base price to 2.50 it shows 3.00 on the last page before paying. If I set the base price as 2.49 then it shows 2.00 on the same page.

    I'll see if I can find the relevant template file and see if I can work out what is going on.

  4. #4
    Join Date
    Jan 2019
    Location
    UK
    Posts
    72
    Plugin Contributions
    0

    Default Re: Strange problem with prices displayed at final stage of checkout

    I was unable to get my head around where the rounding was occurring but it was definitely the inc/ex vat mod. I uninstalled the mod and replaced the relevant files with zen 1.5.7c and Bootstrap files and the totals are displaying correctly. I'll just have to find another method of enabling the display of prices including VAT.

  5. #5
    Join Date
    Jul 2012
    Posts
    16,487
    Plugin Contributions
    17

    Default Re: Strange problem with prices displayed at final stage of checkout

    Have you looked over your currency settings by chance and also can you identify the link to the module that was installed? It would be unusual for it to "blindly" round especially to the decimal instead of at least the number of places for the associated currency(ies)...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Jan 2019
    Location
    UK
    Posts
    72
    Plugin Contributions
    0

    Default Re: Strange problem with prices displayed at final stage of checkout

    The mod i've been using for a long time is Display price with VAT/TAX and Ex VAT/TAX (https://www.zen-cart.com/downloads.php?do=file&id=597).

    After uninstalling it I did try reinstalling and was able to replicate the same issue with rounding up and down on that final step before taking payment.

    I have it working the way I want now but I've had to use the bootstrap template's version of tpl_modules_order_totals.php instead of the inc/ex vat mod's version to ensure confusing information is not displayed before taking payment.

    https://www.thegluepeople.co.uk/

  7. #7
    Join Date
    Jul 2012
    Posts
    16,487
    Plugin Contributions
    17

    Default Re: Strange problem with prices displayed at final stage of checkout

    May I suggest posting the issue and resolution to this at the forum for the plugin? It may be that the instructions might get updated for this or others may benefit.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Sep 2013
    Location
    Devon, UK
    Posts
    56
    Plugin Contributions
    0

    Default Re: Strange problem with prices displayed at final stage of checkout

    I just fixed this myself in 1.57c after seeing the rounding problem. The issue is that $currencies, which is a global, appears not to have been declared as global and therefore a local copy is used instead, which doesn't contain anything. I assume in previous Zen Cart versions it was declared global in some code that included the template (I've only previously tried it up to 1.55f so I can't comment on 1.56 versions).

    The solution for me was to edit the template file includes/templates/YOUR_TEMPLATE/templates/tpl_modules_order_totals.php as follows.

    Original:
    Code:
    <?php 
    /**
     * Displays order-totals modules' output
     */
      for ($i=0; $i<$size; $i++) { ?>
    to:
    Code:
    <?php 
    /**
     * Displays order-totals modules' output
     */
      global $currencies;
      
      for ($i=0; $i<$size; $i++) { ?>
    Having found and fixed the problem, however, I may now just delete the template override altogether as I think I prefer never to display the subtotal with VAT, even when showing prices invclusive of VAT to our UK customers. Including VAT in the subtotal and then showing the VAT on a separate line on the invoice prompts periodic queries from customers who think they have been charged VAT twice and haven't actually tried totting up the numbers to see that they haven't. I currently get around this by changing the "VAT: x.xx" line to read "(Includes VAT x.xx)" but it is conventional for the subtotal not to include VAT.

  9. #9
    Join Date
    Sep 2013
    Location
    Devon, UK
    Posts
    56
    Plugin Contributions
    0

    Default Re: Strange problem with prices displayed at final stage of checkout

    I just fixed this myself in 1.57c after seeing the rounding problem. The issue is that $currencies, which is a global, appears not to have been declared as global and therefore a local copy is used instead, which doesn't contain anything. I assume in previous Zen Cart versions it was declared global in some code that included the template (I've only previously tried it up to 1.55f so I can't comment on 1.56 versions).

    The solution for me was to edit the template file includes/templates/YOUR_TEMPLATE/templates/tpl_modules_order_totals.php as follows.

    Original:
    Code:
    <?php 
    /**
     * Displays order-totals modules' output
     */
      for ($i=0; $i<$size; $i++) { ?>
    to:
    Code:
    <?php 
    /**
     * Displays order-totals modules' output
     */
      global $currencies;
      
      for ($i=0; $i<$size; $i++) { ?>
    Having found and fixed the problem, however, I may now just delete the template override altogether as I think I prefer never to display the subtotal with VAT, even when showing prices inclusive of VAT to our UK customers. Including VAT in the subtotal and then showing the VAT on a separate line on the invoice prompts periodic queries from customers who think they have been charged VAT twice and haven't actually tried totting up the numbers to see that they haven't. I currently get around this by changing the "VAT: x.xx" line to read "(Includes VAT x.xx)" but it is conventional for the subtotal not to include VAT.

  10. #10
    Join Date
    Jul 2012
    Posts
    16,487
    Plugin Contributions
    17

    Default Re: Strange problem with prices displayed at final stage of checkout

    Quote Originally Posted by BillJ View Post
    I just fixed this myself in 1.57c after seeing the rounding problem. The issue is that $currencies, which is a global, appears not to have been declared as global and therefore a local copy is used instead, which doesn't contain anything. I assume in previous Zen Cart versions it was declared global in some code that included the template (I've only previously tried it up to 1.55f so I can't comment on 1.56 versions).

    The solution for me was to edit the template file includes/templates/YOUR_TEMPLATE/templates/tpl_modules_order_totals.php as follows.

    Original:
    Code:
    <?php 
    /**
     * Displays order-totals modules' output
     */
      for ($i=0; $i<$size; $i++) { ?>
    to:
    Code:
    <?php 
    /**
     * Displays order-totals modules' output
     */
      global $currencies;
      
      for ($i=0; $i<$size; $i++) { ?>
    Having found and fixed the problem, however, I may now just delete the template override altogether as I think I prefer never to display the subtotal with VAT, even when showing prices inclusive of VAT to our UK customers. Including VAT in the subtotal and then showing the VAT on a separate line on the invoice prompts periodic queries from customers who think they have been charged VAT twice and haven't actually tried totting up the numbers to see that they haven't. I currently get around this by changing the "VAT: x.xx" line to read "(Includes VAT x.xx)" but it is conventional for the subtotal not to include VAT.
    While this may have prevented the problem seen, it still doesn't look like the right solution or perhaps the problem is caused by something else.

    The tpl_ files are expected to be in the global space. That means any variable referenced within them is expected to be in the global space. The $currencies variable when needed is routinely loaded either in the associated header_php.php file for the page or its main_template_vars like file. Having to declare $currencies as a global indicates that this template file is being loaded/run within some other code section like a function or class method. If that is the case, the function/class method really should ensure that the variable is brought into the current space rather than the file that is being called. Meaning, where global $currencies has been added, it should be within the out-of-scope code section that is calling this template file.

    In other words would suggest using tools->developers tool kit to search for: tpl_modules_order_totals. I would suggest giving a few lines before/after so that might be able to tell when/where it is called within another function/class method and report the results.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 Discount For Completing Survey At Final Checkout Stage
    By ShopVille in forum General Questions
    Replies: 6
    Last Post: 11 Apr 2022, 05:16 PM
  2. Choose displayed prices with or without tax
    By ffredrik in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 28 Oct 2009, 03:40 PM
  3. Tax problem on last stage of checkout
    By Kylles in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 3
    Last Post: 6 Sep 2007, 02:04 AM
  4. Problems with checkout stage 2 (payment options
    By jas99villa in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 6 Jun 2006, 02:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR