Linking latest products to a category item

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
hi ,

if you see my test website : http://www.teamlemon.co.uk/ I have got latest product image as a category , how can i link latest product to that. I dont want to use Latest products in the menu.
12 years ago
You can't because your menu is displaying all the categories available in database and "Latest Products" is a category itself.

The easiest way is :

Do not consume categories in your menu from database.

Just add sub links to your menu tabs manually like

<li>Category 1</li/>
<li>Category 2</li/>
<li>Category 3</li/>

and don't add link for "Latest Product" category in your menu sub level.

This way your image on homepage "Latest product" will be linked with the category "Latest Products" and your menu will display all the available categories except "Latest Products" category.

2nd alternative method: which is more dirty way

Modify your menu code in which you can define category IDs by which you will be able to specify only those category IDs which you want in your menu and you can leave rest (in your case " Latest Products").

In both methods, when you will add new categories in future, you will have to add the category manually in the menu (category link - if you follow 1st methods), (category ID- if you follow 2nd method).
12 years ago
I would prefer first method as the categories are fixed , they wont be added in future only products will be added , by looking into first method should i just add the homepage category code into index :
<div class="home-page-category-grid">
        @(Html.DataList<CategoryModel>(Model, 5,
                @<div class="item-box">
              
                    <div class="category-item" style="background-image:url('/images/@String.Format("{0}.png",item.Id)');">
                      
                        <h2 class="title">
                            <a href="@Url.RouteUrl("Category", new { categoryId = item.Id, SeName = item.SeName })" title="@item.PictureModel.Title">
                                @item.Name</a>
                        </h2>
                        <div class="picture">
                            <a href="@Url.RouteUrl("Category", new { categoryId = item.Id, SeName = item.SeName })" title="@item.PictureModel.Title">
                                <img style="border-width: 0px;" alt="@item.PictureModel.AlternateText" src="@item.PictureModel.ImageUrl"
                                    title="@item.PictureModel.Title" /></a>
                        </div>
                    </div>
                    </div>
          
            ))
    </div>
12 years ago
No. It has nothing to do with homepage category code because if I understood your question correctly you want to make changes in your menu and want to keep all categories as it is under your homepage banner, right ?

Look into Views / Common / Menu.cshtml
12 years ago
You understand half of my question , well i need to remove latest products from the menu and show that into the homepage with all the categories  as it is shown currently , As it has been added in the category section thats why i cant link new products to the (category)latest products . What i want is to show all the categories on the homepage and add another box of show latest products at the end of category . I was not able to do that, thats why i added latest product as category and was thinking to add some how link to new added product to that category(latest product) which in real sense is not a category . Its a bit confusing or may be i m not putting the write words in my explanation.

Hope it make sense now.
12 years ago
Well i sorted out by using some dirty methods :)

$(document).ready(function () {
$("a[href='/c/13/latest-products']").attr("href", "/newproducts"); //replace the category Latest Products link to new products
$('.ul-links > li > ul > li:last').remove(); //removes the last category which is latest product from the sub node
});
  </script>
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.