Developer forum

Forum » Development » Assortments and anonymous user

Assortments and anonymous user

Dmitrij Jazel
Reply

Hi everyone,

We have these product groups:

GROUPA

GROUPB

GROUPC

 

And we have created an assortment where the customer YYYY can see the groups A and B. This is working fine.

The questions is:

How can we manage that they only see the group A and C whyle you are Anonymous (not loggedin user)?

 

In order to setup assortment you have to use userID and groupID, but anonymous user has no ID, but we need to apply assortment rule to it.


Replies

 
Morten Snedker
Reply

Hi Dmitrij,

You can't by default. Basically, an assortment is the relation between users and products. Once a product enters an assortment, only users that are member of this assortment are allowed to view the product

Hence, products that should be publicly available (seen by not logged in user) should NOT be in any assortment.

That aside, I do not understand your concept:

If logged in: you have assortment with group A in it = only logged in user may see products in this group.
If not logged in: you may still see group A.

So why put group A in an assortment, if everyone should be able to see it..?

Let me know if I make sense or if it's all babble, and let me know if I've misunderstood your description. :-)

 

Best regards
/Snedker

 
Dmitrij Jazel
Reply

Well The reason why we do must have that user - is because all products are included in the assortments.

There are so many users and products, that you are able to find a situation when you are lot loggedin and you are supposed to see the product that few others can't. In this situation - you assign assortment to a loggedin user that is supposed to see the product, not logged in must also see them - but there are some users that must not be able to see and filter those certain products.

That is atleast how it is setted up in ERP system. For now the issue remains. Possible solution is to reconstruct that whole assortment structure in ERP dirrectly, but not sure if customers can do it.

I will try to get some more details, and will try getting back to you.

Thanks for so much...

/Dmitrij

 
Morten Snedker
Reply

Optionally you can provide/build your own assortment logic. It is basically just a table with userID+ProductID, and then a template extender with logic decides whether or not product should be listed in a given situation.

 

/Snedker

 

 
Dmitrij Jazel
Reply

Hej Morten,

But in that case, what about filtering values? One of the reasons why I like Assortments, is because filtering is prerendered accordingly to assorted products aswell.

Maybe you could give a short example of such template extender? :-)

 

/Dmitrij

 
Morten Snedker
Reply

Using a ProductListeTemplateExtender:

 

using Dynamicweb;
using Dynamicweb.eCommerce.Products;

namespace ClassLibrary1
{
    public class ProductListTemplateExtender1 : ProductListTemplateExtender
    {
        public override void ExtendTemplate(Dynamicweb.Rendering.Template template)
        {

            foreach (Product p in this.ProductList)
            {
                // your logic
                if ("a" != "b")
                {   //remove product from productlist collection
                    p.RemoveItem(p.ID);
                }
            }
        }
    }
}

 

So, you start by having a complete list of products in the product list, and then use your own logic to remove products from the list before render. 

Hope this helps! :-)

/Snedker

 
Dmitrij Jazel
Reply

Hej Morten,

Now, thanks allot for your help! :-) I am sure we will find the best solution to it.

I know that we can use your examples, to achieve same thing that assortment does, that's all allright.

Me and my collegues decided to share some thoughts about assortments so far.

 

Here is our feedback on assortments, please feel free to collaborate:

So this is the assortment information example, where X means that in this case product must be included in the ProductList, and search index, filtering etc...

http://screencast.com/t/I4Ktj5Y1j3al

With the way (now DW works as we understood) In this picture, turns out that "Everyone" has bigger priority, than UserA or UserB.

Adding product to "Everyone" is the same as Remove product from Assortments.

This means that if "Apple" is selected for Everyone, than "User A" will still get it, no matter if he wishes it or not.

 

And if "User B" wishes to see only Apples and Cherry (because Everyone is everyone, and practically gets kind of bigger priority) - "User B" will still get Banana.

 

Only In case with "Watermelon" Both users will get desired results.

 

On another side, if we forget about "Everyone" and use Not authenticated user (Anonymous User) instead.

http://screencast.com/t/LkjdiIzb

Than, since everyone has it's own set of listed products - everyone is happy.

Just so when we are talking assortments - we are talking User profiles that are loggedin. But not yet loggedin user - it is the same user, and it would be great to have his own preset.

 

Than obviously if product is not in noones assortment set (in other words it is not in the assortments at all) - than it is for "Everyone" in any case.

 

Hope you see what I mean, please feel free to collaborate.

 

/Dmitrij

 
Dmitrij Jazel
Reply

Hej Morten,

I just got a chance to use your code example on anothe project.

And all goes well.

Except product is not beying removed from this.ProductList

Don't you have to .save() it somehow, or do something about it?

 

After I went through all products loop, I also this.ProductList.SaveAllProducts(); bot nothing happens.

I also tryed to modify, reasign, or do something about this.ProductList but those product still remained.

 

You must be logged in to post in the forum