Page 1 of 1
Change Sku to ModelNumber on Packing Slip
Posted: Thu May 10, 2012 7:37 am
by frankenstein897
I am looking at the PackingSlip.aspx file and I see sku in there. But, I can't change to ModelNumber without getting errors. I am sure I am not doing something correct. I am still learning Able. I am sure there is something else I need to do. Has anyone modified the packing slip to show model number instead of SKU? If so, care you give me a hint?
Thanks,
Chris
Re: Change Sku to ModelNumber on Packing Slip
Posted: Thu May 10, 2012 10:53 am
by compunerdy
I do not have a answer but I wish they had a global setting to not show sku's. I want them for myself but I do not want my customers to see them all.
Re: Change Sku to ModelNumber on Packing Slip
Posted: Thu May 10, 2012 11:20 am
by frankenstein897
Same here. We use the UPC code for the Sku which means nothing to most people. I just want the Model Number to show, especially on the Packing Slip. That is critical now.
Re: Change Sku to ModelNumber on Packing Slip
Posted: Thu May 10, 2012 11:22 am
by david-ebt
I'm assuming you're working on the Admin\Orders\Shipments\PackingList.aspx file? You can add a new function to the PackingList.aspx.cs file:
Code: Select all
protected string GetModel(object dataItem)
{
OrderItem orderItem = (OrderItem)dataItem;
if (orderItem.OrderItemType == OrderItemType.Product) return orderItem.Product.ModelNumber;
return StringHelper.SpaceName(orderItem.OrderItemType.ToString());
}
Then change the PackingList.aspx file template to:
Code: Select all
<asp:TemplateField HeaderText="Model">
<HeaderStyle Width="80" HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="center" />
<ItemTemplate>
<asp:Literal ID="Model" runat="server" Text='<%# GetModel(Container.DataItem) %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
That should get you what you're looking for.
Re: Change Sku to ModelNumber on Packing Slip
Posted: Thu May 10, 2012 11:47 am
by frankenstein897
Cool, does it matter where I put the function in the PackingList.aspx.cs file? Is at the end ok? And can I just put the template code in place of the line for the SKU?
Re: Change Sku to ModelNumber on Packing Slip
Posted: Thu May 10, 2012 12:06 pm
by david-ebt
It doesn't matter where you put the function - right after the GetSku function is fine. It just has to be before that final closing curly brace. And yes you can just replace the SKU template code with this version.
The current AbleCommerce code is pretty dependent on the SKU value. If you compare the GetModel function with the GetSku function you'll notice that the SKU is part of the OrderItem object while the ModelNumber isn't - the code has to go back to the product record to get the ModelNumber. This means changing all references from SKU to Model Number is going to be a bit of a pain and often result is an extra database call. Maybe this will be easier to do in version 8!
Re: Change Sku to ModelNumber on Packing Slip
Posted: Thu May 10, 2012 12:22 pm
by frankenstein897
Yeah, I did notice that SKU is used everywhere. It wasn't a problem until we started using UPC codes.