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

[ SOLVED ] Posting product_id as variable

Started by no_leaf, March 27, 2013, 23:44:22 PM

Previous topic - Next topic

no_leaf

Greetings,

I'm trying to add some functionality on product images, and i can do the 99% part but i have a problem on posting product_id while saving the product.

It works in product_edit_images.php if i give a manually product id for value as ;

in tmpl/product_edit_images.php
name="productid" value="8"
and in controllers/product.php
$productid = $_POST['productid'];
this works and writes to database

I can also get the product id with;
$pro_id = $this->product->virtuemart_product_id;

But if i want to post it as $pro_id, not manually written number
It doesn't write to database.
What should i do in controllers/product.php or in another file? VM version : 2.0.18a

Thanks

chetanmadaan

Most Virtuemart files do get the $product arrary in them.

you can try dumping the whole array and see what key has the product id and access it through.

or you can also use JRequest/Getvar to get the product id from get/post.

http://docs.joomla.org/Retrieving_and_Filtering_GET_and_POST_requests_with_JRequest::getVar

no_leaf

Greetings chetanmadaan,
Thanks for your kind answer, actually it posts the id defined as variable on first page. But i don't know why it doesn't process it to write to database. I have found another solution for that without changing any core file more.
I simply do the query in a pop-up in product images tab.

Thanks for your interest