How to put News and recent products in the sidebar of every page instead of on homepage only


https://forum.kartris.com/Topic364.aspx
Print Topic | Close Window

By whelanbe - Sun 23 Jan 2011
Hi,

By default the News headings and Recent products appear on the site homepage in the central column of the shop homepage. Is it possible to have the news headings and recent products appear in the right sidebar of the template so that they appear on every page in the site and not just the hpomepage?

I would like the news and recent products to appear in the right column on every page in the same way that the mini basket  and category listing appears on every page.

Anyone know hoe to do this?
By Mohammad - Mon 24 Jan 2011
Hi, You can have the recent products in either side bars, but unfor. you can't do that for the news for the time being, we are planning to have such stuff more customizable in the future, so to allow placing parts in other places.

To do the recent products, go to:
MasterPages > Kartris.master > Find the div with id="right_pad" and choose the place you want to have the list in and past this code inside the div:
<user:NewestItems ID="UC_NewestItems" runat="server" />


If you want to play with the css of the recent products, you can find the latest products in UserControls > Skin > NewestItems.ascx; but that will affect the home page (default.aspx) as well.
By whelanbe - Mon 24 Jan 2011
Thank you I did that and it worked, however it is displaying just the title/links of the Recent Products. Is it possible to have it display an image of each recent product above the product name/link?
By Mohammad - Tue 25 Jan 2011
Yeah, you can do that, below is how to do it, but would be good to have a copy of the existing file (UserControls > Skin > NewestItems.ascx) before you try, just in case:

1. Open this file UserControls > Skin > NewestItems.ascx
2. Copy and past this code:
<user:ProductTemplateImageOnly ID="UC_ProductImageOnly" runat="server" />

Between:
<ItemTemplate><li>

And This:
</li></ItemTemplate>

3. You can apply the needed css around the pasted code, but it should be inside the <ItemTemplate> tag.

OR you can try this if you like:
Replace this code:
<asp:Repeater ID="rptNewestItems" runat="server">
        <HeaderTemplate>
            <ul>
        </HeaderTemplate>
        <ItemTemplate>
            <li>
                <asp:HyperLink ID="lnkProduct" runat="server" NavigateUrl='' Text='<%# Server.HTMLEncode(Eval("P_Name")) %>'></asp:HyperLink></li></ItemTemplate>
        <FooterTemplate>
            </ul></FooterTemplate>
    </asp:Repeater>

BY this code:
<asp:Repeater ID="rptNewestItems" runat="server">
        <ItemTemplate>
            <table>
                    <tr>
                        <td style="width:52px">
                            <user:ProductTemplateImageOnly ID="UC_ProductImageOnly" runat="server" />
                        </td>
                        <td valign="middle" align="left">
                            <asp:HyperLink ID="lnkProduct" runat="server" NavigateUrl='' Text='<%# Server.HTMLEncode(Eval("P_Name")) %>'></asp:HyperLink>
                        </td>
                    </tr>
                </table>
        </ItemTemplate>
    </asp:Repeater>


Give it a try and let me know if you have problems.
By whelanbe - Tue 25 Jan 2011
Many thanks that worked!

I tried both of your solutions and they both worked great but the second one looks really well so I am going to keep that. To customise further, would it be possible to have the product price showing under the title/link?

All the best and thanks again for good support on the forum.

Beatrice
By Mohammad - Tue 25 Jan 2011
Sorry Beatrice, I don't think the price could be shown in that part.

You are welcome Smile