shopinvader / odoo-shopinvader

Odoo Modules. Sorry Magento, Shopinvader is coming
GNU Affero General Public License v3.0
119 stars 102 forks source link

Product wishlist metadata by user #574

Closed simahawk closed 1 year ago

simahawk commented 4 years ago

Related to https://github.com/shopinvader/odoo-shopinvader/issues/457

We must be able to determine if a product stays in a customer's wishlist or not on client side. How can we handle this?

If we still don't want to call odoo when we load the product page, I think that the only way is to have a specific index in the search engine that stores wishlist metadata. Each record would be a wishlist w/ this params:

This way you can:

@lmignon @rousseldenis @sebastienbeau your input is much appreciated.

lmignon commented 4 years ago

@simahawk All this makes sens....

name (maybe a dict w/ translations, to not have 1 index per each language)

The wishlist name is translatable ?????

simahawk commented 4 years ago

The wishlist name is translatable ?????

actually not, I went by memory :sweat_smile: One thing less to take care of :)

Regarding the lang we have some constraints tho, because it's a required field for indexes.

See https://github.com/OCA/search-engine/blob/12.0/connector_search_engine/models/se_index.py#L22 https://github.com/shopinvader/odoo-shopinvader/blob/13.0/shopinvader_search_engine/models/se_index.py#L18

In theory having a lang on this index should be useless. Anyway, let's consider we stick to current behavior.

We'll have to determine the language to be used and we should be able to pass to the client the index name; the complete name otherwise is going to use the current lang to compute the name and won't find anything.

Otherwise, we assume multilang is going to be supported on wishlists as well and we export multilang settings as we do for existing indexes. Then the client will use the only index available as fallback in case it does not find a name matching current lang.

What do you think?

hparfr commented 4 years ago

Everything in the SE is more or less public. Isn't it a concern about user privacy ?

simahawk commented 4 years ago

you are right but we can simply use something else instead of the email (partner_id or an hash or something else). It seems good at least for a 1st version.

lmignon commented 4 years ago

@simahawk IMO we should support indexes without lang..

simahawk commented 4 years ago

Quick wrap up of recent call w/ @sebastienbeau and @thibaultrey . We are going to simplify this a lot in a way that will be compatible w/ future redis integration (or whatever advanced caching sys we'll have).

On odoo side, we sync on the partner a mapping of product -> wishlist ids and a mapping of whishlist id -> whishlist names. Something like:

wishlist_info = {
    "products": {
        pid1: [1, 2, 3] # wishlist ids,
        pid2: [1, 2, 3] # wishlist ids,
        pid3: [1, 2, 3] # wishlist ids,
    }
    "wishlists": {
        1: {"name": "Wishlist 1"},
        2: {"name": "Wishlist 2"},
    }
}

This will be pushed as json on the customer/user record on locomotive synchronously every time the list of products on a wishlist changes.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.