For hooks to work, they need to have injection points in the Phoenix core.
Injection points call a $group and an $action with an optional $parameter array in some cases (see progressBar in list below).
For example:
echo $OSCOM_Hooks->call('siteWide', 'injectFormDisplay');
The above injection point does the following:
- The above example looks for hooks containing the listen_injectFormDisplay method (function)
- If the above is in a file that is contained in the catalog part of the core, then it will search for any hooks in the following:
- includes/hooks/shop/siteWide
- includes/hooks/shop/*
- Since this is a siteWide injection point, it means all areas of the site will call this routine.
- If you want the hook to show on all pages of your catalog, then place the hook in the siteWide folder.
- If you want the hook to only load on a single page like the product_info.php page, then add it to the includes/hooks/shop/product_info folder.
- If you want the hook to load on multiple pages, but not all pages, you then need to add to the siteWide folder and add some extra logic to detect the php page and render accordingly.
- If the above file is contained in the admin, then all of the same rules apply but the path would change to
- includes/hooks/admin/…
- Note that the class name in your hook file contains the file path in it’s name.
- includes/hooks/shop/siteWide/myHookExample.php would have a class name of hook_shop_siteWide_myHookExample
- includes/hooks/shop/product_info/myHookExample.php would have a class name of hook_shop_product_info_myHookExample
- includes/hooks/admin/siteWide/myHookExample.php would have a class name of hook_admin_siteWide_myHookExample
- includes/hooks/shop/siteWide/myHookExample.php would have a class name of hook_shop_siteWide_myHookExample
In order to target these and use them effectively, you should refer to the file that you are wanting to target and then limit your hook to that area only.
I have listed the the current injection points and where they are located below:
- catalog
- siteWide, injectRedirects (allows you to redirect the page to another page. PHP wont allow this after anything is rendered to the page, so the injectRedirects is at the top of the code. )
- template_top
- siteWide, injectSiteStart (injects between the <head></head> tags and is useful for injecting styles, scripts, meta, etc.)
- template_top
- siteWide, injectBodyStart (injects after the opening <body> tag. Very useful if needing to inject code at the very top of the html page)
- template_top
- siteWide, injectBodyWrapperStart (injects after the main <div id=”bodyWrapper”> opening tag)
- template_top
- siteWide, injectBeforeHeader (injects before the inclusion of the header.php file)
- template_top
- siteWide, injectAfterHeader (injects after the inclusion of the header.php file)
- template_top
- siteWide, injectBodyContentStart (injects after the <div id=”bodyContent”> opening tag)
- template_top
- siteWide, injectBodyContentEnd (injects before the <div id=”bodyContent”> closing tag)
- template_bottom
- siteWide, injectBodyWrapperEnd (injects before the <div id=”bodyWrapper”> closing tag)
- template_bottom
- siteWide, injectBeforeFooter (injects before the inclusion of the footer.php file)
- template_bottom
- siteWide, injectAfterFooter (injects after the inclusion of the footer.php file)
- template_bottom
- siteWide, injectSiteEnd (injects before the footer_scripts are injected)
- template_bottom
- siteWide, injectBodyEnd (injects before the closing </body> tag)
- template_bottom
- siteWide, injectFormDisplay (injects code into forms on each of the pages)
- admin/customers
- templates/default/includes/ext/modules/content/reviews/write
- templates/default/includes/pages/account_edit
- templates/default/includes/pages/checkout_confirmation
- templates/default/includes/pages/checkout_payment
- templates/default/includes/pages/checkout_payment_address
- templates/default/includes/pages/checkout_shipping
- templates/default/includes/pages/checkout_shipping_address
- templates/default/includes/pages/contact_us
- templates/default/includes/pages/create_account
- templates/default/includes/pages/password_reset
- templates/default/includes/pages/checkout_payment
- siteWide, injectFormVerify (injects code into form verification on each of the pages)
-
- admin/customers
- password_reset
- account_edit
- address_book_process
- checkout_payment_address
- checkout_shipping_address
- create_account
- contact_us
-
- account_history_info, orderDetails (injects into the account history page)
- templates/default/includes/pages/account_history_info
- progress, progressBar, $params
- templates/default/includes/pages/checkout_confirmation
- templates/default/includes/pages/checkout_payment
- templates/default/includes/pages/checkout_shipping
- gdpr, injectRedirect
- gdpr
- gdpr, injectData
- gdpr
- gdpr, portData
- templates/default/includes/pages/gdpr
- siteWide, postAccountCreation (injects after saving account)
- create_account
- siteWide, postLogin (injects after login)
- create_account
- login
- siteWide, injectRedirects (allows you to redirect the page to another page. PHP wont allow this after anything is rendered to the page, so the injectRedirects is at the top of the code. )
Additional injection points by file:
admin/action_recorder.php : $OSCOM_Hooks->call('action_recorder', 'preAction'); admin/action_recorder.php : $OSCOM_Hooks->call('action_recorder', 'expireAction'); admin/action_recorder.php : $OSCOM_Hooks->call('action_recorder', 'postAction'); admin/advert_manager.php : $OSCOM_Hooks->call('advert_manager', 'preAction'); admin/advert_manager.php : $OSCOM_Hooks->call('advert_manager', 'importAction'); admin/advert_manager.php : $OSCOM_Hooks->call('advert_manager', 'setFlagAction'); admin/advert_manager.php : $OSCOM_Hooks->call('advert_manager', 'insertAction'); admin/advert_manager.php : $OSCOM_Hooks->call('advert_manager', 'updateAction'); admin/advert_manager.php : $OSCOM_Hooks->call('advert_manager', 'insertUpdateAction'); admin/advert_manager.php : $OSCOM_Hooks->call('advert_manager', 'deleteConfirmAction'); admin/advert_manager.php : $OSCOM_Hooks->call('advert_manager', 'postAction'); admin/advert_manager.php : echo $OSCOM_Hooks->call('advert_manager', 'editForm'); admin/advert_manager.php : echo $OSCOM_Hooks->call('advert_manager', 'newForm'); admin/configuration.php : $OSCOM_Hooks->call('configuration', 'preAction'); admin/configuration.php : $OSCOM_Hooks->call('configuration', 'saveAction'); admin/configuration.php : $OSCOM_Hooks->call('configuration', 'postAction'); admin/countries.php : $OSCOM_Hooks->call('countries', 'preAction'); admin/countries.php : $OSCOM_Hooks->call('countries', 'insertAction'); admin/countries.php : $OSCOM_Hooks->call('countries', 'saveAction'); admin/countries.php : $OSCOM_Hooks->call('countries', 'deleteConfirmAction'); admin/countries.php : $OSCOM_Hooks->call('countries', 'postAction'); admin/currencies.php : $OSCOM_Hooks->call('currencies', 'preAction'); admin/currencies.php : $OSCOM_Hooks->call('currencies', 'insertAction'); admin/currencies.php : $OSCOM_Hooks->call('currencies', 'saveAction'); admin/currencies.php : $OSCOM_Hooks->call('currencies', 'insertSaveAction'); admin/currencies.php : $OSCOM_Hooks->call('currencies', 'deleteConfirmAction'); admin/currencies.php : $OSCOM_Hooks->call('currencies', 'updateAction'); admin/currencies.php : $OSCOM_Hooks->call('currencies', 'deleteAction'); admin/customer_data_groups.php : $OSCOM_Hooks->call('customer_data_groups', 'preAction'); admin/customer_data_groups.php : $OSCOM_Hooks->call('customer_data_groups', 'insertAction'); admin/customer_data_groups.php : $OSCOM_Hooks->call('customer_data_groups', 'insertAction'); admin/customer_data_groups.php : $OSCOM_Hooks->call('customer_data_groups', 'saveAction'); admin/customer_data_groups.php : $OSCOM_Hooks->call('customer_data_groups', 'insertSaveAction'); admin/customer_data_groups.php : $OSCOM_Hooks->call('customer_data_groups', 'deleteConfirmAction'); admin/customer_data_groups.php : $OSCOM_Hooks->call('customer_data_groups', 'postAction'); admin/geo_zones.php : $OSCOM_Hooks->call('geo_zones', 'preSaction'); admin/geo_zones.php : $OSCOM_Hooks->call('geo_zones', 'insertSubSaction'); admin/geo_zones.php : $OSCOM_Hooks->call('geo_zones', 'saveSubSaction'); admin/geo_zones.php : $OSCOM_Hooks->call('geo_zones', 'deleteConfirmSubSaction'); admin/geo_zones.php : $OSCOM_Hooks->call('geo_zones', 'postSaction'); admin/geo_zones.php : $OSCOM_Hooks->call('geo_zones', 'preAction'); admin/geo_zones.php : $OSCOM_Hooks->call('geo_zones', 'insertZoneAction'); admin/geo_zones.php : $OSCOM_Hooks->call('geo_zones', 'saveZoneAction'); admin/geo_zones.php : $OSCOM_Hooks->call('geo_zones', 'deleteConfirmAction'); admin/geo_zones.php : $OSCOM_Hooks->call('geo_zones', 'postAction'); admin/includes/template_bottom.php : echo $OSCOM_Hooks->call('siteWide', 'injectSiteEnd'); admin/includes/template_bottom.php:echo $OSCOM_Hooks->call('siteWide', 'injectBodyEnd'); admin/includes/template_top.php : echo $OSCOM_Hooks->call('siteWide', 'injectSiteStart'); admin/includes/template_top.php:echo $OSCOM_Hooks->call('siteWide', 'injectBodyStart'); admin/info_pages.php : $OSCOM_Hooks->call('info_pages', 'preAction'); admin/info_pages.php : $OSCOM_Hooks->call('info_pages', 'setflagAction'); admin/info_pages.php : $OSCOM_Hooks->call('info_pages', 'updateAction'); admin/info_pages.php : $OSCOM_Hooks->call('info_pages', 'deleteconfirmAction'); admin/info_pages.php : $OSCOM_Hooks->call('info_pages', 'addnewAction'); admin/info_pages.php : $OSCOM_Hooks->call('info_pages', 'postAction'); admin/info_pages.php : echo $OSCOM_Hooks->call('info_pages', 'formEdit'); admin/info_pages.php : echo $OSCOM_Hooks->call('info_pages', 'formNew'); admin/info_pages.php : $pages = info_pages::get_pages($OSCOM_Hooks->call('info_pages', 'order_by')); admin/invoice.php : echo $OSCOM_Hooks->call('invoice', 'extraComments'); admin/languages.php : $OSCOM_Hooks->call('languages', 'preAction'); admin/languages.php : $OSCOM_Hooks->call('languages', 'insertAction'); admin/languages.php : $OSCOM_Hooks->call('languages', 'saveAction'); admin/languages.php : $OSCOM_Hooks->call('languages', 'deleteConfirmAction'); admin/languages.php : $OSCOM_Hooks->call('languages', 'deleteAction'); admin/languages.php : $OSCOM_Hooks->call('languages', 'postAction'); admin/login.php : $OSCOM_Hooks->call('login', 'preAction'); admin/login.php : $OSCOM_Hooks->call('login', 'processAction'); admin/login.php : $OSCOM_Hooks->call('login', 'logoffAction'); admin/login.php : $OSCOM_Hooks->call('login', 'createAction'); admin/login.php : $OSCOM_Hooks->call('login', 'postAction'); admin/mail.php : $OSCOM_Hooks->call('mail', 'preAction'); admin/mail.php : $OSCOM_Hooks->call('mail', 'sendEmailToUserAction'); admin/mail.php : $OSCOM_Hooks->call('mail', 'postAction'); admin/mail.php : echo $OSCOM_Hooks->call('mail', 'formPreview'); admin/mail.php : echo $OSCOM_Hooks->call('mail', 'formNew'); admin/manufacturers.php : $OSCOM_Hooks->call('manufacturers', 'preAction'); admin/manufacturers.php : $OSCOM_Hooks->call('manufacturers', 'insertSaveAction'); admin/manufacturers.php : $OSCOM_Hooks->call('manufacturers', 'deleteConfirmAction'); admin/manufacturers.php : $OSCOM_Hooks->call('manufacturers', 'postAction'); admin/modules_pi.php : $OSCOM_Hooks->call('modules_pi', 'preAction'); admin/modules_pi.php : $OSCOM_Hooks->call('modules_pi', 'saveAction'); admin/modules_pi.php : $OSCOM_Hooks->call('modules_pi', 'installAction'); admin/modules_pi.php : $OSCOM_Hooks->call('modules_pi', 'removeAction'); admin/modules_pi.php : $OSCOM_Hooks->call('modules_pi', 'postAction'); admin/newsletters.php : $OSCOM_Hooks->call('newsletters', 'preAction'); admin/newsletters.php : $OSCOM_Hooks->call('newsletters', 'lockAction'); admin/newsletters.php : $OSCOM_Hooks->call('newsletters', 'unlockAction'); admin/newsletters.php : $OSCOM_Hooks->call('newsletters', 'insertAction'); admin/newsletters.php : $OSCOM_Hooks->call('newsletters', 'updateAction'); admin/newsletters.php : $OSCOM_Hooks->call('newsletters', 'deleteConfirmAction'); admin/newsletters.php : $OSCOM_Hooks->call('newsletters', 'postAction'); admin/newsletters.php : echo $OSCOM_Hooks->call('newsletters', 'newForm'); admin/newsletters.php : echo $OSCOM_Hooks->call('newsletters', 'preview'); admin/orders_status.php : $OSCOM_Hooks->call('orders_status', 'preAction'); admin/orders_status.php : $OSCOM_Hooks->call('orders_status', 'insertSaveAction'); admin/orders_status.php : $OSCOM_Hooks->call('orders_status', 'deleteConfirmAction'); admin/orders_status.php : $OSCOM_Hooks->call('orders_status', 'deleteAction'); admin/orders_status.php : $OSCOM_Hooks->call('orders_status', 'postAction'); admin/packingslip.php : echo $OSCOM_Hooks->call('packingslip', 'extraComments'); admin/products_attributes.php : $OSCOM_Hooks->call('products_attributes', 'preAction'); admin/products_attributes.php : $OSCOM_Hooks->call('products_attributes', 'addProductOptionsAction'); admin/products_attributes.php : $OSCOM_Hooks->call('products_attributes', 'addProductOptionValuesAction'); admin/products_attributes.php : $OSCOM_Hooks->call('products_attributes', 'addProductAttributesAction'); admin/products_attributes.php : $OSCOM_Hooks->call('products_attributes', 'updateOptionNameAction'); admin/products_attributes.php : $OSCOM_Hooks->call('products_attributes', 'updateValueAction'); admin/products_attributes.php : $OSCOM_Hooks->call('products_attributes', 'updateProductAttributeAction'); admin/products_attributes.php : $OSCOM_Hooks->call('products_attributes', 'deleteOptionAction'); admin/products_attributes.php : $OSCOM_Hooks->call('products_attributes', 'deleteValueAction'); admin/products_attributes.php : $OSCOM_Hooks->call('products_attributes', 'deleteAttributeAction'); admin/products_attributes.php : $OSCOM_Hooks->call('products_attributes', 'postAction'); admin/reviews.php : $OSCOM_Hooks->call('reviews', 'preAction'); admin/reviews.php : $OSCOM_Hooks->call('reviews', 'setFlagAction'); admin/reviews.php : $OSCOM_Hooks->call('reviews', 'updateAction'); admin/reviews.php : $OSCOM_Hooks->call('reviews', 'deleteConfirmAction'); admin/reviews.php : $OSCOM_Hooks->call('reviews', 'addNewAction'); admin/reviews.php : $OSCOM_Hooks->call('reviews', 'postAction'); admin/reviews.php : echo $OSCOM_Hooks->call('reviews', 'formEdit'); admin/reviews.php : echo $OSCOM_Hooks->call('reviews', 'formNew'); admin/reviews.php : echo $OSCOM_Hooks->call('reviews', 'formPreview'); admin/specials.php : $OSCOM_Hooks->call('specials', 'preAction'); admin/specials.php : $OSCOM_Hooks->call('specials', 'setFlagAction'); admin/specials.php : $OSCOM_Hooks->call('specials', 'insertAction'); admin/specials.php : $OSCOM_Hooks->call('specials', 'updateAction'); admin/specials.php : $OSCOM_Hooks->call('specials', 'deleteConfirmAction'); admin/specials.php : $OSCOM_Hooks->call('specials', 'postAction'); admin/specials.php : echo $OSCOM_Hooks->call('specials', 'formNew'); admin/stats_customers.php : $OSCOM_Hooks->call('stats_customers', 'preAction'); admin/stats_customers.php : $OSCOM_Hooks->call('stats_customers', 'doCsvAction'); admin/stats_customers.php : $OSCOM_Hooks->call('stats_customers', 'postAction'); admin/store_logo.php : $OSCOM_Hooks->call('store_logo', 'preAction'); admin/store_logo.php : $OSCOM_Hooks->call('store_logo', 'saveAction'); admin/store_logo.php : $OSCOM_Hooks->call('store_logo', 'postAction'); admin/store_logo.php : echo $OSCOM_Hooks->call('store_logo', 'editForm'); admin/tax_classes.php : $OSCOM_Hooks->call('tax_classes', 'preAction'); admin/tax_classes.php : $OSCOM_Hooks->call('tax_classes', 'insertAction'); admin/tax_classes.php : $OSCOM_Hooks->call('tax_classes', 'saveAction'); admin/tax_classes.php : $OSCOM_Hooks->call('tax_classes', 'deleteConfirmAction'); admin/tax_classes.php : $OSCOM_Hooks->call('tax_classes', 'postAction'); admin/tax_rates.php : $OSCOM_Hooks->call('tax_rates', 'preAction'); admin/tax_rates.php : $OSCOM_Hooks->call('tax_rates', 'insertAction'); admin/tax_rates.php : $OSCOM_Hooks->call('tax_rates', 'saveAction'); admin/tax_rates.php : $OSCOM_Hooks->call('tax_rates', 'deleteConfirmAction'); admin/tax_rates.php : $OSCOM_Hooks->call('tax_rates', 'postAction'); admin/testimonials.php : $OSCOM_Hooks->call('testimonials', 'preAction'); admin/testimonials.php : $OSCOM_Hooks->call('testimonials', 'setFlagAction'); admin/testimonials.php : $OSCOM_Hooks->call('testimonials', 'updateAction'); admin/testimonials.php : $OSCOM_Hooks->call('testimonials', 'deleteConfirmAction'); admin/testimonials.php : $OSCOM_Hooks->call('testimonials', 'addNewAction'); admin/testimonials.php : $OSCOM_Hooks->call('testimonials', 'postAction'); admin/testimonials.php : echo $OSCOM_Hooks->call('testimonials', 'formEdit'); admin/testimonials.php : echo $OSCOM_Hooks->call('testimonials', 'formNew'); admin/zones.php : $OSCOM_Hooks->call('zones', 'preAction'); admin/zones.php : $OSCOM_Hooks->call('zones', 'insertAction'); admin/zones.php : $OSCOM_Hooks->call('zones', 'saveAction'); admin/zones.php : $OSCOM_Hooks->call('zones', 'deleteConfirmAction'); admin/zones.php : $OSCOM_Hooks->call('zones', 'postAction'); admin/administrators.php : $OSCOM_Hooks->call('administrators', 'preAction'); admin/administrators.php : $OSCOM_Hooks->call('administrators', 'insertAction'); admin/administrators.php : $OSCOM_Hooks->call('administrators', 'saveAction'); admin/administrators.php : $OSCOM_Hooks->call('administrators', 'deleteConfirmAction'); admin/administrators.php : $OSCOM_Hooks->call('administrators', 'postAction'); admin/categories.php : $OSCOM_Hooks->call('categories', 'preAction'); admin/categories.php : $OSCOM_Hooks->call('categories', 'setFlagAction'); admin/categories.php : $OSCOM_Hooks->call('categories', 'insertCategoryAction'); admin/categories.php : $OSCOM_Hooks->call('categories', 'updateCategoryAction'); admin/categories.php : $OSCOM_Hooks->call('categories', 'insertCategoryUpdateCategoryAction'); admin/categories.php : $OSCOM_Hooks->call('categories', 'deleteCategoryConfirmAction'); admin/categories.php : $OSCOM_Hooks->call('categories', 'deleteProductConfirmAction'); admin/categories.php : $OSCOM_Hooks->call('categories', 'moveCategoryConfirmAction'); admin/categories.php : $OSCOM_Hooks->call('categories', 'moveProductConfirmAction'); admin/categories.php : $OSCOM_Hooks->call('categories', 'productActionSave'); admin/categories.php : $OSCOM_Hooks->call('categories', 'preDuplicateCopyToConfirmAction', $parameters); admin/categories.php : $OSCOM_Hooks->call('categories', 'copyToConfirmAction'); admin/categories.php : $OSCOM_Hooks->call('categories', 'postAction'); admin/categories.php : echo $OSCOM_Hooks->call('categories', 'injectDataForm'); admin/categories.php : echo $OSCOM_Hooks->call('categories', 'injectLanguageForm'); admin/categories.php : echo $OSCOM_Hooks->call('categories', 'injectImageForm'); admin/categories.php : echo $OSCOM_Hooks->call('categories', 'productTab'); admin/customers.php : $OSCOM_Hooks->call('customers', 'preAction'); admin/customers.php : $OSCOM_Hooks->call('customers', 'updateAction'); admin/customers.php : $OSCOM_Hooks->call('customers', 'deleteConfirmAction'); admin/customers.php : $OSCOM_Hooks->call('customers', 'postAction'); admin/customers.php : echo $OSCOM_Hooks->call('customers', 'editForm'); admin/modules_content.php : $OSCOM_Hooks->call('modules_content', 'preAction'); admin/modules_content.php : $OSCOM_Hooks->call('modules_content', 'saveAction'); admin/modules_content.php : $OSCOM_Hooks->call('modules_content', 'installAction'); admin/modules_content.php : $OSCOM_Hooks->call('modules_content', 'removeAction'); admin/modules_content.php : $OSCOM_Hooks->call('modules_content', 'postAction'); admin/modules.php : $OSCOM_Hooks->call('modules', 'preAction'); admin/modules.php : $OSCOM_Hooks->call('modules', 'saveAction'); admin/modules.php : $OSCOM_Hooks->call('modules', 'installAction'); admin/modules.php : $OSCOM_Hooks->call('modules', 'removeAction'); admin/modules.php : $OSCOM_Hooks->call('modules', 'postAction'); admin/orders.php : $OSCOM_Hooks->call('orders', 'preAction'); admin/orders.php : $OSCOM_Hooks->call('orders', 'statusUpdateEmail'); admin/orders.php : $OSCOM_Hooks->call('orders', 'updateOrderAction'); admin/orders.php : $OSCOM_Hooks->call('orders', 'deleteConfirmAction'); admin/orders.php : $OSCOM_Hooks->call('orders', 'postAction'); admin/orders.php : $OSCOM_Hooks->call('orders', 'orderAction'); admin/orders.php : echo $OSCOM_Hooks->call('orders', 'sectionStatusHistoryContentForm'); admin/orders.php : echo $OSCOM_Hooks->call('orders', 'orderTab'); ext/modules/content/reviews/write.php : $OSCOM_Hooks->call('write', 'addNewAction');
The above list is current as of CE Phoenix 1.0.7.9
You can find a list of the injection points in the admin by searching the admin core for
$OSCOM_Hooks->call
The admin injection points are more complexly attached to functionality and you should take the time to understand in detail what the impact of your changes will be to the admin areas.