[ic] Discounts

cblevins at macronet.com cblevins at macronet.com
Wed Feb 28 20:03:51 EST 2007

On 02/28/2007 11:41 AM, cblevins at macronet.com wrote:
> I have this in results_buylist.  The popup returns all the info correctly,
> if the search returns just one product.  If multiple items are returned
> popup displays the info for the last item on the page.  I have searched
> through the list and cannot find anything relating to this particular
> problem. I am using IC 5.5.0-200612100658.  What am I overlooking?
> <script language="JavaScript">
> <!--
> // This is the function that will open the
> // new window when the mouse is moved over the link
> function open_new_window()
> {
> new_window =
> tion=no,status=no,menubar=no");
> // open new document
> new_window.document.open();
> new_window.document.write("<html><title>Best Price for
> [item-code]</title>");
> new_window.document.write("<body bgcolor=\"#FFFFFF\">");
> new_window.document.write("<table><tr>[if discount [item-code]]<TD
> ALIGN=right valign=\"top\">[L]Regular price[/L]
> <STRIKE>[item-price]</STRIKE><br><B>[L]Your price[/L]: [price discount=1
> code="[item-code]"]<br>[L]You save[/L]: [currency][calc][item-price
> noformat=1] -  [price discount=1
> code="[item-code]"noformat=1][/calc][/currency]</TD>[/if]</tr></table>");
> new_window.document.write("<br>");
> new_window.document.write("</body></html>");
> // close the document
> new_window.document.close();
> }
> // This is the function that will close the
> // new window when the mouse is moved off the link
> function close_window()
> {
> new_window.close();
> }
> // -->
> </script>

You could simplify your problem with this...

function foo() {


<a href="#" onclick="foo()">...</a>

which will end up looking like this in the final result:

function foo() {


<a href="#" onclick="foo()">...</a>


function foo() {


<a href="#" onclick="foo()">...</a>

What happens is that the page is loaded along with all the javascript by
the browser, and each subsequent definition of foo() overwrites the
last, so by the time any of the links are clicked on there is just one
foo(), the last one and so that is what is displayed.

Your solution is to do something like this:

Before your loop:

function foo(bar) {

...then inside the loop:

<a href="#" onclick="foo('[item-code]')">...</a>

interchange-users mailing list
interchange-users at icdevgroup.org

Peter and Gert,

Thanx for the help.  The alert does the same thing that is happening with
with my popup.

There is no loop on this page.  It is just the basic
templates/components/results_buylist.  All I have done is inserted my
javascript right under [search-list].


More information about the interchange-users mailing list