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

CHANGE Product fields SQL type

Started by Ferran, May 11, 2015, 11:55:49 AM

Previous topic - Next topic

Ferran

Hello and thanks in advance for support.

I'm running VM3 on a Joomla 3.4.    I have some unused fields like Weight,Height... and i want to use them but filling with TEXT. The problem is that the fields are DEC or INT in SQL , i change the type to varchar and then i can save the text info but this is not displayed in product view. Why? it need to modify something more?

I know that i can use custom fields, but i'm using a 3rdparty plugin that show a table with attached products but no show custom fields, so i need to use default VM fields.

Can someone help me on it?

Thanks in advance!

Studio 42

This is typical a hack to never do.
The values use filters, and if in the table you have int, then you cannot save as varchars.
Of course, you can change the filters, and add more hacks, but i think no one give you solution to continue in this way.
If you need add new fields in mysql table. it's better then changing original fieds. And you can use the on save product trigger to save this in the main table.

PRO

you can use the custom field type "string"

Ferran

Thanks for the answers, as i said i can't use teh custom fields because 3rtparty plugin doesn't accept this for show in a table.

By the way, is there any tutorial or guide to add new avaiable fields to VM3?

Studio 42

Hi,
Quote from: Ferran on May 12, 2015, 08:39:49 AM
Thanks for the answers, as i said i can't use teh custom fields because 3rtparty plugin doesn't accept this for show in a table.

By the way, is there any tutorial or guide to add new avaiable fields to VM3?

Because this is a poor hack, i don't think you can find a tutorial.
The right solution is to use a Joomla system plugin (and perhaps a vm product custom plugin to trigger the onsaveProduct) when you edit the product.

But i'm not sure you can update VIrtuemart later, because you new fields can be removed by an update.

Another solution, is to modify the 3rd party plugin that you can get the needed customfields.

likrish

I am currently working to resolve the same issue. I have numerous fields that I need to add as we are using Virtuemart for an Events based system with limited available spaces. So far I have created a separate table to hold the additional data using the product id as the primary key. This table will then store additional information like the date, time and location of the event.

I have then added the additional fields to the product admin form (using additional tabs) as overrides in the default Joomla 3 Admin template.

So far so good...

My problem is now that I would like to create a plugin to handle saving the extra data to the extended table, but I don't know how to bind to the event trigger for saving a product.

So what I need to work out is that when a product is saved for the first time, I get the MySQL product id (primary key) for the product and use that to save the extra field data in my custom MySQL table.

Any one come across any similar working examples I could perhaps refer to?

Happy to pay!

GJC Web Design

is there a VM onsaveProduct function?





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

Studio 42