Edit Date in Receipt

General ShopSite user discussion

Edit Date in Receipt

Postby silken » Thu Oct 06, 2016 4:20 pm

This is a small issue, but how do I edit the way the date is displayed in the order receipt? Right now it looks like this:

Order Date: Thu Feb 11 09:20:59 2016

And it is annoying to have the time interrupting the flow of the date itself. I would like to put the time before or after the date.

Thanks!
Debbie
silken
 
Posts: 120
Joined: Mon Jun 07, 2010 11:56 am
Location: santa cruz, ca

Re: Edit Date in Receipt

Postby ShopSite Lauren » Mon Oct 24, 2016 9:36 am

Debbie, this isn't an option in ShopSite. However, you could add custom javascript to move or change the time. I have two examples of javascript below that you could use, one for the view order screen and one for the packing slip screen (if you are using the PackingSlip.sst template, if you are using the PackingSlipBasic.sst template, the first javascript should work for both screens). The javascript below also changes the military time display to a basic 12-hour time display.

The javascript examples below change the display from:
Mon Oct 03 15:58:34 2016
To:
Mon Oct 03 2016 @ 3:58pm

Code for Orders > Configure Orders > View Order Footer:

Code: Select all
<script type="text/javascript">
var datefield = document.getElementsByClassName("order_date om")[0].innerHTML;
var twelvetimehour = datefield.substr(30,2);
var twelvetimehalf = "am";
if (twelvetimehour > 11) {var twelvetimehalf = "pm"; if (twelvetimehour > 12) {twelvetimehour = parseInt(twelvetimehour) - 12}};
document.getElementsByClassName("order_date om")[0].innerHTML = datefield.replace((datefield.substr(30,9)), "") + " @ " + twelvetimehour + ":"+ datefield.substr(33,2) + twelvetimehalf;
</script>


Code for Orders > Configure Orders > Packing Slip Footer:

Code: Select all
<script type="text/javascript">
var datefield = document.getElementById("om-date").innerHTML;
var twelvetimehour = datefield.substr(30,2);
var twelvetimehalf = "am";
if (twelvetimehour > 11) {var twelvetimehalf = "pm"; if (twelvetimehour > 12) {twelvetimehour = parseInt(twelvetimehour) - 12}};
document.getElementById("om-date").innerHTML = datefield.replace((datefield.substr(30,9)), "") + " @ " + twelvetimehour + ":"+ datefield.substr(33,2) + twelvetimehalf;
</script>
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Re: Edit Date in Receipt

Postby silken » Mon Oct 24, 2016 9:44 am

Brilliant! 100% works and incredibly easy to do. Can't thank you enough.
Best,
Debbie
silken
 
Posts: 120
Joined: Mon Jun 07, 2010 11:56 am
Location: santa cruz, ca


Return to User Forum

Who is online

Users browsing this forum: No registered users and 91 guests