Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Please help me...


Guest

Recommended Posts

Hi there, i was wondering if anybody would be kind enough to help me with a little problem i'm having.

 

I have an oscommerce shop setup and running, and all is well, with the exception of one issue, and this being something that is quite important.

 

Along the course of adding products to the catalog, the "Tax Class" field was left as "--none--", meaning that 840 products later, we have a catalog which displays prices without VAT.

 

This is now a problem for a number of reasons, and we now need the products to display with the VAT value showing.

 

I couldn't see an option in the admin area to make mass changes to this field, and therefore i'm stuck and was hoping i'd be able to find a way to do this.

 

I looked into the mysql database, under the products table and there is a field called "products_tax_class_id". In this field, at the moment, all products have a value of 0, which represents the "--none--" option set when adding products before. Having made changes one product on the catalog manually (changed the tax class from "--none--" to "VAT" that i setup, the "0" value for the product under the "products_tax_class_id" had changed to "2".

 

I guessed that a simple sql query would do the job of changing all products in this way, where this would be an sql query instructing that all values in the products table under the "products_tax_class_id" field would be changed from their current value or "0" to "2", meaning that all my products would now be under the "VAT" tax class i set up earlier, and that prices would show *with* VAT, solving my problem.

 

The thing is, i am not too hot on the mysql side of things, and i have no idea where to start with writing this sql query, even though i'm quite sure that it;s only a few lines.

 

Any help with this would be much appreciated, as we're hoping to launch the shop over the next week.

 

Thanks in advance,

 

Anthony.

Link to comment
Share on other sites

you can use the mysql.com web site to learn how to structure the query, i personally do not like giving the query, because if you do not do it exactly as what you are shown, then you could come back and say it was wrong, that it wiped out the database.

 

basically you will want to look in the mysql.com site for the update command, for updating the products table by setting the tax class to the appropriate value

Link to comment
Share on other sites

Hi there, i was wondering if anybody would be kind enough to help me with a little problem i'm having.

 

I have an oscommerce shop setup and running, and all is well, with the exception of one issue, and this being something that is quite important.

 

Along the course of adding products to the catalog, the "Tax Class" field was left as "--none--", meaning that 840 products later, we have a catalog which displays prices without VAT.

 

This is now a problem for a number of reasons, and we now need the products to display with the VAT value showing.

 

I couldn't see an option in the admin area to make mass changes to this field, and therefore i'm stuck and was hoping i'd be able to find a way to do this.

 

I looked into the mysql database, under the products table and there is a field called "products_tax_class_id". In this field, at the moment, all products have a value of 0, which represents the "--none--" option set when adding products before. Having made changes one product on the catalog manually (changed the tax class from "--none--" to "VAT" that i setup, the "0" value for the product under the "products_tax_class_id" had changed to "2".

 

I guessed that a simple sql query would do the job of changing all products in this way, where this would be an sql query instructing that all values in the products table under the "products_tax_class_id" field would be changed from their current value or "0" to "2", meaning that all my products would now be under the "VAT" tax class i set up earlier, and that prices would show *with* VAT, solving my problem.

 

The thing is, i am not too hot on the mysql side of things, and i have no idea where to start with writing this sql query, even though i'm quite sure that it;s only a few lines.

 

Any help with this would be much appreciated, as we're hoping to launch the shop over the next week.

 

Thanks in advance,

 

Anthony.

 

 

create this as a .php file upload to your site, browse to it http://www.yoursite.com/pageyousaved.php

 

<html>
<head>
<title>Update Tax Class</title>
</head>
<body>
<?php
mysql_connect('localhost','username','pass'); //<---enter your username and password
mysql_select_db('db_name');//<-----put in your database name

$Query = "update products set products_tax_class_id=2 where products_tax_class_id=0";

$Result = mysql_query($Query);
$HowMany = mysql_affected_rows();

if ($HowMany){
      print "Update Worked: $HowMany records updated";
}
else {
      print "Update failed";
}
?>
</body>
</html>

 

You use this at your own risk

Link to comment
Share on other sites

Thanks a lot for your help, much appreciated.

i'll make a backup of my database and then try the php script.

 

Thanks again.

 

Anthony.

 

create this as a .php file upload to your site, browse to it http://www.yoursite.com/pageyousaved.php

 

<html>
<head>
<title>Update Tax Class</title>
</head>
<body>
<?php
mysql_connect('localhost','username','pass'); //<---enter your username and password
mysql_select_db('db_name');//<-----put in your database name

$Query = "update products set products_tax_class_id=2 where products_tax_class_id=0";

$Result = mysql_query($Query);
$HowMany = mysql_affected_rows();

if ($HowMany){
? ? ? print "Update Worked: $HowMany records updated";
}
else {
? ? ? print "Update failed";
}
?>
</body>
</html>

 

You use this at your own risk

Link to comment
Share on other sites

  • 8 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...