Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2009
    Posts
    64
    Plugin Contributions
    0

    Default Error in tax function ,need help

    I I have an error:
    [21-Feb-2010 20:24:10] PHP Fatal error: Unsupported operand types in /home/converti/public_html/estore/includes/functions/functions_taxes.php on line 176


    Here are the codes:
    ////
    // Add tax to a products price based on whether we are displaying tax "in" the price
    function zen_add_tax($price, $tax) {
    global $currencies;

    if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) ) {
    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']);
    }
    }

    // Calculates Tax rounding the result
    function zen_calculate_tax($price, $tax) {
    global $currencies;
    // $result = bcmul($price, $tax, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
    // $result = bcdiv($result, 100, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
    // return $result;
    return zen_round($price * $tax / 100, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
    }


    I dont understand why because the calling function is checking if $ tax > 0


    When I replace $tax by 1 in the next sentence I have no error

    return zen_round($price * 1 / 100, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);


    Please help me . I try a lot of combination with no success.

    Thanks.

  2. #2
    Join Date
    Mar 2009
    Posts
    64
    Plugin Contributions
    0

    Default Re: Error in tax function ,need help

    Ok solve . I seems that after comming from paypal site my $tax is not numeric . So I made a test is_numeric on hit.

 

 

Similar Threads

  1. v150 Going crazy need help With option manger function!!
    By Darion in forum General Questions
    Replies: 5
    Last Post: 3 Oct 2012, 12:57 AM
  2. Need help: Fatal Error: Call to a member function get_template_part() on a non-object
    By LarryDavidson in forum Upgrading from 1.3.x to 1.3.9
    Replies: 0
    Last Post: 21 Aug 2009, 02:49 PM
  3. Replies: 4
    Last Post: 17 Dec 2008, 10:47 PM
  4. need help finding a core function $box_categories_Array
    By alienfactory in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 9 Jul 2008, 05:08 PM
  5. Editing function- Need a bit of help
    By Amp in forum Templates, Stylesheets, Page Layout
    Replies: 21
    Last Post: 22 Feb 2008, 12:06 AM

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