News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

[SOLVED] List Orders Error

Started by trevorsm, December 22, 2011, 20:07:09 PM

Previous topic - Next topic

design609

 
@Electrocity
QuoteI 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)

design609

#16
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

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

brunoazevedo

#17
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

zzsser

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.

zandee

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.


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 ;

    }

beevo

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?
Using Joomla 3.4.4 and VM 3.0.10