Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New admin hook system


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?

Link to comment
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?

Link to comment
Share on other sites

  • 7 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...