Another fix for Jigoshop

May 292014
 
 Posted by on 29/05/2014 How-To's Tagged with: ,  Add comments

 This is probably the last post about Jigoshop updates, our host updated PHP on server to 5.3. version. And I’m getting tired about these updates – the guys from Jigoshop seems to take these things as a joke… But is not… some of us use their plugin for shops with thousands of products, is not a joke to take down such a shop for their amusement… Because for me start to looking as an amusement how they code this plugin.

Let’s see about what I’m talking. In the morning I received a comment which said that my solution for Jigoshop 1.9.+ don’t works for 1.9.5. I was wondering why… in the changelog for this update was nothing “dangerous”… Looking in the code… the same “line 32” which can be commented…

So, what happens? I reverted php to 5.2.17 on the server (probably our host already think that I am nuts), I commented the line – in frontend all things goes fine, BUT one big WSOD in backend… Turning on WP_DEBUG revealed nothing… error.log on server? – CLEAN.

Finally, switching back and forth PHP version on server, after half of day of work, with all plugins disabled, INCLUDING Jigoshop, I found the problem – trying to re-enable Jigoshop I got this:

Parse error: syntax error, unexpected T_FUNCTION in /home/(username)/(domain name)/wp-content/plugins/jigoshop/admin/jigoshop-admin.php on line 31

And now come the reason for what I am upset… Looking into this file we can see this function:

REALLY??? Why to use an anonymous function here??? What if they write a function compatible with all versions of PHP??? It cost only an ENTER and a word written twice…

 But, stay, this wasn’t all – another error on activation:

Parse error: syntax error, unexpected T_FUNCTION in /home/(username)/(domain name)/wp-content/plugins/jigoshop/admin/write-panels/product-types/variable.php on line 204

Going to that file – another anonymous function!!!!

For what to use such constructions??? For clarity or readability? Don’t look better than classical functions… Below is the filter used normally, much more readable:

In this way are written all actions and filters in plugins and themes – the function is defined separately than call… Only Jigoshop try to force all Internet to upgrade to PHP 5.3.+… I have news for Jigoshop – some of us simply cannot upgrade – some users paid money for customized plugins/themes which cannot be upgraded… Jigo-guy’s know that I paid for a Carousel plugin which aren’t anymore on CodeCanyon?… I paid for Jigoshop Prices by User and now Chris moved his site and closed his shop…

It is so hard to take care about your users??? I know that the things evolve everywhere, but at least keep a minimum necessary for a functional shop even on older servers… Even if they cannot benefit of the new features, keep the old shops as they was…. THE USERS FROM THESE SERVERS WAS WITH YOU FROM THE BEGINNING!

Even the problem with “line 32” can be solved by Jigoshop in a more elegant way than blocking the shops… So in the file jigoshop-web-optimization.php from /wp-content/plugins/jigoshop/plugins/jigoshop-web-optimization-system replace the line 32 (new \Jigoshop\Web\Optimization();) with:

In this way the plugin will check itself the php version of the server and will activate the new web optimization system only on servers which support this. The shops builded on lower version will works as in previous versions, without optimization….

Even this is not a problem of PHP version… Since when the best coding practices was deprecated? After few updates even for original programmer will be hard to find his own functions when hundreds of them will be named just function()…. You can make a plugin for your own purpose on your own server and code it in this way…. but not when thousands of users expect better versions, not worst… And this changes don’t cost nothing, are easy to implement, just one or few lines of code….

In conclusion… if you still are on PHP 5.2. and you cannot upgrade to PHP 5.3. – replace the above function in their respective files, including the last function (or comment the line as in my previous post: https://drafie-design.nl/quick-fix-for-jigoshop-1-9-on-servers-with-php-below-5-3/)… or start thinking to move your shop to Woocommerce (I never thought that will be a day when I say that)…………

Don’t think that on PHP 5.3 all things works perfectly – after installing Jigoshop 1.9.5 from repository, without any change in it’s files, on a server with php 5.3.28, their duck-egg color is spreaded on all admin pages. With php 5.3.16 I don’t see the same problem… I don’t know from where is coming this problem, I am just too tired to dig for every inconsistence in codes…

https://drafie-design.nl/another-fix-for-jigoshop/trackback/Trackback URI:  

Ciprian

Experienced web developer and graphic designer. Former consultant for Suffusion theme and former moderator on Suffusion Support forum. I teach others while learning myself.

Google+ Profile

    Google+ Page

 Leave a Reply

(Your comment will be published. To contact me privately, use the contact form.)

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  3 Responses to “Another fix for Jigoshop”

Comments (2) Pingbacks (1)
  1. Oh Colin, don’t be so categorical… If you have a flavour of PHP 5.3. on your server, you even don’t notice the problems from article.
    I still consider Jigoshop the best e-commerce solution. But the team of Jigoshop was changed and the new team seems to be hurry to bring new options in Jigoshop (which options are really exciting), but in their hurry forget about the old users and about the best coding practices.
    My article tried to be a signal of warning – if I didn’t like Jigoshop I could just move to another solution without writing anything…

     
  2. Thanks for this post Drake. I had just started to configure Jigoshop on a new site. I think I will now forget it and move to Woocommerce.