Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Export orders to csv with attributs


Recommended Posts

Hi all, i have a product with product_id=100000 and the attribut Color has the id=200000


what i need to to is when i export the product ordered, if it has attribut, change it.


I made this code :




if (!$HTTP_GET_VARS['submit'])



<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//DE">

<html <?php echo HTML_PARAMS; ?>>


<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">


<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#CCCC33">

<!-- header //-->

<?php require(DIR_WS_INCLUDES.'header.php'); ?>

<!-- header_eof //-->


<!-- body //-->

  <table border="0" width="100%" cellspacing="2" cellpadding="2" >


    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES.'column_left.php'); ?>

<!-- left_navigation_eof //-->

    </table></td><td valign=top>

<!-- body_text //-->



echo "<center><br><br><br><img src=\"encom1.gif\"><br><br><br><font face=verdana size=2><b>Export</font><br><br>";

echo '<form action="'. $phpself.'">';

echo '<input type="submit" value="Export" name="submit"></form>';




<!-- footer //-->

<center><font color="#666666" size="2"></font></center>

<!-- footer_eof //-->















$user_query = mysql_query("SELECT orders.*, orders_products.*, orders_products_attributes.*

FROM (orders left JOIN orders_products ON orders.orders_id=orders_products.orders_id) left JOIN orders_products_attributes ON orders.orders_id=orders_products_attributes.orders_id;");

while($row = mysql_fetch_array($user_query))




  if(date("d,m,Y", strtotime($row[date_purchased]))==date("d,m,Y")) {




// PRICE----------------------------------------------------






if ( $aa == "+")








// END------------------------------------------------




if ($row[products_options_values]=="") {


} else {

$contents.=str_replace('r. ','',strstr($row[products_options_values], 'r. ')) .";";











} Header("Content-Disposition: attachment; filename=orders.csv");

print $contents;

print $contents5;




require(DIR_WS_INCLUDES . 'application_bottom.php');


This works fine when i order just one product, but for example if i order a product with attributs and another product withought attribut, in the second product(with no attribut) he puts the same product_id and the same price of the first product.



Can someone help me with this please ?

Link to comment
Share on other sites


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

  • Create New...