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.
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.
Take a look at this thread today..
http://www.zen-cart.com/forum/showthread.php?t=63018
Mark,
Are You Vulnerable for an Accessibility Lawsuit?
myZenCartHost.com - Zen Cart Certified, PCI Compatible Hosting by JEANDRET
Free SSL, Domain, and MagicThumb with semi-annual and longer hosting
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!
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!
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
replace withPHP Code:for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
Then print anywhere in the loop the manufacture's name or id by usingPHP Code: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
orPHP Code:<?php echo $order->products[$i]['manufacture_id']; ?>
PHP Code:<?php echo $order->products[$i]['manufacture_name']; ?>
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";
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!!!!
You are welcome, glad you found out yourself.
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.