Fixing the “Warning: array_merge() [function.array-merge]:” error in WordPress’s WP-Ecommerce plugin

When I first installed the WP-Ecommerce plugin on a website this morning and tried to go to the products page, I got this error:

<strong>Warning</strong>: array_merge() [function.array-merge]: Argument #1 is not an array in <strong>/public_html/wp-content/plugins/wp-e-commerce/wpsc-core/wpsc-functions.php</strong> on line <strong>622</strong>

Thankfully, it is actually very easy to fix this error. All you need to do is add (array) to the correct line of code in the plugin’s functions.php file.

Find this line in your wp-e-commerce/wpsc-core/wpsc-functions.php file:

$args = array_merge($wp_query->query, array('posts_per_page' => get_option('wpsc_products_per_page')));

And change it to this:

$args = array_merge((array)$wp_query->query, array('posts_per_page' => get_option('wpsc_products_per_page')));

 

That did the trick for me and hopefully will work for you too. Let me know if you have any questions or run into issues with this.

Meet the author

My name is Libby Fisher and I am an experienced freelance web developer based in Seattle WA. I am passionate about developing websites that are both beautiful AND easily usable because I believe that the most effective websites are a perfect balance of aesthetic appeal and usability/intuitiveness.

2 Comments

Leave a response

*

  1. Alexander Firsov says:

    Dear Libby Fisher,

    Thank you very much for this advice!

    I had a similar problem in Interspire Shopping Cart and was able to fix it the same way!