I have a shopping cart.
Now I want to add a sale that for every item bought the second is half price.
All items are the same price --

can someone help me with the code

my current code is:

Code:
function gettotal(escapedsession)


		Dim sql
		dim s
		dim cartitemid, itemName, qtyselected, itemprice, qtyprice
		dim dblTotalPrice
		sql = ""
		sql = sql & "SELECT "
		sql = sql & "c.cartitemid, pc.Name, c.qtyselected, pc.Price "
		sql = sql & "FROM "
		sql = sql & "ShoppingCart c, "
		sql = sql & "Items pc "
		sql = sql & "WHERE "
		sql = sql & "c.productid = pc.ItemID "
		sql = sql & "AND "
		sql = sql & "c.usrsessid = '" & EscapedSession & "' and ifsubmitted=0"
		openrs r,sql
		s = ""
		if r.BOF Then
			'response.write "You have no items in your basket"
			totalprice=0
		else
			 ' display each item and add a header to the table.
			
			dblTotalPrice = 0
			Do While NOT r.BOF AND NOT r.EOF
							
				cartitemid = r.fields(0).value
				itemName = r.fields(1).value
				qtyselected = r.fields(2).value
				itemprice = r.fields(3).value

				'on error resume next
				qtyprice = itemprice * qtyselected
				shipping=20
				
			'	on error goto 0
		
				' calculate total
				'On Error Resume Next
				dblTotalPrice = cDbl(dblTotalPrice) + cDbl(qtyprice)
				TotalPrice=dbltotalprice+shipping		
		'response.write "totalprice:" & totalprice
				'On Error GoTo 0

				r.MoveNext
			LOOP
			'totalprice=10
			
		end if

		r.Close
		Set r = Nothing

gettotal=totalprice
end function