Latest News: (loading..)

Archived

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

Oza

I can't display the mpn number on the order

1 post in this topic

Hi there, I have added a new field in the products table named products_brandcode (which is the mpn number for googlebase)

No problem adding it and displaying on the website.

But when I try to show it on the order in orders.php instead of the model it doesn't work - I just get NO-PRODUCT-BRANDCODE!

What am I doing wrong here?

Please help....

 

This is the code :

 

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

 

$brandcode = 'NO-BRANDCODE';

$q = tep_db_query("SELECT p.products_brandcode FROM ".TABLE_PRODUCTS." p LEFT JOIN ".TABLE_ORDERS_PRODUCTS." op using(products_id) WHERE op.orders_products_id = '".(int)$order->products[$i]['orders_products_id']."'");

if(tep_db_num_rows($q) == 1) {

$r = tep_db_fetch_array($q);

$brandcode = $r['products_brandcode'];

} else {

$brandcode = 'NO-PRODUCT-BRANDCODE';

}

 

echo ' <tr class="dataTableRow">' . "\n" .

' <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .

' <td class="dataTableContent" valign="top">' . $order->products[$i]['name'];

 

if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) {

for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) {

echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];

if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';

echo '</i></small></nobr>';

}

}

 

echo ' </td>' . "\n" .

// ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" .

' <td class="dataTableContent" valign="top">' . $brandcode . '</td>' . "\n" .

' <td class="dataTableContent" align="right" valign="top">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" .

' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .

' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax'], true), true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .

' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .

' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax'], true) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n";

echo ' </tr>' . "\n";

}

?>

Share this post


Link to post
Share on other sites