VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: ereallstaff on March 08, 2016, 17:32:01 PM

Title: Add EAN field for VM 2.6
Post by: ereallstaff on March 08, 2016, 17:32:01 PM
Hello due actually to very low free time needed to pass to vm 3.0 , I wanted to add only EAN to cart custom field.

I use type string as you can see in attachment . I have added ean as a column to DB table #_virtuemart_product_customfields , but they doesn't appear into field list . I suppose there simply column were parsed and printed as component inside attached form.

Anyone could kindly explain any step more?

THank you
Title: Re: Add EAN field for VM 2.6
Post by: GJC Web Design on March 08, 2016, 18:49:06 PM
added a column in the DB?

completely un-nesscesary.. just use the custom string as normal and display on the templates
Title: Re: Add EAN field for VM 2.6
Post by: ereallstaff on March 09, 2016, 10:24:23 AM
Sorry but I don't understand you.

The custom string should remaing S, I just want to add near S in another field the EAN id as it's being required by most marketplaces and price comparator...

I can create another custom field with a string reference but this would be more work
Title: Re: Add EAN field for VM 2.6
Post by: AH on March 09, 2016, 10:51:20 AM
It would have been simpler if you had added the field to the product table

(Note I said simpler and not necessarily the "best" way from a purist's viewpoint)

You could then adjust one core file to provide the new field to views and then create an override to the view in which you wish to display the field

Core field for the addition of the new field

administrator/components/com_virtuemart/tables/products.php

Add your new field

var $published = 1;

    /**  new variables */
    var $your_new_field_name = null;



Note that you will need to amend admin product views if you want to edit this field


Then create an override and echo the new field to display it.