Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

calling ext. functions in module?


ncoded

Recommended Posts

hi,

 

i have wrote a seperate library file (containing functions) and want to call these functions in a module (product_listing.php).

 

so, i do this:

 

require_once "fnfile.php";

 

then later osc does this, eg allocate a value from an array

 

$p_id = $product['products_id'];

 

however when i call a function from this included file as follows:

 

$cat_link_back_url=product_model_to_cat_name_url($p_id);

 

it fails with this message:

 

Fatal error: Call to undefined function product_model_to_cat_name_url() in /home/xxxxxxxx/public_html/includes/modules/product_listing.php on line 159

 

which basically means the function (in the file) doesn't seem to be visible in product_listing.php, which it is not as it is stored in the library file fnfile.php

 

however i have included (required) the file and hence I would expect the functions to be visible?

 

the library file fnfile.php is the same directory as product_listings.php /includes/modules/fnfile.php

 

so, is there somthing is OSC that I am missing?

 

thanks in advance

Link to comment
Share on other sites

Perhaps you have errors in fnfile.php?

 

have you tried using the function immediatly after your require?

 

NB whats wrong with tep_get_product_path ?

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

thanks for the reply.

 

the include definitly works as i have tested it outside of osc.

 

the main reason i have wrote this script (rather than try and use an osc function) is for a couple reasons.

 

we are using an commercial seo module and i wasnt sure how that would handle it.

 

additionally, to be honest, i wasnt sure if there were any functions that would do this.

 

in order to get this info, it has to query 3 different tables seperately, and then build up the part-url.

 

 

in reality, i am taking a product_code like hi1132244

 

passing it to this function (which calls many other functions in this library) and out comes:

 

/tables-24/pine-tables-435/ so i can setup a link back into that category.

 

the main reason that i havent tested straight away afterwards is because i need osc to extract out the product_model first and that happens later in the code.

 

 

what i think i will do is write the most basic include file i can do and then try included this, hopefully this will point me in the right direction.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...