Quick View Error

So I just imported a store from 2.x to 3.0.4 and am working on getting everything wrapped up on it. While testing, I tried the quick view and got the “Oops” error. I then pulled up my error log and saw:


[22-Nov-2012 18:15:18] PHP Fatal error: Call to undefined function fn_prepare_product_quick_view() in /home/user/public_html/store/controllers/customer/products.php on line 207



I then pulled up that part of the code and saw:


if (defined('AJAX_REQUEST')) {
fn_prepare_product_quick_view($_REQUEST);

$view->display('views/products/quick_view.tpl');
exit;
}




I'm thinking this has something to do with the ($_REQUEST) part, but I'm not sure.



I then pulled up this part of code from 3.0.3 and saw:


if (defined('AJAX_REQUEST')) {
if (!empty($_REQUEST['prev_url'])) {
$view->assign('redirect_url', $_REQUEST['prev_url']);
}

$view->display('views/products/quick_view.tpl');
exit;
}




Which is obviously different.



When I replaced my 3.0.4 code with my 3.0.3 code, I was then able to bring up the quick view with no errors.



Anyone have any ideas why this is?



Thanks,



Brandon

Hello brandonvd,



Thank you for your message.



It seems that the issue occurred because the core/fn.catalog.php file of your CS-Cart installation was not updated for some reason when your store was being upgraded. So the fn_prepare_product_quick_view function was not defined in this file, that is why you saw the mentioned PHP error.



I suggest that you should better define this function in the core/fn.catalog.php file of your CS-Cart installation by adding the following code:




```php /**

  • Prepares product quick view data

    *
  • @param array $params Parameteres for gathering additional quick view data
  • @return boolean Always true

    */

    function fn_prepare_product_quick_view($params)

    {

    if (!empty($params['prev_url'])) {

    Registry::get('view')->assign('redirect_url', $params['prev_url']);

    }



    /**
    • Additional actions for product quick view

      *
    • @param array $_REQUEST Request parameters

      */

      fn_set_hook('prepare_product_quick_view', $_REQUEST);



      return true;

      } ```



      before this part of code:


?>



Also I suggest that you should revert the changes which you implemented in the controllers/customer/products.php file after this.



Please check my recommendations.



Thank you.





Pavel Zyukin

CS-Cart Support team

Sweet, thank you for the solution, it worked perfectly.



Brandon

Hello Brandon,



You are welcome.





Pavel Zyukin

CS-Cart Support team