Jump to content
Sign in to follow this  
ClicShopping

How to use Hooks with APP in administration ?

Recommended Posts

ClicShopping 3.X allow you to use use hooks inside your App to increase the functionalities in others App.


To use this element you can have different choice depends with the app than you want to use

 

Use the Hooks
In hooks you have 2 choices :

output to display an information
call to use a function.

 $CLICSHOPPING_Hooks->call('Orders','Update');
 $CLICSHOPPING_Hooks->ouput('Orders','ContentTracking', null 'display);

To use the hook with call you can have different choices depending of the Hooks : The best is to look this directory inside the original hook where you want to include anew functionalities :

ClicShopping/Apps/Products/ExtraFields/Modules/Hooks/ClicShoppingAdmin/ExtraFields
 $CLICSHOPPING_Hooks->call('Products','Insert');
 $CLICSHOPPING_Hooks->call('Products','Update');
 $CLICSHOPPING_Hooks->call('Products','Delete');
 $CLICSHOPPING_Hooks->call('Products','Save');

At end, don't forget to insert in the

clicshopping.json

the new hook

Display a Hooks
About to display a hooks inside the page you can you something like that
<div id="ContentTabQuantityDiscount"> in the original files you want to modify

inside the hooks you can use this element to display the information. it could a new tab or inside a tab a content.

For a Tab


$dejardins_button = HTML::button('button_name');
$content = '<div> Desjardi</div>;

        $output = <<<EOD
<div class="tab-pane" id="section_CMCICApp_content">
  <div class="mainTitle"></div>
  <div class="adminformTitle">
  <div class="separator"></div>
    {$dejardins_button}
    {$content}
  </div>
</div>

<script>
$('#section_CMCICApp_content').appendTo('#orderTabs .tab-content');
$('#orderTabs .nav-tabs').append('    <li class="nav-item"><a data-target="#section_CMCICApp_content" role="tab" data-toggle="tab" class="nav-link">{$tab_title}</a></li>');
</script>
EOD;

For a content

 you can use append or prepend

$content = '<div>mycontent</div>';

    $output = <<<EOD
<!-- ######################## -->
<!--  Start SpecialsApp      -->
<!-- ######################## -->
<script>
$('#tab9Content').prepend(
    '{$content}'
);
</script>
<!-- ######################## -->
<!--  End SpecialsApp      -->
<!-- ######################## -->
EOD;

For more informations, see the Hooks documentation

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use