Tempting Customers with Free Shipping

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
Jaz
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Nov 05, 2008 4:04 am
Location: Torrance, CA
Contact:

Tempting Customers with Free Shipping

Post by Jaz » Thu Feb 12, 2009 2:25 am

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,
David Jasiewicz
President
Trick Concepts - Metal Fab. Engineering and Product Design
http://www.trickconcepts.com-- If you are an ASP or PHP programmer or CSS web specialist I will gladly trade for graphic design, mechanical engineering or metal fabrication service! --

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Tempting Customers with Free Shipping

Post by mazhar » Thu Feb 12, 2009 5:55 am

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.

Mike718NY
Commodore (COMO)
Commodore (COMO)
Posts: 485
Joined: Wed Jun 18, 2008 5:24 pm

Re: Tempting Customers with Free Shipping

Post by Mike718NY » Thu Feb 12, 2009 9:39 am

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.

User avatar
Jaz
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Nov 05, 2008 4:04 am
Location: Torrance, CA
Contact:

Re: Tempting Customers with Free Shipping

Post by Jaz » Sat Feb 14, 2009 2:59 am

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.
David Jasiewicz
President
Trick Concepts - Metal Fab. Engineering and Product Design
http://www.trickconcepts.com-- If you are an ASP or PHP programmer or CSS web specialist I will gladly trade for graphic design, mechanical engineering or metal fabrication service! --

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Tempting Customers with Free Shipping

Post by mazhar » Sat Feb 14, 2009 4:09 am

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"]]

User avatar
Jaz
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Nov 05, 2008 4:04 am
Location: Torrance, CA
Contact:

Re: Tempting Customers with Free Shipping

Post by Jaz » Sat Feb 14, 2009 7:40 pm

Thanks. That clears up a lot, but I think I am still doing something wrong.

I set up the Shipping Method:

Image

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.
David Jasiewicz
President
Trick Concepts - Metal Fab. Engineering and Product Design
http://www.trickconcepts.com-- If you are an ASP or PHP programmer or CSS web specialist I will gladly trade for graphic design, mechanical engineering or metal fabrication service! --

vn2479
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Thu Jul 29, 2010 12:43 pm

Re: Tempting Customers with Free Shipping

Post by vn2479 » Thu Aug 19, 2010 1:20 pm

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;
            }
        }
    }

Post Reply