Project

General

Profile

« Previous | Next » 

Revision 5781

include "shopping cart" for search results

View differences:

index.jsp
308 308
	return false;
309 309
	
310 310
}
311
function loadCart() {
312

  
313
	// start the busy indicator
314
	$("#cartResults").busy(
315
			{
316
				position	: 'left', 
317
				offset		: -30, 
318
				hide		: true, 
319
				img			: "<%=STYLE_COMMON_URL%>/jquery/busy/busy.gif" 
320
			});
321
	
322
	// for looking up the cart
323
	var params = 
324
	{
325
		'action': 'getcart',
326
		'showAdd': 'false',
327
		'showRemove': 'true',
328
		'qformat': 'semtools'
329
	};
330
	//load the cart results
331
	$("#cartResults").load(
332
		"<%=SERVLET_URL%>" + " #content_wrapper",
333
		params,
334
		// call back function when loading finishes
335
		function(response, status, xhr) {
336
			if (status == "error") {
337
				var msg = "Sorry but there was an error performing the search: ";
338
				$("#error").html(msg + xhr.status + " " + xhr.statusText);
339
			}
340
			// collapsible search results - show and hide the next div
341
			$(function() {
342
				$('.accordian').click(function() {
343
					var ref = $(this);
344
					$(this).parent().next().slideToggle(
345
						"slow",
346
						function() {
347
							if ($(ref).parent().next().is(":visible")) {
348
								$(ref).html("-");
349
							} else {
350
								$(ref).html("+");
351
							}
352
						});
353
					return false;
354
				}).parent().next().hide();
355
			});
356
			
357
			// stop the busy indicator
358
			$("#cartResults").busy("hide");
359
		});
360
	return true;
361
}
362
function clearCart() {
363

  
364
	// for looking up the cart
365
	var params = 
366
	{
367
		'action': 'editcart',
368
		'operation': 'clear',
369
		'qformat': 'semtools'
370
	};
371
	// post the cart clear
372
	$("#cartResults").load(
373
		"<%=SERVLET_URL%>",
374
		params,
375
		// call back function when loading finishes
376
		function(response, status, xhr) {
377
			if (status == "error") {
378
				var msg = "Sorry but there was an error clearing the cart: ";
379
				$("#error").html(msg + xhr.status + " " + xhr.statusText);
380
			}
381
		});
382
	return true;
383
}
311 384
function clearForm() {
312 385
	// clear the form values
313 386
	$('#searchForm').get(0).reset();
......
366 439
function pageLoad() {
367 440
	initialize();
368 441
	doSearch($('#searchForm').get(0));
442
	//loadCart();
369 443
}
370 444
function donothing() {}
371 445
--></script>
......
403 477
	<input name="query" type="hidden" />
404 478
	<input name="qformat" value="semtools" type="hidden" />
405 479
	<input name="includeHeader" value="false" type="hidden" />
480
	<input name="showAdd" value="true" type="hidden" />
481
	<input name="showRemove" value="false" type="hidden" />
406 482
	<input name="action" value="semquery" type="hidden" />
407 483

  
408 484
	<!-- tabs for the search interface -->		
......
547 623
	
548 624
	<br/>
549 625
	
626
	<!--cart here -->	
627
	<table class="subGroup subGroup_border onehundred_percent">
628
		<tr>
629
			<th>
630
				Cart
631
				<input type="button" value="Refresh" onclick="loadCart()"/>
632
				<input type="button" value="Remove all" onclick="clearCart(); loadCart()"/>
633
			</th>
634
		</tr>
635
		<tr>
636
			<td>
637
				<div id="cartResults">
638
				No items in cart
639
				</div>
640
			</td>
641
		</tr>
642
	</table>
643

  
644
	<br/>
645

  
550 646
	<!-- search results here -->	
551 647
	<table class="subGroup subGroup_border onehundred_percent">
552 648
		<tr>

Also available in: Unified diff