VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Coding Central => Topic started by: borro on May 27, 2013, 14:55:35 PM

Title: Where is the place where SQL queries come from for customfields table update?
Post by: borro on May 27, 2013, 14:55:35 PM
Hello

I'm trying to find where is the place in code which generates sql UPDATE query which runs after you clicking SAVE button in product card. 
I made changes in related products logic and now I have to change UPDATE sql-query that modifies #__virtuemart_product_customfields table after saving product card changes
Please help

Thank you
Title: Re: Where is the place where SQL queries come from for customfields table update?
Post by: borro on June 05, 2013, 16:09:25 PM
There are such strokes in "Save" function body which defined in administrator/.../vmcontroller.php:


...
$model = VmModel::getModel($this->_cname);
$id = $model->store($data);
...


I'd opened administrator/components/com_virtuemart/helpers/vmmodel.php, and found store function definition there. Due to debug I placed such code in its body:

...
var_dump($data);
die();
...

But when I click Save button in product card which runs Save function of vmcontroller.php and then as i think it has to run modified Store function. But it doesn't happens.
Can any tell me why there is no change in output? Why do I not see var_dump output?
Title: Re: Where is the place where SQL queries come from for customfields table update?
Post by: Milbo on June 07, 2013, 12:06:45 PM
The save function is very often customised. Check the custom and customfield model, but be aware that is not written by me. The code will be drastically enhanced in vm2.1. and use vmdebug, it easier then var_dump
Title: Re: Where is the place where SQL queries come from for customfields table update?
Post by: borro on June 07, 2013, 12:33:16 PM
Quote from: Milbo on June 07, 2013, 12:06:45 PM
The save function is very often customised. Check the custom and customfield model, but be aware that is not written by me. The code will be drastically enhanced in vm2.1. and use vmdebug, it easier then var_dump
thank you. where can i read about benefits of vmdebug and how to use it?
Title: Re: Where is the place where SQL queries come from for customfields table update?
Post by: Milbo on June 07, 2013, 15:16:03 PM
Read here http://dev.virtuemart.net/projects/virtuemart/wiki/Developing_a_module_or_plugin_for_VirtueMart_2

then use vmdebug('description',$values1, $value2,....)
Title: Re: Where is the place where SQL queries come from for customfields table update?
Post by: borro on June 07, 2013, 15:32:00 PM
Quote from: Milbo on June 07, 2013, 15:16:03 PM
Read here http://dev.virtuemart.net/projects/virtuemart/wiki/Developing_a_module_or_plugin_for_VirtueMart_2

then use vmdebug('description',$values1, $value2,....)
sorry, but there is no descripton of vmdebug usage in link you have suggested
Title: Re: Where is the place where SQL queries come from for customfields table update?
Post by: Milbo on June 07, 2013, 18:49:08 PM
just try it... use it somewhere in the code, just use what I gave you vmdebug('description',$values1, $value2,....)

you must load the vmconfig before, you can also read there about the function. helpers/config.php
Title: Re: Where is the place where SQL queries come from for customfields table update?
Post by: edward concepcion on July 11, 2013, 04:40:01 AM
I am in same place... i added a field to table jos_virtuemart_product_customfields but cant find where to add field to update statement on admin side...  Somewhat frustrating...

Hoping someone can help...

thanks in Advance
Title: Re: Where is the place where SQL queries come from for customfields table update?
Post by: Milbo on July 11, 2013, 11:16:14 AM
Quote from: borro on May 27, 2013, 14:55:35 PM
I made changes in related products logic and now I have to change UPDATE sql-query that modifies #__virtuemart_product_customfields table after saving product card changes

What is a product card? Do you mean the product edit? If you want to change what is stored, you need to change the table file! in the folder "tables". Or take a look in customfields model. I still do not really understand what you are looking for.

Btw instead hacking the core, take a look on the textinput plugin and write a plugin.
Title: Re: Where is the place where SQL queries come from for customfields table update?
Post by: borro on September 08, 2015, 08:59:10 AM
Hello, friends.

I used the vmdebug function in code. Where should i look for its output?
I've found, right at the page