Jump to content
Latest News: (loading..)
Portman

call to new function in addon

Recommended Posts

Hi

I am using BS Frozen

I have been doing some modifications to an add-on and I have created a new <function> to the code to make the add-on operate in the way I need it to...

This has worked fine within the files of the add-on....

Now I want to call that function (located in catalog/includes/module/store/st_addon.php) in catalog/product_info.php...

Can I do that? and if so how?

Share this post


Link to post
Share on other sites
require('includes/application_top.php'); //<-- you need find this line and insert the code bellow

// includes your function file here
require('includes/module/store/st_addon.php');

Insert this code in product_info.php file...


Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

No pierdas el tiempo. Si quieres usar la versión más estable de osCommerce (la realizada por la comunidad, que además es 'responsive', la 2.3.4.1BS Edge) pincha aquí y aquí para descargarte el idioma Español.

Share this post


Link to post
Share on other sites

Hello Pete @Portman,

If you added the function outside the module class as a independant function, it should be available if the module is active on the product_info page.

Check if there is a page selection if you have product_info.php included.

Then the store module is loaded in template_top.php (supposed it's one of my store module  add-ons, it is a modified header_tag module).

Therefore the function will not be available before the template_top.php call:

  require('includes/template_top.php');

If you need the function before, you should opt to include it in includes/functions/general.php instead of adding it to the module.

Then it is available everywhere after:

  require('includes/application_top.php');

 

Edited by raiwa

Share this post


Link to post
Share on other sites

thanks @raiwa... that was what I needed to know!

Yes I am modifying one of your addons - or at least trying to - at this stage trying to create the ability to hide products from particular wholesale groups 

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

×