Jump to content

Recommended Posts

Been inspecting how new hook system works taking it from paypal app. I've come to conclusion the system basically uses these principles:

 

  • hooks.php in catalog/includes/classes: Class to register and call hook system
  • Calls to create a new instance of the class in catalog/includes/application_top.php and catalog/admin/includes/application_top.php
  • The following changes to orders.php:
// this registers the class for this page
  $OSCOM_Hooks->register('orders');

// this returns the new tab content
  $OSCOM_Hooks->call('orders', 'orderAction');

// this returns the new tab button
 $OSCOM_Hooks->call('orders', 'orderTab');

Is this correct? Are there any documentation or sample (apart of paypal app) that covers this hook system?

 

For now I've found that if there are no app classes for this page in includes\hooks\admin\orders the system throws a warning:

 

Warning: Invalid argument supplied for foreach() in C:\htdocs\234_order_editor\includes\classes\hooks.php on line 56

 

so an error check should be added just in case there are no apps or modules installed, otherwise the system could not be added to other admin pages. Am I right?

Share this post


Link to post
Share on other sites

Well today I learned about heredoc string method. Nice! :)

 

Also learned how to add a tab and simple content. The script that does the tab button is

<script>
$(function() {
  $('#orderTabs ul').append('<li><a href="{$tab_link}">{$tab_title}</a></li>');
});
</script>

I'm not good at javascript. Anyone can help me with hiding and reordering the tabs?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×