Author Topic: [solved ]Rev. 4902 Cannot access protected property TableProducts::$_pkey  (Read 2006 times)

Stephen Roberts

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 142
    • SundaySchool.com
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

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 142
    • SundaySchool.com
Re: Rev. 4902 Cannot access protected property TableProducts::$_pkey
« Reply #1 on: December 02, 2011, 22:33:17 pm »
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:

Code: [Select]
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9942
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Rev. 4902 Cannot access protected property TableProducts::$_pkey
« Reply #2 on: December 03, 2011, 13:54:08 pm »
A bit strange yes.

Please try instead of yours, this fix:
Code: [Select]
$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++;
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Stephen Roberts

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 142
    • SundaySchool.com
Re: Rev. 4902 Cannot access protected property TableProducts::$_pkey
« Reply #3 on: December 03, 2011, 17:07:05 pm »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9942
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Rev. 4902 Cannot access protected property TableProducts::$_pkey
« Reply #4 on: December 04, 2011, 13:33:19 pm »
My version just creates/copy not the internal variables, which should be better anyway.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Stephen Roberts

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 142
    • SundaySchool.com
Re: Rev. 4902 Cannot access protected property TableProducts::$_pkey
« Reply #5 on: December 05, 2011, 03:39:12 am »
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

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 142
    • SundaySchool.com
Re: Rev. 4902 Cannot access protected property TableProducts::$_pkey
« Reply #6 on: December 05, 2011, 17:22:49 pm »
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