Skip to content
Permalink
Browse files

[IMP] website_sale_slides: improve course purchase flow

Slight improvement to the course purchase flow that directly redirects the user
to the checkout process when he buys a course.

closes #32649

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
  • Loading branch information...
awa-odoo authored and tde-banana-odoo committed Apr 12, 2019
1 parent 96e3442 commit 11b24c6b45893a8802054a3351a20f8b834f0043
@@ -409,7 +409,7 @@ def cart(self, access_token=None, revive='', **post):

return request.render("website_sale.cart", values)

@http.route(['/shop/cart/update'], type='http', auth="public", methods=['POST'], website=True, csrf=False)
@http.route(['/shop/cart/update'], type='http', auth="public", methods=['GET', 'POST'], website=True, csrf=False)
def cart_update(self, product_id, add_qty=1, set_qty=0, **kw):
"""This route is called when adding a product to cart (no options)."""
sale_order = request.website.sale_get_order(force_create=True)
@@ -432,6 +432,10 @@ def cart_update(self, product_id, add_qty=1, set_qty=0, **kw):
product_custom_attribute_values=product_custom_attribute_values,
no_variant_attribute_values=no_variant_attribute_values
)

if kw.get('express'):
return request.redirect("/shop/checkout?express=1")

return request.redirect("/shop/cart")

@http.route(['/shop/cart/update_json'], type='json', auth="public", methods=['POST'], website=True, csrf=False)
@@ -18,7 +18,7 @@
t-esc="product_info['list_price']"
t-options="{'widget': 'monetary', 'display_currency': product_info['currency_id']}"/>
</div>
<a role="button" class="btn btn-primary btn-block" t-att-href="channel.product_id.website_url">
<a role="button" class="btn btn-primary btn-block" t-att-href="'/shop/cart/update?product_id=%s&amp;express=1' % channel.product_id.id">
<span class="cta-title text_small_caps">Buy Course</span>
</a>
</t>

0 comments on commit 11b24c6

Please sign in to comment.
You can’t perform that action at this time.