getRow($sql);
$id = $product['id_product'];
if($id){
$sql = "Select link_rewrite from ps_product_lang where id_product = " . $id;
$productlang = $db->getRow($sql);
$link = $productlang['link_rewrite'];
$redirect = '/products/' . $id . '-' . strtolower($productCode) . '-' . $link . '.html';
header( 'Location: ' . $redirect);
}
else{
header( 'Location: /' ) ;
}
}
function redirectCat($category){
if(!is_int($category))
header( 'Location: /' ) ;
$db = Db::getInstance();
$sql = "Select * from ps_category_lang where id_category = " . $category;
$cat = $db->getRow($sql);
$id = $cat['id_category'];
$link = $cat['link_rewrite'];
if($id){
$redirect = '/' . $id . '-' . $link;
header( 'Location: ' . $redirect);
}
else{
header( 'Location: /' ) ;
}
}
?>