Post edited 9:13 am – April 14, 2010 by classicjoes.com Post edited 9:17 am – April 14, 2010 by classicjoes.com Post edited 9:23 am – April 14, 2010 by classicjoes.com
I figured out how to do this with a easy amount of time. I hope this will help anyone else. This should hopefully be a good way to approach this with minimal effort. I'm sure theres another way to do it, but it does work, and it's not bad at all!
So the idea here is to make items out of stock not display on main page/search.
I have my main page as a frontdoor page (Just items displayed, no news), But I would think it would be the same in the main index file for the default template. But for my changes:
Open up Frontdoor.php and search.php in the mk3 theme directory.
FIND IN BOTH FILES (Or any other file you want to do this with):
while ($wp_query->have_posts()) : $wp_query->the_post(); // check for product large image $pli = get_post_meta($post->ID, 'pli', $single = true); // check for item price $price = get_post_meta($post->ID, 'price', $single = true);?>
$oversell : If you can keep selling after quantity is 0.
$outstock: Manual out of stock enable/disable.
So the if check is if quantity is empty, but oversell is not enabled, OR if manual out of stock is enabled, bypass this item (continue; skips though the php while loop, so it bypasses the item!) These are all meta tag variables that markettheme already handles so you don't need any additional changes.
Pretty simple I think
1:00 pm April 14, 2010
Market Admin
Admin
posts 4756
2
Thanks for sharing!
10:14 pm June 27, 2010
Cory
Member
posts 14
3
I can't make this work. Any guesses as to why? I'm almost positive I'm replacing the right check of code with the appropriate chunk of code.
12:31 pm June 28, 2010
Market Admin
Admin
posts 4756
4
I never tested it personally… Just took CJ's word for it.