Upgrading Interprise 5.6.22 for Easy Skinning

by jasonrshaver 17. September 2011 23:06

So here is one of the issues I have with Interprise and ASP.Net Storefront:

image

The “Shopping Cart” header does not fit with the font, styling, color scheme, or really anything.  If I want to change it, I have to create a new graphic.  But not just one graphic, but 79 graphics:

image

So, what can we do about it?  Well here comes HTML + CSS to the rescue!

Changing your ASPX file

The default box for the Shopping Cart example above looks like this:

  1. <table width="100%" cellpadding="2" cellspacing="0" border="0" style="border-style: solid;
  2.     border-width: 0px; border-color: #444444">
  3.     <tr>
  4.         <td align="left" valign="top">
  5.             <asp:Image ID="ShoppingCartGif" AlternateText="" runat="server" ImageAlign="AbsMiddle" /><br />
  6.             <table width="100%" cellpadding="4" cellspacing="0" border="0" style="border-style: solid;
  7.                 border-width: 1px; border-color: #444444;">
  8.                 <tr>
  9.                     <td align="left" valign="top">
  10.                         <asp:Literal ID="CartItems" runat="server"></asp:Literal>
  11.                     </td>
  12.                 </tr>
  13.             </table>
  14.         </td>
  15.     </tr>
  16. </table>

The asp:Image is where the Shopping Cart displays the blue boxes we wish to get rid of.  Lets add after that asp:Image control with the following:

  1. <h3 class="boxHeader"><span>Shopping Cart</span></h3>

and set the asp:Image control to have a Visible=”false” attribute like this:

  1. <asp:Image ID="ShoppingCartGif" AlternateText="" runat="server" ImageAlign="AbsMiddle" Visible="false" />

and change the table beneath all that to have no style, but instead use the “boxBody” class, like this:

  1. <table width="100%" cellpadding="4" cellspacing="0" border="0" class="boxBody">

So the completed block looks like this:

  1. <table width="100%" cellpadding="2" cellspacing="0" border="0" style="border-style: solid;
  2.     border-width: 0px; border-color: #444444">
  3.     <tr>
  4.         <td align="left" valign="top">
  5.             <asp:Image ID="ShoppingCartGif" AlternateText="" runat="server" ImageAlign="AbsMiddle" Visible="false" />
  6.             <h3 class="boxHeader"><span>Shopping Cart</span></h3><br />
  7.             <table width="100%" cellpadding="4" cellspacing="0" border="0" class="boxBody">
  8.                 <tr>
  9.                     <td align="left" valign="top">
  10.                         <asp:Literal ID="CartItems" runat="server"></asp:Literal>
  11.                     </td>
  12.                 </tr>
  13.             </table>
  14.         </td>
  15.     </tr>
  16. </table>

One thing to note about the above, we could have deleted the asp:Image control, but made it invisible instead.  If we deleted that line, we would have to change the ShoppingCart.cs file to no longer look up the image and I am a bit too lazy for that.

Getting Some CSS Up In Here

So, now what?  Lets create some CSS that can make everything pretty:

  1. h3.boxHeader
  2. {
  3.     color: #AAA;
  4.     margin: 0px 10px;
  5.     display:inline;
  6.     float: left;  
  7.     background: transparent url('images/boxHeader.png') no-repeat top right;    
  8.     font: bold 12px/22px Verdana, Arial, Helvetica, Sans-serif;
  9. }
  10. h3.boxHeader span
  11. {
  12.     margin: 0px 15px -4px -10px;
  13.     padding: 1px 20px 5px 18px;
  14.     position: relative;
  15.     float: left;
  16.     background: transparent url('images/boxHeader.png') no-repeat top left;  
  17. }
  18. table.boxBody
  19. {
  20.     border-style: solid;
  21.     border-width: 2px;
  22.     border-color: #AAA;
  23. }

What this does, is take our boxHeader.png image, which looks something like this:

image

or

image

What I like about the first image is that I can use the table.boxBody CSS style to blend in and get a nice unified look:

image

Pretty cool huh?

And Repeat

So, once you have the above done as a proof of concept, you need to start changing this all over the place.  Here is a list of files that need to updated to use my H3/Span method instead of the image.  ** Make sure you make backups of each file you edit! **

  • ShoppingCart.aspx
  • Account.aspx
  • CreateAccount.aspx
  • Xml_Packages\page.search.xml.config
  • CheckOutShipping.aspx.cs (* see note)
  • CheckOutPayment.aspx.cs (* see note)
  • CheckOutReview.aspx.cs (* see note)
  • [ I am sure I missed some ]

For the XML Packages, instead of changing the boxes, you can modify the BoxFrameStyle AppConfig, but I prefer to use a class instead so I can do a CSS only skin.

About CheckOut[blah].aspx.cs Files

Update the DisplayOrderSummary method like so:

  1. private void DisplayOrderSummary()
  2. {
  3.     //OrderSummary.Text = _cart.RenderHTMLLiteral(new CheckOutShippingPageLiteralRenderer());
  4.     OrderSummary.Text = _cart.RenderHTMLLiteral(new CheckOutShippingPageLiteralRenderer()).Replace("<img src=\"skins/Skin_1/images/orderinfo.gif\" align=\"absbottom\" border=\"0\">", "<h3 class=\"boxHeader\"><span>Order Summary</span></h3>");
  5. }

Each file requires slight difference, but you should be able to figure them out.

No clue why they bake the graphic/skin into the code like that.  You can Modify the type, it exists in the InterpriseSuiteEcommerceCommon.InterpriseIntegration namespace, but there is a large amount of code in there. 

Tags: , , ,

Blog

About the author

I am a software developer working for Microsoft in Redmond, WA.  In addition, my wife and I own TTXOnline, what is likely the 3rd largest table tennis store in the US.

Month List

Page List