rsisales
El Presidente
Just Getting Started
Member Likes (0)
Basically, MarketPress::load_store_templates() uses $is_shop_page to denote if the page is a shop page, but keeps it in the local scope. It would be nice to make this a class variable that can be grabbed via a helper method like MarketPress::is_shop_page(). The same thing is in MarketPress_MS::load_marketplace_templates(), so maybe there should actually be a helper function like:
function marketplace_is_shop_place() {
global $mp, $mp_wpmu;
if ( is_multisite() )
return $mp_wpmu->is_shop_page();
return $mp->is_shop_page();
}
It seems like something that could drop right into template-functions.php.

Responses (13)
Member (joined August 2010) Likes (0)
Almost forgot. Possible use case: A sidebar containing the cart, product tags, etc, that is only displayed on store pages.
Member (joined April 2009) Likes (0)
Hiya!
Thanks for the feedback and suggestion. I've asked Aaron to come by and take a look. He's the lead plugin dev on this one.
Thanks again!
Lead Developer (joined May 2009) Likes (0)
Will do. I'll make it a class var and template function.
Member (joined August 2010) Likes (0)
Aaron: Thanks. Any idea when it'll be available...or better yet, could you send me a patch (to aaron@xavisys.com) that I can apply so I'm using it the way it'll be implemented?
Lead Developer (joined May 2009) Likes (0)
There will be a new mp_is_shop_page() template function in 1.1 out soon.
Member (joined August 2010) Likes (0)
Thank you very much. For those that need this sooner, there are two steps to add this yourself:
1) Find "$is_shop_page" and replace it with "$this->is_shop_page" in marketpress-includes/marketpress-ms.php and marketpress.php.
2) Add this code to marketpress-includes/template-functions.php:
function mp_is_shop_page() {
global $mp_wpmu, $mp;
if ( is_a( $mp_wpmu, 'MarketPress_MS' ) ) {
return $mp_wpmu->is_shop_page;
} elseif ( is_a( $mp, 'MarketPress' ) ) {
return $mp->is_shop_page;
}
return false;
}
Member (joined October 2008) Likes (0)
How do we use this? Can you spell it out for us amateur PHP developers?
Lead Developer (joined May 2009) Likes (0)
Basically in 1.1 in theme templates (or plugins) you can just check:
if (mp_is_shop_page()) {//your code here
}
Member (joined October 2008) Likes (0)
Just so I'm clear, that's a fix for this issue, right?
http://premium.wpmudev.org/forums/topic/themeing-marketpress#post-58960
Lead Developer (joined May 2009) Likes (0)
Well it's really a feature update. Though the other issue at the bottom of the thread is fixed as well (passing the checkout step query var)
Member (joined August 2010) Likes (0)
Aaron: This fix is actually broken. It says uses $mp->is_shop_page() which doesn't exist. It should use the variable rather than the non-existent method like this: $mp->is_shop_page
Lead Developer (joined May 2009) Likes (0)
Whoops, thanks. For now you can just access $mp->is_shop_page directly.
Member (joined August 2010) Likes (0)
I just fixed the function on this site, assuming you'll fix it for the next release
Become a member