Pull Sheet with Image

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
SamsSteins
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 92
Joined: Thu Jul 10, 2008 11:43 am
Location: Lancaster PA
Contact:

Pull Sheet with Image

Post by SamsSteins » Mon Apr 04, 2011 1:48 pm

Would there be a way to have the pull sheet show the thumb nail image of each product?

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5082
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Pull Sheet with Image

Post by mazhar » Wed Apr 06, 2011 5:19 am

There is a complication. Upon pulls sheet returned OrderPullItem objects don't have product id information along with them. The only workaround could be to make use of Sku to load product to use thumbnail URL information. It could be something like

Add following column code to columns section on pullsheet page (.aspx file)

Code: Select all

<asp:TemplateField HeaderText="Pulled" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <%#GetImage(Container.DataItem) %>
                    </ItemTemplate>
                </asp:TemplateField>
then add following code block to code behind file (.aspx.cs )

Code: Select all

public string GetImage(Object dataItem) 
    {
        OrderPullItem item = (OrderPullItem)dataItem;
        string sku = item.Sku;
        if (string.IsNullOrEmpty(sku))
            return string.Empty;
        ProductCollection products = ProductDataSource.LoadForCriteria(string.Format("Sku = '{0}'", sku));
        if (products == null && products.Count == 0)
            return string.Empty;
        Product product = products[0];
        string thumbnailUrl = product.ThumbnailUrl;
        if (string.IsNullOrEmpty(thumbnailUrl))
            return string.Empty;
        return string.Format("<img src='{0}' />", Page.ResolveUrl(thumbnailUrl));
    }

SamsSteins
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 92
Joined: Thu Jul 10, 2008 11:43 am
Location: Lancaster PA
Contact:

Re: Pull Sheet with Image

Post by SamsSteins » Wed Apr 06, 2011 7:46 am

It worked, thank you so very much!!! Only one tiny thing need changed. You had "img scr" instead of img src.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5082
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Pull Sheet with Image

Post by mazhar » Wed Apr 06, 2011 9:21 am

:) Glad that you were able to fix that typo.

SamsSteins
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 92
Joined: Thu Jul 10, 2008 11:43 am
Location: Lancaster PA
Contact:

Re: Pull Sheet with Image

Post by SamsSteins » Wed Apr 06, 2011 12:12 pm

I am not techy at all, that was ONLY thing I could have fixed. Thanks again, it will be a great time saver for us!

Post Reply