Announcement

Collapse
No announcement yet.

Price not showing with VAT !?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Use Parent (=Standard Layout using CSS v8_5_2_0)

    I guess I could just put a php block in there to add the VAT...

    Comment


      #17
      No matt that is the product layout, i want to know the price layout.

      Comment


        #18
        Use Parent (=Standard Tax Inclusive Price)

        Comment


          #19
          If there is nothing amiss on the tax tab in business settings or on the vat settings itself on the product, i'm afraid all my ideas are exhausted without seeing it. Perhaps someone else can think of something. Sorry.

          Comment


            #20
            hmmmm... cant find whats causing it.

            Perhaps you could tell me if there is a variable that outputs the product price as a decimal number without the £ sign.

            <actinic:variable name="TaxExclusivePrice" />

            Gives a £ sign infront of it.

            <actinic:variable name="Price" />

            Gives me some rubbish.. '{£21.28}'

            Anyway of getting a clean number?


            I've tried

            Code:
            $price = "<actinic:variable name="TaxExclusivePrice" />";
            $thisprice = str_replace("£","",$price);
            $thisprice = trim($thisprice);
            
            if ($taxstatus == 2) 
            {
            // Apply VAT
            $price = $thisprice; 
            echo $price; //Prints correct price without vat
            $price = round($price , 2);
            $price = number_format($price,2); 
            echo $price; // Prints out 0.00
            
            		$price_with_vat = $price + (17.5 *($price /100));
            		$price_with_vat = round($price_with_vat , 2);
            		$price_with_vat = number_format($price_with_vat,2);
            
            echo $price_with_vat; // Prints 0.00
            }

            The first echo of price works but the second does not. Well it doew but it outputs 0.00 . I figure this is because $price is formed from a string and php will only deal with numbers when rounding or doing maths.

            So why Im looking for a clean number from an actinic price var.

            Comment


              #21
              Ok thanks for all you help Lee..

              I've managed to sort this out. I couldnt work with Actinic anymore, it just doesnt want to play by the rules, so I hacked a solution.

              Code:
              <!-- ProductPrice PHP begin -->
              <!-- This template uses php to access mysql products db to get price with correct tax status. -->
              <br/>
              <span class="actprice"><b>&pound;
              <!-- Connection PHP -->
              <actinic:block php="true" >	
              
              $connection = mysql_connect ("","", "") or die ("Cannot make the connection");
              $db = mysql_select_db ("",$connection) or die ("Cannot connect to database");
              
              //CHECK TAX
              $thisproduct = '<actinic:variable encoding="perl" name="ProductID" selectable="false" />';
              $thisproduct = trim($thisproduct);
              
              $query = sprintf("SELECT * FROM cl_products WHERE offer_id='$thisproduct' LIMIT 1");
              
              $result = mysql_query($query);
              
              if (!$result) {
                  $message  = 'Invalid query:';
                  $message .= 'Whole query: ' . $query;
                  die($message);
              }
              
              while ($row = mysql_fetch_assoc($result)) 
              {
              $taxstatus = $row['tax']; 
              $prodprice = $row['price']; 
              }
              
              mysql_free_result($result);
              
              
              
              if ($taxstatus == 2) 
              {
              // Apply VAT
              		$price_with_vat = $prodprice + (17.5 *($prodprice /100));
              		$price_with_vat = round($price_with_vat , 2);
              		$price_with_vat = number_format($price_with_vat,2);
              
              echo $price_with_vat;
              }
              else 
              {
              echo $prodprice;
              }
              
              
              </actinic:block>
              <!-- Connection PHP -->
              
              </b></span><br/>
              
              
              <!-- ProductPrice PHP end -->

              Comment

              Working...
              X