Copied to clipboard

Flag this post as spam?

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


  • praveen 113 posts 164 karma points
    Jul 31, 2012 @ 03:37
    praveen
    0

    Read Sub Pages Properties

    Hi there

    I am struggling to get this XSLT going,

    I want to read the sub pages properties "Product Title", "Product Image" and "Read More link"

    and create the product list on the products page.

  • Peter Gregory 408 posts 1614 karma points MVP 3x admin c-trib
    Jul 31, 2012 @ 05:41
    Peter Gregory
    0

    You will need to know what the aliases of those properties are first by looking at the document type that represents the product nodes.  You can find these out by going to the settings section and looking at the generic properties tab on for the document type in the document types folder.

    If there any reason why you have chosen to use XSLT over Razor?  What version of Umbraco are you using?  I am going to assume you are using Umbraco 4.7 or above for the following as to do this with Razor is far easier. I will also be fully assuming what the properties names are based on your highlights above.

    If you dont know how to create Razor Macro create a new Razor Macro by going to Develper and right clicking on the Scripting Files folder and clicking new (like you would for an XSLT file) and check the box to create the macro etc.  Not 100% sure why you need a property called read more link as Umbraco assigns a URL to each piece of content.  Unless you are using a page picker to have the product elsewhere you dont need to have this.

    Your razor code for the file might look a little something like this:

    <ul>
    @foreach(var product in Model.Children.Where("Visible")){
    <li>
    <p>@product.ProductTitle</p>
    <img src="@product.Media("productImage").UmbracoFile"/>
    <p><a href="@product.Url">Read more</a></p>
    </li>
    }
    </ul>

    Hope this helps. 

     

  • praveen 113 posts 164 karma points
    Jul 31, 2012 @ 06:08
    praveen
    0

    Hi Peter, 

    Many thanks for the quick reply, we are using 4.7.2 version

    I am not aware of Razor coding, can you please provide some useful links please.

    Kind Regards

    Praveen

Please Sign in or register to post replies

Write your reply to:

Draft