VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: randomdev on July 18, 2012, 09:23:33 AM

Title: Barcode Display on Admin product page
Post by: randomdev on July 18, 2012, 09:23:33 AM
I have a client who would like a barcode image to display on the admin (not frontend) product information tab in virtuemart.

I have found some easy to use php code here (http://www.ashberg.de/php-barcode/) but the problem I have is I am not sure how to integrate custom code with virtuemart.
I would simply read the barcode from a custom field in virtuemart and display it using the php code.

(I assume if I just found the product page and edited in the code I need this would break future virtuemart updates?)

I know my way around php ok, but am very new to Joomla & virtuemart and have trouble figuring out how to integrate my own code (apologies if this is more a general Joomla question but I figured since the client wants the barcode to display on the Product Information Tab in virtuemart I would ask here.).
Title: Re: Barcode Display on Admin product page
Post by: randomdev on July 19, 2012, 07:50:16 AM
Well I have just edited the following file.. /administrator/components/com_virtuemart/views/product/tmpl/product_edit_information.php
and it appears to be working fine.

If there is a better way someone please let me know.
Title: Re: Barcode Display on Admin product page
Post by: ivus on July 19, 2012, 07:56:37 AM
Hi randomdev,

changing the core VM files will get over written once you do an update. It is much better to create layout overrides within your templates' html folder.

I was in the process of researching a solution for your issue when I ran into another related issue in that you can't override the products layout templates. To which was solved here

http://forum.virtuemart.net/index.php?topic=101122.0 (http://forum.virtuemart.net/index.php?topic=101122.0)

Your solution is perfect except I'd move them into the overrides folder so it doesn't accidentally get wiped.

Title: Re: Barcode Display on Admin product page
Post by: ivus on July 19, 2012, 08:02:38 AM
Hi randomdev,

Not sure if this is of benefit to you or not, but if you're in need of QR code generator, here is a very easy PHP class you can use.

http://www.shayanderson.com/php/php-qr-code-generator-class.htm (http://www.shayanderson.com/php/php-qr-code-generator-class.htm)

Title: Re: Barcode Display on Admin product page
Post by: randomdev on July 23, 2012, 05:06:01 AM
Thanks very much for your help ivus!

I noticed a problem with the barcode generator I linked in that it will only render certain barcodes (e.g. ean-13). The barcode numbers range from 1 to 13 digits (I am pretty sure the numbers under 6 digits must be errors)
I have found a few more barcode generators but the problem is working out what symbolgy I should even be using to render these (not a problem for this forum but thought I would mention it in case anyone is trying to do the same thing)