title: How to return ajax response with error http code from PrestaShop ModuleFrontController?
body: <p>I start working with PrestaShop 1.7.6 (before I worked with Symfony) and I write few custom modules to PrestaShop, but now I want send json data from my front controller module to user. Everything works fine if I send json with http code 200, but now I want send error message with proper http code (e.g 400). In Symfony I can do that by using JsonResponse (I try to do that here but it's not working as expected).I saw in presta controller are just two methods with ajax response (ajaxDie - which is deprecated and ajaxRender), but both of them doesn't takes as parameter http code response and always send 200.</p>
  <pre><code>    if (!$product) {
           $json = Tools::jsonEncode(['status' =&gt; false]);
           $this-&gt;ajaxRender($json);
  
           //return new JsonResponse($json, Response::HTTP_BAD_REQUEST);// doesn't send proper code
      }
  </code></pre>
  <p>Can anyone tell me how to send error code from module front controller which extends ModuleFrontController?? Now only possible to me action is send error message with http code 200 (but I think it's bad idea to send error with that code). Thanks a lot for any help.</p>