Osclass forums

Support forums => old => Topic started by: data99 on April 12, 2015, 02:06:06 am

Title: XML category import/export problem
Post by: data99 on April 12, 2015, 02:06:06 am

Hello. I have installed XML category import/export plugin. I can see the configuration but I it doesnt work. I use Osclas 3.5
For Importing the XML file I can choose the file but it doesnt want to load. And in export case I click on export but it doesn't do anything...

Has anyone got solution for this problem
Title: Re: XML category import/export problem
Post by: data99 on April 23, 2015, 02:44:10 am
im using 3.5.6 the latest .. any suggestion how do I copy from one website to another
Title: Re: XML category import/export problem
Post by: teseo on April 23, 2015, 01:24:13 pm
***CORRECTED***

Hi,

Don't know that plugin, but category tables are pretty simple to export/import using PhpMyAdmin;

1.- Enter your source database and click on Export at the top.

2.- On the next page, you need to check "Custom - display all possible options", you'll see a lot of options:

     2a.- Table(s): Select only t_category and t_category_description

     2b.- Format-specific options:

          Disable foreign key checks -> Checked (This to avoid error messages regarding foreign keys constraints.)

          Check "Add DROP TABLE statement"

     2c.- Go and save to disk.

3.- Enter your destination database and click on Import.

That should do it, regards.
Title: Re: XML category import/export problem
Post by: data99 on April 23, 2015, 06:17:32 pm
Thanks for the reply but I get this error on import


Code: [Select]
--
-- Dumping data for table `oc_t_category`
--

INSERT INTO `oc_t_category` (`pk_i_id`, `fk_i_parent_id`, `i_expiration_days`, `i_position`, `b_enabled`, `b_price_enabled`, `s_icon`) VALUES
(1, NULL, 0, 17, 1, 1, NULL),
(2, NULL, 0, 18, 1, 1, NULL),
(3, NULL, 0, 10, 1, 1, NULL),
(4, NULL, 0, 9, 1, 1, NULL),
(5, NULL, 0, 4, 1, 1, NULL),
(6, NULL, 0, 19, 1, 1, NULL),
(7, NULL, 0, 20, 1, 1, NULL),
(8, NULL, 0, 6, 1, 1, NULL),
(9, 1, 0, 1, 1, 1, NULL),
(10, 1, 0, 2, 1, 1, NULL),
(11, 1, 0, 3, 1, 1, NULL),
(12, 1, 0, 4, 1, 1, NULL),
(13, 1, 0, 5, 1, 1, NULL),
(14, 1, 0, 6, 1, 1, NULL),
(15, 1, 0, 7, 1, 1, NULL),
(16, 1, 0, 8, 1, 1, NULL),
(17, 1, 0, 9, 1, 1, NULL),
(18, 1, 0, 10, 1, 1, NULL),
(19, 1, 0, 11, 1, 1, NULL),
(20, 1, 0, 12, 1, 1, NULL),
(21, 1, 0, 13, 1, 1, NULL),
(22, 1, 0, 14, 1, 1, NULL),
(23, 1, 0, 15, 1, 1, NULL),
(24, 1, 0, 16, 1, 1, NULL),
(25, 1, 0, 17, 1, 1, NULL);

MySQL said: Documentation
#1062 - Duplicate entry '1' for key 'PRIMARY'
Title: Re: XML category import/export problem
Post by: teseo on April 23, 2015, 06:55:34 pm
I see... I guess you already have categories in the destination database.Your goal, is it to add new categories to an already existent set of them or to replace existent ones entirely? ???

Regards

Title: Re: XML category import/export problem
Post by: ashish1241 on April 23, 2015, 08:49:41 pm
Hey I got the same error. I don't have any categories already created, where I want to Import the Categories
Please Help
Title: Re: XML category import/export problem
Post by: ashish1241 on April 23, 2015, 08:51:00 pm
This is the error : SQL query:

-- -- Dumping data for table `osc_t_category` -- INSERT INTO `osc_t_category` (`pk_i_id`, `fk_i_parent_id`, `i_expiration_days`, `i_position`, `b_enabled`, `s_icon`, `b_price_enabled`) VALUES (1, 14, 0, 12, 1, NULL, 1), (2, 14, 0, 5, 1, NULL, 1), (3, 14, 0, 6, 1, NULL, 1), (4, 14, 0, 7, 1, NULL, 1), (5, 14, 0, 4, 1, NULL, 1), (6, 14, 0, 1, 1, NULL, 1), (7, 14, 0, 2, 1, NULL, 1), (8, 14, 0, 8, 1, NULL, 1), (9, 14, 0, 9, 1, NULL, 1), (10, 14, 0, 11, 1, NULL, 1), (11, 14, 0, 0, 1, NULL, 1), (12, 14, 0, 3, 1, NULL, 1), (13, 14, 0, 10, 1, NULL, 1), (14, NULL, 0, 3, 1, NULL, 0), (15, 30, 0, 13, 1, NULL, 1), (16, 30, 0, 12, 1, NULL, 1), (17, 30, 0, 14, 1, NULL, 1), (18, 30, 0, 10, 1, NULL, 1), (19, 30, 0, 9, 1, NULL, 1), (20, 30, 0, 8, 1, NULL, 1), (21, 30, 0, 7, 1, NULL, 1), (22, 30, 0, 6, 1, NULL, 1), (23, 30, 0, 5, 1, NULL, 1), (24, 30, 0, 4, 1, NULL, 1), (25, 30, 0, 3, 1, NULL, 1), (26, 30, 0, 2, 1, NULL, 1), (27, 30, 0, 1, 1, NULL, 1), (28, 30, 0, 0, 1, NULL, 1), (29, 30, 0, 11, 1, NU[...]

MySQL said: Documentation

#1062 - Duplicate entry '1' for key 'PRIMARY'
Title: Re: XML category import/export problem
Post by: data99 on April 23, 2015, 09:05:55 pm
no I deleted all category from admin panel but still get error while deleting

SQL query:

DELETE FROM `oddclass_adminji`.`oc_t_category` WHERE `oc_t_category`.`pk_i_id` = 1

MySQL said: Documentation
#1451 - Cannot delete or update a parent row: a foreign key constraint fails (`oddclass_adminji`.`oc_t_category`, CONSTRAINT `oc_t_category_ibfk_1` FOREIGN KEY (`fk_i_parent_id`) REFERENCES `oc_t_category` (`pk_i_id`))
Title: Re: XML category import/export problem
Post by: teseo on April 23, 2015, 09:17:48 pm
Yes, review now my above post. Under section 2b, look at the new "Add DROP TABLE statement" instruction. That will empty the current table before importing (when you install Osclass it is filled with default categories, so it always has contents). And remember the Foreign key checks = Off too.

Regards
Title: Re: XML category import/export problem
Post by: ashish1241 on April 23, 2015, 10:28:17 pm
Let me try, will update you in a few min
Title: Re: XML category import/export problem
Post by: ashish1241 on April 23, 2015, 10:39:21 pm
After importing I get :  Import has been successfully finished, 19 queries executed. (cityehub_osc3.sql (2).zip)
but nothing show up http://ar.cityehub.com/ (http://ar.cityehub.com/)
Title: Re: XML category import/export problem
Post by: teseo on April 23, 2015, 10:52:40 pm
Hi,

Can you seem them on Admin Dashboard? ???

Regards
Title: Re: XML category import/export problem
Post by: ashish1241 on April 23, 2015, 11:06:30 pm
Nope not even there
Title: Re: XML category import/export problem
Post by: teseo on April 23, 2015, 11:19:56 pm
Did you follow exactly the procedure described ¡n my corrected post here?:

http://forums.osclass.org/3-5-x/xml-category-importexport-problem-28767/msg120254/#msg120254 (http://forums.osclass.org/3-5-x/xml-category-importexport-problem-28767/msg120254/#msg120254)

Regards
Title: Re: XML category import/export problem
Post by: ashish1241 on April 23, 2015, 11:48:24 pm
Word by word, I cross checked as well  :-\
Title: (Solved) - Re: XML category import/export problem
Post by: data99 on April 23, 2015, 11:49:40 pm
you said and i did


1.- Enter your source database and click on Export at the top.

2.- On the next page, you need to check "Custom - display all possible options", you'll see a lot of options:

     2a.- Table(s): Select only t_category and t_category_description

     2b.- Format-specific options:

          Disable foreign key checks -> Checked (This to avoid error messages regarding foreign keys constraints.)

          Check "Add DROP TABLE statement"

     2c.- Go and save to disk.

3.- Enter your destination database and click on Import.

I did that i can import only t_category_description but when I imported only t_category  it gave me a error and it got deleted
and I again install the whole website and this time I deleted all category from admin panel and again I imported t_category  again it gave me a error and got deleted :(



!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Solved

Thanks to teseo

Steps

1 download the plugin and install it
2 now we need to make changes in the plugins
In xml_import_export_category/functions.php look for all lines containing this segment:

Quote
Code: [Select]
    file=xml_import_export_category/functions.php?func=


and replace it with:

Quote

Code: [Select]
    file=xml_import_export_category/functions.php&func=

That should be all.
plugin will exports resultant XML to /oc-admin/outCategory.xml, not directly to your computer. Download from there to your computer, go to your destination installation Admin Dashboard and Import.

you must make changes to plug-in on both the website
Title: Re: XML category import/export problem
Post by: data99 on April 24, 2015, 12:07:17 am
error 1
SQL query:

CREATE TABLE IF NOT EXISTS `oc_t_category` (
  `pk_i_id` int(10) unsigned NOT NULL,
  `fk_i_parent_id` int(10) unsigned DEFAULT NULL,
  `i_expiration_days` int(3) unsigned NOT NULL DEFAULT '0',
  `i_position` int(2) unsigned NOT NULL DEFAULT '0',
  `b_enabled` tinyint(1) NOT NULL DEFAULT '1',
  `b_price_enabled` tinyint(1) NOT NULL DEFAULT '1',
  `s_icon` varchar(250) DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=284 DEFAULT CHARSET=utf8;

MySQL said: Documentation
#1005 - Can't create table 'oddclass_oddclas.oc_t_category' (errno: 150) (Details…)


error 2


Storage Engines
InnoDB Documentation

Percona-XtraDB, Supports transactions, row-level locking, and foreign keys

[ Variables | Buffer Pool | InnoDB Status ]


Open new phpMyAdmin window
Title: Re: XML category import/export problem
Post by: teseo on April 24, 2015, 12:23:36 am
@data99:

That's weird, there are no indexes in your category table, it should be something more like this:

CREATE TABLE IF NOT EXISTS `oc_t_category` (
  `pk_i_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `fk_i_parent_id` int(10) unsigned DEFAULT NULL,
  `i_expiration_days` int(3) unsigned NOT NULL DEFAULT '0',
  `i_position` int(2) unsigned NOT NULL DEFAULT '0',
  `b_enabled` tinyint(1) NOT NULL DEFAULT '1',
  `b_price_enabled` tinyint(1) NOT NULL DEFAULT '1',
  `s_icon` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`pk_i_id`),
  KEY `fk_i_parent_id` (`fk_i_parent_id`),
  KEY `i_position` (`i_position`),
  KEY `fk_i_parent_id_2` (`fk_i_parent_id`),
  KEY `i_position_2` (`i_position`),
  KEY `fk_i_parent_id_3` (`fk_i_parent_id`),
  KEY `i_position_3` (`i_position`)

) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=104 ;

Both of you, could you attach here the entire .sql generated by export?

Regards
Title: Re: XML category import/export problem
Post by: data99 on April 24, 2015, 12:32:03 am
is there any way to fix the  XML category import/export problem plugin
Title: Re: XML category import/export problem
Post by: teseo on April 24, 2015, 12:51:51 am
I have no idea, as already told you I don't know that plugin, better ask to its developer.

This procedure I put here it's fully working for me, and that's all I can do with no further information. ???

Regards
Title: Re: XML category import/export problem
Post by: data99 on April 24, 2015, 01:54:36 am
I will do it manually

is there any way add 100 NEW CATEGORY, EDIT ME! at one so I can edit and rename them
Title: Re: XML category import/export problem
Post by: teseo on April 24, 2015, 09:14:24 pm
Today I was taking a look at that plugin (http://forums.osclass.org/plugins/(plugin)-xml-import-export-category-v0-1-beta/). It's a bit old and somewhat unpolished, but I managed to get it working doing this modification:

In xml_import_export_category/functions.php look for all lines containing this segment:

Quote
file=xml_import_export_category/functions.php?func=

and replace it with:

Quote
file=xml_import_export_category/functions.php&func=

That should be all. The rest is just a bit hard because the plugin exports resultant XML to /oc-admin/outCategory.xml, not directly to your computer. Download from there to your computer, go to your destination installation Admin Dashboard and Import.

Please tell me if this is working for you so I could post in the official thread of the plugin.

Regards
Title: Re: XML category import/export problem
Post by: ashish1241 on April 24, 2015, 10:43:35 pm
Hey the export worked fine, I have the xml file, but the import did not.
1 point to mention here, I checked "Deleting all category before import." which did work.
Title: Re: XML category import/export problem
Post by: data99 on April 25, 2015, 03:50:47 am
ashish1241 is correct the I can only export but I cant import
Title: Re: XML category import/export problem
Post by: data99 on April 25, 2015, 03:54:06 am
Solved it works now Thanks
Title: Re: XML category import/export problem
Post by: ashish1241 on April 25, 2015, 08:24:24 am
Hey data99,
Please share how did you solve it?
Title: Re: XML category import/export problem
Post by: data99 on April 25, 2015, 03:22:53 pm
Solved

Thanks to teseo

Steps

1 download the plugin and install it
2 now we need to make changes in the plugins
In xml_import_export_category/functions.php look for all lines containing this segment:

Quote
Code: [Select]

    file=xml_import_export_category/functions.php?func=




and replace it with:

Quote

Code: [Select]

    file=xml_import_export_category/functions.php&func=



That should be all.
plugin will exports resultant XML to /oc-admin/outCategory.xml, not directly to your computer. Download from there to your computer, go to your destination installation Admin Dashboard and Import.

you must make changes to plug-in on both the website
Title: Re: XML category import/export problem
Post by: ashish1241 on April 25, 2015, 07:28:28 pm
I missed on this step...

You must make changes to plug-in on both the website

Please mark this as resolved

I have attached the corrected .zip file for anyone who needs it