Hi everybody,
I,ve been struggeling for months adding one field to my order print. My store contains over 3000 products, all of these have a unique placement in our warehouse. When we recive a order it would save us a lot of time if we could print the location of the product i the print sheet of the order.
For the time beeing we have been using the MPN field in product manager for this. When a order arrives we now have to go into every product manually to find the location of the product in our warehose.
What I need is a simple way to add the MPN field to the order print template. Can someone please provide a short and simple guide for this !
You will probably have to do a core change this will get overwritten every time you upgrade
administrator/components/com_virtuemart/models/orders.php
Around line 200
$q = 'SELECT virtuemart_order_item_id, product_quantity, order_item_name,
order_item_sku, i.virtuemart_product_id, product_item_price,
product_final_price, product_basePriceWithTax, product_discountedPriceWithoutTax, product_priceWithoutTax, product_subtotal_with_tax, product_subtotal_discount, product_tax, product_attribute, order_status, p.product_available_date, p.product_availability,
intnotes, virtuemart_category_id
change to
$q = 'SELECT virtuemart_order_item_id, product_quantity, order_item_name,
order_item_sku, i.virtuemart_product_id, product_item_price,
product_final_price, product_basePriceWithTax, product_discountedPriceWithoutTax, product_priceWithoutTax, product_subtotal_with_tax, product_subtotal_discount, product_tax, product_attribute, order_status, p.product_available_date, p.product_availability,
intnotes, virtuemart_category_id,p.product_mpn
Now you can do a template override to the invoice - this will not get overwritten if you upgrade:-
templates/yourtemplate/html/com_virtuemart/invoice/invoice_items.php
To show the MPN
<?php echo $item->product_mpn; ?>
or do the query directly in the templates/yourtemplate/html/com_virtuemart/invoice/invoice_items.php but some people see this as being akin to sleeping with your sister... (not recommended apparently)
then it won't be over written
LOL GJC.
And should IMHO be part of core
It looks like a nice trick, your above guide, but
but where will I find the original com_virtuemart/invoice/invoice_items.php so I can make the overide ?
I,m a novice, thats why I,m asking
It is here
components/com_virtuemart/views/invoice/tmpl/invoice_items.php
Thanks a lot ;)
Dear GJC
I followed yoyr guide step by step but cant get this to work. I modified the order.php file as instructed.
I then added the echo call in the discount column where I want the mpn to show up, but I cant see any changes,.... Probably I,m doing something wrong :(
Am I missing something,
Now I,m a little bit stuck
You should use my instructions, not GJC as GJC has not given you a detailed step by step approach for doing it all in the view
Sorry Hutson,
The message were ment for you. I have used your instructions but still cant get it to work. Can some cached files be a problem ?
As for the first issue you helped me with, the overide did not work, but when modifying the original virtuemart file it worked. I,m refering to the extra fields in product list mpn and stock.
Basicly this works exactly like I wanted it, but using the original file, not an overide ? I,m a little bit confused, cause I,ve never managed to get overides to work !
You are not putting your override in the correct directory
templates/YOURTEMPLATE/html/com_virtuemart/invoice/invoice_items.php
YOURTEMPLATE is the frontend template for your site e.g. beez5
@AH... was it added to the core. I try it to hack just now but there is p.product_mpn
It works... Just add <?php echo $item->product_mpn; ?> in your template...
yes it was added to core :)