summaryrefslogtreecommitdiff
path: root/addons/website_livechat/models
diff options
context:
space:
mode:
authorfja-odoo <fja@odoo.com>2019-08-21 16:40:10 +0000
committerfja-odoo <fja@odoo.com>2019-09-16 09:38:53 +0000
commite33172e83210a5e0044a6fb92e315b84deefc440 (patch)
tree96edafcf0a9f2807bfe011fcfae414978f0f88a1 /addons/website_livechat/models
parent1bc4c1697f33c70927f204ffbd38d1e0ad9cba07 (diff)
[IMP] website_sale, *: keep track of products viewed
*= website, website_livechat, website_rating ///// Tracking Product ///// Now when a user browse products in eCommerce, we keep track of the products he looked at. We use the website_visitor to store the products viewed. A cookie is added with a TTl of 30 min it will prevent the RPC for that time. We track the page only if the product view is tracked. The recently viewed products are displayed as a snippet but also with the customize option in product pages of website_sale. Products that are in cart will not be returned as recently viewed. It is possible to add a recently viewed product to the cart directly from the carousel, it will not redirect to the cart. If we are on the cart page, the product is displayed in the cart. The Visitor page in website now references products viewed ///// Tracking Page ///// Feature to track a view was remove in: https://github.com/odoo/enterprise/pull/4834 That feature is now reintroduced and will use website_track instead of leads to be stored. The track field is now on the view instead of the page. url field is added to website.track, it will store the url for pages and views The Visitor page in website now references urls viewed Add some tests task-1984575 closes odoo/odoo#35810 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/website_livechat/models')
-rw-r--r--addons/website_livechat/models/mail_channel.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/addons/website_livechat/models/mail_channel.py b/addons/website_livechat/models/mail_channel.py
index ba8fb18fec7..e6d00133eff 100644
--- a/addons/website_livechat/models/mail_channel.py
+++ b/addons/website_livechat/models/mail_channel.py
@@ -50,8 +50,13 @@ class MailChannel(models.Model):
:param visitor: website.visitor of the channel
:return: arrow separated string containing navigation history information
"""
- recent_history = visitor.visitor_page_ids[:3] if len(visitor.visitor_page_ids) >= 3 else visitor.visitor_page_ids
- return ' → '.join(page.page_id.name + ' (' + page.visit_datetime.strftime('%H:%M') + ')' for page in recent_history)
+ history = []
+ for page in visitor.website_track_ids:
+ if page.page_id:
+ history += page.page_id.name + ' (' + page.visit_datetime.strftime('%H:%M') + ')'
+ if len(history) == 3:
+ break
+ return ' → '.join(history)
def close_livechat_request_session(self, message):
self.ensure_one()
@@ -75,4 +80,3 @@ class MailChannel(models.Model):
'last_connection_datetime': fields.datetime.now(),
})
return message
-