VirtueMart Forum

VirtueMart 2 + 3 => Virtuemart Development and bug reports => Topic started by: trevorsm on December 22, 2011, 20:07:09 pm

Title: [SOLVED] List Orders Error
Post by: trevorsm on December 22, 2011, 20:07:09 pm
I have added a menu item - List Orders but when I click to view an order there are errors reported for each item on the order:
Code: [Select]
Warning: key() [function.key]: Passed variable is not an array or object in /--- website ---/administrator/components/com_virtuemart/plugins/vmcustomplugin.php on line 253I get the same result if I click on the 'view your order online' link in the confirmation email that is sent to the customer.

Using VM2.0.0

Edit - It only seems to happen when the product has custom fields!
Title: Re: List Orders Error
Post by: PRO on December 22, 2011, 21:42:00 pm
Get the same here

[attachment cleanup by admin]
Title: Re: List Orders Error
Post by: Studio 42 on December 23, 2011, 06:47:37 am
I have added a menu item - List Orders but when I click to view an order there are errors reported for each item on the order:
Code: [Select]
Warning: key() [function.key]: Passed variable is not an array or object in /--- website ---/administrator/components/com_virtuemart/plugins/vmcustomplugin.php on line 253I get the same result if I click on the 'view your order online' link in the confirmation email that is sent to the customer.

Using VM2.0.0

Edit - It only seems to happen when the product has custom fields!

fixed At revision: 5167
Title: Re: List Orders Error
Post by: Norman27 on December 30, 2011, 19:10:47 pm
Hallo! Ich habe das selbe Problem, wollte mal nachfragen, was das Revision 5167 bedeutet und wie ich das einbinden kann, damit der Fehler nicht mehr passiert.

English (not good:-)) Hello, i have the same Problem. What is the fixed 5167. How i become it? Thanks!
Title: Re: List Orders Error
Post by: PRO on December 30, 2011, 20:13:03 pm
Hallo! Ich habe das selbe Problem, wollte mal nachfragen, was das Revision 5167 bedeutet und wie ich das einbinden kann, damit der Fehler nicht mehr passiert.

English (not good:-)) Hello, i have the same Problem. What is the fixed 5167. How i become it? Thanks!

on the next update, OR if you use SVN

https://dev.virtuemart.net/svn/virtuemart/trunk/virtuemart/
Title: Re: List Orders Error
Post by: Norman27 on January 01, 2012, 16:28:55 pm
Hello!
I changed the file now. However, the error message comes back, but now 254th in line The line was also added new and is called: if (key ($ plg) == $ this-> _name)

Hope you can help me.
greeting
Norman
Title: Re: List Orders Error
Post by: adham on January 06, 2012, 11:51:45 am
I did have the same error, found it it was either the custom field was deleted or altered, or it wasnt configured the right way, try to delete the custom field and make a new one and see, also empty the cache.
Cheers!

FORGET THE ABOVE!!1 the error came back, also in backend print view it displays this {"429":" Choose a colour : <\/span>62"} VM 2.0 and J1.5.X
Title: Re: List Orders Error
Post by: zzsser on January 11, 2012, 11:05:11 am
Hi, does someone could solve this problem ?

I still have this problem. I tried:

- install the last custom fields files (taking into account revision 5167)
- empty the cache
- create a new simple custom field (color field with 2 colors)
- create a new simple product with only the new custom field

The error message remain the same in back-end (no problem in confirmation e-mails):


Warning: key() expects parameter 1 to be array, string given in /homez.398/stickerv/www/administrator/components/com_virtuemart/plugins/vmcustomplugin.php on line 253

I'm lost :-(
Title: [SOLVED] Re: List Orders Error
Post by: trevorsm on January 11, 2012, 11:08:57 am
I updated to the latest version from the svn two days ago and it it seems to work OK now.
Title: Re: [SOLVED] List Orders Error
Post by: zzsser on January 12, 2012, 08:56:36 am
I replace the file and I get the same error to an other line (196 vs 253) in this file:


Warning: key() expects parameter 1 to be array, string given in /homez.398/stickerv/www/administrator/components/com_virtuemart/plugins/vmcustomplugin.php on line 196

(I use J1.7)
Title: Re: [SOLVED] List Orders Error
Post by: trevorsm on January 12, 2012, 09:47:48 am
I think there might be more than one file involved. I updated all the files from the svn.
Title: Re: [SOLVED] List Orders Error
Post by: supermac on January 12, 2012, 13:38:50 pm
I cannot replace all files because i'm customizing some php for my needs: I'd like to know which files are involved....
Title: Re: [SOLVED] List Orders Error
Post by: maxi1973 on January 25, 2012, 14:30:33 pm
Upgrade with new release 2.0.1 and it will fix the problem. Save before for your customized files
Title: Re: [SOLVED] List Orders Error
Post by: brunoazevedo on January 25, 2012, 18:49:54 pm
Hi,

i Updated the VM 2.0.1, the error atoped, but i lose the products and categories imagens and details (Images, Custon Fields...)

Any ideia

Thanks
Bruno

Title: Re: [SOLVED] List Orders Error
Post by: PRO on January 25, 2012, 19:05:28 pm
go to "shop media files" and publish all images
Title: Re: [SOLVED] List Orders Error
Post by: design609 on January 26, 2012, 03:23:22 am
 
@Electrocity
Quote
  I have added a menu item - List Orders but when I click to view an order there are errors reported for each item on the order:
    Code: [Select]
    Warning: key() [function.key]: Passed variable is not an array or object in /--- website ---/administrator/components/com_virtuemart/plugins/vmcustomplugin.php on line 253
    I get the same result if I click on the 'view your order online' link in the confirmation email that is sent to the customer.
    Using VM2.0.0

    Edit - It only seems to happen when the product has custom fields!

fixed At revision: 5167

Since the problem is to be found i VM 2.0 and I tried the VM 2.0.1 which created new sets of problems - then I am forced to stay on with 2.0 for a while.
Could we might get an insight into which files have to be edited and with what so we can fix it on a VM 2.0 version?
This issue blackout customer (view order) and shopadmin (backend list orders) to see which item is ordered (custom field - image for instance)
Please...
(tried as above to replace content of that single file vmcustomplugin.php with the new one fram 2.0.1 but of course that not worked just moved error to :
/public_html/dev/administrator/components/com_virtuemart/plugins/vmcustomplugin.php on line 196)
Title: Re: [SOLVED] List Orders Error
Post by: design609 on January 26, 2012, 04:12:48 am
A very dirty fix (or rather hiding of this issue) for VM 2.0

I replaced content with VM 2.0 content of VM 2.0.1 files
/administrator/components/com_virtuemart/models/customfields.php
/administrator/components/com_virtuemart/plugins/vmcustomplugin.php

Went into the
 /administrator/components/com_virtuemart/plugins/vmcustomplugin.php

Edited:
line 188

Quote
    public function GetPluginInCart($product){
       //$plgName = $productCustom->value;

       if(!empty($product->param)){
         if (!is_array($product->param)) return false ;
         $param = array() ;
         
          foreach($product->param as $k => $plg){
             if (key($plg)== $this->_name)
             $param[$k]= $plg[$this->_name];
          }
         if ($param ) return $param ;
       }

       return null ;

    }

to
Quote
    public function GetPluginInCart($product){
       //$plgName = $productCustom->value;

       //if(!empty($product->param)){
         //if (!is_array($product->param)) return false ;
         //$param = array() ;
         
          //foreach($product->param as $k => $plg){
             //if (key($plg)== $this->_name)
             //$param[$k]= $plg[$this->_name];
          //}
         //if ($param ) return $param ;
       //}

       return null ;

    }

Now at least me and customers do not have to look at the error message and the custom filed type image is shown with image title...
I did not test where this is going to break some other stuff.


EDIT::::::::::::::::::::::::::::::::::::::::::::::::

hmmm.. this seems to have broken custom field type string on the frontend
:O
Title: Re: [SOLVED] List Orders Error
Post by: brunoazevedo on January 26, 2012, 12:26:18 pm
Hi BanquetTables.pro,

Thanks. Working :)

But i found other problems/bug:

In product detail, the thumbnail image open with big dimensons.

The custon fieds not show in product Details.

Thanks
Bruno
Title: Re: [SOLVED] List Orders Error
Post by: zzsser on January 27, 2012, 17:18:14 pm
Hi BanquetTables.pro,

This is an interesting solution... For me this is not usefull because the fields "Text input" (what customers have to fill in) disappear on front-end.
Title: Re: [SOLVED] List Orders Error
Post by: zandee on February 02, 2012, 15:10:42 pm
This problem was bought to my attention by a customer of mine, for whom the existing solution on this page was not sufficient.

The following code fixes the error and displays the custom fields.

Code: [Select]
public function GetPluginInCart($product){
    //$plgName = $productCustom->value;

    if(!empty($product->param)){
$param = array() ;

    foreach($product->param as $k => $plg){


    //if ($plg == $this->_name)
$param[]= $plg;
    }

if ($param ) return $param ;
    }

    return null ;

    }
Title: Re: [SOLVED] List Orders Error
Post by: beevo on February 10, 2012, 12:26:40 pm
I'm having this error too for every product listed.

Can I just ask, where exactly are you getting VM 2.0.1 from? In the admin area it says that VM 2.0.0. is the latest version. Same on the VM website under downloads the only latest option is VM 2.0.0.

So where are you getting VM 2.0.1 from?