Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Hayden 32 posts 170 karma points
    May 24, 2017 @ 20:48
    Hayden
    0

    Pulling in 8 products which have a custom checkbox which is TRUE

    Hi all,

    I'm trying to pull in all of my merchello products WHERE bestSeller = true, does anybody have any ideas on how I can do this?

    Also any good beginner documentation for how search functionality works? I'm having a tough time getting what I need from the readme.io version.

    Cheers, Hayden

  • Kerri Mallinson 113 posts 497 karma points
    May 25, 2017 @ 10:02
    Kerri Mallinson
    1

    Hi Hayden,

    You could try @if (Model.GetPropertyValue<bool>("bestSeller"))

    Or, you could create a collection for best sellers then use something similar to the example in FastTrack "Featured Products" to return the products

     @if (Model.FeaturedProducts.Any())
    { 
    <section id="categories">
            <div class="page-header">
                <h1>Featured Products</h1>
            </div>
            @foreach (var row in Model.FeaturedProducts.ToArray().Split(3))
            {
                <div class="row">
                    @foreach (var fp in row)
                    {
                        <div class="col-xs-4">
                            @Html.Partial("_ProductBox", fp)
                        </div>
                    }
                </div>
            }
    
        </section>
    

    Kerri

  • Hayden 32 posts 170 karma points
    Jun 02, 2017 @ 02:53
    Hayden
    100

    To anybody who is wondering the same thing, I didn't realize there is data types that merchello created when I installed it.

    If you take a look at the featured products section within the tutorial below it will all make sense

    http://skrift.io/articles/archive/how-to-quickly-add-ecommerce-to-your-existing-website/

    Basically create a field within your home node "merchello product list view" -> go back to your home node and find your new field -> press the 'cog' in the top right and select which collection you want to put in, then you can display it on the homepage using something like this...

    @foreach (var fp in Model.Content.GetPropertyValue<IEnumerable<IProductContent>>("bestSellers").Take(8))
    {
        <div class="col-lg-3 col-md-4 col-sm-6">
            @Html.Partial("_ProductBox", fp)
        </div>
    }
    

    Yours will probably be slightly different but hope I've helped (check the tutorial above for more information!

    Cheers, Hayden

Please Sign in or register to post replies

Write your reply to:

Draft