@@ -37,19 +37,20 @@ class SwitchMerchantController extends AbstractController | |||
if ($context == 'admin') { | |||
$url .= 'admin'; | |||
} | |||
} | |||
if(!$url) { | |||
$url = $request->headers->get('referer'); | |||
} | |||
if($url) { | |||
return $this->redirect($url); | |||
} | |||
} | |||
if ($url) { | |||
return $this->redirect($url); | |||
} else { | |||
$this->addFlashTranslator('error', ActionDefinition::SWITCH_MERCHANT, 'Merchant'); | |||
return $this->redirect($request->headers->get('referer')); | |||
} | |||
$this->addFlashTranslator('error', ActionDefinition::SWITCH_MERCHANT, 'Merchant'); | |||
return $this->redirectToRoute('frontend_home'); | |||
} | |||
} |
@@ -33,6 +33,10 @@ class CartController extends AbstractController | |||
$idProductFamily = $data['order_products']['id_product_family']; | |||
$this->productFamily = $this->getProductFamilyContainer()->getStore()->getOneById($idProductFamily); | |||
if(!$this->productFamily) { | |||
$return['return'] = 'error'; | |||
} | |||
// alerte si cookies non acceptés | |||
if (!$user && !$visitor) { | |||
$this->addFlash( | |||
@@ -44,7 +48,7 @@ class CartController extends AbstractController | |||
'fos_user_security_login' | |||
) . '">connecter</a> pour ajouter un produit.' | |||
); | |||
return false; | |||
$return['return'] = 'error'; | |||
} | |||
if ($this->productFamily) { | |||
@@ -68,6 +72,8 @@ class CartController extends AbstractController | |||
$this->addOrderProduct($orderShop, $orderProduct); | |||
} | |||
} | |||
$return['return'] = 'success'; | |||
} | |||
} | |||
} |
@@ -90,9 +90,12 @@ class FavoriteController extends AbstractController | |||
private function _getProductFamily($request) | |||
{ | |||
$idProductFamily = $request->request->get('idProductFamily'); | |||
$productFamily = $this->getProductFamilyContainer()->getStore()->getOneById($idProductFamily); | |||
if ($productFamily) { | |||
if($idProductFamily) { | |||
$productFamily = $this->getProductFamilyContainer()->getStore()->getOneById($idProductFamily); | |||
} | |||
if (isset($productFamily) && $productFamily) { | |||
return $productFamily; | |||
} else { | |||
throw new \ErrorException('Ce produit est introuvable'); |
@@ -21,7 +21,7 @@ class UserMerchantEmailFilter extends AssociationFilter | |||
array( | |||
'required' => false, | |||
'attr' => array( | |||
'class' => ' input-sm', | |||
'class' => ' input-sm autocomplete-disabled', | |||
'form' => 'filters-form', | |||
), | |||
) |
@@ -21,7 +21,7 @@ class UserMerchantFirstnameFilter extends AssociationFilter | |||
array( | |||
'required' => false, | |||
'attr' => array( | |||
'class' => ' input-sm', | |||
'class' => ' input-sm autocomplete-disabled', | |||
'form' => 'filters-form', | |||
), | |||
) |
@@ -24,7 +24,7 @@ class UserMerchantLastnameFilter | |||
array( | |||
'required' => false, | |||
'attr' => array( | |||
'class' => ' input-sm', | |||
'class' => ' input-sm autocomplete-disabled', | |||
'form' => 'filters-form', | |||
), | |||
) |