Author Topic: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3  (Read 7832 times)

innato

  • Jr. Member
  • **
  • Posts: 52
  • Newby to this forum
  • VirtueMart Version: VM 3 on Joomla! 3
Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
« Reply #15 on: August 25, 2016, 14:46:54 pm »
Quote
Notice: Undefined property: stdClass::$customfield_price
in /home/momsfavoritefudge/public_html/components/com_virtuemart/sublayouts/customfield.php on line 426

Notice: Undefined property: stdClass::$customfield_value
in /home/momsfavoritefudge/public_html/components/com_virtuemart/sublayouts/customfield.php on line 430

Notice: Undefined property: stdClass::$customfield_value
in /home/momsfavoritefudge/public_html/components/com_virtuemart/sublayouts/customfield.php on line 431

these are just notices and won't affect the function of the file .. your error reporting is very high to be showing these

Using VM 3.0.16 on J3.6.2 and PHP 5.6.24.

I stumbled across the above post because I was getting the $customfield_value notice as well. I don't want notices, even if they're told to be 'harmless' (they may not be harmless at all).
In my VM version 3.0.16 the $customfield_price issue appears to have fixed, and the same hack should have been used for $customfield_value

In file /components/com_virtuemart/sublayouts/customfield.php line 457 reads:

Code: [Select]
         if(!isset($productCustom->customfield_price)) $productCustom->customfield_price = 0.0;

Now add an additional line so that it reads:

Code: [Select]
         if(!isset($productCustom->customfield_price)) $productCustom->customfield_price = 0.0;
         if(!isset($productCustom->customfield_value)) $productCustom->customfield_value = '';

and you're done in a jiffy!

I am posting this, so that others may benefit and the VM team can include it in the next VM release.
Regards
Rob

VM3.2.6 (enhanced) on J3.8.8 and PHP 7.1 or 7.2

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10356
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
« Reply #16 on: August 25, 2016, 15:29:47 pm »
please check on VM3.0.17.6 as this is the latest dev version which shortly will be released as VM3.0.18

http://dev.virtuemart.net/attachments/download/1011/com_virtuemart.3.0.17.6_extract_first.zip

many of these small changes may have been done

BTW -- vm extensions is running on 3.0.17.6 so almost production ready

Quote
even if they're told to be 'harmless' (they may not be harmless at all)

they are harmless otherwise php would 'error' or 'warning' them
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

innato

  • Jr. Member
  • **
  • Posts: 52
  • Newby to this forum
  • VirtueMart Version: VM 3 on Joomla! 3
Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
« Reply #17 on: August 25, 2016, 18:24:02 pm »

Quote
even if they're told to be 'harmless' (they may not be harmless at all)

they are harmless otherwise php would 'error' or 'warning' them

Agree, but what is harmless for PHP may still not be harmless for the outcome/result of the software if it's not sufficiently robust.

Thanks for the hint ref VM3.0.17, but I'll wait for the first next stable version because it goes into a production site.
Regards
Rob

VM3.2.6 (enhanced) on J3.8.8 and PHP 7.1 or 7.2

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10158
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
« Reply #18 on: September 16, 2016, 11:04:43 am »

Quote
even if they're told to be 'harmless' (they may not be harmless at all)

they are harmless otherwise php would 'error' or 'warning' them

Agree, but what is harmless for PHP may still not be harmless for the outcome/result of the software if it's not sufficiently robust.

Thanks for the hint ref VM3.0.17, but I'll wait for the first next stable version because it goes into a production site.


and how should we know then, if vm3.0.17 has the error?

it just leads to the situation, that you have the error in vm3.0.18, pure logic, we are no wizards.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

innato

  • Jr. Member
  • **
  • Posts: 52
  • Newby to this forum
  • VirtueMart Version: VM 3 on Joomla! 3
Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
« Reply #19 on: September 16, 2016, 13:25:54 pm »
Milbo, lucky you that you are 'only' human and not a wizard. Welcome to the club  ;)
Well, if you guys are developing/fine-tuning VM3.0.17, I guess you have installed it somewhere. The error has been described in sufficient detail, so you could see if it occurs on your VM3.0.17 install. There is no magic to that.
The alternative is that I have to upgrade my present VM3.0.16 on my production site (the only place where I use VM), with the risk of seeing the error again and having to reverse the upgrade. I could also setup a test site and install VM3.0.17 there. Both alternatives are significantly more effort than the first.
I was just trying to give you constructive feedback for you to benefit from. I had already applied the hack to my production site.
Regards
Rob

VM3.2.6 (enhanced) on J3.8.8 and PHP 7.1 or 7.2

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10158
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
« Reply #20 on: September 20, 2016, 12:22:15 pm »
Well, if you guys are developing/fine-tuning VM3.0.17, I guess you have installed it somewhere. The error has been described in sufficient detail, so you could see if it occurs on your VM3.0.17 install. There is no magic to that.

I cant reproduce it, you do not even tell whicht customfield type yo use. My more than 10 years experience with programming tells me that if someone finds a bug, always ask him to test the fix himself. Else you test very likely something else. Standard Problem.

The alternative is that I have to upgrade my present VM3.0.16 on my production site (the only place where I use VM), with the risk of seeing the error again and having to reverse the upgrade. I could also setup a test site and install VM3.0.17 there. Both alternatives are significantly more effort than the first.

no, setting up a vm with fullinstaller takes 5 minutes. VirtueMart is a project and I wrote the 95% of the code, so it is also a time problem.

I was just trying to give you constructive feedback for you to benefit from. I had already applied the hack to my production site.

Which I cannot use, because the files changed a lot. It would have been also enough, just to exchange the file, to check if the error is still in the file
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

innato

  • Jr. Member
  • **
  • Posts: 52
  • Newby to this forum
  • VirtueMart Version: VM 3 on Joomla! 3
Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
« Reply #21 on: September 20, 2016, 21:54:46 pm »
Yes the problem still exists in VM3.0.18.
This is the fix:

File /components/com_virtuemart/sublayouts/customfield.php

Change: Line 518 of current file should become line 516 of new file

Present code
=========

Code: [Select]
513 $default = reset($customfields[$selectList[$customfield->virtuemart_custom_id]]->options);
514 foreach ($customfields[$selectList[$customfield->virtuemart_custom_id]]->options as &$productCustom) {
515 if(!isset($productCustom->customfield_price)) $productCustom->customfield_price = 0.0;
516 $price = VirtueMartModelCustomfields::_getCustomPrice($productCustom->customfield_price, $currency, $calculator);
517 if($type == 'M'){
518 if(!isset($productCustom->customfield_value)) $productCustom->customfield_value = '';
519 $productCustom->text = VirtueMartModelCustomfields::displayCustomMedia ($productCustom->customfield_value,'product',$customfield->width,$customfield->height).' '.$price;
520 } else {
521 $trValue = vmText::_($productCustom->customfield_value);
522 if($productCustom->customfield_value!=$trValue and strpos($trValue,'%1')!==false){
523 $productCustom->text = vmText::sprintf($productCustom->customfield_value,$price);
524 } else {
525 $productCustom->text = $trValue.' '.$price;
526 }
527 }
528 }


Should be
=======

Code: [Select]
513 $default = reset($customfields[$selectList[$customfield->virtuemart_custom_id]]->options);
514 foreach ($customfields[$selectList[$customfield->virtuemart_custom_id]]->options as &$productCustom) {
515 if(!isset($productCustom->customfield_price)) $productCustom->customfield_price = 0.0;
516 if(!isset($productCustom->customfield_value)) $productCustom->customfield_value = '';
517 $price = VirtueMartModelCustomfields::_getCustomPrice($productCustom->customfield_price, $currency, $calculator);
518 if($type == 'M'){
519 $productCustom->text = VirtueMartModelCustomfields::displayCustomMedia ($productCustom->customfield_value,'product',$customfield->width,$customfield->height).' '.$price;
520 } else {
521 $trValue = vmText::_($productCustom->customfield_value);
522 if($productCustom->customfield_value!=$trValue and strpos($trValue,'%1')!==false){
523 $productCustom->text = vmText::sprintf($productCustom->customfield_value,$price);
524 } else {
525 $productCustom->text = $trValue.' '.$price;
526 }
527 }
528 }

Regards
Rob

VM3.2.6 (enhanced) on J3.8.8 and PHP 7.1 or 7.2

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10158
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
« Reply #22 on: September 21, 2016, 08:03:41 am »
Sadly not in the new release. So it is just setting the default value for any type and not just type = M, okey.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

innato

  • Jr. Member
  • **
  • Posts: 52
  • Newby to this forum
  • VirtueMart Version: VM 3 on Joomla! 3
Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
« Reply #23 on: September 21, 2016, 08:41:27 am »
Yes Max that is correct
Regards
Rob

VM3.2.6 (enhanced) on J3.8.8 and PHP 7.1 or 7.2