bedfordprint Posted August 21, 2014 Share Posted August 21, 2014 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 Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 21, 2014 Share Posted August 21, 2014 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. Quote Link to comment Share on other sites More sharing options...
bedfordprint Posted August 21, 2014 Author Share Posted August 21, 2014 Shall I put it in the email template in the admin panel or somewhere in the files? I did put it in the template editor but again it doesn't refresh and does not update the order. Thanks, Peter Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 21, 2014 Share Posted August 21, 2014 You need to be using the email template editor. When you say, "It doesn't refresh", what exactly does not refresh? Quote Link to comment Share on other sites More sharing options...
bedfordprint Posted August 21, 2014 Author Share Posted August 21, 2014 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 Quote Link to comment Share on other sites More sharing options...
bedfordprint Posted August 21, 2014 Author Share Posted August 21, 2014 And it worked once only, if I'll try it again it goes nowhere, as it was with my piece of the code... hmm Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 21, 2014 Share Posted August 21, 2014 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. Quote Link to comment Share on other sites More sharing options...
bedfordprint Posted August 21, 2014 Author Share Posted August 21, 2014 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 Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 21, 2014 Share Posted August 21, 2014 I'm not sure I would agree with the above. There may be times when using the Source mode is appropriate, but I feel the WYSIWYG mode functions well. Quote Link to comment Share on other sites More sharing options...
bedfordprint Posted August 21, 2014 Author Share Posted August 21, 2014 Well if I paste it in the WYSIWIG mode it works, but if I'll comeback to it, even just to change the email subject and save it, the above code gets in cased in paragraph or div tags and the whole thing is stuck again. Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 21, 2014 Share Posted August 21, 2014 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.) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.