Post by cdstg » Wed Feb 24, 2010 6:49 am

A lot of prices we only have the sale price including tax ( GST in our case)
So wanted a way to enter it like that
This appears to work but use at your own risk I did it for 1.4 so am unsure if it works for other versions
also does not work for sales price yet if I have time will do that as well

Unzip it in your cart directory and it all overwrite
admin\language\english\catalog\product.php
admin\view\template\catalog\product_form.tpl
admin\index.php
admin\controller\catalog\product.php

In your admin set display prices with TAX
It will also use your store settings country and location for the TAX rate when entering
so make sure you have a Geo class that matches that with a tax rate in the tax class

When entering your products you can enter as Gross ( eg with tax ) and it will back calculate the net ( before tax price ) or if you enter that price then it to forward calculate the gross price

It still only saves the price to the database
and if the shopper has other taxes because of his area he will still get these

anyway it works for my case and certainly helps the person entering the prices

Newbie

Posts

Joined
Wed Feb 24, 2010 6:35 am

Post by isparduotuvele » Fri Apr 09, 2010 2:47 pm

Is this solution upgrade proof or I should reinstall files after every upgrade of OC? Houw about compatibility issues after OC update? Any chances this could be implemented in core? In my opinion it very usefull feature, because when you sold as enterprice and need to add VAT using backward math it's practically impossible to get "marketig price" as XX.99 or so.
Also I get an error, that required file /system/library/measurement.php can not be found.


Posts

Joined
Wed Apr 07, 2010 6:42 pm

Post by katalin » Sun May 23, 2010 9:06 pm

Very interesting, that would help me a lot, the archive seems to be damaged, could you please post a guide on how we can do this?
PS: I am using v1.4.6.

Active Member

Posts

Joined
Wed May 05, 2010 2:28 am

Post by Xsecrets » Sun May 23, 2010 10:34 pm

isparduotuvele wrote:Is this solution upgrade proof or I should reinstall files after every upgrade of OC? Houw about compatibility issues after OC update? Any chances this could be implemented in core? In my opinion it very usefull feature, because when you sold as enterprice and need to add VAT using backward math it's practically impossible to get "marketig price" as XX.99 or so.
Also I get an error, that required file /system/library/measurement.php can not be found.
considering the files it overwrites no it absolutely would not be upgrade proof. And you wouldn't want to blindly go overwriting the files for the next version either. If there are any changes in the product entry at all it would completely remove them.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by katalin » Sun May 23, 2010 11:09 pm

@Xsecrets How about the files? Where can I download them?

Active Member

Posts

Joined
Wed May 05, 2010 2:28 am

Post by mcs107 » Tue Jun 01, 2010 12:54 pm

cdstg, any chance of re-uploading the taxchange.zip attachment for us. When I download it, the archive is corrupt. Your contribution looks good; it'd be a shame to not get it because of a transfer error. Thanks in advance.

Newbie

Posts

Joined
Tue Jun 01, 2010 12:10 pm

Post by Xsecrets » Tue Jun 01, 2010 9:10 pm

yeah when the forum had to be reinstalled a while back some of the files got corrupted the op or someone who has the files would have to reupload them.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by katalin » Sun Jun 13, 2010 7:24 pm

Here's the original attachment.

Active Member

Posts

Joined
Wed May 05, 2010 2:28 am

Post by tronics » Wed Jun 16, 2010 3:19 am

Or simply use this hack by only exchanging this templatefile in admin/views/template/catalog/product_form.php
and change TAXVALUE - ENTER DIRECTLY according to your value. Ok this is a bit simpler but much easier to handle.

There are only 2 blocks needed, easy to update them in the next release, marked with
<!-- TAXMOD1 BEGIN --> <!-- TAXMOD1 END -->

Cheers,
tronics

Newbie

Posts

Joined
Wed Jul 15, 2009 5:05 pm

Post by tronics » Wed Jun 16, 2010 3:33 am

Unfortunately the upload does not work however just replace the price against:

Code: Select all

          <!-- TAXMOD1 BEGIN -->
          <tr>
            <td><b>Bruttopreis</b> Komma mit . angeben nicht mit Komma</td>
            <td><input type="text" id="grossprice" name="grossprice" onkeyup="updateNet()" value="<?php print ($price*1.2); ?>" /></td>
          </tr>
          <tr>
            <td><?php echo $entry_price; ?></td>
            <td><input type="text" id="price" name="price" onkeyup="updateGross()" value="<?php echo $price; ?>" /></td>
          </tr>
          <!-- TAXMOD1 END -->

--------------

and below use this javascript but change the TAX value first:

Code: Select all

<script type="text/javascript"><!--
var image_row = <?php echo $image_row; ?>;

function addImage() {
    html  = '<tbody id="image_row' + image_row + '">';
	html += '<tr>';
	html += '<td class="left"><input type="hidden" name="product_image[' + image_row + ']" value="" id="image' + image_row + '" /><img src="<?php echo $no_image; ?>" alt="" id="preview' + image_row + '" class="image" onclick="image_upload(\'image' + image_row + '\', \'preview' + image_row + '\');" /></td>';
	html += '<td class="left"><a onclick="$(\'#image_row' + image_row  + '\').remove();" class="button"><span><?php echo $button_remove; ?></span></a></td>';
	html += '</tr>';
	html += '</tbody>';
	
	$('#images tfoot').before(html);
	
	image_row++;
}
//--></script>
<script type="text/javascript" src="view/javascript/jquery/ui/ui.datepicker.js"></script>
<script type="text/javascript"><!--
$(document).ready(function() {
	$('.date').datepicker({dateFormat: 'yy-mm-dd'});
});
//--></script>
<script type="text/javascript"><!--
$.tabs('#tabs a'); 
$.tabs('#languages a'); 
//--></script>

<!-- TAXMOD1 BEGIN -->
  <script type="text/javascript"><!--

 
    function doRound(x, places) {
      return Math.round(x * Math.pow(10, places)) / Math.pow(10, places);
    }


    function updateGross() {
      var taxRate = 20; //TAXVALUE - ENTER DIRECTLY
      var grossValue = document.forms["form"].price.value;
    
      if (taxRate > 0) {
        grossValue = grossValue * ((taxRate / 100) + 1);
      }
    
      document.forms["form"].grossprice.value = doRound(grossValue, 4);
    }

    function updateNet() {
      var taxRate = 20; //TAXVALUE - ENTER DIRECTLY
      var netValue = document.forms["form"].grossprice.value;
    
      if (taxRate > 0) {
        netValue = netValue / ((taxRate / 100) + 1);
      }
    
      document.forms["form"].price.value = doRound(netValue, 4);
    }
  //--></script>
<!-- TAXMOD1 END -->
Last edited by i2Paq on Wed Jun 16, 2010 3:37 am, edited 1 time in total.
Reason: Code-tags added

Newbie

Posts

Joined
Wed Jul 15, 2009 5:05 pm

Post by visnetmedia » Fri Jun 25, 2010 1:14 pm

Sorry but can you please tell me if I can change this for the latest opencart. I am not totally sure exactly where to change this - is on the product.php and product_form.tpl

Thanks - don't want to upset the beautiful code.

I changed the code in the product_form.tpl after reading it again but can't get it to have the gross working correctly. Every time I add say 500.0000 and save it when I go back it has 545.4546

Any reason why the gross amount won't stay?

Thanks - not sure if it is because I have to change files anywhere else.

Active Member

Posts

Joined
Fri Feb 12, 2010 7:17 am

Post by visnetmedia » Mon Jun 28, 2010 12:57 pm

Thanks I got this sorted it was on the gross field having $price*1.2 whereas I needed to change this to 1.1
Cheers

Active Member

Posts

Joined
Fri Feb 12, 2010 7:17 am

Post by BMWMaX » Thu Jun 09, 2011 1:07 am

This works fine in 1.4.9.5. Thanks!

Active Member

Posts

Joined
Sat May 21, 2011 3:24 am
Location - Grootebroek

Post by Photospirit » Sun Feb 19, 2012 11:41 pm

Hi,

I'm using the code / script posted by tronics, which works fine for a "single" price.

I tried to use and change the code, so that also the prices in the options table are being shown with/without tax. I was able to add the fields, but the automatic calculation does not work here. I'm not very familiar with JavaScript so any help is appriciated.

Here's the code I'm trying to find the solution

Code: Select all

            <!-- TAXMOD1 BEGIN -->

					<input type="text" id="grossprice1" name="grossprice1" onkeyup="updateNet1()" value="<?php print ($product_option_value['price']*1.025); ?>" size="5" />

                    <input type="text" name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][price]" id="price" onkeyup="updateGross1()" value="<?php echo $product_option_value['price']; ?>" size="5" /></td>



            <!-- TAXMOD1 BEGIN -->
              <script type="text/javascript"><!--
        
        
                function doRound(x, places) {
                  return Math.round(x * Math.pow(10, places)) / Math.pow(10, places);
                }
        
        
                function updateGross1() {
                  var taxRate = 2.5; //TAXVALUE - ENTER DIRECTLY
                  var grossValue = document.forms["form"].price.value;
                  if (taxRate > 0) {
                    grossValue = grossValue * ((taxRate / 100) + 1);
                  }
               
                  document.forms["form"].grossprice1.value = doRound(grossValue, 4);
                }
        
                function updateNet1() {
                  var taxRate = 2.5; //TAXVALUE - ENTER DIRECTLY
                  var netValue = document.forms["form"].grossprice1.value;
               
                  if (taxRate > 0) {
                    netValue = netValue / ((taxRate / 100) + 1);
                  }
               
                  document.forms["form"].price.value = doRound(netValue, 4);
                }
              //--></script>
            <!-- TAXMOD1 END -->
Many thanks for your help.
Cheers, Chris

New member

Posts

Joined
Sat Oct 23, 2010 8:16 pm

Post by robster » Wed Mar 28, 2012 9:22 pm

Interesting thread - is there a version available for 1.5.1.3.1?

I know my place...!


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 8:08 pm
Location - North Yorkshire, UK

Post by hdwallpaper » Fri Sep 21, 2012 5:09 pm

I need it thanks very much

hd wallpaper,widescreen wallpaper,background desktop,desktop wallpaper


Newbie

Posts

Joined
Fri Sep 21, 2012 4:56 pm


Post by i2Paq » Fri Sep 21, 2012 9:04 pm


Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by guntis.e » Mon Nov 25, 2013 5:53 am

Here is commercial solution:

ImageFor Opencart 1.5.x: Price Input Helper - Entering Price With Tax Included
ImageFor Opencart 2.x: Price Input Helper 2 - Enter price with tax

This OpenCart extension allows e-commerce store owner to input prices with tax on product edit form. The price without tax will be automatically calculated and saved with the form.

Features

Imagepossibility to edit and save the price modifyer (or myltiplyer)
Imagepossibility to auto-detect the tax rate based on product tax class
Imagehelper field available in all places where the price input is done:
Imageproduct price
Imageoptions prices
Imagediscounts prices
Imagespecial prices
ImageProduct list page has additional column with price incl. tax

Image

Guntis
Image Partneris.lv - opencart web site development and support


Active Member

Posts

Joined
Fri Jan 28, 2011 4:20 am
Who is online

Users browsing this forum: No registered users and 117 guests