Copied to clipboard

Flag this post as spam?

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


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Marcin 5 posts 25 karma points
    Oct 29, 2012 @ 16:18
    Marcin
    0

    CategoryProductRelation save only first item

    Hi

    I have problem with saving product.CategoryProductRelation collection. If in this collection are more then one new item after save I see that only first item was saved. How can I resolve it ?

  • Marcin 5 posts 25 karma points
    Oct 29, 2012 @ 16:21
    Marcin
    0

    Some example:

                        var relation1 = new CategoryProductRelation();

                        relation1.Product = product;

                        relation1.Category = category1;

        var relation2 = new CategoryProductRelation();

                        relation2.Product = product;

                        relation2.Category = category2;

     

      product.CategoryProductRelation.Add(realation1);

      product.CategoryProductRelation.Add(realation2);

     product.Save();

     

    After that only relation1 is in db.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Nov 02, 2012 @ 09:50
    Søren Spelling Lund
    0

    Which version are you on?

  • Marcin 5 posts 25 karma points
    Nov 13, 2012 @ 12:24
    Marcin
    0

    2.6.1.0

  • Søren Spelling Lund 1797 posts 2786 karma points
    Nov 13, 2012 @ 16:18
    Søren Spelling Lund
    0

    Try

    category1.AddProduct(product, 0);
    category2.AddProduct(product, 0);
    category1.Save();
    category2.Save(); 

     

Please Sign in or register to post replies

Write your reply to:

Draft