File: D:/web/expressmusic/2025-06-10/new/customutils.asp
<%
' ==============
' customutils.asp
' ==============
' Version 1.14 (10/06/25)
' ============
' HISTORY
' ============
' (SS,12/09/05) First created
' (SS,18/07/08) Created GetCustomHTMLTitle to allow customised titles
' Saurav had modified apputils.asp, which is not allowed because it's generic to all
' our shopping sites, so moved his added code from GetHTMLTitle to GetCustomHTMLTitle below.
' Saurav, in future please could you modify customutils.asp to edit the titles and please don't
' touch apputils.asp? I've restored apputils.asp back to what it was.
' I also modified inc-template-main.asp to call GetCustomHTMLTitle instead of GetHTMLTitle
' (NS, 10/11/09) NS Replaced "West Midlands" with "Coventry"
' (SS,20/04/10) Added functions CustomFreeDeliveryTextForPrice and CustomFreeDeliveryText
' (SS,20/04/10) Delivery is now calculated here using CustomGetDelivery
' (SS,25/05/10) Change to CustomGetDelivery to not charge if TotalWeight is zero
' (SS,24/08/10) Added "US" United States in delivery calculation
' (SS,13/01/11) Changed UK delivery from 2.50 to 3.00 in CustomGetDelivery
' (SS,26/08/15) Replaced Solihull with Shirley, GetCustomHTMLTitle and other routines probably not be used by this framework, to check
' (SS,17/07/17) Change to Function CustomGetDelivery, delivery free limit now �30 and cost now �4.99
' (SS,04/08/18) Change to Function CustomGetDelivery from �30 to �50 limit for free UK delivery
' (SS,10/06/21) Added Sub CustomShowHolidayNotice
' (SS,03/11/21) Change to Function CustomGetDelivery from �50 to �100 limit for free UK delivery
' (SS,16/08/22) Change to Function CustomGetDelivery from �100 to �200 limit for free UK delivery, and amount from �4.99 to �6.98
' (SS,22/02/23) Change to Function CustomGetDelivery, various delivery cost adjustments
' (SS,24/04/24) Added Function CustomProductIsPreOwned
' (SS,10/06/25) Added Sub CustomShowPayPalPayLaterBanner, relies on paypal script in header
Function GetCustomHTMLTitle
Const DEFAULT_TITLE = "Guitar Shop, Guitar Lessons, Music Shop, Music Lessons | Shirley, Birmingham, Coventry from ExpressMusicStore.co.uk"
Dim thepagename, Result
thepagename = LCase(Request.QueryString("page"))
if len(thepagename)>0 then
select case thepagename
case "about"
Result = "Guitar Lessons, Music Lessons, Music Shop in Shirley, Birmingham, Coventry"
case "customerinfo"
Result = "Customer Info - Music Lessons, Music Shop in Shirley, Birmingham, Coventry"
case "termsconditions"
Result = "Terms and Conditions of Music Shop in Birmingham - Express Music Store"
case "repairs"
Result = "Guitar Repair, Brass Repair, Woodwind Repair in Shirley, Birmingham, Coventry from Express Music Store"
case "tuition"
Result = "Music Lessons, Guitar Lessons, Bass Guitar Lessons in Shirley, Birmingham, Coventry"
case "jobs"
Result = "Careers at Express Music Store, " & DEFAULT_TITLE
case "howtoorder"
Result = "How to order, " & DEFAULT_TITLE
case "links"
Result = "Links, " & DEFAULT_TITLE
case "faqs"
Result = "Frequently Asked Questions on guitar repair, guitar lessons, piano lessons and more"
case "createaccount"
Result = "Create an account, " & DEFAULT_TITLE
case "contact"
Result = "Contact us for Music Lessons, Drum Lessons, Piano Lessons in Shirley, Birmingham, Coventry"
case "account"
Result = "Account, " & DEFAULT_TITLE
case "forgotpassword"
Result = "Forgot password?"
case else
Result = GetHTMLTitle(DEFAULT_TITLE)
end select
else
Result = GetHTMLTitle(DEFAULT_TITLE)
end if
GetCustomHTMLTitle = Result
End Function
' (SS,20/4/10) to show ", FREE DELIVERY" text after product name in product details if price is >= 20 (inc-template-product-detail.asp)
Function CustomFreeDeliveryTextForPrice(AStdPrice, ASalePrice)
Dim LPrice
LPrice = AStdPrice
If ASalePrice <> "" Then LPrice = ASalePrice
If LPrice >= 20 Then
CustomFreeDeliveryTextForPrice = ", FREE DELIVERY"
Else
CustomFreeDeliveryTextForPrice = ""
End If
End Function
' (SS,20/4/10) text shown near bottom of product detail page (inc-template-product-detail.asp)
Function CustomFreeDeliveryText
CustomFreeDeliveryText = "<strong>All deliveries to mainland UK are <font color=""#CC6600"" size=""2"">free of charge</font> for orders above �20.</strong>"
End Function
' (SS,20/4/10) show at the top of very page (inc-template-main.asp)
Function CustomFreeDeliveryTextMain
CustomFreeDeliveryTextMain = "All deliveries to mainland UK are <font color=""#CC6600"" size=""2"">free of charge</font> for orders above �20"
End Function
' this routine must exist if CustomDeliveryEnabled
' (SS,9/12/14) added AByPriceDeliveryCost, AByWeightDeliveryCost to make compatible with latest apputils
' (SS,16/1/15) simplified by removing the postcode code, new delivery_postcodes table now determines ARegionCode using postcode for UK, PayPal Express only has one UK country (no variations)
' (SS,26/8/15) made changes for Express Music, adding the extra parameters which didn't exist before
' (SS,17/7/17) changed from �20 to �30 limit for free UK delivery, and cost changed from �3 to �4.99
' (SS,4/8/18) changed from �30 to �50 limit for free UK delivery
' (SS,4/11/21) changed from �50 to �100 limit for free UK delivery
' (SS,16/8/22) changed from �100 to �200 limit for free UK delivery, and amount from �4.99 to �7 (�6.99 not possible, either �6.98 or �7.00, Phil prefered �7)
' (SS,22/2/23) delivery prices changes, (also a setting change after noticing VAT was being charged for EU, UseVATFlagFromCountries wasn't set to true, now is)
'
' - Delete totally the below 1kg option
'
' New prices below listed for each area
'
' UK Mainland
' 1-30kg - FREE
' 30kg+ - FREE
'
' UK off Mainland
' 1-30kg - �30
' 30kg+ - �40
'
' Europe
' 1-30kg - �50
' 30kg+ - 80
'
' Europe (Non-EU)
' 1-30kg - �60
' 30kg+ - �90
'
' USA
' 1-30kg - �195
' 30kg+ - �245
'
' Rest of the world
' Contact us for a shipping quote
'
Function CustomGetDelivery(ATotalValue, AValueOfNonWeightedGoods, ATotalWeight, AVATContent, ATotalItems, ANormalDeliveryCost, AByPriceDeliveryCost, AByWeightDeliveryCost, APostcode, ARegionCode, ADeliveryRegion, ACountry)
Dim LDelivery, LMinPrice, LFactor, LFixedPrice
' Response.Write("<br>#" & ARegionCode & "#" & ATotalWeight & "<br>")
If ARegionCode = "UK" Then
' (SS,25/5/10) added ATotalWeight = 0, not to charge if weight is zero
' (SS,17/7/17) changed from 20 to 30
' (SS,4/8/18) changed from 30 to 50
' (SS,4/11/21) changed from 50 to 100
' (SS,16/8/22) changed from 100 to 200
If ATotalValue >= 200 Or ATotalWeight = 0 Then
LDelivery = 0
Else
' LDelivery = 2.13 ' i.e. �2.50 inc VAT at 17.5%
' LDelivery = 2.50 ' i.e. �3 inc VAT at 20% (SS,13/1/11) also changed in
' LDelivery = 4.16 ' (SS,17/6/17) changed to 4.99
LDelivery = 5.83 ' (SS,16/8/22) changed to 7.00 (couldn't do �6.99 due to VAT rounding), first did 6.98 (5.82), later changed to 5.83 i.e. �7
End If
ElseIf ARegionCode = "U2" Then ' "UK off Mainland"
If ATotalWeight >= 30 Then
LDelivery = 33.33 ' i.e. 40 - VAT
Else
LDelivery = 25 ' i.e. 30 - VAT
End If
ElseIf ARegionCode = "EU" Then
If ATotalWeight >= 30 Then
LDelivery = 80
Else
LDelivery = 50
End If
ElseIf ARegionCode = "NW" Or ARegionCode = "SW" Then ' "Norway" or "Switzerland"
If ATotalWeight >= 30 Then
LDelivery = 90
Else
LDelivery = 60
End If
' (SS,24/8/10) added ARegionCode = "US" for United States
' (SS,22/2/23) moved US here from above
ElseIf ARegionCode = "US" Then
If ATotalWeight >= 30 Then
LDelivery = 245
Else
LDelivery = 195
End If
Else ' not unlikely to happen, make it a very high delivery just in case
LDelivery = 999
End If
CustomGetDelivery = LDelivery
End Function
' (SS,28/10/14) "P" for product page, "H" for home, AProductID is applicable
' call added to inc-template-product-details.asp and inc-template-home.asp
' also three tokens: Holiday Notice Radiators, Holiday Notice Other, Holiday Notice Home
' (SS,25/11/15) added "B" for "Holiday Notice Basket"
' (SS,14/10/16) added "C" for contact page
' (SS,10/6/21) adapted for ExpressMusic
Sub CustomShowHolidayNotice(AType, AProductID)
Dim LToken
If AType = "B" Then
LToken = "Holiday Notice Basket"
ElseIf AType = "C" Then ' (SS,14/10/16)
LToken = "Holiday Notice Contact"
Else
LToken = "Holiday Notice Home"
End If
If LToken <> "" Then
Dim LNotice, LStartDate, LEndDate, LPos
LNotice = ComposeDescription("{" & LToken & "}", False, False)
' get date range from first line
If Left(LNotice, 6) = "[DATE:" Then
LStartDate = Mid(LNotice, 7, 10)
LEndDate = Mid(LNotice, 18, 10)
' if not valid start date then default to a very early date
If IsDate(LStartDate) Then
LStartDate = CDate(LStartDate)
Else
LStartDate = CDate("01/01/2000")
End If
' if not valid end date then default to a very late date
If IsDate(LEndDate) Then
LEndDate = CDate(LEndDate)
Else
LEndDate = CDate("01/01/2200")
End If
' remove the date bit
LPos = InStr(LNotice, "]")
If LPos > 0 Then LNotice = Mid(LNotice, LPos + 1)
If LStartDate > Date() Or LEndDate < Date() Then LNotice = ""
End If
Response.Write LNotice
End If
End Sub
' (SS,24/4/24) returns true is product name contains "pre owned"
Function CustomProductIsPreOwned(AProductName)
Dim LResult
LResult = InStr(1, AProductName, "Pre Owned", vbTextCompare) > 0
CustomProductIsPreOwned = LResult
End Function
' (SS,10/6/25) copied from CIRC, relies on paypal script in header
Sub CustomShowPayPalPayLaterBanner
If GetPayPalPayLaterMessagesEnabled And Not (IsProductDetailsPage Or IsBasketPage Or InCheckout) Then%>
<div class="container paypal-banner" style="margin-top: 10px; margin-bottom: <%=IIf(IsHomePage, "0px", "0px")%>">
<div class="row" style="">
<div class="col-lg-12 col-md-12">
<div data-pp-message data-pp-style-layout="flex" data-pp-style-ratio="20x1" data-pp-style-color="blue" data-pp-amount="0"></div>
</div>
</div>
</div><%
End If
End Sub
%>