Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Neil Hodges 338 posts 987 karma points
    Mar 24, 2021 @ 11:52
    Neil Hodges
    0

    CMS Import & Tea Commerce

    I'd like to use CMS Import to import Products into Tea Commerce.

    Firstly I've managed to get the top-level details added in from a CSV file.

    Product Name
    SKU
    

    And so on.

    However when working with more complex property Types for instance:

    Nested Content & Tea Commerce Variants

    How do we structure the CSV file to accommodate these?

    Is there an example of an Excel file/CSV file someone has used before we can have a lok at?

    Even if the Variants are just say - Colour and Size for instance. How do we handle that in the spreadsheet? And Map using CMS Import?

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Mar 24, 2021 @ 12:26
    Richard Soeteman
    0

    Hi Neil,

    I worked with Anders on some Teacommerce extensions years ago. Don't know if theses are still valid but you can find them here https://www.dropbox.com/s/xhuwizhqe27tmt2/CMSImport.TeaCommerce-source.rar?dl=0

    The variants is in here and work as a seperate child import, so you basically have Categories -> Products (Child import of categories) -> Product variants (Child import of Products). Variants allows you to map to a variant and price

    Nested content is not something CMSImport can handle since it's a definition of it's own.

    Hope you can use the source code.

    Best,

    Richard

  • Neil Hodges 338 posts 987 karma points
    Mar 24, 2021 @ 14:39
    Neil Hodges
    0

    Hi Richard

    Thanks, I'll take a look.

    For things like Multi Media Pickers, Content Tree Pickers, Multi-Node Tree Pickers.

    Is there a format that information needs adding to a cell? Then generate the CSV.

    For instance, in a Multi-Media Picker, do we just list the file location of the images comma delimited?

    e.g - C:\Documents\Pic1.png, C:\Documents\Pic2.png

    And so on? Do they need to be in quotes? Is there a definitive guide on how we need to format cells in our spreadsheet so the CMS Import can map the values correctly to the corresponding property type?

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Mar 24, 2021 @ 14:43
    Richard Soeteman
    0

    For media Pickers use a relative path to the media item /images/pic1.png etc for link pickers use the title.

    Best to watch the video import Content First https://soetemansoftware.nl/cmsimport/videos that explains how to map the things.

    Best,

    Richard

  • Neil Hodges 338 posts 987 karma points
    Mar 24, 2021 @ 15:20
    Neil Hodges
    0

    Hi Richard

    Yes, I'm aware of how to map things in CMS Import, I select the corresponding item in the dropdown.

    I Just want to know how it should be saved/formatted in the Excel Spreadsheet so CMS Import knows how to map the value entered into the cell of the spreadsheet to the corresponding property type.

    Can it handle multiple images for the Multi-Image Picker? If I add the paths like this in a cell:

    "/images/pic1.jpg", "/images/pic2.jpg"

    will CMS Import know that it will import 2 images to that Property Type of Multi-Media Picker?

    Do I need the quotes around the file path?

  • Neil Hodges 338 posts 987 karma points
    Mar 24, 2021 @ 17:19
    Neil Hodges
    0

    Also when you say relative path for images, is this relative to Umbraco?

    enter image description here

    So in the images folder add an image and reference in the Excel spreadsheet?

    I have tried /images/product_images/pic1.png and this just fails, I get an error when opening the created product node, it can't find that URL.

    enter image description here

    Or do I need to upload the images to Umbraco's Media folder, and then add the relative path to the Excel spreadsheet?

    Surely this should all be documented somewhere? I've spent the best part of a day testing paths, text, in the hope it will magically map what I've added, is there any reference documentation I can use to make sure what I'm adding to my cells in Excel can be mapped correctly on import?

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Mar 25, 2021 @ 11:10
    Richard Soeteman
    0

    Hi Neil,

    The images need to be relative to the root folder. Did you set the advanced settings on the mapping?

    Below the sheet and the images folder I used in the video.

    https://www.dropbox.com/s/3mtrz9ljw2yhx54/Products.xlsx?dl=0 https://www.dropbox.com/s/ji759gehh6wkltf/productimages.zip?dl=0

  • Neil Hodges 338 posts 987 karma points
    Mar 25, 2021 @ 12:16
    Neil Hodges
    0

    HI Richard

    Thanks, I'll take a look at the Excel sheets.

    I guess it's all going to be nested with Keys to determine what each nestable options which rely on its parent.

    Hopefully, I can get this code to work for Tea Commerce Variants and the client can build up their Excel sheets accordingly.

    Where do I set up advanced settings on the mapping?

    Do I need to purchase a license to see those options. We're using the default one at the min to test we can import before committing and buying a license, but if we need it to set these options, we'll buy the license

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Mar 25, 2021 @ 12:23
    Richard Soeteman
    0

    Hi Neil,

    Ah that explains. The free version doesn't support media import If you email [email protected] I'll reply with a Trial license. And then you should see a settings icon after the Image property mapping.

    Hope this helps,

    Richard

  • Neil Hodges 338 posts 987 karma points
    Mar 25, 2021 @ 12:27
    Neil Hodges
    0

    HI Richard

    Brilliant, email sent.

  • Neil Hodges 338 posts 987 karma points
    Mar 26, 2021 @ 16:07
    Neil Hodges
    0

    HI Richard

    I'm trying to implement this - https://www.dropbox.com/s/xhuwizhqe27tmt2/CMSImport.TeaCommerce-source.rar?dl=0

    I've got it compiling into a DLL, added it to my bin folder, and referenced it in Visual Studio.

    I'm running a 'Create Child Definition' from the imported Products. Setting a ParentId and Id of the Variant, however it doesn't seem to map the Variants correctly?

    enter image description here

    As you can see it just creates them as Child Nodes of Type Variant. It's mapping some of the Properties Ok, so think I'm nearly there with it.

    When I Map the Property Types, There doesn't seem to be mapping for Colour and Sizes.

    Any pointers on how to get this working correctly?

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Mar 29, 2021 @ 07:04
    Richard Soeteman
    1

    Hi Neil,

    Did you use the TeacommerceVariant Import provider in that child import? I think you've used the standard one?

    Best,

    Richard

  • Neil Hodges 338 posts 987 karma points
    Mar 29, 2021 @ 09:39
    Neil Hodges
    0

    Morning Richard

    Hmmm, no i cant see that Option:

    enter image description here

    Using Umbraco 7.15.5 and CMS Import 3.7.8

    Do you happen to have a compiled DLL to use with it, I assume if it's not showing up here it's not setup/working correctly?

  • Neil Hodges 338 posts 987 karma points
    Mar 29, 2021 @ 10:12
    Neil Hodges
    0

    Looking at the code base you sent, TeacommerceVariantImportProvider has a couple of errors:

    public static ImportState GetPersistedStateByWizardID(Guid stateID) { var state = (ImportState)SerializeHelper.DeserializeBase64(DataHelper.LoadState(stateID)); < ------Cannot Access internal method return state; }

        /// <summary>
        /// Gets a list of  child state by parent ID. This is a list because more than 1 child import can be stored under a parent
        /// </summary>
        /// <param name="stateID">The state ID.</param>
        /// <returns></returns>
        public static List<ImportState> GetChildStateByParentID(Guid stateID)
        {
            List<ImportState> childStateList = new List<ImportState>();
            List<Guid> childStateIds = DataHelper.LoadChildStateIDs(stateID);  <------ Cannot Access internal method
            if (childStateIds.Count > 0)
            {
                foreach (Guid childStateID in childStateIds)
                {
                    childStateList.Add(GetPersistedStateByWizardID(childStateID));
                }
            }
            return childStateList;
        }
    

    I've commented these out to get it to build, as LoadChildStateIDs and LoadState are Internals. Unsure if they are needed or not? As GetChildStateByParentID has no references to being used?

    if they are needed, is there a way for it to access these internal methods?

  • Neil Hodges 338 posts 987 karma points
    Mar 29, 2021 @ 11:21
    Neil Hodges
    0

    Ok think im getting somewhere with this now:

    enter image description here

    I have the Teacommerce Variant provider

    I can't import a child definition, have to use Import Data to be able to select the Teacommerce Variant provider.

    When I run it against the Excel sheet I have i get the following error:

     2021-03-29 12:19:47,072 [P37020/D13/T442] ERROR CMSImportLibrary.Import.ImportProviders - CMSImport:Error during import
    System.Data.SqlClient.SqlException (0x80131904): Cannot find the object "CMSImportTeacommerceVariantImport" because it does not exist or you do not have permissions.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
       at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
       at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
       at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClass2_0.<ExecuteNonQueryWithRetry>b__0()
       at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
       at Umbraco.Core.Persistence.Database.Execute(String sql, Object[] args)
       at CMSImport.TeaCommerce.Services.VariantService.ClearTempTable() in C:\Users\Neil\source\repos\CMSImport.TeaCommerce-source\CMSImport.TeaCommerce\Services\VariantService.cs:line 16
       at CMSImport.TeaCommerce.ImportProviders.TeacommerceVariantImportProvider.Import(ImportState state, ImportOptions importOptions, ImportStatistics importStatistics) in C:\Users\Neil\source\repos\CMSImport.TeaCommerce-source\CMSImport.TeaCommerce\ImportProviders\TeacommerceVariantImportProvider.cs:line 136
       at CMSImportLibrary.Import.ImportProviders.(ImportState , ImportOptions , ImportStatistics , DataProvider )
    ClientConnectionId:81a6b9cb-0365-48e2-bb76-6556962dfe1e
    Error Number:4701,State:1,Class:16
     2021-03-29 12:19:47,072 [P37020/D13/T442] INFO  CMSImport.Extensions.Providers.ImportProviders.ImportProvider - CMSImport:Import finished, Records in datasource: 0, Records  Added 0, Records  Updated 0, Records skipped 0, Records deleted 0, Errors 1, duration 00:00:00 
    
  • Neil Hodges 338 posts 987 karma points
    Mar 29, 2021 @ 14:55
    Neil Hodges
    0

    Ok, sort of got this working now :)

    However the Table - CMSImportTeacommerceVariantImport has a NodeId of 0

    It stores the JSON in the VariantJSON column but unsure why my NodeId is not getting populated.

    I think once that's sorted this will then import the variants.

  • Neil Hodges 338 posts 987 karma points
    Mar 29, 2021 @ 15:41
    Neil Hodges
    0

    All working as should now!

    The NodeId is returning. I think the import needed the Parent Id of the Product import, now all working correctly.

    Thanks for your help, Richard!

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Mar 30, 2021 @ 06:48
    Richard Soeteman
    0

    Great to hear Neil, was about to go through your questions..

    Happy importing!

  • Neil Hodges 338 posts 987 karma points
    Mar 30, 2021 @ 08:04
    Neil Hodges
    0

    Yes, sorry about the barrage of questions, hopefully, me documenting it in this way will help someone else looking for the same thing in the future :)

    Thanks again Richard

Please Sign in or register to post replies

Write your reply to:

Draft