Copied to clipboard

Flag this post as spam?

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


  • Tor Erik Skogen 31 posts 61 karma points
    Apr 26, 2016 @ 11:59
    Tor Erik Skogen
    0

    List Merchello featured products on existing home node

    Hi Is there a way of listing products in existing home node that using Umbraco.Web.Mvc.UmbracoTemplatePage. My Marchello is now located in App_Plugins. Or is there any way of adding collections/products as a subitems on the categories? -Tor

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Apr 26, 2016 @ 14:43
    Rusty Swayne
    0

    Hi Tor,

    Sure thing. Probably the easiest way to get started tinkering is to use Merchello.Web.Mvc.MerchelloTemplatePage which itself inherits from Umbraco.Web.Mvc.UmbracoTemplatePage but also exposes to additional properties:

    • Merchello - reference to an instantiated MerchelloHelper
    • CurrentCustomer - which is the customer looking at the view your are presenting.

    Check out the docs https://merchello.readme.io/docs/merchellohelper for more information on the MerchelloHelper.

    You might also have a glimpse at the Merchello.Bazaar solution ( https://github.com/Merchello/Merchello/tree/merchello-dev/src ) to have a look how that starter is coded.

  • Tor Erik Skogen 31 posts 61 karma points
    Apr 27, 2016 @ 09:17
    Tor Erik Skogen
    0

    Hi Rusty

    Thanks for the answer but i cant figure out how to add e.x featured products into my excisting home template. I would love to have the featured product as a macro. Here is what i mean: My Bazaar is now in the App_Plugins folder and my page is in the Views folder, is this maybe i cant use it on my excisting page?

        @foreach (var product in Model.FeaturedProducts)
        {
            <div class="col-md-4">
                <a href="@product.Url" class="thumbnail">
                    @if (!string.IsNullOrEmpty(product.Image))
                    {
                        <img src="@(product.Image)&[email protected]" alt="@product.Name" />
                    }
                    <div class="caption">
                        <h3>@product.Name</h3>
                        <p class="price">
                            @if (product.OnSale)
                            {
                                <span class="price-sale">
                                    @product.FormattedSalePrice <span class="glyphicon glyphicon glyphicon-fire" aria-hidden="true"></span>
                                </span>
                            }
                            else
                            {
                                @product.FormattedPrice
                            }
                        </p>
                    </div>
                </a>
            </div>
        }
    

    I cant find FeaturedProducts.

    @inherits Umbraco.Web.Mvc.UmbracoViewPage
    @using Merchello.Bazaar
    @using Merchello.Bazaar.Models.ViewModels
    @using Merchello.Web.Models.VirtualContent
    @using Umbraco.Web
    

    What am i doing wrong?

    -Tor

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Apr 27, 2016 @ 15:43
    Rusty Swayne
    0

    I think your getting confused by the typed Bazaar models.

    You can do the same thing the Bazaar is doing directly through Umbraco (in fact that is all the Bazaar is doing).

    On your home page DocumentType (ContentType) you can add a property named "featuredProducts". Associated with that property add the DataType named "Merchello Product List View", which is defined during the Bazaar install or create another data type if you want using the same property editor.

    Once done, if you go to your home page in the back office you will see a product list view with a "Gear" icon.

    Merchello Product List View

    If you click that, you can select the Featured Product Collection (or any other product collection you may have created).

    In your view to get the products:

      var products = Model.Content.GetPropertyValue<IEnumerable<IProductContent>>("featuredProducts");
    

    This will return the same list that is used in the typed model on the Store.

  • Tor Erik Skogen 31 posts 61 karma points
    Apr 28, 2016 @ 07:33
    Tor Erik Skogen
    0

    Hi again Rusty and tnx for help but i cant get the product to my homepage, i can see it in backend but i cant figure it out on the front, i get the Object reference not set to an instance of an object, i have this code `@{var products = Model.Content.GetPropertyValue<>

    <div class="row">
        @foreach (var product in products)
        {
            <div class="col-md-4">
                <a href="@product.Url" class="thumbnail">
                   @if (product.HasValue("image"))
                    {
                        <img src="@product.GetCropUrl(propertyAlias: "image", height: 300)" alt="@product.Name" />
                    }
                    <div class="caption">
                        <h3>@product.Name</h3>
                        <p>@product.GetPropertyValue("brief")</p>
                    </div>
                </a>
            </div>
        }
    </div>`. 
    

    Im sorry for bothering you with this but....:)

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Apr 28, 2016 @ 15:33
    Rusty Swayne
    0

    Hey Tor,

    Have you extended your products with a document type? IProductContent requires a document type be attached to the product in the back office.

    You will be able to see if a product can render by looking at the check box in the list view property editor.

    Shows whether a product can be rendered

    You should also look at https://merchello.readme.io/docs/product-content-types to make sure you have the document type associated correctly.

    Can you post a screen shot of your home page back office content tab where you have the Merchello Product List View property editor?

  • Tor Erik Skogen 31 posts 61 karma points
    Apr 29, 2016 @ 09:12
    Tor Erik Skogen
    0

    Hi Again Rusty Where can i extend my product with a doc type? And what cind of doc type?

    I have the checkboxes but i cant click on them Here is what i have in my home node in the back office

    This is the doctype i made fro product standard I also get this error in settings on my home node when open it:

    Request error: The URL returned a 404 (not found):
    /umbraco/backoffice/Merchello/EntityCollectionApi/GetByKey 
    

    Again thank you so much -Tor

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Apr 29, 2016 @ 14:40
    Rusty Swayne
    0

    The error you are seeing was reported here http://issues.merchello.com/youtrack/issue/M-996 and will be fixed in the 2.0.0 release.

    In order to see the Product Content Types you need to be in the Merchello section on the product listing page: https://merchello.readme.io/docs/back-office-sections

Please Sign in or register to post replies

Write your reply to:

Draft