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 ]Rev. 4902 Cannot access protected property TableProducts::$_pkey

Started by Stephen Roberts, December 02, 2011, 22:06:18 PM

Previous topic - Next topic

Stephen Roberts

I was just configuring some shipping options and testing them in the cart when I refreshed the page and hit this error:

Fatal error: Cannot access protected property TableProducts::$_pkey in /Users/stephenroberts/Sites/imd/administrator/components/com_virtuemart/models/product.php on line 393

I can't navigate the front-end at all now without hitting this error. This happened once before in a previous revision and I had to reinstall the whole store. Anyone else hit this yet and have any ideas?

Currently on Joomla! 1.5.24 with VM revision 4902.
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com

Stephen Roberts

Doing this let's me limp along at least, but I don't understand what changed and what's really causing this problem.

product.php line 392:

if(isset($child->$k) && empty($child->$k)){
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com

Milbo

A bit strange yes.

Please try instead of yours, this fix:

$parentProduct = $this->getProductSingle($child->product_parent_id,$front, false,false);
if($child->product_parent_id === $parentProduct->product_parent_id) break;
$attribs = get_object_vars($parentProduct);

foreach($attribs as $k=>$v){

if(strpos($k,'_')!==0 && empty($child->$k)){
$child->$k = $v;
vmdebug('getProduct $k',$k);
}
}
$i++;
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Stephen Roberts

That works also. I'll keep an eye out for anything else strange happening...
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com

Milbo

My version just creates/copy not the internal variables, which should be better anyway.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Stephen Roberts

Agreed. I'm going to set up a fresh installation and compare it with my current one and see if I can figure out what happened and if there's possibly a deeper problem here.
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com

Stephen Roberts

It turns out that I'm calling getProduct(), the offending function, in a module and that seems to causing the problem. I think your solution does the trick so I'd say this case is closed. :)
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com