Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with creating a pdf with products_options_values


IslaCozumelDayPass

Recommended Posts

My store creates a pdf download as the product. The pdf includes the customer's name and products options. Worked great with one product option, but now I have five product options. The pdf is now generating one page per product option. I need all product options together.

 

Please help.

 

<?php

 

require_once 'CreateVoucher.class.php';

 

$order_id = (int)$_GET['order_id'];

 

$exp_date = date("M d Y");

$control_number = $order_id;

 

$con = mysql_connect("75790230572340-5.db.75790230572340-5.not-here.com", "75790230572340-5", "not-this");

mysql_select_db("75790230572340-5", $con);

 

$query = "

SELECT

O.billing_name as customers_name,

OP.products_name,

OPA.products_options_values

FROM orders O

INNER JOIN orders_products AS OP ON OP.orders_id = O.orders_id

INNER JOIN orders_products_attributes AS OPA ON OPA.orders_products_id = OP.orders_products_id

WHERE

O.orders_id = " . $order_id;

 

 

$result = mysql_query($query);

 

$pdf = new CreateVoucher();

 

while ($row = mysql_fetch_assoc ($result))

{

$name = $row['customers_name'];

$pkg = $row['products_name'];

$persons = substr($row['products_options_values'], 0, 100);

 

$pdf->addNewVoucher($pkg, $name, $persons, $control_number, $exp_date);

}

 

$pdf->outputPdf();

 

?>

Link to comment
Share on other sites

Check the query. Right now it produces one row for each option

 

What you need are 2 queries

1 -> to get the products of the order

2 -> for each product to get it's options

 

PS I don't know why you don't use the osCommerce functions for the queries

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...