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.

  • SideSam 13 posts 33 karma points
    Nov 14, 2011 @ 16:54
    SideSam
    0

    Issue with Product.CreatedBy property

    Hello,

    I am trying to create product and specify CreatedBy so later I would be able to select Products that have matching CreatedBy property.

    So far I am able to create products from API, everything works fine and I can see that products are created in backend:

            var product = new Product
            {
                Sku = "sku-123",
                Name = "my product name",
                CreatedBy = "some-existing-member-or-user",
                AllowOrdering = true,
                DisplayOnSite = true,
                ProductDefinition = productDefinition, //existing definition
                ThumbnailImageMediaId = 1081
            };
            product.Save();

    But when I try to select products by CreatedBy property like that I always get empty list.

    IList<Product> products = Product.Find(x => x.CreatedBy == "some-existing-member-or-user");

    I tried selecting all products in code, change CreatedBy property in loop and save, after I do that I can "Find(..)" them by CreatedBy property as expeted.

    Any ideas of what could be the reasion that I am not able to save these properties when creating product for the first time? Or maybe I am using them incorrectly?

  • SideSam 13 posts 33 karma points
    Nov 15, 2011 @ 09:33
    SideSam
    0

    Edit: When I crete items from code for the first time they always have CreateBy property set to "admin" (default value?).

    Edit functionality here seems to be broken :(

  • Søren Spelling Lund 1797 posts 2786 karma points
    Nov 29, 2011 @ 08:58
    Søren Spelling Lund
    0

    Hello,

    Could you take a look in the database after the first run and see if the values are updated? The CreatedBy and ModifiedBy properties are maintained automatically by uCommerce based on who's logged in when the code runs that might be what's tripping you up.

Please Sign in or register to post replies

Write your reply to:

Draft