cfai
Veteran
Just Getting Started
Member Likes (0)
Hey Guys,
Having an odd issue.
I have a global product list put together on this page: http://www.cfai.co/gallery/
It works fine when your viewing it as a non-logged in user. But as soon as you log in, the page is not visible.
I turned on debug and i get this error:
Notice: Undefined variable: class in /usr/local/plesk/apache/vhosts/cfai.co/httpdocs/wp-content/plugins/marketpress/marketpress-includes/template-functions.php on line 1656
Here is my code I have on that page:
<?php
$args = array(
'echo' => true,
'paginate' => true,
'per_page' => 50,
'order_by' => 'date',
'order' => 'DESC',
'category' => '',
'tag' => '',
'show_thumbnail' => true,
'thumbnail_size' => 100,
'context' => 'list',
'show_price' => false,
'text' => 'none',
'as_list' => true );
$args = array(
'echo' => true,
'per_page' => 50,
'category' => '',
'tag' => '',
'sep' => ' -- ',
'prelabel' => __('« Previous', 'mp'),
'nxtlabel' => __('Next »', 'mp')
);
//check for paging
if (get_query_var('paged'))
$args['page'] = intval(get_query_var('paged'));
mp_list_global_products( $args ); ?>
<div id="product-pagination">
<?php mp_global_products_nav_link($args); ?>
</div>
I checked line 1656, all variables seem to be defined.
Any ideas?
- Nick

Responses (11)
WPMU DEV Fanatic (joined October 2009) Likes (0)
Hi cfai,
That's an odd one, it's saying "Undefined variable: class" but there's no variable named class in the plugin as far as I can see.
Any chance you've tried the [mp_list_global_products] shortcode in a page along with the arguments you're trying to use, to see how that renders?
Could you also try the function call without any arguments, just mp_list_global_products()?
-David
Member (joined August 2011) Likes (0)
Yeah, a bit odd.
I started out with the shortcode, however, I ran into an issue because it doesn't support pagination. We exceeded the product limit I set within 20 minutes of launching the site and I had no product gallery.
Now I have a functioning gallery.... unless you're logged in.
I can see the products no problem with the standard function call, so it's obviously something my code... I just don't know what.
WPMU DEV Fanatic (joined October 2009) Likes (0)
That is just seriously strange that it would display except for if you're logged in. It does that regardless of the user role you're logged in as I assume?
I'll tag the developer to have a look here as I just can't see a reason for that one.
-David
Lead Developer (joined May 2009) Likes (0)
Do you have a membership plugin installed or something else that could change behavior based on logged in status?
The error has nothing to do with it.
Member (joined August 2011) Likes (0)
I was using Membership for awhile, but turned it off, as it was complicating the flow for new users. So I deactivated it.
I can turn it back on to see if it fixes it.
Lead Developer (joined May 2009) Likes (0)
At this point I can only think of a plugin or theme conflict, as there is not code in MP that checks logged in status or not. I would try deactivating other plugins one by one to see which is causing the issue, and temporarily change your theme to twentyeleven as a last check if needed.
Member (joined August 2011) Likes (0)
Ok, I think I figured something out.
I changed the product category to a category that only has a few products in it and it works fine.
The overarching product database probably has around 600 products in.
So it turns out there is a capacity issue.
Any ideas how to fix that?
Lead Developer (joined May 2009) Likes (0)
I'm not sure I understand. Logged in only products from a certain global category go missing?
Member (joined August 2011) Likes (0)
What I'm about to describe still only happens when I'm logged in.
The script above is set with no category defined. Meaning it will pull all products. When I have it set that way, I get a page load error and the page never finishes loading. With Debug on I get that 1656 error.
If I define a category that has like 50 products, the page loads fine.
If I define a category that has like 600 products, the page does not load.
Again, all of this only occurs when a user is logged in. I have disabled all plugins, set theme to twentyeleven, none of that helps.
So my deduction, is that I'm reaching some sort of product quantity ceiling for the plugin and it fails to load the page at all.
I ran into this using the shortcode about a week ago, after I got passed 100 products, the shortcode crashed the page. I found out the shortcode didn't support pagination, and you had provided this alternate solution to bring in the products with pagination. I slightly adapted it to bring in what I needed and of I went.
Everything was peachy keen until a few days ago, when apparently we hit another shelf. Now the main gallery feed doesn't load, but categories with less products do load.
They're all using the same script.
Does that help clarify?
Lead Developer (joined May 2009) Likes (0)
Ya, it's not meant scale to that many products on the same page. It's probably causing too many queries and timing out. Anything in your error log regarding that? I'm not sure however why it would behave different logged in or not.
Member (joined April 2009) Likes (0)
Hiya,
As we haven't heard back from you we're going to assume the problem was sorted out and mark this ticket as resolved.
If it wasn't resolved, or you have any more questions related to this thread please feel free to post them below and tick the 'Mark as Not Resolved (re-open)' box below the post area (or else we'll miss it!)
Otherwise, thanks for using the forums, and for being a member of WPMU DEV, it's a pleasure to help you out and we look forward to being of assistance in the future.
Thanks
Become a member