VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Development & Testing => Topic started by: CE WebDesign München on July 17, 2012, 18:06:20 PM

Title: [SOLVED] vm208e: database error when copy (clone) product with custom plugin
Post by: CE WebDesign München on July 17, 2012, 18:06:20 PM
hi,

thanks a lot for adding copying of custom fields, that's really timesaving, great!
now just one issue:
since 208d I get this error when copying product with custom plugin for vm (NetBase VM-Youtube Plugin)

it works, when i manually add the missing database-fields to gvd0t_virtuemart_products_en_gb

sorry for having to ask this here (got no feedback from NetBase):

is it ok to fix it like this, or will it cause trouble sometime ahead?

and is the plugin not ready for vm208e or buggy or will vm insert these custom-plugin-fields in future?

thanks again for helping, maybe this is usefull for 3party-developer too
(a short yes or no will do, just so i know if i wait with updating the lifesite)


here is the error:
vmError: VmTableData::store failed - Unknown column 'custom_nbyoutube_title' in 'field list' SQL=INSERT INTO `gvd0t_virtuemart_products_en_gb` (`virtuemart_product_id`,`product_name`,`product_s_desc`,`product_desc`,`metadesc`,`metakey`,`customtitle`,`slug`,`id`,`custom_nbyoutube_title`,`custom_nbyoutube_url`,`custom_nbyoutube_width`,`custom_nbyoutube_height`,`created_on`,`created_by`,`modified_on`,`modified_by`,`locked_on`,`locked_by`) VALUES ( .....
Title: Re: vm208e: database error when copy product with custom plugin for vm
Post by: Milbo on July 18, 2012, 10:21:12 AM
I had also one time a problem cloning a product, but I was not able to reproduce it.

So you say it is connected to the customplugins, good to have a grib. I dont know if it is the plugin or the core. Maybe the developer write a pm to me.
Title: Re: vm208e: database error when copy product with custom plugin for vm
Post by: CE WebDesign München on July 18, 2012, 11:10:56 AM
yes, i can clone products without that plugin.
i could pm you the plugin if you like, for a closer look (very small, but cant attach, its commercial)
or here is the link: http://www.cms-extensions.net/netbase-youtube-for-virtuermart-plugin.html

do you see a problem adding the databasefields to virtuemart_products_en_gb manually?

kind regards and greetings
Title: Re: vm208e: database error when copy product with custom plugin for vm
Post by: bluesheep on July 20, 2012, 11:14:10 AM
Hallo milbo
Mit dem mitgelieferten VM CustomFields PlugIn erscheint der Fehler ebenfalls.
The error appears also with the original VM CustomFields PlugIn.

cya
bluesheep
Title: Re: vm208e: database error when copy product with custom plugin for vm
Post by: bluesheep on July 20, 2012, 11:30:07 AM
Ich habe das Problem evtl. Gelöst: in der Datei administrator/component/com_virtuemart/models/product.php in Zeile 1404 muss man
$product = $this->getProduct($id, FALSE, TRUE, FALSE);
in
$product = $this->getProduct($id);
wechseln.

@Milbo: Kannst Du das so Bestätigen?

I have found a solution for the problem: in file administrator/component/com_virtuemart/models/product.php at row 1404 you must change
$product = $this->getProduct($id, FALSE, TRUE, FALSE);
to
$product = $this->getProduct($id);

@Milbo: Can you confirm that?

cya
bluesheep
Title: Re: vm208e: database error when copy product with custom plugin for vm
Post by: bubster on July 20, 2012, 16:33:28 PM
I have the same problem with VMCALCULATION_VMISTRAXX_QUANTITY plugin.

When i try to clone a product with the plugin enabled I get a database error:

vmError: VmTableData::store failed - Unknown column 'id' in 'field list' SQL=INSERT INTO `n57vi_virtuemart_products_en_gb` (`virtuemart_product_id`,`product_name`,`product_s_desc`,`product_desc`,`metadesc`,`metakey`,`customtitle`,`slug`,`id`,`created_on`,`created_by`,`modified_on`,`modified_by`,`locked_on`,`locked_by`)

As I understand Virtuemart is attempting to write data for;

'created_on`,`created_by`,`modified_on`,`modified_by`,`locked_on`,`locked_by`

These columns do not exist in virtuemart_products.

When I disable Istraxx quantity plugin, products can be cloned.

I have applied the solution above but this doesn't fix the clone problem.

Title: Re: vm208e: database error when copy (clone) product with custom plugin for vm
Post by: CE WebDesign München on July 20, 2012, 19:03:03 PM
hm, maybe a solution would be,

if vm stores the custom-plugin-entries for the clone with its new id,
where it takes the copied data from -

the table where all needed columns already exist
and the origin data comes from? (sorry, absolute beginner concerning databases)
Title: Re: vm208e: database error when copy product with custom plugin for vm
Post by: Milbo on July 20, 2012, 19:24:37 PM
This is strange


getProduct ($virtuemart_product_id = NULL, $front = TRUE, $withCalc = TRUE, $onlyPublished = TRUE)


we use line 1410

$product = $this->getProduct($id, FALSE, TRUE, FALSE);

$withCalc is in both cases true and I think onlyPublished should be ignored, so it should be FALSE.

So the error is in $front= FALSE

So I think the best is

$product = $this->getProduct($id, TRUE, TRUE, FALSE);
Title: Re: vm208e: database error when copy (clone) product with custom plugin for vm
Post by: CE WebDesign München on July 20, 2012, 22:55:20 PM
hm, for me it is line 1411 (vm208e, opened with notepad++)

tested:    TRUE TRUE FALSE, TRUE FALSE FALSE, FALSE FALSE FALSE
and just:    $product = $this->getProduct($id);

still same error as in post on top
probably special in my case because of custom plugin
Title: Re: vm208e: database error when copy (clone) product with custom plugin for vm
Post by: bluesheep on July 21, 2012, 10:01:02 AM
This work for me on 2.0.8C:
$product = $this->getProduct($id, TRUE, TRUE, FALSE);
Title: Re: vm208e: database error when copy (clone) product with custom plugin for vm
Post by: bubster on July 23, 2012, 12:39:18 PM
Hi

Tested:
TRUE TRUE FALSE, TRUE FALSE FALSE, FALSE FALSE FALSE
$product = $this->getProduct($id);

Still unable to clone with Istraxx plugin published.

All products attempted to be cloned are published and have no children.
Title: Re: vm208e: database error when copy (clone) product with custom plugin for vm
Post by: usovdm on October 09, 2012, 11:41:25 AM
My solution of this problem: http://forum.virtuemart.net/index.php?topic=108517.0 (http://forum.virtuemart.net/index.php?topic=108517.0)
Title: Re: vm208e: database error when copy (clone) product with custom plugin for vm
Post by: CE WebDesign München on December 05, 2012, 11:39:30 AM
[SOLVED] Hi, it works for me and that youtube plugin now in VM 2.0.14 + J 2.5.8,
no need for database change! THANK YOU!