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
```<br />
<br />
I then pulled up that part of the code and saw:<br />
<br />
```php
if (defined('AJAX_REQUEST')) {<br />
            fn_prepare_product_quick_view($_REQUEST);<br />
<br />
            $view->display('views/products/quick_view.tpl');<br />
            exit;<br />
        }
```<br />
<br />
I'm thinking this has something to do with the ($_REQUEST) part, but I'm not sure.<br />
<br />
I then pulled up this part of code from 3.0.3 and saw:<br />
<br />
```php
if (defined('AJAX_REQUEST')) {<br />
            if (!empty($_REQUEST['prev_url'])) {<br />
                $view->assign('redirect_url', $_REQUEST['prev_url']);<br />
            }<br />
<br />
            $view->display('views/products/quick_view.tpl');<br />
            exit;<br />
        }
```<br />
<br />
Which is obviously different.<br />
<br />
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.<br />
<br />
Anyone have any ideas why this is?<br />
<br />
Thanks,<br />
<br />
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