Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Hook is not callable Rate Topic   - - - - -

 
  • grayloon
  • Senior Member
  • Members
  • Join Date: 29-May 08
  • 450 posts

Posted 07 May 2012 - 09:59 PM #1

My store owner wanted his products sorted by price in each category, but he wanted them sorted descending. I found the line in the core/fn.catalog.php file where the 'products_sorting':
fn_set_hook('products_sorting', $sorting);

I tried to override this with the my_changes addon, but I'm getting an error:

Hook fn_my_changes_products_sorting is not callable


/addons/my_changes/init.php:
<?php
fn_register_hooks('products_sorting');

/addons/my_changes/controllers/customer/init.post.php:
<?php
function fn_my_changes_products_sorting(&$sorting)
{
  $sorting['price']['default_order'] = 'desc';
}
?>

Any ideas why this isn't working? I guess I could change the /core.fn.catalog array to sort desc for price, but I'd rather not modify core files.
7 CS-Cart licenses - 2.2 through 4.2

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11766 posts

Posted 08 May 2012 - 06:39 PM #2

Put your hook in func.php versus the controller and it will work fine.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • grayloon
  • Senior Member
  • Members
  • Join Date: 29-May 08
  • 450 posts

Posted 08 May 2012 - 07:59 PM #3

Put your hook in func.php versus the controller and it will work fine.


Worked perfectly. Thank you sir!
7 CS-Cart licenses - 2.2 through 4.2

 
  • globalburo
  • Junior Member
  • Members
  • Join Date: 16-Mar 11
  • 138 posts

Posted 15 August 2013 - 09:19 AM #4

hi,

I took this error,I faced white page.

Hook fn_******_get_orders is not callable

how to get rid of this situation?

NOTE: I am using v401

regards,
may

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11766 posts

Posted 15 August 2013 - 09:18 PM #5

Why are you deleting part of the error? That info would tell us what to tell you to change.
Whatever addon you are using "******" is using a fn_register_hooks() call for 'get_orders' and it cannot find the corresponding function.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1267 posts

Posted 17 August 2013 - 10:12 AM #6

Hi @grayloon,
The trick will work until you will have a catalog promotion ;), because the price will be recalculated after this particular hook

Please check controllers/customer/categories.php
  list($products, $search) = fn_get_products($params, Registry::get('settings.Appearance.products_per_page'));
  fn_gather_additional_products_data($products, array('get_icon' => true, 'get_detailed' => true, 'get_options' => true, 'get_discounts' => true, 'get_features' => false));

I consider you are using v2.2.3

---
Valentin
part of hungryweb.net

 

Posted 02 August 2020 - 04:55 AM #7

Getting similar error after enabling reward points addon. Appreciate a fix. thanks.

 

Tygh\Exceptions\AException Message

Hook fn_reward_points_load_products_extra_data is not callable

Error at

app/Tygh/Exceptions/DeveloperException.php, line: 41



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 20936 posts

Posted 03 August 2020 - 05:52 AM #8

The function should exist in the following file

 

app/addons/reward_points/func.php

 

Pelase check


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11766 posts

Posted 03 August 2020 - 06:18 PM #9

Also ensure you clear your cache since hooks are cached.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.