Jump to content

[Apps] Tools Import Data


Recommended Posts

(edited)

Can you be more specific with your osCmax issue? (It's not OscMax).

 

You may wish to add a note to the readme.md

"Larger stores may need to temporarily extend PHP memory and timeout - 256MB and 120 (seconds) should cater for most stores. This is often done by adjust php.ini or .user.ini"

 

Thanks.

Edited by AlwaysSkint
Link to post

I notice that you haven't adopted my changes to ImportData

  • Prevent duplicate key errors when resubmitting a migration and ensure no old orders (for example) remain. The current truncates seem arbitrary.
  • Prevent the default Logo banner from being erased (it's not obvious how to recreate it).
Link to post
(edited)
55 minutes ago, ClicShopping said:

I try with oscMax, but there is a problem on the db importation.

This is why I asked.

Note: I forgot to test 'newsletters' I'll check that for version 1.1 ;)

Edited by AlwaysSkint
Link to post
(edited)

Yes, I did say that I couldn't understand github. 😢

I'm trying to just have one repo called AlwaysSkint, that pulls updates from your master when it gets updated. Then I can make proposed alterations to my fork/branch whatever.

I can't even figure out how to delete my fork and start again! I'm getting too old/stupid for this. 😢

Edited by AlwaysSkint
Link to post
(edited)

It would be extremely useful if the default logo ID could be changed to say 1000.

This should have no impact on any new stores and will allow migrations to keep existing banners. Even for existing stores, there should be no (or very rare) issues.

UPDATE `banners` SET `banners_id` = '1000' WHERE `banners`.`banners_id` = 1;

 

Edited by AlwaysSkint
Link to post
(edited)

The banner ID is assigned INT(11), so there is very little danger of a store owner using up the number of possible banners! The most banners that I have seen used in a large store (10s of thousands of products) has been about 25 and it begins to look silly. 😉

 

About to attempt to submit v1.1 osCmax20.php plus revert some of your changes.. If I can get it to work.

 

 

Edited by AlwaysSkint
Link to post

I'm looking for a little bit of help here.. Customer groups wont migrate due to a slightly different table definition, so I'm trying to temporarily alter it but it returns a mysql syntax error.

//******************************************
//Customers Groups
//******************************************
/* Inverted restrictions

          'group_payment_allowed' => $data['group_payment_allowed'],
          'group_shipment_allowed' => $data['group_shipment_allowed']
*/
// Set default to match original db
      $Qalter = $this->db->prepare('ALTER TABLE :customers_groups 
      								CHANGE customers_group_id customers_group_id INT(11) NOT NULL DEFAULT 0
                                   ');
      $Qalter->execute();
      echo 'temporary structure change<br>';
      
      $QcustomersGroups = $mysqli->query('select *
                                         from ' . $this->PrefixTable . 'customers_groups
                                       ');
      echo '<hr>';
      echo '<div>table_customers_groups</div>';
      echo '<div>' . CLICSHOPPING::getDef('text_number_of_item') . ' : ' . $QcustomersGroups->num_rows . '</div>';
      echo '<hr>';

      while ($data = $QcustomersGroups->fetch_assoc()) {
        $sql_data_array = [
          'customers_group_id' => (int)$data['customers_group_id'],
          'customers_group_name' => $data['customers_group_name'],
          'group_tax' => $data['customers_group_tax_exempt'],
          'group_order_taxe' => (int)$data['customers_group_show_tax']
        ];

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

// Return structure to original
      $QalterRevert = $this->db->prepare('ALTER TABLE :customers_groups 
      									  CHANGE customers_group_id customers_group_id INT(11) NOT NULL AUTO_INCREMENT
                                  		 ');

      $QalterRevert->execute();

 

Link to post
(edited)

You can look clicshopping_v2 maybit can help you

https://github.com/ClicShoppingOfficialModulesV3/apps_tools_import_data/blob/7f8c544a8e1742d26a1f549ca946665ad0200d3e/includes/Module/Hooks/ClicShoppingAdmin/ImportDatabase/ClicShoppingV2.php

line around 548

 

In my sense it's better to make an update via Customer/Customer group  and add other groups after.

 

customers_group_id int not_null auto_increment
customers_group_name varchar(32) not_null
customers_group_discount decimal(11,2) default(0.00) not_null
color_bar varchar(8) default('#FFFFFF') not_null
group_order_taxe tinyint(1) default(0) not_null
group_payment_unallowed varchar(255) default('cc')
group_shipping_unallowed varchar(255)
group_tax varchar(5) default('false') not_null
customers_group_quantity_default int(4) default(0) not_null
--
primary customers_group_id
idx_customers_group_name customers_group_name
##
engine innodb
character_set utf8mb4
collate utf8mb4_unicode_ci

 

Maybe your problem is the primary.

Edited by Patrick
  • Thanks 1
Link to post

Hello,

 

you can try this

 

      if ($data['customers_group_id'] > 0) {  
        $sql_data_array = [
          'customers_group_id' => (int)$data['customers_group_id'],
          'customers_group_name' => $data['customers_group_name'],
          'group_tax' => $data['customers_group_tax_exempt'],
          'group_order_taxe' => (int)$data['customers_group_show_tax']
        ];
      }

 

  • Thanks 1
Link to post
(edited)

@Foster Thanks for trying to help but that is essentially what I was doing when I discovered the data corruption. Hence looking to change the table structure. I'm not looking to append to the existing data, which is irrelevant - it's required to replace it.

Fundamentally, the source database begins customers_group_id at zero, whereas ClicShopping begins at 1.

I'm now at the stage of dropping the table and trying to recreate it. After a few hours, I've discovered "OM" appears to have a dbdelete function but not a simple dbcreate function. This got me looking into creating a custom\schema but seems overly complex for something quite simple. 😕

I'll perhaps backtrack and reanalyse the problem.

 

 

Edited by AlwaysSkint
Link to post
(edited)

If I manually remove AUTO_INCREMENT from the target customers_groups table, then the migration works. So I need a simple means of removing this prior to the migration, then add it back in once the data has transferred.

 

Edited by AlwaysSkint
Link to post
(edited)

I've now figured out this was the wrong way around and now corrected to..

          'group_tax' => (int)$data['customers_group_show_tax'],
          'group_order_taxe' =>  $data['customers_group_tax_exempt']

There is an issue with ClicShopping

'group_tax' = 0 should be Excluding Tax and 'group_tax' = 1 should be Including Tax.

Also, I can't use 2 other fields because they are the opposite of the original meaning..

Originals are: 'group_payment_allowed' and 'group_shipment_allowed'

ClicShopping: 'group_payment_unallowed' and 'group_shipment_unallowed'

😢

 

Edited by AlwaysSkint
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