Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

csv files


sdancem

Recommended Posts

Stan,

You'll probably have to write something yourself as I'm not aware of any implemented modules for doing that. If you want to do it yourself, you'll need to create a database query that pulls all the variables you want. Simply separate the variables within a row with '\t' and end each row with '\n' if you want a tab delimited file. If you want a comma delimited file, use ',' instead of '\t'.

 

You can put all the information into one large string. Then, when you want to download it, use this function:

 

if ($user_wants_to_download){

//*******************************

// STREAM FILE

//*******************************

header("Content-type: application/vnd.ms-excel");

header("Content-disposition: attachment; filename=Adresses.txt");

// Changed if using SSL, helps prevent program delay/timeout (add to backup.php also)

// header("Pragma: no-cache");

if ($request_type== 'NONSSL'){

header("Pragma: no-cache");

}

else {

header("Pragma: ");

}

header("Expires: 0");

echo $file_contents;

die();

}

 

Hope that helps.

 

Ken

Link to comment
Share on other sites

Stan,

You'll probably have to write something yourself as I'm not aware of any implemented modules for doing that.  If you want to do it yourself, you'll need to create a database query that pulls all the variables you want.  Simply separate the variables within a row with '\t' and end each row with '\n' if you want a tab delimited file.  If you want a comma  delimited file, use ',' instead of '\t'. 

 

You can put all the information into one large string.  Then, when you want to download it, use this function:

 

if ($user_wants_to_download){

//*******************************

// STREAM FILE

//*******************************

  header("Content-type: application/vnd.ms-excel");

  header("Content-disposition: attachment; filename=Adresses.txt");

  // Changed if using SSL, helps prevent program delay/timeout (add to backup.php also)

  // header("Pragma: no-cache");

  if ($request_type== 'NONSSL'){

  header("Pragma: no-cache");

  }

  else {

  header("Pragma: ");

  }

  header("Expires: 0");

  echo $file_contents;

  die();

}

 

Hope that helps.

 

Ken

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...