Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2005
    Location
    Finland
    Posts
    186
    Plugin Contributions
    1

    database error [OPEN CHANGE-331 ]Wrong display of prices inc. tax on order and invoice

    Order and invoice view displayes prices ex. tax in the column inc. tax if 'Configuration -> My Store -> Display Prices with Tax in Admin' is set to 'false'

    A price display telling it's inc. tax should be inc. tax whatever this setting is.
    Now the price display inc. and ex. tax is the same, if set to false.

    Guess same issue applyes to frontend.

  2. #2
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,896
    Blog Entries
    2
    Plugin Contributions
    2

    Default Re: [OPEN CHANGE-331 ]Wrong display of prices inc. tax on order and invoice

    Hi,

    We do agree that the display of totals in admin dependant on DISPLAY_PRICES_WITH_TAX can be a little confusing and needs to be better formatted.

    As such have moved this to change management.

    Thanks.

  3. #3
    Join Date
    Nov 2004
    Location
    Glasgow, Scotland
    Posts
    251
    Plugin Contributions
    0

    Default Re: [OPEN CHANGE-331 ]Wrong display of prices inc. tax on order and invoice

    I think I may have the solution to this bug. It requires two minor changes to the following files:
    admin/includes/functions/general.php
    admin/includes/classes/currencies.php

    In admin/includes/functions/general.php we have the 'zen_add_tax' function at around line 1671. This looks like this:
    Code:
    /*  function zen_add_tax($price, $tax) {
        global $currencies;
        if (DISPLAY_PRICE_WITH_TAX_ADMIN == 'true') {
          return zen_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + zen_calculate_tax($price, $tax);
        } else {
          return zen_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
        }
      }
    This returns the price with or without tax added dependent on the value of DISPLAY_PRICE_WITH_TAX_ADMIN which is set in Configuration>>My Store>>Display Prices with Tax in Admin.
    By definition a function named 'zen_add-tax' when called should add the tax regardless so my solution is to change this function to the following:
    Code:
        function zen_add_tax($price, $tax) {
          global $currencies;
          return zen_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + zen_calculate_tax($price, $tax);
      }
    This change alone results in the tax inclusive price being displayed correctly in admin in orders and invoices, however it also results in the product prices in Catalog>>Categories/Products displaying as the tax inclusive price regardless of the value of DISPLAY_PRICE_WITH_TAX_ADMIN. This is not the desired result and requires a change to the 'display_price' function in admin/includes/classes/currencies.php
    At around line 65 this looks like
    Code:
        function display_price($products_price, $products_tax, $quantity = 1) {
    		return $this->format(zen_add_tax($products_price, $products_tax) * $quantity);
        }
    This function sets how the price is displayed and therefore it is here that I believe the value of DISPLAY_PRICE_WITH_TAX_ADMIN should effect the return value. My solution is to change this function to the following:
    Code:
        function display_price($products_price, $products_tax, $quantity = 1) {
    	  if (DISPLAY_PRICE_WITH_TAX_ADMIN == 'true') {
    		return $this->format(zen_add_tax($products_price, $products_tax) * $quantity);
    	  }
    	  else {
    		return $this->format($products_price * $quantity);
    	  }
          }
    I have tested this on a v1.5 site and cannot find any adverse effects of these changes in either Admin or in the Store. Being 'Admin' files I would not expect any issues in the Store as a result of these changes.

    If anyone finds any issues associated with these changes perhaps they could post these here.

    I hope this helps.

    Alan

 

 

Similar Threads

  1. How to Uninstall?: Display Inc/Ex Tax or VAT Prices, Created by Andrew Moore?
    By omerhanif in forum All Other Contributions/Addons
    Replies: 5
    Last Post: 12 Oct 2010, 08:53 PM
  2. Invoice showing same price for inc and ex tax
    By robsnowden in forum Basic Configuration
    Replies: 4
    Last Post: 6 Aug 2010, 06:45 PM
  3. Display inc. and exl. tax only for registered users
    By gociak in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 20 Jan 2010, 10:02 AM
  4. Price(inc) vs. Order Total Tax on invoice
    By susb8383 in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 0
    Last Post: 23 Jan 2009, 09:32 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