VirtueMart Forum

VirtueMart 2 + 3 + 4 => Installation, Migration & Upgrade => Topic started by: ntm91307 on October 26, 2015, 02:22:08 AM

Title: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: ntm91307 on October 26, 2015, 02:22:08 AM
Hello;

I downloaded and installed the J2.5/VM3 package using the included vmBeez5 template and created my first eCommerce website.  Everything was coming along nicely until I started testing the Checkout process.  The page I was taken to after I pressed Confirm Order was completely messed up.  All navigation, messages, buttons etc. was displayed as text links on the left side of the screen in almost indiscernible order.  I tried other VM aware templates with the same result.  My final attempt at a repair was to upgrade from J2.5 to J3.4 but instead of fixing my problem I introduced a new one.  Now not only does my Order Confirmed screen out of whack but now I get the following error message on my shop screens:

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
.
.
.
.

I'm pretty sure I know, in general, what I did wrong (I tried to use a major upgrade to solve what was probably a very minor problem) but now I need help on finding the best way to fix it.  I have backups so I can revert to the point just before the upgrade if need be.  Or, if fighting forward is the way to go I'm in.  I do have a good deal of development background and, in time, could probably dig through the code and figure this out.  Trouble is, as always, I don't have the time for that luxury.  I'm hoping this is something someone has experienced and fixed before and would be willing to share the answer.

Here's some of the under-the-hood-details:

Virutemart 3.0.10

PHP Built On    Linux host.mbsscorp.com 2.6.32-573.7.1.el6.x86_64 #1 SMP Tue Sep 22 22:00:00 UTC 2015 x86_64
Database Version    5.5.46
Database Collation    utf8_general_ci
PHP Version    5.6.13
Web Server    Apache/2.2.15
WebServer to PHP Interface    cgi-fcgi
Joomla! Version    Joomla! 3.4.5 Stable [ Ember ] 22-October-2015 21:30 GMT
Joomla! Platform Version    Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent    Mozilla/5.0 (Windows NT 5.1; rv:41.0) Gecko/20100101 Firefox/41.0
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: driver_wedge on October 27, 2015, 02:02:24 AM
Have you gone into VM in backend, then Tools>Tools & Migration - then click "Update vm2 order format of customfields to vm3 format", followed by "Remove old vm2 inherited customfields"?

This needs to be done when upgrading from VM2.5 to VM3.
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: ntm91307 on October 27, 2015, 22:08:17 PM
Thought you might have had it there, but no.  My upgrade wasn't from VM 2.5 to 3.x.  It was from Joomla! 2.5 to 3.4.  Nice try though...:)

Anybody else?  This is like the very last thing I need to conquer before I can activate this site.

Anybody at all?
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: GJC Web Design on October 27, 2015, 22:24:51 PM
QuoteNotice: 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

try
error_reporting( E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING );

at the top of that file

plus these line numbers don't correspond to my customfield.php VM3.0.10 .. line numbers are slightly out...  sure your on the latest .. (even try 3.0.11 which is pretty stable in tests)

without a life url to the order confirm mess i doubt anyone can help you
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: ntm91307 on October 27, 2015, 22:41:42 PM
Thank you for your prompt reply...:)

I've disabled the site but have created a user ID anyone can use to look around:

   url: www.momsfavoritefudge.com
   Login: techsupport
   Password: techsupport

I've got payments setup as Sandbox so feel free to beat it up as much as you like.

I'll go look for 3.0.11 and try it.  I've got backups here so no harm, no foul if it doesn't work.

And which file are you talking about putting this code into?
   error_reporting( E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING );

Thanks again....:)
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: GJC Web Design on October 27, 2015, 22:43:35 PM
components/com_virtuemart/sublayouts/customfield.php
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: ntm91307 on October 27, 2015, 22:55:34 PM
Thanks for the snippet.....worked like a charm...:)

Now, one last bug to go.....
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: Milbo on October 28, 2015, 00:42:00 AM
I think you just stumbled over a bug in vm3.0.10, which got fixed in vm3.0.11. Try a normal update to vm3.0.11, so far vm3.0.11 looks more stable than vm3.0.10
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: ntm91307 on October 28, 2015, 00:47:09 AM
Ah....I feel better...was beginning to think it was me....:)

Working on that update now.  It seems I have to upload the files to a tmp directory before I can update.  Trying the regular package type install gives me the dreaded "error uploading this file to the server" message despite making the well-published changes to the file size and timeout parameters.  Take a little longer but I'm getting there.....:)

Stay tuned.....
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: ntm91307 on October 28, 2015, 01:12:28 AM
Bummer....no help.  Everything is still crammed to the left after pressing Confirm Order.  I've made a couple of screenshots and put them in a Word doc so you can see what I see.  The first page is after pressing Cart.  The second after pressing Confirm Purchase...<brace yourself>.

As you can see those pesky warnings are back again but thanks to my friend GJC Web Design I do believe I have the answer to that.  But what to do about the ugly confirmation screen?

Thanks one and all....
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: ntm91307 on October 28, 2015, 15:35:54 PM
Recap: As suggested I updated VM to 3.0.11 in order to solve what appear to be my final problem before bringing this website live.  From the Cart view press Confirm Order and the presentation is no longer formatted properly.  It's very unstructured (see attachment from previous post for screenshots).  And just to reiterate one piece of info that may or may not be pertinent I started with the Joomla! 2.5/VM 3.x installation package from this site.  I don't recall this being a problem at that time.  I followed the step by step instructions provided by Joomla! and upgraded from J2.5 to J3.4.5 Stable.  This is when I noticed this screen looking this way.

I'm still trying to get this figured out.  Is anyone else out there having this problem?
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: jenkinhill on October 28, 2015, 18:15:30 PM
Turn off "Enable SSL for sensitive areas (recommended)" in VM configuration/shop

And also turn off PHP notices & warnings. Use the Error Reporting setting in Joomla global configuration/server settings - should work for you.
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: ntm91307 on October 28, 2015, 19:08:01 PM
BULLSEYE!!!  I'd have never thought of that one.

Thank you very much one and all....:)
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: Milbo on October 29, 2015, 22:17:42 PM
nice, vm3.0.11.2  should work even better
http://forum.virtuemart.net/index.php?topic=131898.0
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: ntm91307 on October 30, 2015, 00:36:00 AM
Wow...you have been busy...:)  I'll get that installed after I finish tweaking the site and get a full backup.  I'll report any anomalies I find.

One of the fixes I read actually generated a question in my mind.  It's off this topic completely so if you want to shut this down and pick it up somewhere else I get it.

Can/Will VM natively support Bitcoins at some point?  I have a colleague who is extremely excited about Bitcoins and he wants me to incorporate them into my site.  I know there are addons but I generally prefer native....just seems to go more smoothly for me.

Your thoughts?
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: innato on August 25, 2016, 14:46:54 PM
Quote from: GJC Web Design on October 27, 2015, 22:24:51 PM
QuoteNotice: 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:


         if(!isset($productCustom->customfield_price)) $productCustom->customfield_price = 0.0;


Now add an additional line so that it reads:


         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.
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: GJC Web Design 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

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

they are harmless otherwise php would 'error' or 'warning' them
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: innato on August 25, 2016, 18:24:02 PM
Quote from: GJC Web Design on August 25, 2016, 15:29:47 PM

Quoteeven 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.
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: Milbo on September 16, 2016, 11:04:43 AM
Quote from: innato on August 25, 2016, 18:24:02 PM
Quote from: GJC Web Design on August 25, 2016, 15:29:47 PM

Quoteeven 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.
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: innato 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.
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: Milbo on September 20, 2016, 12:22:15 PM
Quote from: innato on September 16, 2016, 13:25:54 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.

Quote from: innato on September 16, 2016, 13:25:54 PM
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.

Quote from: innato on September 16, 2016, 13:25:54 PM
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
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: innato 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
=========


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
=======


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 }


Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: Milbo 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.
Title: Re: Upgrade from J2.5.x to J3.4.x causes errors in Virtuemart 3
Post by: innato on September 21, 2016, 08:41:27 AM
Yes Max that is correct