Interchange Developer Resource


[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date ][Interchange by thread ]

RE: [ic] How to use BUY ME image buttons in a form on a results page?



> The setup:
> -----------
> Red Hat 6.2
> 
> Interchange 4.6.5
> 
> People are at a results page looking at a form that lists T-shirts.
> There is a different T-shirt on each row, listed along with its price
> and description. There are <SELECT> widgets on the each row, letting
the
> user pick size and color.

This seems like an easy issue, but it took me quite some time to get it
to work.  However after the time invested it's now up and running on 2
sites successfully.  The reason it does not work in the construct demo
is because construct used a perl routine for adding items to the cart
which did not take into account options for the item.

> The problem:
> -----------
> The web designer wants an <input type="image"> button on each row of
the
> form. The image shows a "BUY ME!" graphic. It's the same image on each
> row of the table. It has to be in a form because of the size and color
> drop down widgets.
> 
> On another page, I just use something like this:
>  [loop search=...]
>    <tr><td>
>    [order [loop_code]]<img src="buyme.gif">[/order]
>    </td></tr>
>  [/loop]
> But that results in <a href> tags and not <input type="image">
buttons.

Yes, href tags will not work.  And <input type="image"> will not work
either because the type="image" is not a valid type in the HTML spec.
Netscape adheres to this guideline which invalidates the onClick or any
other javascript event.  An <input type="image"> will work in netscape
if there is no javascript on the input, but you need the javascript for
this problem.

> This approach doesn't seem to work for page in question either:
> 
> <form name="results" action="[process-order]" method="POST">
> <input type="hidden" name="mv_todo" value="refresh">
> <input type="hidden" name="mv_nextpage" value="ord/basket">
> [loop search="ra=yes/fi=tshirts/tf=description"]
>    <tr><td>
>    <input type="image" name="mv_junk" src="buybtn.gif" onClick="
> results.mv_order_item.value='[loop-code]';
> results.mv_order_size.value=results.size_[loop-
> increment][results.size_[loop-increment].selectedIndex].value;
> results.mv_order_color.value=results.color_[loop-
> increment][results.color_[loop-increment].selectedIndex].value;
> results.submit();">
>    </td>
> 
> MORE STUFF (like the code for [loop-accessories] tags for color and
size
> 
> </tr>
> [/loop]
> 
> I've been scouring the docs and the archives all day, and can't seem
to
> get my head around how to do this?
> 
> Anybody?

Please take a look at the page I have attached to this message.  This
was used as 'results.html' on http://www.mygamewear.com before we
switched to a results page which does not have buy buttons.  Similar
code is also being used currently at http://www.caseetc.com .  Pay
particular attention to the form, hidden inputs and the check for which
browser is being used to determine how to display the buy button.

Good luck!
-Ron
[comment] ui_template: Yes ui_template_name: top_left_bottom [/comment] [comment] Author: Ron Phipps Date: Jan-22-2001 Company: MyGamewear.com [/comment] [set bgcolor]#FFFFFF[/set] [set component_right][/set] [set component_after][/set] [set component_before][/set] [set members_only]0[/set] [set page_banner][/set] [set component_vsize][/set] [set vbanner][/set] [set vpromo_type][/set] [set component_hsize][/set] [set hbanner][/set] [set hpromo_type][/set] [set header_saying]Search Results[/set] [set page_title]__COMPANY__ | Search Results[/set] @_TLB_TOP_@ [include templates/regions/HEADER_W_RESULTS.TXT] @_TLB_LEFT_@ [set did_order][/set] [search-region] [tmp cross_sale][value-extended name=mv_searchspec index=0][/tmp] [on-match] [/on-match] [search-list]
 
[item-field category]
[item-field description]
Qty: Size: [item-accessories size, select, size, products, size_[item-increment]] Color: [item-accessories color, select, color, products, color_[item-increment]]
[item-field short_comment]
Price: [item-price] 
 
[if-item-data inventory quantity < 1] [else] [if session browser =~ /MSIE/] [else] [/else] [/if] [/else] [/if-item-data]
     

[/search-list] [on-match] [/on-match] [no-match]

Sorry, your search for [calc] my $joiner = ' AND '; $joiner = ' OR ' if defined $Search->{''}->{mv_orsearch}[0] and $Search->{''}->{mv_orsearch}[0]; my @str = grep /\D/, @{$Values->{mv_searchspec}}; return join $joiner, @str; [/calc] did not return any matches.

Please search again or return to our front page. [if value mv_search_error]
Errors:
[value-extended name=mv_search_error joiner="
"]
[/if]


[/no-match] [comment]
[/comment] [more-list]
Matches [matches] of [match-count] returned.
[more]
[/more-list] [/search-region] @_TLB_BOTTOM_@
Search for: Match: Format: Sort by: