Welcome Guest! To enable all features please try to register or login.
Options
Go to last post Go to first unread
Offline lpln  
#1 Posted : Monday, September 11, 2017 8:31:57 AM(UTC)
lpln

Rank: Newbie

Reputation:

Groups: Registered, Registered Users, Subscribers
Joined: 12/28/2016(UTC)
Posts: 7

Thanks: 2 times
hi
i wanna custom this module . i wanna to show product image with name , could you please help me how i can do.
Offline Will Strohl  
#2 Posted : Friday, September 22, 2017 9:03:00 PM(UTC)
Will Strohl

Rank: Administration

Reputation:

Groups: Administrators, HCC-Employee-Store-Manager, HCC-Employee-Support, HCC-Partner, Moderators, Partners, Registered, Registered Users, Subscribers
Joined: 12/22/2016(UTC)
Posts: 342

Thanks: 78 times
Was thanked: 59 time(s) in 57 post(s)
Hello:

The default template for this view looks something like this:

Code:
<div class="hc-top-10-products">
    <h2>@Model.Title</h2>
    <ol>
        @foreach (var item in Model.Items)
        {
            <li><a href="@item.Url" title="@item.Title">@item.Name</a></li>
        }
    </ol>
</div>


The product name already appears to be there. It sounds like you want to show an image along with the name. Here's a snippet replacement that can help you get there. It's untested, but it should get you where you need to be. Note the additional method, and the image added to the HTML.

Code:
@model Hotcakes.Modules.Core.Models.SideMenuViewModel

@functions{

    string GetProductImage(string url)
    {
        // get an instance of the Hotcakes application
        var hccApp = Hotcakes.Commerce.HotcakesApplication.Current;
        // create a cache key
        var current = DotNetNuke.Entities.Portals.PortalController.Instance.GetCurrentPortalSettings();
        var cacheKey = string.Concat("HccTop10", current.ActiveTab);

        // see if the products are already cached
        var cachedItems = DotNetNuke.Services.Cache.CachingProvider.Instance().GetItem(cacheKey);

        if (cachedItems == null)
        {
            // load the products from a query only if a cached collection doesn't already exist
            var s = new DateTime(1900, 1, 1);
            var e = new DateTime(3000, 12, 31);
            cachedItems = hccApp.ReportingTopSellersByDate(s, e, 10);

            // cache the products to prevent performance issues
            DotNetNuke.Services.Cache.CachingProvider.Instance().Insert(cacheKey, cachedItems);
        }

        // convet the cached products to a usable list
        var products = (List<Hotcakes.Commerce.Catalog.Product>) cachedItems;

        // iterate through each of the 10 products in the collection
        foreach (var product in products)
        {
            if (Hotcakes.Commerce.Utilities.UrlRewriter.BuildUrlForProduct(product) == url)
            {
                // return the product image only if the URL's match
                return product.ImageFileMedium;
            }
        }

        // return a generic image, in the event that there isn't a matching product image/URL
        return "/Portals/0/some-folder/generic-image.png";
    }

}
<div class="hc-top-10-products">
    <h2>@Model.Title</h2>
    <ol>
        @foreach (var item in Model.Items)
        {
            <li><a href="@item.Url" title="@item.Title">
                <img src="@GetProductImage(item.Url)" alt=""/><br />@item.Name
            </a></li>
        }
    </ol>
</div>
Will Strohl, Upendo Ventures
Hotcakes Cloud | Get Support | Code Support
Official Cloud & Support provider for Hotcakes
Offline lpln  
#3 Posted : Wednesday, September 27, 2017 10:36:12 AM(UTC)
lpln

Rank: Newbie

Reputation:

Groups: Registered, Registered Users, Subscribers
Joined: 12/28/2016(UTC)
Posts: 7

Thanks: 2 times
hi dear
thancks so much for reply
i used these codes but images doesnt show yet.please see this this site :
http://mytest.com.iis2001.shared-servers.com/
Offline Will Strohl  
#4 Posted : Saturday, September 30, 2017 1:01:51 PM(UTC)
Will Strohl

Rank: Administration

Reputation:

Groups: Administrators, HCC-Employee-Store-Manager, HCC-Employee-Support, HCC-Partner, Moderators, Partners, Registered, Registered Users, Subscribers
Joined: 12/22/2016(UTC)
Posts: 342

Thanks: 78 times
Was thanked: 59 time(s) in 57 post(s)
It actually looks like it is working, but the image path isn't complete. It's only the image file name, and it doesn't include the rest of the image path. (Like I said, it was untested.)

Look for this line of code in the example:

Code:
return product.ImageFileMedium;


Try replacing it with this:

Code:

return DiskStorage.ProductImageUrlSmall(
				hccApp,
				product.Bvin,
				product.ImageFileSmall,
				hccApp.IsCurrentRequestSecure());


Or this:

Code:

return DiskStorage.ProductImageUrlOriginal(
				hccApp,
				product.Bvin,
				product.ImageFileSmall,
				hccApp.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection);


You'll probably also need to import one or both of the following namespaces:

Code:

@using Hotcakes.Commerce.Storage
@using Hotcakes.Commerce.Utilities


By the way, this kind of inquiry is covered, with guaranteed response times under our Developer Support Services.

https://upendoventures.c...mmerce-Developer-Support
Will Strohl, Upendo Ventures
Hotcakes Cloud | Get Support | Code Support
Official Cloud & Support provider for Hotcakes
thanks 1 user thanked Will Strohl for this useful post.
lpln on 10/11/2017(UTC)
Offline lpln  
#5 Posted : Tuesday, October 3, 2017 8:52:44 AM(UTC)
lpln

Rank: Newbie

Reputation:

Groups: Registered, Registered Users, Subscribers
Joined: 12/28/2016(UTC)
Posts: 7

Thanks: 2 times
thanks so much , now its ok.
Offline Will Strohl  
#6 Posted : Tuesday, October 3, 2017 12:17:53 PM(UTC)
Will Strohl

Rank: Administration

Reputation:

Groups: Administrators, HCC-Employee-Store-Manager, HCC-Employee-Support, HCC-Partner, Moderators, Partners, Registered, Registered Users, Subscribers
Joined: 12/22/2016(UTC)
Posts: 342

Thanks: 78 times
Was thanked: 59 time(s) in 57 post(s)
Originally Posted by: lpln Go to Quoted Post
thanks so much , now its ok.


We're happy to help!
Will Strohl, Upendo Ventures
Hotcakes Cloud | Get Support | Code Support
Official Cloud & Support provider for Hotcakes
Offline DhruvishaLad  
#7 Posted : Wednesday, December 12, 2018 6:20:08 AM(UTC)
DhruvishaLad

Rank: Newbie

Reputation:

Groups: Registered, Unverified Users
Joined: 12/12/2018(UTC)
Posts: 1

hi
i wanna custom this module . i wanna to show product image with name & short Description, too. could you please help me how i can do.
Offline Will Strohl  
#8 Posted : Wednesday, December 19, 2018 2:23:49 PM(UTC)
Will Strohl

Rank: Administration

Reputation:

Groups: Administrators, HCC-Employee-Store-Manager, HCC-Employee-Support, HCC-Partner, Moderators, Partners, Registered, Registered Users, Subscribers
Joined: 12/22/2016(UTC)
Posts: 342

Thanks: 78 times
Was thanked: 59 time(s) in 57 post(s)
Originally Posted by: DhruvishaLad Go to Quoted Post
hi
i wanna custom this module . i wanna to show product image with name & short Description, too. could you please help me how i can do.


Could you please post a new thread in the forum asking this question? Also, it would be super helpful if you could include more details about what you're trying to do. Thanks! :)

Will Strohl, Upendo Ventures
Hotcakes Cloud | Get Support | Code Support
Official Cloud & Support provider for Hotcakes
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.311 seconds.

Notification

Icon
Error

Loading
  • Sign-up for the Hotcakes Community Newsletter: