A A A

Please consider registering
guest

Log In Register

Login form protected by Login LockDown.


Register | Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Disable items from frontpage or search if out of stock
April 14, 2010
5:12 am
Member
Forum Posts: 17
Member Since:
March 29, 2010
Offline

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);?>

CHANGE TO:

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);
$quantity = get_post_meta($post->ID, 'mkt_stock_quantity', $single = true);
$oversell = get_post_meta($post->ID, 'mkt_stock_oversell_ok', $single = true);
$outstock = get_post_meta($post->ID, 'outstock', $single = true);
if (($quantity == 0 && $oversell != 1) || $outstock == 1) continue; ?>

====

What the new coding means:

$quantity: Item amount of quantity left

$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 :)

April 14, 2010
1:00 pm
Admin
Forum Posts: 5051
Member Since:
March 16, 2008
Offline

Thanks for sharing!

June 27, 2010
10:14 pm
Member
Forum Posts: 14
Member Since:
March 29, 2010
Offline

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.

June 28, 2010
12:31 pm
Admin
Forum Posts: 5051
Member Since:
March 16, 2008
Offline

I never tested it personally…  Just took CJ's word for it. 

Maybe you can send him a private message.

July 23, 2010
1:31 pm
Member
Forum Posts: 14
Member Since:
March 29, 2010
Offline

Never heard back from CJ.

Anyone have success with this?

Forum Timezone: UTC 0

Most Users Ever Online: 40

Currently Online:
18 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

icy1: 2371

wreed06: 175

laurie390: 168

StitchTek Services, LLC: 144

boutiqueelliette: 130

yiorgos: 127

Member Stats:

Guest Posters: 428

Members: 2252

Moderators: 1

Admins: 1

Forum Stats:

Groups: 1

Forums: 4

Topics: 2983

Posts: 16042

Moderators: Market Admin (5051)

Administrators: Market Admin (5051)

Market takes e-commerce to the next level with an easy to use, quick setup platform. Learn more or take the tour.