Limit SELECT of products based on YES/NO?

A place to discuss and receive support for the Web Auction application.

Limit SELECT of products based on YES/NO?

Postby Nicole » Tue Dec 18, 2007 4:24 am

Hi Steve.

Can't find the answer to this on the forum:

I'm having some trouble locating/figuring out how to limit the auction product selection to allow public display of just a few items based on a WHERE clause. I'd like to create a separate view that limits public product display to just a few featured items, to be exact (which can then be implemented into site template)

The use I envision is being able to have a few "Featured" auction items on just the homepage. I have successfully modified the database part in MySQL with an ENUM and a yes or no and NULL as the default (that's the easy part). But I keep getting stuck with errors in the coding part of it.

I'd like to have results for * products&fields WHERE featured_item = YES and also have it use a different template template called "featured_list.html". I thought it may be in products.php but I'm just not having any luck with creating a new class with the additional clause (I know enough about MySQL/PHP to be dangerous, but all those special syntax particulars just stump me sometimes). And even if I did, I'm also having trouble figuring out where&how to implement it.

Please help as I think this would be a very useful feature for all :-)

Thank you!
Aloha,
Nicole
Nicole
 
Posts: 6
Joined: Sun Dec 16, 2007 2:25 am

Postby Nicole » Tue Dec 18, 2007 9:50 pm

Thanks to Cam, I figured it out:

I copied the public_product_list.html and created a home_featured_list.html or whatever.

In that file I added the following right after the "for" statement:

{if $product->val('featured_item') == YES}


Like this:
{foreach from=$products item=product name=product}
{if $product->val('featured_item') == YES}


and the {/if} right before the end of the {/foreach}

Like this:
{/if}
{/foreach}
Nicole
 
Posts: 6
Joined: Sun Dec 16, 2007 2:25 am


Return to Web Auction Discussion

Who is online

Users browsing this forum: No registered users and 25 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved