News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Extra field in print template

Started by P Humstad, December 01, 2014, 05:09:29 AM

Previous topic - Next topic

P Humstad

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 !
May U live 2 see the dawn

AH

#1
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?>

Regards
A

Joomla 4.4.5
php 8.1

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

AH

LOL GJC.

And should IMHO be part of core
Regards
A

Joomla 4.4.5
php 8.1

P Humstad

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
May U live 2 see the dawn

AH

It is here

components/com_virtuemart/views/invoice/tmpl/invoice_items.php
Regards
A

Joomla 4.4.5
php 8.1

P Humstad

May U live 2 see the dawn

P Humstad

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
May U live 2 see the dawn

AH

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
Regards
A

Joomla 4.4.5
php 8.1

P Humstad

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 !
May U live 2 see the dawn

AH

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
Regards
A

Joomla 4.4.5
php 8.1

servlet

@AH... was it added to the core. I try it to hack just now but there is p.product_mpn
Он-лайн магазин за фототапети http://mishelfoster.com

servlet

It works... Just add <?php echo $item->product_mpn; ?> in your template...
Он-лайн магазин за фототапети http://mishelfoster.com

AH

Regards
A

Joomla 4.4.5
php 8.1