Zen Cart Logo
Forums / Customization from the Admin / adding product attributes to invoice

adding product attributes to invoice

Views: 741

Results 1 to 4 of 4
14 Dec 2012, 5:48 PM
#1
alpaf avatar

alpaf

New Zenner

Join Date:
Nov 2012
Posts:
7
Plugin Contributions:
0

adding product attributes to invoice

We make a lot of custom products and for some reason, all of the personalization attributes are visible on the order detail screen but not on the invoice. I've looked at invoice.php and it seems to be calling the right data fields, but not all of them display.

**
Sample order details:**
1 x "A Personalized" Custom Frame

  • Theft Resistant Hardware: 4 Metric Silver Locking N & B (+$5.95)
  • Hardware Snap On Covers: Set of 4 Chrome Color (+$4.95)
  • Bottom Strip: HOSSOME
  • Comments: only bottom-leave the top chrome
  • Frame Color: Chrome Frame
  • Color Strip: Black Background / Silver Letters

Sample invoice text (from the same order):
1 x "A Personalized" Custom Frame

  • Theft Resistant Hardware: 4 Metric Silver Locking N & B (+$5.95)
  • Hardware Snap On Covers: Set of 4 Chrome Color (+$4.95)
  • Bottom Strip: HOSSOME
  • Comments: only bottom-leave the top chrome
  • Frame Color: Chrome Frame
    (missing color strip)

invoice.php code, lines 157-181:
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
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']) && (($k = sizeof($order->products[$i]['attributes'])) > 0)) {
for ($j = 0; $j < $k; $j++) {
if ($order->products[$i]['attributes'][$j]['price'] != '0'
or $order->products[$i]['attributes'][$j]['option'] == 'Personalize'
or $order->products[$i]['attributes'][$j]['option'] == 'Full size or motorcycle size?'
or $order->products[$i]['attributes'][$j]['option'] == 'Top Strip'
or $order->products[$i]['attributes'][$j]['option'] == 'Bottom Strip'
or $order->products[$i]['attributes'][$j]['option'] == 'Frame Color'
or $order->products[$i]['attributes'][$j]['option'] == 'Color Engravable Strip'
or $order->products[$i]['attributes'][$j]['option'] == 'Purchase as Combo Package & Save'
or $order->products[$i]['attributes'][$j]['option'] == 'Comments'
or $order->products[$i]['attributes'][$j]['option'] == 'Select lettering color'
or $order->products[$i]['attributes'][$j]['option'] == 'Logo or Lettering Color'
or $order->products[$i]['attributes'][$j]['option'] == 'Background Color'
or $order->products[$i]['attributes'][$j]['option'] == 'Line 1'
or $order->products[$i]['attributes'][$j]['option'] == 'Line 2'
or $order->products[$i]['attributes'][$j]['option'] == 'Line 3'
or $order->products[$i]['attributes'][$j]['option'] == 'Color of the Tag'
or $order->products[$i]['attributes'][$j]['option'] == "Background Color for Logo's"
or $order->products[$i]['attributes'][$j]['option'] == 'Silver or Gold Lettering')
echo '<br><br /><large> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']));

14 Dec 2012, 6:20 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: adding product attributes to invoice

And if you add to your custom code:

or $order->products[$i]['attributes'][$j]['option'] == 'Color Strip'

does it now display?

14 Dec 2012, 6:36 PM
#3
alpaf avatar

alpaf

New Zenner

Join Date:
Nov 2012
Posts:
7
Plugin Contributions:
0

Re: adding product attributes to invoice

It did! And I was able to use the same idea to add a few other missing attributes. Thank you!

14 Dec 2012, 6:39 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: adding product attributes to invoice

Are you filtering the Attributes for a reason rather than just show them all? :lookaroun