Author Topic: 1054 Unknown column 'Array' in 'where clause after update to 3.8.6 ** SOLVED **  (Read 12180 times)

Partyzant

  • Beginner
  • *
  • Posts: 2
  • A beginner
thanks!!!!, it works!!!!!

EsSa55

  • Jr. Member
  • **
  • Posts: 93
    • 4FootyFans & 4MovieTVmusicFans
  • Skype Name: talk2-4footyfans
  • VirtueMart Version: Live: 3.4.2
Thanks, Jumbo

Products now open in the backend.

However, Product Price, image(s), Category(ies) and Manufacturer are now empty.

TIA


That's a different issue. It appears that the database was not updated correctly during the update and the data were lost.

The database content is correct but it is not being read.
Do you think repeating the update might solve the issue?
Thankfully, this was on a dev installation, not Live.

TIA

EsSa55

  • Jr. Member
  • **
  • Posts: 93
    • 4FootyFans & 4MovieTVmusicFans
  • Skype Name: talk2-4footyfans
  • VirtueMart Version: Live: 3.4.2
I have restored another Live backup into my dev installation and repeated the VM update.

The issue is the same.

There are 6740 products.

The latest 114 display correctly.

The remainder have no images, categories, manufacture, price.

The database tables are correct.

citylop

  • Beginner
  • *
  • Posts: 13
Thank you Jumbo!, your solution worked for me.

freethud

  • Beginner
  • *
  • Posts: 3
Your solution is ok!!
But now, the product order doesn't work :-(

I'll be waiting for the ultimate solution!!

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10545
  • VM4.0.7 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/


freethud

  • Beginner
  • *
  • Posts: 3
Your solution is ok but... changing the product order doesn't work!!
Do you think to develop another version??

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10545
  • VM4.0.7 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
When I wrote the fix, I did not see the version of Jumbo. My fix works completly different, because the basic construction had a big error. So the technic now is to convert it always to an array.

Code: [Select]
if (!empty($virtuemart_category_id )){
if( is_array($virtuemart_category_id)) {
$virtuemart_category_id = array_filter($virtuemart_category_id);
} else {
$virtuemart_category_id = array($virtuemart_category_id);
}
}
if (!empty($virtuemart_category_id )) {
$joinCategory = TRUE;
VmConfig::set('show_subcat_products',true);
if(VmConfig::get('show_subcat_products',false)){
/*GJC add subcat products*/
$catmodel = VmModel::getModel ('category');
$cats = '';
foreach($virtuemart_category_id as $catId){
$childcats = $catmodel->getChildCategoryList(1, $catId,null, null, true);
foreach($childcats as $k=>$childcat){
if(!empty($childcat->virtuemart_category_id)){
$cats .= $childcat->virtuemart_category_id .',';
}
}
$cats .= $catId;
}

                if(!empty($cats)){
                    $joinCategory = TRUE;
                    $where[] = ' `pc`.`virtuemart_category_id` IN ('.$cats.') ';
                }
} else {
$where[] = ' `pc`.`virtuemart_category_id` IN ('.implode(',',$virtuemart_category_id).') ';
}
} else if ($isSite) {
if (!VmConfig::get('show_uncat_parent_products',TRUE)) {
$joinCategory = TRUE;
$where[] = ' ((p.`product_parent_id` = "0" AND `pc`.`virtuemart_category_id` > "0") OR p.`product_parent_id` > "0") ';
}
if (!VmConfig::get('show_uncat_child_products',TRUE)) {
$joinCategory = TRUE;
$where[] = ' ((p.`product_parent_id` > "0" AND `pc`.`virtuemart_category_id` > "0") OR p.`product_parent_id` = "0") ';
}
}

It replaces more than Jumbos code suggestion.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

freethud

  • Beginner
  • *
  • Posts: 3
Excuse me,
Should I replace the code from your last update "virtuemart.3.8.7.10378.zip" with this one?
Which are the the row numbers?? With this patch, does it work the change of product order of a category in the frontend?
Thank you very much

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10743
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
the idea is to install (carefully .. i.e. on clone etc first ) virtuemart.3.8.7.10378.zip
GJC Web Design
VirtueMart and Joomla Developers - php developers https://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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

AnnieG13

  • Jr. Member
  • **
  • Posts: 54
  • A beginner
I am getting this error too. When I tried to add some categories and products, I get it not when the created the category but when I went to create the products. (See screenshot)

I really need to get this fixed so if anyone has a solution for me I would really appreciate it.

Thanks Annie

Joomla 3.9
Virtuemart 3.4
PHP Version 7.4.13

www.puppylanetreats.com.au

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3935
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
This is because JOOMLA or PHP changed. Can You downgrade Your PHP perhaps ?

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

rakeshy

  • Beginner
  • *
  • Posts: 5
  • A beginner
Please test http://dev.virtuemart.net/attachments/1276/com_virtuemart.3.8.7.10378.zip
Took quite some time to find this fix!
This error gives a LOT of results when searching: 1054 Unknown column 'Array' in 'where clause

ttanidis

  • Beginner
  • *
  • Posts: 19
  • Educational & Corporate IT Solutions
    • tanidisit.website
Open - administrator/components/com_virtuemart/models/product.php

Find the exact following codes between lines 473 to 479:

Code: [Select]
                if(!empty($cats)){
                    $joinCategory = TRUE;
               $cats .= $virtuemart_category_id;
                    $where[] = ' `pc`.`virtuemart_category_id` IN ('.$cats.') ';
                } else {
               $where[] = ' `pc`.`virtuemart_category_id` = ' . $virtuemart_category_id;
            }

Replace above by:

Code: [Select]
            if(!empty($cats)) {
               $joinCategory = TRUE;
               $cats .= $virtuemart_category_id;
               $where[] = ' `pc`.`virtuemart_category_id` IN ('.$cats.') ';
            } else {
               if(is_array($virtuemart_category_id)) {
                  $category_id = array_filter(array_map('intval', $virtuemart_category_id));
                  if(!empty($category_id))
                  {
                     $where[] = ' `pc`.`virtuemart_category_id` IN (' . implode(',', $category_id) . ')';
                  }
               } else {
                  $where[] = ' `pc`.`virtuemart_category_id` = ' . $virtuemart_category_id;
               }
            }

This will fix the issue for the time being. A permanent solution is expected in the next release.

Thank you but this didn't solve the problem for me. Same error when filtering by category, search or when I change page.

Then you must have changed the wrong codes. Category filtering works fine now.

Modified file attached.

Thank you for the file. I uploaded the file in administrator/components/com_virtuemart/models, I cleared all browser history and cookies and I still have the same problem after the update.
Any ideas?


It works perfectly for me too. My eshop operates with the template virtueplanet.com/joomla-templates/vp-smart in Joomla! 3.9.23, VirtueMart 3.8.6 10373 & PHP Version 7.4.13.
Thank you very much!