Jump to content

SMARTY - Estimated delivery date


bedfordprint

Recommended Posts

In order complete email I want to let customers know, when approximately they will receive their item.

I was hoping to add smarty to the template but when I change the status it freezes CubeCart.

 

I've added this to the template

{assign var="z_date" value="+5 days"|date_format:"%d-%m-%Y"} {$z_date}

I guess I need to add the first part somewhere in the files and just add {$z_date}

to the template.

Any help really appreciated.

 

Thanks,

Peter

Link to comment
Share on other sites

I haven't tried this myself, but try:

{if $DATA.ship_date}
Expect your package between
{* 5 days *}{strtotime($DATA.ship_date)+(5*86400)|date_format:"%d-%m-%Y"}
and
{* 10 days *}{strtotime($DATA.ship_date)+(10*86400)|date_format:"%d-%m-%Y"}
{/if}

We are using the existing Shipping Date you have entered into the Order Details when you shipped that order - moving the order to Completed. CubeCart saves this as a human-readable date. The strtotime() function takes that human-readable date and converts it to a timestamp value. That value is then having 5 or 10 day's worth of seconds added to it. Then, the Smarty date_format variable modifier takes that adjusted timestamp value and makes a new human-readable string.

Link to comment
Share on other sites

In the order, I want to change order status to  "order complete" and click save. After I click save, everything disappears and if you refresh you are back to the order page and it still shows "processing"

Thanks


ok, I have removed <div> and <p> from around it and it went through but the info in the email looks like this

 

Expect your package between 1408575606 and 1408575611

 

ha ha

Link to comment
Share on other sites

Let's do this:

{if $DATA.ship_date}
Expect your package between
{* 5 days *}{(strtotime($DATA.ship_date)+(5*86400))|date_format:"%d-%m-%Y"}
and
{* 10 days *}{(strtotime($DATA.ship_date)+(10*86400))|date_format:"%d-%m-%Y"}
{/if}

We are now wrapping the entire expression in parentheses, then giving it to the date_format modifier.

Link to comment
Share on other sites

OK, this works perfectly THANKS AGAIN!

 

But whoever reads this in the future, make sure there is no HTML tags around it. If there id <div> or <p> around it it will NOT work.

The email editor adds html tags automatically including paragraphs. So if you want to edit this smarty just paste edited code in the html mode, save and never comeback to it.

Uhh

Link to comment
Share on other sites

It is true that when saving the Rich Text Editor (RTE) contents, the editor (CC5 uses the CKEditor) will "finalize" certain things and make pretty the HTML that makes up what you see. But almost nothing is "finalized" if you save while in the Source mode. (Or so my experiments have shown me.)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...