Zen Cart Logo
Forums / Managing Customers and Orders / Show manufacturer on invoice?

Show manufacturer on invoice?

Locked

Views: 3,308

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
12 Apr 2007, 1:43 AM
#1
digitalrust avatar

digitalrust

New Zenner

Join Date:
Nov 2006
Posts:
13
Plugin Contributions:
0

Show manufacturer on invoice?

Does anyone know if there is an easy way to show the manufacturer for each product on the invoice in admin? I've been searching for awhile and can't dig anything up.

12 Apr 2007, 7:46 AM
#3
masterblaster avatar

masterblaster

Totally Zenned

Join Date:
Aug 2004
Location:
Germany
Posts:
528
Plugin Contributions:
0

Re: Show manufacturer on invoice?

You would just go by making a mysql call for each product, to lookup the manufacture and print it on the page. Similar to the post in the thread linked above!

12 Apr 2007, 2:06 PM
#4
digitalrust avatar

digitalrust

New Zenner

Join Date:
Nov 2006
Posts:
13
Plugin Contributions:
0

Re: Show manufacturer on invoice?

Thanks for pointing me in the right direction. Very helpful. I've hit a snag though when trying to modify this to show the manufacturer. Since the manufacturer_id is not stored with the order, how can I query the db? Please bear with me, I'm fairly new to PHP.

Here's my query:

<?php $manufacturersid_sql = $db->Execute("SELECT manufacturers_id from ".TABLE_MANUFACTURERS." WHERE manufacturers_id = '".$order->products['manufacturers_id']."'"); ?>

but I realize this won't work. Any suggestions would be greatly appreciated!

12 Apr 2007, 2:29 PM
#5
masterblaster avatar

masterblaster

Totally Zenned

Join Date:
Aug 2004
Location:
Germany
Posts:
528
Plugin Contributions:
0

Re: Show manufacturer on invoice?

Ok I thought you only needed some small pointers...

Here is a code I just wrote for you to use:
find in admin/invoice.php at line 156

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

replace with

    for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
	//manufacture hack start
	$manufacture_id_sql = "select m.manufacturers_name, m.manufacturers_id
                          from " . TABLE_PRODUCTS . " p, " .
                            TABLE_MANUFACTURERS . " m
                          where p.products_id = '" . (int)$order->products[$i][id] . "'
                          and p.manufacturers_id = m.manufacturers_id";
	
	$order->products[$i]['manufacture_id']=$manufacture_id_sql->fields['manufacturers_id'];
	$order->products[$i]['manufacture_name']=$manufacture_id_sql->fields['manufacturers_name'];
	//manufacture hack end

Then print anywhere in the loop the manufacture's name or id by using

<?php echo $order->products[$i]['manufacture_id']; ?>
``` or
```php
<?php echo $order->products[$i]['manufacture_name']; ?>
12 Apr 2007, 2:48 PM
#6
digitalrust avatar

digitalrust

New Zenner

Join Date:
Nov 2006
Posts:
13
Plugin Contributions:
0

Re: Show manufacturer on invoice?

Thanks for such a speedy reply, Masterblaster. I appreciate it. I've replaced the code as suggested and then added this in about line 182 but nothing is displaying. Did this work on your end?

<td class="dataTableContent" valign="top">' . $order->products[$i]['manufacture_name'] . '</td>' . "\n";
12 Apr 2007, 8:56 PM
#7
digitalrust avatar

digitalrust

New Zenner

Join Date:
Nov 2006
Posts:
13
Plugin Contributions:
0

Re: Show manufacturer on invoice?

Sorted it out:

$manufacture_id_sql = $db->Execute("select m.manufacturers_name, m.manufacturers_id
from " . TABLE_PRODUCTS . " p, " .
TABLE_MANUFACTURERS . " m
where p.products_id = '" . (int)$order->products[$i][id] . "'
and p.manufacturers_id = m.manufacturers_id");

THANK YOU, MASTERBASTER!!!!

12 Apr 2007, 9:05 PM
#8
masterblaster avatar

masterblaster

Totally Zenned

Join Date:
Aug 2004
Location:
Germany
Posts:
528
Plugin Contributions:
0

Re: Show manufacturer on invoice?

You are welcome, glad you found out yourself.

19 Apr 2007, 11:27 PM
#9
sino avatar

sino

New Zenner

Join Date:
Jan 2006
Posts:
11
Plugin Contributions:
0

Re: Show manufacturer on invoice?

digitalrust:

Sorted it out:

$manufacture_id_sql = $db->Execute("select m.manufacturers_name, m.manufacturers_id
from " . TABLE_PRODUCTS . " p, " .
TABLE_MANUFACTURERS . " m
where p.products_id = '" . (int)$order->products[$i][id] . "'
and p.manufacturers_id = m.manufacturers_id");

THANK YOU, MASTERBASTER!!!!

Hi Digital, can you tell me where you placed this code,, i am also trying to do the same thing.

20 Apr 2007, 1:20 AM
#10
digitalrust avatar

digitalrust

New Zenner

Join Date:
Nov 2006
Posts:
13
Plugin Contributions:
0

Re: Show manufacturer on invoice?

Sure, here's my whole invoice.php file so you can see how it's implemented. I had to modify the tables in order to display the name column. Bascially look at lines 148, 158, 183, and 206 where I changed the colspan to 9.

I'll also note that I have stock by attributes installed so my page may include some additional code as well.

20 Apr 2007, 1:36 AM
#11
sino avatar

sino

New Zenner

Join Date:
Jan 2006
Posts:
11
Plugin Contributions:
0

Re: Show manufacturer on invoice?

you are the man,,,, thanks alot,, works great,