Announcement

Collapse
No announcement yet.

Unassign products from categories using product import flat file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Unassign products from categories using product import flat file

    I hate to ask this, I know I've done it before but can't get it to work right now and I've checked the documentation. I know how to assign products to categories using a flat file import but I have 80+ products, each assigned to various categories that I want to unassign from any categories at all, hopefully by way of an import using the product import. I tried using a blank field and assigning nothing to it, I tried assigning them all to a category that has no other products in it and used the replace function hoping I could just go to that category and quickly unassign them but all that did was assign them to that new category in addition to the categories they were already assigned to so that didn't help. Any suggestions would be appreciated.

    When its all said and done, I want these 80+ products not assigned to any category. Thank you.

    #2
    Re: Unassign products from categories using product import flat file

    In the current imports you can't remove category assignments, only add assignments.

    There is an XML way to do it.

    Here is some toolkit code to built the XML file which will remove a product from all categories

    Code:
    <mvt:item name="toolkit" param="productincategory|incatcount|g.product_code" />
    	<mvt:if expr="incatcount GT 0">
    		<mvt:foreach iterator="incategory" array="incategories">
    			<CategoryProduct_Unassign category_code="&mvt:incategory:code;" product_code="&mvt:global:product_code;" />
    		</mvt:foreach>
    	</mvt:if>
    I believe there is a bug on this that will be fixed in the core software so you can unassign products from categories via an import.
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      As this post is rather old, I'm hoping there is a solution to a similar problem I'm trying to resolve. Using the provisioning import in v9, I'd like to be able to change the product/category assignment of a given item. I am able to add assignments, but is there a way to remove those previously assigned?

      For example, product 123 is assigned to category A and Category B. Using an import, is there a way to have it only assigned to B? Or, to have it assigned to B and C?

      Thanks,
      Paul
      Last edited by ocpxc02; 01-23-16, 03:41 PM. Reason: I just realized this was in the 5.5 forum, instead v9, which I'm using.
      Paul

      Comment


        #4
        Yes there is now a setting under the Category Import in Data Management, Import Settings.

        You can choose how Miva treats the categories being imported. There is an option to Add New and Replace Existing Categories which should give you what you want.
        Brennan Heyde
        VP Product
        Miva, Inc.
        [email protected]
        https://www.miva.com

        Comment


          #5
          Originally posted by Brennan View Post
          Yes there is now a setting under the Category Import in Data Management, Import Settings.

          You can choose how Miva treats the categories being imported. There is an option to Add New and Replace Existing Categories which should give you what you want.
          Is this possible using the XML import as well?
          Paul

          Comment


            #6
            There are no settings for the XML since it going to execute the tags you have included in the import. But yes this is possible. You would first need to unassign products from all their existing categories the add then to the new ones.

            There is no tag for unassign all so you would need to know what categories it was first assigned to an include the XML to unassign from each.
            Brennan Heyde
            VP Product
            Miva, Inc.
            [email protected]
            https://www.miva.com

            Comment


              #7
              Originally posted by Brennan View Post
              There are no settings for the XML since it going to execute the tags you have included in the import. But yes this is possible. You would first need to unassign products from all their existing categories the add then to the new ones.

              There is no tag for unassign all so you would need to know what categories it was first assigned to an include the XML to unassign from each.
              Thanks, that's not too practical for us. It would be great if an "unassign all" tag were developed and could be placed and processed just ahead of the assign tags in the file.
              Last edited by ocpxc02; 01-25-16, 10:01 AM.
              Paul

              Comment


                #8
                I am so glad I Found this thread. I asked for this back as an xml provisioning in 2012 and it didn't exist (or i couldn't find the info). This will work!

                I pretty much want to do was ocpxc02 wants to do. But only for several hundred products instead of all of them.
                I am going to make a hidden page template that is pretty much a copy of the SMAP and password protect it. Inside the foreach that cycles through all the products, I will use this method. It pretty much will be a no brainer to just use that url, then import as normal to reassign things where I want them to go (with the next import) In my case, I will have a custom product field that I will set to true. I can import that. And then wrap the above example from brenan with the logic foreach product if my custom field is true do brenans stuff end if end foreach

                Comment


                  #9
                  I recently update all the category assignments on MivaScript.com

                  I create an import file that re-structured all the function -> categories but before importing that I ran a query listing all products (aka functions). I looped through each, calling the API function that removes all product category assignments.

                  Finally I imported my file to complete the process.

                  Ray Yates
                  "If I have seen further, it is by standing on the shoulders of giants."
                  --- Sir Isaac Newton

                  Comment

                  Working...
                  X