Jump to content

Restoring DELETED Tax Group in 1.7.8.10


madpugger

Recommended Posts

Hi, I have an issue where a tax group is deleted (tax group 1) and I would like to restore it, since product imports default to 1 on our import sheets. This then causes an error on the product when it is edited where the next tax is used (0%) when saved. If this is not noticed, then the customer will not pay VAT and it causes us problems!

 

So in the DB, ps_tax_rules_group, there is a column "deleted" which shows this group as "1". When I change it to "0" i can see and edit the group in the BO, but when I save, it goes back to it's deleted state with no changes saved.

 

Is there any other tables i should also edit to re-enable this group?

 

Thanks

Link to comment
Share on other sites

2 hours ago, Nickz said:

make to person pay for damage who deleted that group. So it won't happen again.
Ask your hosting if they have a back up of before the act (of deleting).

It was me. It was deliberate at the time. And a back on help if I don’t know which tables need restored. 
 

in theory, setting deleted to 0’shoukd work. But when I do this, the tax rule only exists until I try to edit it (I.e. remove the EU countries to leave only UK. The deleted status returns in the table on save. 
 

so there must be a log somewhere that the BO checks and is deleting it again. 
 

for clarity, the tax group is not deleted in the database when you delete it. It simply adds a 1 to the deleted column. (And does something else too somewhere!) All the data is still there. 

Link to comment
Share on other sites

30 minutes ago, Nickz said:

Well next time don't do that. Set up a shop in localhost and test there first, get used to make back ups and such. :)

I thank you for your condescending remarks and politely ask that you keep them to yourself!

 

it was intentional at the time and I have plenty backups. I also have plenty text servers. Additionally, your comments offer nothing to the topic and are therefore completely pointless other than to make you feel good about yourself. 

Link to comment
Share on other sites

  • 1 year later...
On 1/6/2024 at 1:26 PM, madpugger said:

I thank you for your condescending remarks and politely ask that you keep them to yourself!

 

it was intentional at the time and I have plenty backups. I also have plenty text servers. Additionally, your comments offer nothing to the topic and are therefore completely pointless other than to make you feel good about yourself. 

brilliant, such a good community member...who knows what you are doing?  what you know?  but I know you are here only to take, not contribute.....I'm sure you are like this in real life....not even sad for you....you make everyone else look like a good person...fu

Link to comment
Share on other sites

I'm thinking this sounds a cache thing as I'm pretty sure I've manually "undeleted" tax groups like this before and it has worked; although I may not have edited the group afterwards (it was just to fix an accidental delete just to restore it to the previous state).

I would make the change, then clear the cache (if you haven't already) and then try editing it. If that doesn't work though let us know and I'd be happy to try and replicate the issue here and see if we can work out what's going on. I've written custom import controllers to get data from POS systems and tax settings have been one of the biggest pains with it. I submitted a pull request that has been merged with 9.0.0 as getIdByName() in that class would return the first name it found even if it had been deleted and a new group of the same name added in again.....

Link to comment
Share on other sites

@madpugger

Hi. I'll give you the SQL with the tables. Just upload the SQL to phpMyAdmin and run it. It will delete the corrupted tables and upload new ones including the original data, as in the initial installation.

The following tables will be restored:

ps_tax, ps_tax_rule, ps_tax_rules_group, ps_tax_rules_group_shop

Alternatively, choose what you want to restore, but I recommend restoring all of the tables mentioned.


DROP TABLE IF EXISTS `ps_tax`;
CREATE TABLE `ps_tax` (
  `id_tax` int(10) UNSIGNED NOT NULL,
  `rate` decimal(10,3) NOT NULL,
  `active` tinyint(1) UNSIGNED NOT NULL DEFAULT 1,
  `deleted` tinyint(1) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `ps_tax` (`id_tax`, `rate`, `active`, `deleted`) VALUES
(1, 4.000, 1, 0),
(2, 0.000, 1, 0),
(3, 6.600, 1, 0),
(4, 6.000, 1, 0),
(5, 8.250, 1, 0),
(6, 2.900, 1, 0),
(7, 0.000, 1, 0),
(8, 0.000, 1, 0),
(9, 6.000, 1, 0),
(10, 4.000, 1, 0),
(11, 4.000, 1, 0),
(12, 6.000, 1, 0),
(13, 6.250, 1, 0),
(14, 7.000, 1, 0),
(15, 6.000, 1, 0),
(16, 5.300, 1, 0),
(17, 6.000, 1, 0),
(18, 4.000, 1, 0),
(19, 5.000, 1, 0),
(20, 6.000, 1, 0),
(21, 6.250, 1, 0),
(22, 6.000, 1, 0),
(23, 6.875, 1, 0),
(24, 7.000, 1, 0),
(25, 4.225, 1, 0),
(26, 0.000, 1, 0),
(27, 5.500, 1, 0),
(28, 6.850, 1, 0),
(29, 0.000, 1, 0),
(30, 7.000, 1, 0),
(31, 5.125, 1, 0),
(32, 4.000, 1, 0),
(33, 5.500, 1, 0),
(34, 5.000, 1, 0),
(35, 5.500, 1, 0),
(36, 4.500, 1, 0),
(37, 0.000, 1, 0),
(38, 6.000, 1, 0),
(39, 7.000, 1, 0),
(40, 6.000, 1, 0),
(41, 4.000, 1, 0),
(42, 7.000, 1, 0),
(43, 6.250, 1, 0),
(44, 4.750, 1, 0),
(45, 6.000, 1, 0),
(46, 4.000, 1, 0),
(47, 6.500, 1, 0),
(48, 6.000, 1, 0),
(49, 5.000, 1, 0),
(50, 4.000, 1, 0),
(51, 5.500, 1, 0),
(52, 6.000, 1, 0);

DROP TABLE IF EXISTS `ps_tax_rule`;
CREATE TABLE `ps_tax_rule` (
  `id_tax_rule` int(11) NOT NULL,
  `id_tax_rules_group` int(11) NOT NULL,
  `id_country` int(11) NOT NULL,
  `id_state` int(11) NOT NULL,
  `zipcode_from` varchar(12) NOT NULL,
  `zipcode_to` varchar(12) NOT NULL,
  `id_tax` int(11) NOT NULL,
  `behavior` int(11) NOT NULL,
  `description` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `ps_tax_rule` (`id_tax_rule`, `id_tax_rules_group`, `id_country`, `id_state`, `zipcode_from`, `zipcode_to`, `id_tax`, `behavior`, `description`) VALUES
(1, 1, 21, 4, '0', '0', 1, 1, ''),
(2, 2, 21, 5, '0', '0', 2, 1, ''),
(3, 3, 21, 6, '0', '0', 3, 1, ''),
(4, 4, 21, 7, '0', '0', 4, 1, ''),
(5, 5, 21, 8, '0', '0', 5, 1, ''),
(6, 6, 21, 9, '0', '0', 6, 1, ''),
(7, 7, 21, 10, '0', '0', 7, 1, ''),
(8, 8, 21, 11, '0', '0', 8, 1, ''),
(9, 9, 21, 12, '0', '0', 9, 1, ''),
(10, 10, 21, 13, '0', '0', 10, 1, ''),
(11, 11, 21, 14, '0', '0', 11, 1, ''),
(12, 12, 21, 15, '0', '0', 12, 1, ''),
(13, 13, 21, 16, '0', '0', 13, 1, ''),
(14, 14, 21, 17, '0', '0', 14, 1, ''),
(15, 15, 21, 18, '0', '0', 15, 1, ''),
(16, 16, 21, 19, '0', '0', 16, 1, ''),
(17, 17, 21, 20, '0', '0', 17, 1, ''),
(18, 18, 21, 21, '0', '0', 18, 1, ''),
(19, 19, 21, 22, '0', '0', 19, 1, ''),
(20, 20, 21, 23, '0', '0', 20, 1, ''),
(21, 21, 21, 24, '0', '0', 21, 1, ''),
(22, 22, 21, 25, '0', '0', 22, 1, ''),
(23, 23, 21, 26, '0', '0', 23, 1, ''),
(24, 24, 21, 27, '0', '0', 24, 1, ''),
(25, 25, 21, 28, '0', '0', 25, 1, ''),
(26, 26, 21, 29, '0', '0', 26, 1, ''),
(27, 27, 21, 30, '0', '0', 27, 1, ''),
(28, 28, 21, 31, '0', '0', 28, 1, ''),
(29, 29, 21, 32, '0', '0', 29, 1, ''),
(30, 30, 21, 33, '0', '0', 30, 1, ''),
(31, 31, 21, 34, '0', '0', 31, 1, ''),
(32, 32, 21, 35, '0', '0', 32, 1, ''),
(33, 33, 21, 36, '0', '0', 33, 1, ''),
(34, 34, 21, 37, '0', '0', 34, 1, ''),
(35, 35, 21, 38, '0', '0', 35, 1, ''),
(36, 36, 21, 39, '0', '0', 36, 1, ''),
(37, 37, 21, 40, '0', '0', 37, 1, ''),
(38, 38, 21, 41, '0', '0', 38, 1, ''),
(39, 39, 21, 42, '0', '0', 39, 1, ''),
(40, 40, 21, 43, '0', '0', 40, 1, ''),
(41, 41, 21, 44, '0', '0', 41, 1, ''),
(42, 42, 21, 45, '0', '0', 42, 1, ''),
(43, 43, 21, 46, '0', '0', 43, 1, ''),
(44, 44, 21, 47, '0', '0', 44, 1, ''),
(45, 45, 21, 48, '0', '0', 45, 1, ''),
(46, 46, 21, 49, '0', '0', 46, 1, ''),
(47, 47, 21, 50, '0', '0', 47, 1, ''),
(48, 48, 21, 51, '0', '0', 48, 1, ''),
(49, 49, 21, 52, '0', '0', 49, 1, ''),
(50, 50, 21, 53, '0', '0', 50, 1, ''),
(51, 51, 21, 54, '0', '0', 51, 1, ''),
(52, 52, 21, 56, '0', '0', 52, 1, '');

DROP TABLE IF EXISTS `ps_tax_rules_group`;
CREATE TABLE `ps_tax_rules_group` (
  `id_tax_rules_group` int(11) NOT NULL,
  `name` varchar(50) NOT NULL,
  `active` int(11) NOT NULL,
  `deleted` tinyint(1) UNSIGNED NOT NULL,
  `date_add` datetime NOT NULL,
  `date_upd` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `ps_tax_rules_group` (`id_tax_rules_group`, `name`, `active`, `deleted`, `date_add`, `date_upd`) VALUES
(1, 'US-AL Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(2, 'US-AK Rate (0%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(3, 'US-AZ Rate (6.6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(4, 'US-AR Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(5, 'US-CA Rate (8.25%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(6, 'US-CO Rate (2.9%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(7, 'US-CT Rate (0%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(8, 'US-DE Rate (0%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(9, 'US-FL Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(10, 'US-GA Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(11, 'US-HI Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(12, 'US-ID Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(13, 'US-IL Rate (6.25%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(14, 'US-IN Rate (7%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(15, 'US-IA Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(16, 'US-KS Rate (5.3%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(17, 'US-KY Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(18, 'US-LA Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(19, 'US-ME Rate (5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(20, 'US-MD Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(21, 'US-MA Rate (6.25%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(22, 'US-MI Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(23, 'US-MN Rate (6.875%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(24, 'US-MS Rate (7%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(25, 'US-MO Rate (4.225%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(26, 'US-MT Rate (0%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(27, 'US-NE Rate (5.5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(28, 'US-NV Rate (6.85%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(29, 'US-NH Rate (0%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(30, 'US-NJ Rate (7%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(31, 'US-NM Rate (5.125%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(32, 'US-NY Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(33, 'US-NC Rate (5.5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(34, 'US-ND Rate (5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(35, 'US-OH Rate (5.5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(36, 'US-OK Rate (4.5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(37, 'US-OR Rate (0%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(38, 'US-PA Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(39, 'US-RI Rate (7%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(40, 'US-SC Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(41, 'US-SD Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(42, 'US-TN Rate (7%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(43, 'US-TX Rate (6.25%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(44, 'US-UT Rate (4.75%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(45, 'US-VT Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(46, 'US-VA Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(47, 'US-WA Rate (6.5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(48, 'US-WV Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(49, 'US-WI Rate (5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(50, 'US-WY Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(51, 'US-PR Rate (5.5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(52, 'US-DC Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21');

DROP TABLE IF EXISTS `ps_tax_rules_group_shop`;
CREATE TABLE `ps_tax_rules_group_shop` (
  `id_tax_rules_group` int(11) UNSIGNED NOT NULL,
  `id_shop` int(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `ps_tax_rules_group_shop` (`id_tax_rules_group`, `id_shop`) VALUES
(1, 1),
(2, 1),
(3, 1),
(4, 1),
(5, 1),
(6, 1),
(7, 1),
(8, 1),
(9, 1),
(10, 1),
(11, 1),
(12, 1),
(13, 1),
(14, 1),
(15, 1),
(16, 1),
(17, 1),
(18, 1),
(19, 1),
(20, 1),
(21, 1),
(22, 1),
(23, 1),
(24, 1),
(25, 1),
(26, 1),
(27, 1),
(28, 1),
(29, 1),
(30, 1),
(31, 1),
(32, 1),
(33, 1),
(34, 1),
(35, 1),
(36, 1),
(37, 1),
(38, 1),
(39, 1),
(40, 1),
(41, 1),
(42, 1),
(43, 1),
(44, 1),
(45, 1),
(46, 1),
(47, 1),
(48, 1),
(49, 1),
(50, 1),
(51, 1),
(52, 1);


ALTER TABLE `ps_tax`
  ADD PRIMARY KEY (`id_tax`);

ALTER TABLE `ps_tax_rule`
  ADD PRIMARY KEY (`id_tax_rule`),
  ADD KEY `id_tax_rules_group` (`id_tax_rules_group`),
  ADD KEY `id_tax` (`id_tax`),
  ADD KEY `category_getproducts` (`id_tax_rules_group`,`id_country`,`id_state`,`zipcode_from`);

ALTER TABLE `ps_tax_rules_group`
  ADD PRIMARY KEY (`id_tax_rules_group`);

ALTER TABLE `ps_tax_rules_group_shop`
  ADD PRIMARY KEY (`id_tax_rules_group`,`id_shop`),
  ADD KEY `id_shop` (`id_shop`);


ALTER TABLE `ps_tax`
  MODIFY `id_tax` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53;

ALTER TABLE `ps_tax_rule`
  MODIFY `id_tax_rule` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53;

ALTER TABLE `ps_tax_rules_group`
  MODIFY `id_tax_rules_group` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53;

 

Edited by ps8modules (see edit history)
Link to comment
Share on other sites

13 hours ago, ps8modules said:

@madpugger

Hi. I'll give you the SQL with the tables. Just upload the SQL to phpMyAdmin and run it. It will delete the corrupted tables and upload new ones including the original data, as in the initial installation.

The following tables will be restored:

ps_tax, ps_tax_rule, ps_tax_rules_group, ps_tax_rules_group_shop

Alternatively, choose what you want to restore, but I recommend restoring all of the tables mentioned.


DROP TABLE IF EXISTS `ps_tax`;
CREATE TABLE `ps_tax` (
  `id_tax` int(10) UNSIGNED NOT NULL,
  `rate` decimal(10,3) NOT NULL,
  `active` tinyint(1) UNSIGNED NOT NULL DEFAULT 1,
  `deleted` tinyint(1) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `ps_tax` (`id_tax`, `rate`, `active`, `deleted`) VALUES
(1, 4.000, 1, 0),
(2, 0.000, 1, 0),
(3, 6.600, 1, 0),
(4, 6.000, 1, 0),
(5, 8.250, 1, 0),
(6, 2.900, 1, 0),
(7, 0.000, 1, 0),
(8, 0.000, 1, 0),
(9, 6.000, 1, 0),
(10, 4.000, 1, 0),
(11, 4.000, 1, 0),
(12, 6.000, 1, 0),
(13, 6.250, 1, 0),
(14, 7.000, 1, 0),
(15, 6.000, 1, 0),
(16, 5.300, 1, 0),
(17, 6.000, 1, 0),
(18, 4.000, 1, 0),
(19, 5.000, 1, 0),
(20, 6.000, 1, 0),
(21, 6.250, 1, 0),
(22, 6.000, 1, 0),
(23, 6.875, 1, 0),
(24, 7.000, 1, 0),
(25, 4.225, 1, 0),
(26, 0.000, 1, 0),
(27, 5.500, 1, 0),
(28, 6.850, 1, 0),
(29, 0.000, 1, 0),
(30, 7.000, 1, 0),
(31, 5.125, 1, 0),
(32, 4.000, 1, 0),
(33, 5.500, 1, 0),
(34, 5.000, 1, 0),
(35, 5.500, 1, 0),
(36, 4.500, 1, 0),
(37, 0.000, 1, 0),
(38, 6.000, 1, 0),
(39, 7.000, 1, 0),
(40, 6.000, 1, 0),
(41, 4.000, 1, 0),
(42, 7.000, 1, 0),
(43, 6.250, 1, 0),
(44, 4.750, 1, 0),
(45, 6.000, 1, 0),
(46, 4.000, 1, 0),
(47, 6.500, 1, 0),
(48, 6.000, 1, 0),
(49, 5.000, 1, 0),
(50, 4.000, 1, 0),
(51, 5.500, 1, 0),
(52, 6.000, 1, 0);

DROP TABLE IF EXISTS `ps_tax_rule`;
CREATE TABLE `ps_tax_rule` (
  `id_tax_rule` int(11) NOT NULL,
  `id_tax_rules_group` int(11) NOT NULL,
  `id_country` int(11) NOT NULL,
  `id_state` int(11) NOT NULL,
  `zipcode_from` varchar(12) NOT NULL,
  `zipcode_to` varchar(12) NOT NULL,
  `id_tax` int(11) NOT NULL,
  `behavior` int(11) NOT NULL,
  `description` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `ps_tax_rule` (`id_tax_rule`, `id_tax_rules_group`, `id_country`, `id_state`, `zipcode_from`, `zipcode_to`, `id_tax`, `behavior`, `description`) VALUES
(1, 1, 21, 4, '0', '0', 1, 1, ''),
(2, 2, 21, 5, '0', '0', 2, 1, ''),
(3, 3, 21, 6, '0', '0', 3, 1, ''),
(4, 4, 21, 7, '0', '0', 4, 1, ''),
(5, 5, 21, 8, '0', '0', 5, 1, ''),
(6, 6, 21, 9, '0', '0', 6, 1, ''),
(7, 7, 21, 10, '0', '0', 7, 1, ''),
(8, 8, 21, 11, '0', '0', 8, 1, ''),
(9, 9, 21, 12, '0', '0', 9, 1, ''),
(10, 10, 21, 13, '0', '0', 10, 1, ''),
(11, 11, 21, 14, '0', '0', 11, 1, ''),
(12, 12, 21, 15, '0', '0', 12, 1, ''),
(13, 13, 21, 16, '0', '0', 13, 1, ''),
(14, 14, 21, 17, '0', '0', 14, 1, ''),
(15, 15, 21, 18, '0', '0', 15, 1, ''),
(16, 16, 21, 19, '0', '0', 16, 1, ''),
(17, 17, 21, 20, '0', '0', 17, 1, ''),
(18, 18, 21, 21, '0', '0', 18, 1, ''),
(19, 19, 21, 22, '0', '0', 19, 1, ''),
(20, 20, 21, 23, '0', '0', 20, 1, ''),
(21, 21, 21, 24, '0', '0', 21, 1, ''),
(22, 22, 21, 25, '0', '0', 22, 1, ''),
(23, 23, 21, 26, '0', '0', 23, 1, ''),
(24, 24, 21, 27, '0', '0', 24, 1, ''),
(25, 25, 21, 28, '0', '0', 25, 1, ''),
(26, 26, 21, 29, '0', '0', 26, 1, ''),
(27, 27, 21, 30, '0', '0', 27, 1, ''),
(28, 28, 21, 31, '0', '0', 28, 1, ''),
(29, 29, 21, 32, '0', '0', 29, 1, ''),
(30, 30, 21, 33, '0', '0', 30, 1, ''),
(31, 31, 21, 34, '0', '0', 31, 1, ''),
(32, 32, 21, 35, '0', '0', 32, 1, ''),
(33, 33, 21, 36, '0', '0', 33, 1, ''),
(34, 34, 21, 37, '0', '0', 34, 1, ''),
(35, 35, 21, 38, '0', '0', 35, 1, ''),
(36, 36, 21, 39, '0', '0', 36, 1, ''),
(37, 37, 21, 40, '0', '0', 37, 1, ''),
(38, 38, 21, 41, '0', '0', 38, 1, ''),
(39, 39, 21, 42, '0', '0', 39, 1, ''),
(40, 40, 21, 43, '0', '0', 40, 1, ''),
(41, 41, 21, 44, '0', '0', 41, 1, ''),
(42, 42, 21, 45, '0', '0', 42, 1, ''),
(43, 43, 21, 46, '0', '0', 43, 1, ''),
(44, 44, 21, 47, '0', '0', 44, 1, ''),
(45, 45, 21, 48, '0', '0', 45, 1, ''),
(46, 46, 21, 49, '0', '0', 46, 1, ''),
(47, 47, 21, 50, '0', '0', 47, 1, ''),
(48, 48, 21, 51, '0', '0', 48, 1, ''),
(49, 49, 21, 52, '0', '0', 49, 1, ''),
(50, 50, 21, 53, '0', '0', 50, 1, ''),
(51, 51, 21, 54, '0', '0', 51, 1, ''),
(52, 52, 21, 56, '0', '0', 52, 1, '');

DROP TABLE IF EXISTS `ps_tax_rules_group`;
CREATE TABLE `ps_tax_rules_group` (
  `id_tax_rules_group` int(11) NOT NULL,
  `name` varchar(50) NOT NULL,
  `active` int(11) NOT NULL,
  `deleted` tinyint(1) UNSIGNED NOT NULL,
  `date_add` datetime NOT NULL,
  `date_upd` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `ps_tax_rules_group` (`id_tax_rules_group`, `name`, `active`, `deleted`, `date_add`, `date_upd`) VALUES
(1, 'US-AL Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(2, 'US-AK Rate (0%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(3, 'US-AZ Rate (6.6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(4, 'US-AR Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(5, 'US-CA Rate (8.25%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(6, 'US-CO Rate (2.9%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(7, 'US-CT Rate (0%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(8, 'US-DE Rate (0%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(9, 'US-FL Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(10, 'US-GA Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(11, 'US-HI Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(12, 'US-ID Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(13, 'US-IL Rate (6.25%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(14, 'US-IN Rate (7%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(15, 'US-IA Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(16, 'US-KS Rate (5.3%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(17, 'US-KY Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(18, 'US-LA Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(19, 'US-ME Rate (5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(20, 'US-MD Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(21, 'US-MA Rate (6.25%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(22, 'US-MI Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(23, 'US-MN Rate (6.875%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(24, 'US-MS Rate (7%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(25, 'US-MO Rate (4.225%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(26, 'US-MT Rate (0%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(27, 'US-NE Rate (5.5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(28, 'US-NV Rate (6.85%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(29, 'US-NH Rate (0%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(30, 'US-NJ Rate (7%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(31, 'US-NM Rate (5.125%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(32, 'US-NY Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(33, 'US-NC Rate (5.5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(34, 'US-ND Rate (5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(35, 'US-OH Rate (5.5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(36, 'US-OK Rate (4.5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(37, 'US-OR Rate (0%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(38, 'US-PA Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(39, 'US-RI Rate (7%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(40, 'US-SC Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(41, 'US-SD Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(42, 'US-TN Rate (7%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(43, 'US-TX Rate (6.25%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(44, 'US-UT Rate (4.75%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(45, 'US-VT Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(46, 'US-VA Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(47, 'US-WA Rate (6.5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(48, 'US-WV Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(49, 'US-WI Rate (5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(50, 'US-WY Rate (4%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(51, 'US-PR Rate (5.5%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21'),
(52, 'US-DC Rate (6%)', 1, 0, '2025-07-15 22:52:21', '2025-07-15 22:52:21');

DROP TABLE IF EXISTS `ps_tax_rules_group_shop`;
CREATE TABLE `ps_tax_rules_group_shop` (
  `id_tax_rules_group` int(11) UNSIGNED NOT NULL,
  `id_shop` int(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `ps_tax_rules_group_shop` (`id_tax_rules_group`, `id_shop`) VALUES
(1, 1),
(2, 1),
(3, 1),
(4, 1),
(5, 1),
(6, 1),
(7, 1),
(8, 1),
(9, 1),
(10, 1),
(11, 1),
(12, 1),
(13, 1),
(14, 1),
(15, 1),
(16, 1),
(17, 1),
(18, 1),
(19, 1),
(20, 1),
(21, 1),
(22, 1),
(23, 1),
(24, 1),
(25, 1),
(26, 1),
(27, 1),
(28, 1),
(29, 1),
(30, 1),
(31, 1),
(32, 1),
(33, 1),
(34, 1),
(35, 1),
(36, 1),
(37, 1),
(38, 1),
(39, 1),
(40, 1),
(41, 1),
(42, 1),
(43, 1),
(44, 1),
(45, 1),
(46, 1),
(47, 1),
(48, 1),
(49, 1),
(50, 1),
(51, 1),
(52, 1);


ALTER TABLE `ps_tax`
  ADD PRIMARY KEY (`id_tax`);

ALTER TABLE `ps_tax_rule`
  ADD PRIMARY KEY (`id_tax_rule`),
  ADD KEY `id_tax_rules_group` (`id_tax_rules_group`),
  ADD KEY `id_tax` (`id_tax`),
  ADD KEY `category_getproducts` (`id_tax_rules_group`,`id_country`,`id_state`,`zipcode_from`);

ALTER TABLE `ps_tax_rules_group`
  ADD PRIMARY KEY (`id_tax_rules_group`);

ALTER TABLE `ps_tax_rules_group_shop`
  ADD PRIMARY KEY (`id_tax_rules_group`,`id_shop`),
  ADD KEY `id_shop` (`id_shop`);


ALTER TABLE `ps_tax`
  MODIFY `id_tax` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53;

ALTER TABLE `ps_tax_rule`
  MODIFY `id_tax_rule` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53;

ALTER TABLE `ps_tax_rules_group`
  MODIFY `id_tax_rules_group` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53;

 

Thanks for this! I'll need to modify for our use case, since we have UK VAT rates, but essentially, ID1 was deleted years ago in error and I'd like to use it!

Link to comment
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
×
×
  • Create New...