Jump to content
Latest News: (loading..)

Recommended Posts

Display tax info Version 3.0 by @raiwa

 

Download:

http://addons.oscommerce.com/info/9365
**********************************************************************
Based on:
Version 2.3 for oscommerce-2.3.x:
http://addons.oscommerce.com/info/8160
Original version:
By www.tim-international.net
http://addons.oscommerce.com/info/6725

And:
Tax info 1.6
http://addons.oscommerce.com/info/2788
**********************************************************************
Complete new modularized version.
All Configuration entries, language definitions, currency class extension and styleshhets included in one store module.
Copy the modules and language files and install the module.
That's all.

What does this version do:

It will display the following below the price on each page included in the module:

1. If the tax value of the displayed price is = 0:
    Shows: "VAT excl." or any other text you define in the language file

2. If the tax value of the displayed price is not = 0:
    Shows: "XX% VAT incl." or any other text you define in the language file
    Where XX is the value of the tax in percentage as defined in admin/tax rates
    
Note: For other languages/uses its possible to define a text string before the tax rate and another after the tax rate:
          Example: for german it will look like this: "inkl. XX % MwSt."
 

Page selection where to use the module

Optional parameter added to display_price function which allows to switch off the tax information.

Edited by raiwa

Share this post


Link to post
Share on other sites

Dear Rainer ,

 

First I like to say, installing was a breeze easy and this add-on works and looks great.

 

I have one problem when I enable this add on for the : product_info.php page, I get the following at the top left side of this page :

 

Incl. 21% BTW">
Incl. 21% BTW" />

 

(I'm dutch)

 

When I check the element inspector (Goofle Chrome) the first line is inserted just before the first meta tags and the second one somewhere between the las meta tags.

 

Can you help ?

Share this post


Link to post
Share on other sites

Hello @@pmsmiers,

 

It seems you have a header tag module which uses the "display_price" function on the product_info page. You should localize the header tag module by switching off step by step the header tag modules and then once you know which one, search in it for the "display_price" function. Apply then the modification like explained at the end of the installation instructions under "Optional": Add "false" as the sixth parameter of the "display_price" function.

 

Regards

Rainer

Share this post


Link to post
Share on other sites

Hello @@pmsmiers,

 

It seems you have a header tag module which uses the "display_price" function on the product_info page. You should localize the header tag module by switching off step by step the header tag modules and then once you know which one, search in it for the "display_price" function. Apply then the modification like explained at the end of the installation instructions under "Optional": Add "false" as the sixth parameter of the "display_price" function.

 

Regards

Rainer

Yes, found it in : header_tags_opengraph.php and works great.

Thanks man for this fast reaction.

 

Regards,

Peter

Share this post


Link to post
Share on other sites

Hello Tim @@baulie38,
 
I had a deeper look on this and found the bug. It happens also on product_reviews_write.php.
The st_tax_below_price.php module is loaded in template_top.php which loads in these 2 pages below the product price definition. So the currencies class modification is not yet loaded and doesn't modify the product price.
To fix it, please move this line (line 45 in product_reviews.php, line 75 in product_reviews_write.php):

  require(DIR_WS_INCLUDES . 'template_top.php');

Up before the product price definition (line 29 in product_reviews.php, line 64 in product_reviews_write.php):

  if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
    $products_price = '<del>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
  } else {
    $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
  }

So it should look like this (begins with line 29 in product_reviews.php and line 64 in product_reviews_write.php):

  require(DIR_WS_INCLUDES . 'template_top.php');

  if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
    $products_price = '<del>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
  } else {
    $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
  }

Please confirm and I'll include these instructions to the add-on.

 

Thank you and kind regards

Rainer

Share this post


Link to post
Share on other sites

What's Happening her

With 19% Tax in Germany for a Product that Cost 5.00 EURO Net Price When in Configuration Display Prices with Tax "False" everything is fine I see 5.00 EURO.

But when I Turn Display Prices with Tax "True" I see the amount of 16,28.

It has nothing to do with the Modul when I Turn the Module off I see the same wrong number 16.28

I post it her because of the strange Tax amount under the price see the attached Pictures.

https://www.dropbox.com/s/pu776n1q0r9hjn8/Display%20Prices%20with%20Tax19%25_False.jpg?dl=0

Share this post


Link to post
Share on other sites

What's Happening her

With 19% Tax in Germany for a Product that Cost 5.00 EURO Net Price When in Configuration Display Prices with Tax "False" everything is fine I see 5.00 EURO.

But when I Turn Display Prices with Tax "True" I see the amount of 16,28.

It has nothing to do with the Modul when I Turn the Module off I see the same wrong number 16.28

I post it her because of the strange Tax amount under the price see the attached Pictures.

https://www.dropbox.com/s/pu776n1q0r9hjn8/Display%20Prices%20with%20Tax19%25_False.jpg?dl=0

I found the error

In the data base at the Table "zones_to_geo_zones" the "zone_id" of the default zone must set to "0" it was set to "1" that "1" was giving the wrong tax calculation.

If someone has the same problem the solution is set in the Table "zones_to_geo_zones" the "zone_id" to "0"

Share this post


Link to post
Share on other sites

Maybe this time I am more Lucky and somebody will help

I want to display the Product Price Like this: (in the middle the calculated Tax amount)

Preis: 5,00€

+19%MwSt.: 0,95€

Total: 5,95€

 

I Have done This (In Germany the vat is19%) and it displays the vat also the 19

Preis: 5,00€

+19%MwSt.: 19,00€

Total: 5,95€

Here is the Code:

-----------

    function display_price($products_price, $products_tax, $quantity = 1, $show_tax_info = true) {
 if(DISPLAY_PRICES_NET_GROSS == 'true' && DISPLAY_PRICE_WITH_TAX == 'true' && $products_price > 0){
return '' . $this->format($products_price * $quantity . '<br /><small>', true, null, null, $products_tax, $show_tax_info) . $this->format($products_tax) . '<br />' . $this->format($this->calculate_price($products_price, $products_tax, $quantity)) . '</small>';
 }
 else{
        return $this->format($this->calculate_price($products_price, $products_tax, $quantity));
      }
    }
-----------
I don't know how to fix this part: . $this->format($products_tax)
Would be happy if somebody could help

Share this post


Link to post
Share on other sites

I installed the Version 3.4

and Become the following Error (in Version 3.3 everything was o.k.)

 

Warning: include(includes/languages/english/modules/cfg_modules/st_tax_below_price.php) [function.include]: failed to open stream: No such file or directory in /users/folder/www/catalog/admin/includes/classes/cfg_modules.php on line 28

Warning: include() [function.include]: Failed opening 'includes/languages/english/modules/cfg_modules/st_tax_below_price.php' for inclusion (include_path='.') in /users/folder/www/catalog/admin/includes/classes/cfg_modules.php on line 28

 

Fatal error: Class 'st_tax_below_price' not found in /users/folder/www/catalog/admin/includes/classes/cfg_modules.php on line 31

 

P.S. The Verson is OSC Edge the Newest with Depricaded names-paths ...

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Thanks! Solved was my mistake

Confusing folders and I put a file that had to come to the "front/modules" folder in "admin/modules" folder to.

I had inside the folder

/catalog/admin/includes/modules/cfg_modules/

2 files 

1. st_tax_below_price.php (this is only needed in "front/modules" folder and was causing the error)

2. cfgm_store.php

 

Thanks !

Share this post


Link to post
Share on other sites

Hello Rainer
 
Thank you for this simple contribution! I did not wanted to install the way to big German Market add-on (as for the moment Switzerland fortunately is not requesting these EU stuff...) - so I tired yours and it is working perfectly. In my old store (2.2 MS) I had as well an additional link to the shipping page included. 
 
I tried a bit around and found that the coding is quite simple. So I cam up with this solution:

 

Starting at line 218 I added--> tep_href_ link('shipping.php') 
$format_string .= 
    sprintf(MODULE_STORE_TAX_BELOW_PRICE_INCLUDING_TAX_AMOUNT, $products_tax, tep_href_link('shipping.php'), null);
     } else {
     $format_string .= 
          sprintf(MODULE_STORE_TAX_BELOW_PRICE_INCLUDING_TAX_TEXTONLY, tep_href_link('shipping.php'));

and in the language file I added <a href="%s">shipping</a>

define('MODULE_STORE_TAX_BELOW_PRICE_INCLUDING_TAX_TEXTONLY', 'VAT incl. + <a href="%s">shipping</a>');/***!---  Put here the text to display when Display tax amount? = false--***/
  define('MODULE_STORE_TAX_BELOW_PRICE_INCLUDING_TAX_AMOUNT', '%s%% VAT incl. + <a href="%s">shipping</a>');/***!---  Put here the text to display when Display tax amount? = true--***/

So I ended up with a clickable link which leads to the shipping & returns page.

 

Maybe there would even be an easier way, but I am just a beginner :-)

 

Regards - Felix

 


Whoever finds errors and misspellings in my postings can keep them  o:)

 

Moving from 2.2 MS to 2.3.4 BS EDGE - and I love this version!

 

I might show "online" all the time - but I might be away from my computer  ;)

Share this post


Link to post
Share on other sites
On 4.10.2015 at 11:39 AM, raiwa said:

Hello Peter @@pmsmiers,

 

Thanks for the report. I'll include a fix for this in the next update.

 

regards

Rainer

Hi Rainer,

great contribution!

problem exists anymore.

(

I have one problem when I enable this add on for the : product_info.php page, I get the following at the top left side of this page :

 

Incl. 21% BTW">
Incl. 21% BTW" />

)

After deactivating the open_graph in SEO Header Tag V3.3.5 the problem is solved.

 

Kind Regards

David

Unbenannt.PNG

Edited by rubberfashion

Share this post


Link to post
Share on other sites

Hello David @rubberfashion,

 

It seems the SEO Header Tag still uses the "display_price" function to format and show the price. Display Tax Info modifies this function to add the tax info.

Another function, "display_raw" has been introduced in 2.3.4 BS EDGE and should be used for all SEO Tags.

Please find in your SEO Header Tag the "display_price" function and replace it by ""display_raw". This should solve the problem.

Another possibility is to supress the Tax Info addition by adding an additional parameter to the "display_price" function.

This is explained in the Display Tax Info Instructions under "OPTIONAL".

rgds

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

@raiwa

Very great work...!!!!!!!!!!!!!!!


  • The clever one learn from everything and from everybody
  • The normal one learn from his experience
  • The silly one knows everything better

[socrates, 412 before Christ]

Computers help us with the problems we wouldn't have without them!
99.9% of the bugs sit in front of the computer!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0

if(isset($this) || !isset($this)){ // that's the question...

 

Share this post


Link to post
Share on other sites

@raiwahi

Thanks for the addon. I have tried to copy this addon code to show the % of the tax rate,
this is the catalog/includes/languages/english.php

define('GST_TEXT', '('.  (tep_get_tax_rate($product_info['tax_rate'])).' %&nbsp;GST&nbsp;Incl.)');


image.png.7b17792c947c868595bdbee88b7183a2.png

Instead of showing the correct 10% tax, it show 0. How can I fix this problem?

Many thanks!   Lyn

 

Share this post


Link to post
Share on other sites

For the product listing you'll need to use:

tep_get_tax_rate($listing['products_tax_class_id'])

But I wouldn't include the function in the language file. use %s and sprintf(

to format the output.

Edited by raiwa

Share this post


Link to post
Share on other sites

Hello Lyn @ce7,

I had a deeper look now and I believe you can do this easier.

If your problem is that with the header tag of the add-on you get the tax rate shown twice - once below the prices with tax and again below the prices without tax you should do the following:

In the core currency class duplicate and rename the "display_price" and "format" functions to something like "format_no_tax" and "display_price_no_tax".

Be aware to change also the function name used  in the "display_price_no_tax" function from "format" to "format_no_tax".

Then use the function "display_price_no_tax" to show the prices without tax in the product listing modules and elsewhere.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×