E-com DevBlog Spider-ball-vacuum

3Dec/080

A quick post (based on a google search) about WCParam

I was reviewing my logs and noticed that two people happened to hit the site looking for an explanation on how to add a parameter to WCParam.  So I thought I'd take a minute or two and write up a  quick example using JSTL.

What you need to do is add the parameter in your c:url tag as a parameter when you define it. Let's say that I have a value that I am taking from a c:forEach loop (with a var="items"), we'll call it 'otherId' (since I'm going to pass this through the location/address-bar). I am also going to pass a langId (language code), a storeId (we're all about commerce), a catalogId (yep, we like to sell things), and finally my otherId. Using the code below (and yes I'm skipping setting up your command or whatever you are passing to) I can set up a quick c:url tag with my custom parameter in it that I can then access through the ${WCParam.otherId} on the page that I go to.

You must be using the 'c' tag lib for this to work, so don't forget to include that on your page, here we go.

?View Code HTML4STRICT
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 
<c:url var="myURL" context="${CommandContext.webpath}" value="/mycmd">
   <c:param name="langId" value="${langId}" />
   <c:param name="storeId" value="${WCParam.storeId}" />
   <c:param name="catalogId" value="${WCParam.catalogId}" />
   <c:param name="otherId" value="${items.otherId}" />
</c:url>

And that, in a quick nut shell is how you get a variable accessible through your WCParam. Remember, WCParam is pretty much the same as saying, 'grab it from the location/address/url-bar'.

Feel free to drop corrections and comments (and yes I realize that my code box says HTML4STRICT, until it supports JSP code, HTML4STRICT is what you get).

Print This Post Print This Post
1Nov/081

Unhide the “X” when displaying flash in fancybox

If it ever strikes your fancy to use FancyBox to display consoles or other flash content, you may run into a problem with the close button not displaying properly.

To correct this problem, you will need to add the line "so.addParam("wmode", "transparent");" to the
ProductNumber.html file, as shown below:

?View Code HTML4STRICT
<script type="text/javascript">
	// <![CDATA[
	var so = new SWFObject("console.swf", "console", "533", "531", "8");
	so.addVariable("xmlloc", "data/console.html");
	so.addVariable("product", "ProForm 450 Elliptical");
	so.addParam("wmode", "transparent");
	so.addVariable("image", "images/PFEL03907.jpg");
	so.write("flashcontent");
	// ]]>
</script>

This allows the flash content to show the button properly.

I discovered this after visiting the website of the providers of our SWFObject.js script: http://blog.deconcept.com/swfobject/"

Print This Post Print This Post
30Oct/083

JSTL Agent identification

So converting NT2.2 to be IE6 friendly was a kick in the teeth... and as Dustin posted earlier, it would have been nice to throw up a warning window and let them see the horror or an IE6 rendering job.  However we coded it up to be usable in IE6 and in the process had to rewrite some of the homepage.  At first I used the ugly <![if IE 6]> // do something magical <![endif]--> tags, but they caused Safari to explode on itself.  So I went back did a quick study and came out with a JSTL solution, and then modded it with Drew to get it working.

Using JSTL you can get the browser through the user-agent string in the URL request header. Like this:

?View Code HTML4STRICT
<c:set var="browser" value="${header['User-Agent']}" scope="page"/>

You can see that I used a c:set to get the 'User-Agent' string and set the variable 'browser' to that value.

Now we just need to set up a c:choose to determine the path of IE 6 or other browser types using the indexOf function in the JSTL 'fn' library.  So a quick c:choose statement would look like this.

?View Code HTML4STRICT
<c:set var="browser" value="${header['User-Agent']}" scope="page"/>
<c:choose>
	<c:when test="${!empty browser && fn:indexOf(browser, 'MSIE 6') >= 0}">
		NOT EMPTY
	</c:when>
	<c:otherwise>
		EMPTY
	</c:otherwise>
</c:choose>

In the 'c:when test' you can see that the indexOf ends with a '>=0', this is because indexOf returns an INT, which is treated Boolean-esque in this case (it's not a Boolean, but the way we are using it resembles a Boolean).

Don't forget that when using the JSTL fn and c tag libraries you need to include them in your jsp file.  use the following at the top of your page to use these excellent tag-libs.

?View Code HTML4STRICT
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

If you have any questions, leave'em in the comments :) .

Print This Post Print This Post
Tagged as: , , , , 3 Comments
23Oct/081

Loop through nothing.

We all know that using jstl we can us a <c:forEach...> to loop through just about anything, for example in the new NT2.2 we used a loop through all SKUs to grab gallery images for all apparel products.

?View Code HTML4STRICT
<c:forEach var="items" items="${product.publishedItems}">

This is great but required all publishedItems in order for the loop to be effective.

But what if you want to loop through nothing? I know I know, sounds like it could be pretty useless but it's not. What I'm talking about is what if you want to run a loop 5 times but have nothing to loop through? Well it's pretty simple but difficult to find any documentation on, hence this post. So before you go dropping scriplet (or as I like to call it, "Nava" or "NinJava") code on your .jsp and have one of your teammates commit treason, read on Josephine, read on.

Brace yourself, here it is.

?View Code HTML4STRICT
<c:forEach begin="1" end="8">

Pretty neat huh, your loop starts at one and ends at 8, one thing I've yet to find is an effective way to break the loop using jstl if necessary. Ninja said something about setting a flag and I did that but at second glance it's not quite as effective as I had originally hoped.

Print This Post Print This Post
29Sep/080

Installing Fixpacks on Webshpere in Windows

first of all you go download your fixpack from the place. then you put it in this directory

D:\Rational\SDP\6.0\runtimes\base_v6\updateinstaller\maintenance

after that you should backup your profiles (in fact the updater will tell you to but you can ignore it if you are brave) in D:\Commerce\6.0\wasprofile\bin to do this you open a cmd line and navigate to said directory then run backupConfig.bat file.zip

once the backup is complete (or if you opted to ignore it) you then back out of D:\Rational\SDP\6.0\runtimes\base_v6\updateinstaller\maintenance to D:\Rational\SDP\6.0\runtimes\base_v6\updateinstaller\

doubleclick update.exe

a wizard will start and you can "Next>" then browse to the new .pak file that you want to update. once you find the file and click "next" it will warn you to backup your profile. After that just sit and wait for things to happen.

oh you will need to shut down your server and instance of websphere if it is running.

Print This Post Print This Post
17Sep/080

Take product in/out of stock (adjust inventory)

Select "Operations - Find Inventory":

Enter a product name or the SKU (without the prd_):

Select the item SKU (the one without the prd_) and select “Adjust Quantity”:

Select “Decrease…” and enter a value equal to the current inventory to take it out of stock, or select “Increase…” and give it whatever value you wish to put it back in:

Print This Post Print This Post
16Sep/080

In Home Assembly, the grinch (only I didn’t say grinch I said another word) of Wonderland.

So everytime we start a new site, and I've been doing a lot of them lately but you wouldn't know it because they never go live, we have to set up In Home Assembly on the big 3 (treadmills, ellipticals, exercise bikes). this always gets me because I can never remember the correct way to do a merchadising association. Therefore, for this cause have i decided to write this post in order that I can remember how to do these things next time.

the first few steps are easy so we'll breeze through them.

  • Create a new category in the master catalog.
  • Create new products for In Home Assembly in the new category in the master catalog.
  • set prices on said new products in the new category in the master catalog. (I think you see where this is going)
  • generate SKUs on the new products in the new category in the master catalog.
  • edit SKU's ID in the new products in the new category in the master catalog.

Now here comes the tricky part, Setting up Merchandising Associations:

  • in Accelerator go to Merchandise -> Find Merchandising Associations
  • change "Number of Search results" at bottom of page to as many as possible.
  • click "Find" (if it feels weird cuz you never typed anything just ignore that).
  • find product SKU that you want to Associate In Home Assembly with.
  • click little check box to left of said SKU (make sure no other checkboxes are clicked or you'll pull your hair out).
  • in the "code" box to the right type the SKU of desired In Home Assembly thingy.
  • click Add
  • you should see two new drop down boxes appear under "Target Catalog Entries" if you don't you have too many checkboxes checked, uncheck some and start agian, but don't start at the beginning start at the middle.
  • the first checkbox "Association" should be set to "up sell" there is a trick to this cuz once you click the drop down you have to click it again...you'll see.
  • the next "Schematic" should be set to "none"
  • click save
  • find next product SKU and start all over again, but don't start from the beginning start from the middle.

if you have any questions just look at how it was done on previous sites (ProForm, NordicTrack [even though it never went live], Reebok, Weslo, WorkouWarehouse, and now HealthRider).

Print This Post Print This Post
7Aug/080

NordicTrack Promo tidbit

Here's something to think about when dealing with promos that are assigned to specific products on NT (I mean the old NT cuz the new one has not and isn't going live, something about it not officially being approved). if you create a promo to assign to a specific product, you must have a decimal value (or rather a precent value converted to decimal form, like 20% would be .2) in the Long Description field of the Promotion. The reason is there is a script that takes this value and figures out the new price as well as the savings and if this value is text then the Javascript pukes and goes into the fetal position all the while the JSP decides who cares about a price. And you conveniently get a product with no price showing on the cat page and product pages.

So if your promo includes a free item such as a bundle of iFIT cards it is best to either try leaving the Long desc field null or putting in a .00 as a value.

Of course we wouldn't have this problem for long if the new NT was going live, but I'm not bitter about that >:(

Print This Post Print This Post
Tagged as: , No Comments
31Jul/084

Consoles and YOU!

In the past when I've been given a console to push out I normally would just fire and forget and hope that the QA guy catches any errors. In fact that is kinda my motto (or at least one of them as I have many and my favorite changes from day to day).

However recently I found a little trick that most of you probably already knew, this allows you to check out the console from your local box without sending it to cvs. It also could, if you like to be thourough, help in preventing problems from reaching the live server.

All you need to do is modify the following link for your store and your console and you should see it pop up in your browser, of course it's not sized properly but that's an issue that QA can QA later.

http://localhost/wcsstore/WorkoutWarehouse/images/consoles/PFTL66906/PFTL66906.html

Print This Post Print This Post
31Jul/081

Adding/changing Commercial Sales Reps in Freemotion (Oh goody)

For those who are interested, here is how the Domestic Commercial sales Reps are rendered in Freemotion.

It all starts with ContactDisplay.jsp which includes CustomerRepStateList.jspf but don't get excited, this file uses javascript from AJAX_Util.js (getRepInfo()) to conveniently make a call to another view, namely CustomerRepAJAXView which is made up of the file CustomerRepDisplay.jsp which does nothing other than call CustomerRep.jspf. HOWEVER, even knowing all of that you can't make any changes unless you have DB access, because apparently this is where all the sales Rep info is stored...which is really the only thing that makes any kind of sense in this whole scenario.

Now if you couldn't follow that here is the short version:

ContactDisplay.jsp -> CustomerRepStateList.jspf ->getRepInfo() from AJAX_Util.js -> CustomerRepAJAXView(CustomerRepDisplay.jsp) -> CustomerRep.jspf -> (DB which holds all info).

as a bonus all of these files, with the exception of the AJAX_Util.js are kept in two folders and here is the route by folders

NOTE:folder names have been altered.

ShopProfileSection/ -> bitsNpieces/profits/ -> javascripts/ -> ShopProfileSection/ -> bitsNpieces/profits/

gay huh?

For the life of me I can't figure out why all the running back-n-forth but I'm sure there is an explanation...I doubt it's a valid one, but an explanation nonetheless.

To quickly get this done if you don't have access to the DB send the task to Jason or Drew.

Print This Post Print This Post