[FIX] website_sale: fix ga Ecommerce statistics

Name from product was missing / confusing with category name
https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEcommerce
This commit is contained in:
Jeremy Kersten 2015-06-30 09:35:29 +02:00
parent 9334645f82
commit 02d3e703a2
1 changed files with 4 additions and 3 deletions

View File

@ -914,17 +914,18 @@ class website_sale(http.Controller):
for line in order_lines: for line in order_lines:
ret.append({ ret.append({
'id': line.order_id and line.order_id.id, 'id': line.order_id and line.order_id.id,
'name': line.product_id.categ_id and line.product_id.categ_id.name or '-',
'sku': line.product_id.id, 'sku': line.product_id.id,
'quantity': line.product_uom_qty, 'name': line.product_id.name or '-',
'category': line.product_id.categ_id and line.product_id.categ_id.name or '-',
'price': line.price_unit, 'price': line.price_unit,
'quantity': line.product_uom_qty,
}) })
return ret return ret
@http.route(['/shop/tracking_last_order'], type='json', auth="public") @http.route(['/shop/tracking_last_order'], type='json', auth="public")
def tracking_cart(self, **post): def tracking_cart(self, **post):
""" return data about order in JSON needed for google analytics""" """ return data about order in JSON needed for google analytics"""
cr, uid, context = request.cr, request.uid, request.context cr, context = request.cr, request.context
ret = {} ret = {}
sale_order_id = request.session.get('sale_last_order_id') sale_order_id = request.session.get('sale_last_order_id')
if sale_order_id: if sale_order_id: