Please, help me with importing only customers from nopC 3.5 to new nopC 3.9. I have Win VPS Server, both sites are there...

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hello.

I have the working site on nopCommerce 3.50.

Now, I am going to move to nopCommerce 3.90 version. I have already installed and configured the new site 3.90...

I want to import customer accounts only to new site from 3.5 to 3.9.

Also, i want to move all reviews from old site to new site...

Both sites and MSSQL Databases are on the same Win VPS Server. I can share it with you so that you would help me with importing...

If you can help me, please, contact me by Skype ID: zaf.su

Thanks in advance!
6 years ago
You can do this yourself, by copying the database from version 3.50 and sequentially execute the files upgrade.sql from versions 3.60, 3.70, 3.80 and 3.90. Then you can delete what you do not need from new database.
6 years ago
hi
u can try the following
I wrote it along time ago so u need to update some of the fields according to the new tables

u can add more customer attributes i only took name and last name

hope it helps


declare
    @CustomerGuid  uniqueidentifier,
    @Username nvarchar(1000),
        @Email nvarchar(1000),
        @Password nvarchar(max),
        @PasswordFormatId int,
        @PasswordSalt nvarchar(max),
        @AdminComment nvarchar(max),
        @IsTaxExempt bit,
        @AffiliateId int,
        @VendorId int,
        @Active bit,
        @Deleted bit,
        @IsSystemAccount bit,
        @SystemName nvarchar(max),
        @LastIpAddress nvarchar(max),
        @CreatedOnUtc datetime,
        @LastLoginDateUtc datetime,
        @LastActivityDateUtc datetime,
        @BillingAddress_Id int,
        @ShippingAddress_Id int,
        @IsBanned bit,
    @EntityId int,
        @FirstName nvarchar(400),
        @LastName nvarchar(max),
    @InsertId int,
    @i int = 0,

        @EmailExternal nvarchar(max),
        @ExternalIdentifier nvarchar(max),
        @ExternalDisplayIdentifier nvarchar(max),
        @OAuthToken nvarchar(max),
        @OAuthAccessToken nvarchar(max),
        @ProviderSystemName nvarchar(max)
    
    

WHILE @i < 500000 BEGIN
  SET @i = @i + 1
  SET @EntityId = @i
  
  SELECT
     @CustomerGuid  = [CustomerGuid],
       @Username = [Username],
       @Email = [Email],
     @Password = [Password],
       @PasswordFormatId = [PasswordFormatId],
       @PasswordSalt = [PasswordSalt],
       @AdminComment = [AdminComment],
       @IsTaxExempt = [IsTaxExempt],
       @AffiliateId = [AffiliateId],
       @VendorId = [VendorId],
       @Active = [Active],
       @Deleted = [Deleted],
       @IsSystemAccount = [IsSystemAccount],
       @SystemName = [SystemName],
       @LastIpAddress= [LastIpAddress],
       @CreatedOnUtc = [CreatedOnUtc],
       @LastLoginDateUtc = [LastLoginDateUtc],
       @LastActivityDateUtc = [LastActivityDateUtc],
       @BillingAddress_Id = [BillingAddress_Id],
       @ShippingAddress_Id = [ShippingAddress_Id]
  FROM [windalert_sql].[dbo].[Customer]
  WHERE Id = @EntityId

  IF @@RowCount <> 0
  BEGIN
    SELECT  @FirstName  = [Value] FROM [windalert_sql].[dbo].[GenericAttribute]  
    WHERE EntityId = @EntityId AND [Key] = 'FirstName'

    SELECT  @LastName  = [Value] FROM [windalert_sql].[dbo].[GenericAttribute]  
    WHERE EntityId = @EntityId AND [Key] = 'LastName'

    INSERT INTO [windalert].[dbo].[Customer]([CustomerGuid],[Username],[Email],[Password],[PasswordFormatId],[PasswordSalt],[AdminComment],[IsTaxExempt]
           ,[AffiliateId],[VendorId],[Active],[Deleted],[IsSystemAccount],[SystemName],[LastIpAddress],[CreatedOnUtc] ,[LastLoginDateUtc]
           ,[LastActivityDateUtc] ,[BillingAddress_Id],[ShippingAddress_Id])
    VALUES
           ( @CustomerGuid,@Username ,@Email,@Password,@PasswordFormatId,@PasswordSalt,
             @AdminComment,@IsTaxExempt,@AffiliateId,@VendorId,@Active,
             @Deleted,@IsSystemAccount,@SystemName,@LastIpAddress,@CreatedOnUtc,
         @LastLoginDateUtc,@LastActivityDateUtc,@BillingAddress_Id,@ShippingAddress_Id
       )
    SELECT @InsertId = Id from [windalert].[dbo].[Customer] where Email = @Email

    INSERT INTO [windalert].[dbo].[GenericAttribute]([EntityId],[KeyGroup],[Key],[Value],[StoreId])
    VALUES(@InsertId, 'Customer', 'FirstName', @FirstName,0)
    INSERT INTO [windalert].[dbo].[GenericAttribute]([EntityId],[KeyGroup],[Key],[Value],[StoreId])
    VALUES(@InsertId, 'Customer', 'LastName', @LastName,0)
    
    SELECT
      @EmailExternal = [Email],
      @ExternalIdentifier = [ExternalIdentifier],
      @ExternalDisplayIdentifier = [ExternalDisplayIdentifier],
      @OAuthToken = [OAuthToken],
      @OAuthAccessToken = [OAuthAccessToken] ,
      @ProviderSystemName = [ProviderSystemName]
     FROM  [windalert_sql].[dbo].[ExternalAuthenticationRecord] WHERE CustomerId = @EntityId
    IF @@RowCount <> 0
    BEGIN
      INSERT INTO [windalert].[dbo].[ExternalAuthenticationRecord]
        ([CustomerId],[Email],[ExternalIdentifier],[ExternalDisplayIdentifier]
         ,[OAuthToken] ,[OAuthAccessToken] ,[ProviderSystemName])
         VALUES(@InsertId,@EmailExternal,@ExternalIdentifier,@ExternalDisplayIdentifier
         ,@OAuthToken ,@OAuthAccessToken ,@ProviderSystemName)

    END
  END
END
GO
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.