VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: role74 on December 20, 2014, 15:12:02 PM

Title: How to display Product MPN on Invoice Details
Post by: role74 on December 20, 2014, 15:12:02 PM
Hi There

I'm quite OK in html coding, but not too good in php :-)

I'm currently using Virtuemart 2.6.10

I would like to display the product MPN (Manufacturer Part Number) in the invoice details.
As far that I know it's in the invoice_items.php and there I see from line 57 the correct position:

      <tr valign="top">
         <td align="left">
            <?php echo $item->order_item_sku; ?>
            here's the expected position in the code for the MPN (no matter about the formatting, I get it done  ;D
         </td>
         <td align="left" colspan="2" >
            <div float="right" ><a href="<?php echo $product_link; ?>"><?php echo $item->order_item_name; ?></a></div>


<?php echo $item->order_item_mpn; ?> doesn't work.

Can anybody tell me the correct line of code to insert in order to get the products MPN displayed next to the SKU?

Thanks alot!
-roland
Title: Re: How to display Product MPN on Invoice Details
Post by: jenkinhill on December 20, 2014, 16:19:43 PM
As a guess, try  product_mpn 
Title: Re: How to display Product MPN on Invoice Details
Post by: AH on December 20, 2014, 19:39:41 PM
product_mpn is not stored in the order item detail table

The order query uses this info for the order lines

db virtuemart_order_items does not store this field - only SKU

So trying to just use the variable name product_mpn will not deliver any results

Title: Re: How to display Product MPN on Invoice Details
Post by: role74 on December 20, 2014, 20:53:04 PM
Quote from: Hutson on December 20, 2014, 19:39:41 PM

So trying to just use the variable name product_mpn will not deliver any results


...and what does finally deliver a result?
Title: Re: How to display Product MPN on Invoice Details
Post by: AH on December 21, 2014, 02:34:40 AM
nothing does deliver it.

It is not in the table of order details and is not available to the order without some core customisation (not just a template change!)
Title: Re: How to display Product MPN on Invoice Details
Post by: jenkinhill on December 21, 2014, 11:46:29 AM
You would have to write a query to pull the product_mpn from the ##_virtuemart_products table in the database.  Best way would be to write a plugin rather than a core hack.

I use product_mpn in product details page by just putting echo $this->product->product_mpn;  into an override.  I actually had not noticed that GTIN (ISBN) or MPN were not included in the orders table.
Title: Re: How to display Product MPN on Invoice Details
Post by: alin on January 13, 2015, 15:33:36 PM
It would be nice in the future to have it available in $vars['orderDetails']['items']