Free Shipping Warning Addon Help

Hi everyone

I'm new to programming for cs cart and was hoping to get some help on creating a custom addon. It's mostly a learning project but also a useful feature on the cart.

I'd like to display a box at the checkout which warns the customer when their order subtotal is almost high enough for them to receive free shipping. like so:

So far I've achieved this by using a template hook: summary.override.tpl with the following code:

{assign var="sub_total" value=$cart.display_subtotal-$tax.tax_subtotal}
{assign var="remaining" value=50-$sub_total}
{if $remaining>0 && $remaining<20}

You're almost eligible for free shipping!

Spend just {$remaining|format_price:$currencies.$secondary_currency:$span_id:$class:true:$is_integer:$live_editor_name:$live_editor_phrase nofilter} more to receive free shipping.*

*order must be over £50 before adding VAT.


At the moment the order subtotals between which the message should be shown are hard coded into the template. The above code will show the message if the order subtotal is greater than £30 but below £50. customers receive free shipping on orders over £50 so no need to show the message if the subtotal is higher than this.

I'd like to make this more flexible by create fields in the addon settings where custom values can be input and having the cart use those rather than having to code the values into the template.

so far I've gotten as far as this in the addon.xml file:

    Free Shipping Warning
    Shows message when customer is close to threshold for free shipping
    10000000 0

        DROP TABLE IF EXISTS ?:shipping_note_data;

            CREATE TABLE `?:shipping_note_data` (
`ship_thresh` int(11) unsigned NOT NULL DEFAULT 0,
`mess_thresh` int(11) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`ship_thresh`)

        DROP TABLE IF EXISTS ?:shipping_note_data;

Free Shipping Threshold

Show Message at

On installation the addon creates a new table in the database with a column each for the free shipping threshold (the order subtotal after which the customer will receive free shipping) and the message threshold (the minimum order subtotal needed before the message is shown).

My questions are.

How do I have the addon upload the values in the addon's setting fields into the table on the database?

How do I then retrieve these values from the database for use on the template files?

Sorry if this is super basic. If someone could point me in the right direction that would be a great help.

Thanks in advance!

There is already a couple of these in the marketplace if that helps any.? The first one is free.

There is already a couple of these in the marketplace if that helps any.? The first one is free.

Great thanks. I'll download the first one and see how they do it.

these two are great addon but the firts one i tried dosn't seem to work with the category restrictions.

So if you have a category that you don't want to give free shipping, you can not exlude it.