Jump to content

[Apps] Tools Import Data


Recommended Posts

I'm trying to import a database from osCmax using this addon but it gets stuck almost immediately.

Quote

The migration is in progress, please wait

Oscommerce

table_languages

Item number : 1

No item to import, exist inside db : en

table_products_description

number_of_products : 28

663 - TEN Gel 3pk

It (at least) reads the first product (with a description) from the 'old' database but doesn't continue.

 

[29-Oct-2020 17:44:44 UTC] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in /home/clic/public_html/shop/includes/ClicShopping/OM/DbStatement.php:136
Stack trace:
#0 /home/clic/public_html/shop/includes/ClicShopping/OM/DbStatement.php(136): PDOStatement->execute(NULL)
#1 /home/clic/public_html/shop/includes/ClicShopping/OM/Db.php(374): ClicShopping\OM\DbStatement->execute()
#2 /home/clic/public_html/shop/includes/Module/Hooks/ClicShoppingAdmin/ImportDatabase/Oscommerce.php(117): ClicShopping\OM\Db->save(':table_products...', Array)
#3 /home/clic/public_html/shop/includes/ClicShopping/OM/Hooks.php(63): ClicShopping\OM\Module\Hooks\ClicShoppingAdmin\ImportDatabase\Oscommerce->execute(NULL)
#4 /home/clic/public_html/shop/includes/ClicShopping/Apps/Tools/ImportData/Sites/ClicShoppingAdmin/Pages/Home/templates/import_process.php(80): ClicShopping\OM\Hooks->call('ImportDatabase', 'Oscommerce')
#5 /home/clic/public_html/shop/ClicShoppingAdmin/index.php(41): include('/home/clic/publ...')
#6 {main}
  in /home/clic/public_html/shop/includes/ClicShopping/OM/DbStatement.php on line 136

I've tried adding and deleting database tables prefix (something I don't normally use), in case that was the cause of "Invalid parameter" - that didn't help.

 

Note: the installation instructions are not clear at all. I uploaded the images & includes directories to shop. I then added the apps_tools_import_data.json from ModuleInfosJson to ClicShopping/Work/Cache/Github. Is this correct?

Link to post
(edited)

Hello

 

It's long time I do not use this app.

It's important to let the prefix table to be in concordance with ClicShopping Table

About the installation : yes you must to to that.

 

Could you make that :

$this->db->save('products_description', $sql_data_array);

by
 

var_dump($sql_data_array);

//$this->db->save('products_description', $sql_data_array);

       }
      }

exit;

 

What is the result ;

Do you have 1 or 2 language or more ?

 

Thank you.

Edited by Foster
  • Thanks 1
Link to post

Hi,

This is a fresh installation with no demo data loaded. (Was bad enough just to get the thing to run!)

Importing a single language (en).

There is no specific file for osCmax, even though it is listed in the dropdown. It'll try changing it in the Oscommerce.php file and select that one.

 

Link to post

The section that you suggested doesn't exist; this is the closest that I could find:

      while ($data = $QproductDescriptions->fetch_assoc()) {
        foreach ($clicshopping_languages as $languages) {

          echo $data['products_id'] . ' - ' . $data['products_name'] . '<br />';

          $sql_data_array = [
            'products_id' => (int)$data['products_id'],
            'language_id' => (int)$languages['languages_id'],
            'products_name' => $data['products_name'],
            'products_description' => $data['products_description'],
            'products_url' => $data['products_url'],
            'products_viewed ' => (int)$data['products_viewed'],
          ];

          // $this->db->save('products_description', $sql_data_array);
        }
      }

 

Link to post
[30-Oct-2020 18:10:32 UTC] PHP Fatal error:  Uncaught PDOException: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column 'entry_zone_id' at row 1 in /home/clic/public_html/shop/includes/ClicShopping/OM/DbStatement.php:136
Stack trace:
#0 /home/clic/public_html/shop/includes/ClicShopping/OM/DbStatement.php(136): PDOStatement->execute(NULL)
#1 /home/clic/public_html/shop/includes/ClicShopping/OM/Db.php(374): ClicShopping\OM\DbStatement->execute()
#2 /home/clic/public_html/shop/includes/Module/Hooks/ClicShoppingAdmin/ImportDatabase/Oscommerce.php(148): ClicShopping\OM\Db->save(':table_address_...', Array)
#3 /home/clic/public_html/shop/includes/ClicShopping/OM/Hooks.php(63): ClicShopping\OM\Module\Hooks\ClicShoppingAdmin\ImportDatabase\Oscommerce->execute(NULL)
#4 /home/clic/public_html/shop/includes/ClicShopping/Apps/Tools/ImportData/Sites/ClicShoppingAdmin/Pages/Home/templates/import_process.php(80): ClicShopping\OM\Hooks->call('ImportDatabase', 'Oscommerce')
#5 /home/clic/public_html/shop/ClicShoppingAdmin/index.php(41): in /home/clic/public_html/shop/includes/ClicShopping/OM/DbStatement.php on line 136
[30-Oct-2020 18:12:41 UTC] PHP Notice:  Undefined index: MessageStack_Data in /home/clic/public_html/shop/includes/ClicShopping/OM/MessageStack.php on line 35
[30-Oct-2020 18:12:41 UTC] PHP Notice:  Undefined property: ClicShopping\Sites\Shop\Search::$checkManufacturer in /home/clic/public_html/shop/includes/ClicShopping/Sites/Shop/Search.php on line 408

Given the message stack error and manufacturer errors, I think I'll try a re-installation, from master.

Link to post

Hello,

 

while ($data = $QproductDescriptions->fetch_assoc()) { ....

 Yes it was the line. but be careful check if all the data imported is the same that the original database. You can eventually have problem between products and products description inside your database (integrity) for example.

 

About the last message, what you do, I do not understand exactly.

 

Thank you.

 

 

 

 

Link to post

Nothing was imported. :'(

I'm not happy about the various error messages that are appearing in the error log, so I'm going to re-install clicshopping (again!).

The instructions for installing aren't very good though, so it sometimes takes a few attempts.

Link to post

I'm back at this migration. 🤪

Presumably, even though it's listed the osCmax migration code isn't included. I'm going to try copying the osCommerce.php to osCmax.php and rename the class within it, to osCmax. This way I can tweak the new file, to match up database files.

Am I missing something?

 

Link to post
(edited)

A global search revealed this:

                $filename_array[] = array('id' => 'Oscommerce', 'text' => 'OscMax');

So my hunch was correct and this likely needs changed to match.

The quest continues.. Blimey, this software has a convoluted/complex directory structure!

 

Edited by AlwaysSkint
Link to post
(edited)

.. Got a custom osCmax migration, in development.

There are various issues with the different database tables, though I do have the (simple) Categories one working.

Some field names don't quite match up and date formats are throwing error, though I'm fairly hopeful that I'll get most of this fixed up.

PHP Fatal error:  Uncaught PDOException: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '0000-00-00 00:00:00' for column 'customers_dob' at row 1 in /home/clic/public_html/shop/includes/ClicShopping/OM/DbStatement.php:136

 

Edited by AlwaysSkint
Link to post
(edited)

Hello,

 

this software has a convoluted/complex directory structure ==> When you do  not know a software, it's always like that the first time

 

You can create your own hooks and make that step by step.  You have all the informations. I think it's better. In that case, you have not to change anything inside the apps.

 

example.

 

 namespace ClicShopping\OM\Module\Hooks\ClicShoppingAdmin\ImportDatabase;

  use ClicShopping\OM\Registry;
  use ClicShopping\OM\HTML;
  use ClicShopping\OM\CLICSHOPPING;
  use ClicShopping\OM\Cache;

  use ClicShopping\Apps\Configuration\Administrators\Classes\ClicShoppingAdmin\AdministratorAdmin;
  use ClicShopping\Apps\Tools\ImportData\Classes\ClicShoppingAdmin\ImportDatabase;

  class MyOwnOscMax
  {
...
  }

 

 

Edited by Patrick
Link to post
(edited)

Unfortunately that syntax is beyond me. 😞

I figured out all I had to do was remove the non-working osCmax reference and add my own osCmax.php, based on the Oscommerce one.

 

At the moment, I'm trying to figure out the differences between HTML::outputProtected and HTML::sanitized

Example: 'products_description' => HTML::outputProtected($data['products_description']),

I'm trying to allow addresses with a # symbol (American's use it for number) and descriptions that include styles, as examples.

 

(My comment stands on the complex directory structure - osCommerce is/was bad enough. ;) )

Edited by AlwaysSkint
Link to post
(edited)

Hello @Patrick,

 

HTML::.... do not allow you to import whatever. ====> Are you sure ?

It's not better to say : HTML::sanitize do not allow you wathever. For example delete the tag <script> . I suppose that you want to tell us.

Edited by Foster
Link to post
(edited)

Now that I have the store software running much better, I've had time to test migrations again. I wish I'd realised this tool is now included for free but don't regret the relatively little amount paid for it. ;) Hey, at least it has given me something to work from. 🕵️‍♂️

 

I have an updated ImportDatabase.php Classes file that truncates many more tables, making migration considerably easier.

I also have a new osCmax20.php (note the correct capitalisation) that is now on version 0.8 and is migrating a substantial amount of data now.

Would you like these? What's the best/easiest way to get them to you?

 

P.S. I'm using HTML::outputProtected now on some fields. ;)

Edited by AlwaysSkint
typos :'(
Link to post

Re: purchase of the tool. Please ignore: I got confused by a similar one for a different cart.

Re: github - never could get my head around that but can try, I guess. Used SVN in the past.

Would be much easier to just post an attachment or provide an upload location eg. netxcloud.

Link to post
(edited)
1 hour ago, Patrick said:

Hello,

 

You can create a fork on github, And It will be check, I suppose (include inside the app)

I've managed to do something on github. 🤪 Can you merge the two branches and I might be able to add further updates, when available?

Edited by AlwaysSkint
  • Like 1
Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use