I have product links of the form (olddomain.com/product_name-p-###)
Each one has a unique ID which I have stored in the product database in odoo. I'm trying to write a controller to redirect these pages to the correct product in odoo but am having some problems. In the code below the three commented lines don't seem to work.
# -*- coding: utf-8 -*-
import odoo.http as http
class dental_brands(http.Controller):
@http.route(['/<string():garbage>-p-<int:zenid>',
'/-p-<int:zenid>',
'/<string():catgarbage>/<string():garbage>-p-<int:zenid>'], type='http', auth='user', website=True)
def zencart_redirect_product(self, **kw):
odooid = 276886
# currrec = self.env('product.product').search(['x_studio_import_id, '=', zenid], limit=1)
# if currrec:
# odooid = currrec.id
return http.request.redirect('/shop/product/' + str(odooid))
# return http.request.render('dental_brands.index', {})
@http.route(['/<string():garbage>-c-<string():cpath>', type='http', auth='user', website=True)
def zencart_redirect_category(self, **kw):
odoocatid = 16852
return http.request.redirect('/shop/category/' + str(odoocatid))
Any help would be appreciated. Thanks.