Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Display product description in product_info.php from .txt file.


adrianconchie

Recommended Posts

Hi,

 

I am trying to get the product_info.php page to display the product description from a .txt file.

 

This is because I import the product data from a csv through the admin. There are thousands of products and I have the descriptions all on seperate .txt files, so it would be great if I could somehow call the text from each corresponding .txt file and display it where the product description is normally displayed. The .txt files are all located in images/products/.

 

I have tried simply putting the code:

<?php include ("images/products/xxxx.txt"); ?>

as the product description in my csv, where xxxx is the corresponding text file for each product, but it doesn't display anything.

 

The standard code which calls the product description in product_info.php is

<?php echo stripslashes($product_info['products_description']); ?>

, so I somehow need to get this to display the text.

 

I'm sure it's probably very simple, but I haven't been able to work it out.

 

Any help would be much appreciated!

 

Thanks.

Link to comment
Share on other sites

I've figured this one out. It was very simple.

 

I just changed

<?php echo stripslashes($product_info['products_description']); ?>

 

to:

 

<?php include ($product_info['products_description']); ?>

 

Now when I simply import the path to the txt file (eg. images/products/xxxx.txt) in the csv for each description, it works.

 

Just posted this in case anyone else needs to do this in the future.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...