Page 1 of 1
Tempting Customers with Free Shipping
Posted: Thu Feb 12, 2009 2:25 am
by Jaz
I thought I saw a post in the past where someone was asking for a way to let customers Know they have to spend $x.xx more to qualify for free shipping. Does anyone remember where that post was, and if a solution was found?
Thanks,
Re: Tempting Customers with Free Shipping
Posted: Thu Feb 12, 2009 5:55 am
by mazhar
One way to accomplish this job is to create a conlib control and specify the id of free shipping method. This user control check the current basket total against the minimum purchase amount of the shipping method and display the message. Give a try to the following user control.
Re: Tempting Customers with Free Shipping
Posted: Thu Feb 12, 2009 9:39 am
by Mike718NY
Here is the code I made that works
($70.00 or more for free shipping, otherwise $4.95 flat fee):
protected LSDecimal GetShippingAmt()
{
decimal subTot = Convert.ToDecimal(Token.Instance.User.Basket.Items.TotalPrice(displayItemTypes));
if (subTot < 70M)
{
lblTotal.Text = Convert.ToString(subTot + 4.95M);
lblFreeShip.Text = String.Format("{0:c}", (70.00M - subTot)) + " away from Free Shipping";
return 4.95M;
}
else
{
lblTotal.Text = Convert.ToString(subTot);
lblFreeShip.Text = "Free Shipping will be applied to this order!";
return 0.00M;
}
}
I don't know which page this is from right now because I just copied
it from a notes page I had. If you can't find it, I'll check later.
Re: Tempting Customers with Free Shipping
Posted: Sat Feb 14, 2009 2:59 am
by Jaz
OK, I am trying both of these methods, but my lack of programing knowledge is standing in my way.
I tried to put together the way Mike718NY showed:
Code: Select all
<%@ Control Language="C#" ClassName="FreeShippingAlert2" %>
<script runat="server">
protected LSDecimal GetShippingAmt()
{
decimal subTot = Convert.ToDecimal(Token.Instance.User.Basket.Items.TotalPrice(displayItemTypes));
if (subTot < 150M)
{
lblTotal.Text = Convert.ToString(subTot + 4.95M);
lblFreeShip.Text = String.Format("{0:c}", (150.00M - subTot)) + " away from Free Shipping";
return 4.95M;
}
else
{
lblTotal.Text = Convert.ToString(subTot);
lblFreeShip.Text = "Free Shipping will be applied to this order!";
return 0.00M;
}
}
</script>
<blink>
<asp:Label Font-Bold="true" ForeColor="red" ID="FreeShippingLabel" runat="server"></asp:Label>
</blink>
I did something Wrong because I get the error:
[[ConLib:custom/FreeShippingAlert2 Visible="true"]] d:\Internet\TrickConcepts.com\ConLib\Custom\FreeShippingAlert2.ascx(7): error CS0103: The name 'displayItemTypes' does not exist in the current context
I am not quite sure what "displayItemTypes" is referencing
So I tried Mazhar's Method and nothing shows up. However this does not surprise me beacuse I do not know where or how to define my shipping method.
Sorry for the lask of understanding.
Re: Tempting Customers with Free Shipping
Posted: Sat Feb 14, 2009 4:09 am
by mazhar
Well I setup free shipping method as in the screen shot and then configured the control with its ShipMethodId
Code: Select all
[[ConLib:FreeShippingAlert ShipMethodId="2"]]
Re: Tempting Customers with Free Shipping
Posted: Sat Feb 14, 2009 7:40 pm
by Jaz
Thanks. That clears up a lot, but I think I am still doing something wrong.
I set up the Shipping Method:
Then I set it up as follows:
Code: Select all
[[ConLib:FreeShippingAlert ShipMethodId="1"]]
I did not change "FreeShippingAlert.ascx" in any way
However, when I view the page, nothing shows up.
Re: Tempting Customers with Free Shipping
Posted: Thu Aug 19, 2010 1:20 pm
by vn2479
Hello,
I have a "This item qualifies for free shipping" image that I want to automatically display on product pages if price is over $99.
I thought using this logic would work -->
Code: Select all
#if($Product.Price > 99)
<img src="freeshipping.gif" alt="free shipping" />
#end
Clearly, it didn't work and I think it's much more code involved. The shipping alert example you included here is a good addition and thanks for posting it. However, how would I go about combining the two features i.e. if product is over $99 show image and if less than $99 than show message? Any help is much appreciated!
Here is the code snippet from the shipping alert example. Not sure how to write the correct syntax for displaying an image in the else condition -->
Code: Select all
protected void Page_Load(object sender, EventArgs e)
{
ShipMethod shipMethod = ShipMethodDataSource.Load(ShipMethodId);
if (shipMethod != null)
{
LSDecimal totalPrice = Token.Instance.User.Basket.Items.TotalPrice();
if (totalPrice < shipMethod.MinPurchase)
{
string message = "Spend {0} more and get free shipping!";
FreeShippingLabel.Text = string.Format(message, (shipMethod.MinPurchase - totalPrice).ToString("ulc"));
}
else {
image.Picture = image URL;
}
}
}