---
title: "frakt problem"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/59833-frakt-problem"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Leon"
published: "2002-11-21T10:13:52.000Z"
updated: "2002-11-21T10:30:12.000Z"
replies: 1
views: 177
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/59833-frakt-problem"
---

# frakt problem

## #1 — Leon, 2002-11-21T10:13Z

Har problem med hur jag ska få det att bli fraktfritt över en viss gräns... här är koden som hämtar fram rätt frakt  genom hur mycket alla varor väger tillsammans.

```
<%
Dim ShippingRS__value
ShippingRS__value = "0"
If (CCcart_Weight <> "") Then
  ShippingRS__value = CCcart_Weight
End If
%>
<%
Dim ShippingRS
Dim ShippingRS_numRows

Set ShippingRS = Server.CreateObject("ADODB.Recordset")
ShippingRS.ActiveConnection = MM_CharonCart_STRING
ShippingRS.Source = "SELECT *  FROM Freight  WHERE weightfrom <= " + Replace(ShippingRS__value, "'", "''") + " AND weightto > " + Replace(ShippingRS__value, "'", "''") + ""
ShippingRS.CursorType = 0
ShippingRS.CursorLocation = 2
ShippingRS.LockType = 1
ShippingRS.Open()

ShippingRS_numRows = 0
%>
<%
'
'Add shipping from a value in a recordset
'And If the value exeeds the session freightlimit sets it to 0
'

CCcart_SubTotal = Replace(CCcart_SubTotal, ",", ".")
Session("Freightlimit") = Replace(Session("Freightlimit"), ",", ".")
If (CCcart_SubTotal >= Session("Freightlimit")) Then
	CCcart_Shipping = 0
	Else
	CCcart_Shipping=ShippingRS.Fields.Item("freight").Value
	End If
%>
```

sen har jag en session med ett nummer säg, 6000

då vill jag att den kollar mot subtotalen av shoppingcarten...

```
<%
x=CCcart_SubTotal
y=Session("Freightlimit")
If (x >= y) Then
	CCcart_Shipping = 0
	Else
	CCcart_Shipping=ShippingRS.Fields.Item("freight").Value
	End If
%>
```

 

problemet är när jag kör den här koden och det råkar vara en decimal så funkar det ju inte... har aldrig fått det att fungera som det borde... har ni några förslag?!

Permalänk: https://www.webforum.nu/p/59833

## #2 — OveRRidE, 2002-11-21T10:30Z

Det är alltså decimalen du har problem med? Detta kan du väl lätt fixa med funktionen round()?  Om du inte behöver decimalen, vill säga. ;)

```
x=round(CCcart_SubTotal,0)
y=round(Session("Freightlimit"),0)
If (x >= y) Then
	CCcart_Shipping = 0
	Else
	CCcart_Shipping=ShippingRS.Fields.Item("freight").Value
	End If
```

Permalänk: https://www.webforum.nu/p/861656

---

Tråden på webben: https://www.webforum.nu/amne/asp/59833-frakt-problem
