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

Where in the source are products inserted into the database?

Started by Andre72, January 28, 2013, 17:10:03 PM

Previous topic - Next topic

Andre72

Hi,
we get a component to add products but it does not work.
The returned error message is still empty so is useless.

For this reason I need to catch the error message when the insert to the DB does not work...
So here's the code from the component:

if (!class_exists( 'VirtueMartModelProduct' )) require (JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'product.php');
$modelProduct = new VirtueMartModelProduct;
...
$prod_id = $modelProduct->store($data);


So I think I'll find the fuction for store in administrator/components/com_virtuemart/models/product.php and in line 49381 I found:
public function store

Is this the right function I'm looking for?
I try something like
$fh=fopen('error.log','w');

There but error.log will never be created so I think I understand something wrong ...
I'm a novice with development.

I use Joomla 2.5.8 and VirtueMart 2.0.18a

Can somebody help me please to figure out why it does not work?

Thanks

Andre

Andre72

The path was right - the log file was just created in the excecuting directory ...
So I can do loging now.

Milbo

This looks correct
$modelProduct = new VirtueMartModelProduct;
...
$prod_id = $modelProduct->store($data);

the $data should be an associative array. Use vmdebug and check our used data format, you may understand then whats missing (for example virtuemart_product_id = null) or so
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/