Prestashop 1.7.8 Specific Price - Smarty - retrieve day - prestashop

As they still haven't decided to put the time to work in the date-picker of discounts.
Wouldn't it be possible to take 1 day off the code that shows the end date of the promotion?
This code displays the end date of the promotion, but due to the time issue the promotion ends before the end of the day, so we have to add a day on the backoffice side. And the idea in this code was to remove the extra day to hit the date right, you know?
{l s='End promo: '}{$product->specificPrice.to|date_format:'%d-%m-%Y' . "-1 days"}
but not working... i have tried a lot of combinations and nothing.
I await your comments.
Thanks!

This will do the trick :
{l s='End promo: '}{"$product->specificPrice.to -1 Days"|date_format:'%d-%m-%Y'}

Here is the solution:
{if $product.has_discount}{dateFormat date=$product.specific_prices.from} to {dateFormat date=$product.specific_prices.to|cat:' -1 day'|date_format:'%Y-%m-%d'}{/if}
Hope this works for you guys to!

Related

Karate UI - When i enter expiration date, it is not taking it correctly

I want to enter month and year in the expiration date field. and I used this And input('#card_expDate', "0828")
But it takes the value in the field as 82/80.. I want it to take it as 08/28
Tried And input('#card_expDate', "08/28") as well and no luck
Can someone please help me on this?
There can be many reasons for this, most likely because the page has some fancy javascript. No one can help you unless they see the actual page.
The only suggestions I have are:
try adding a delay before each keystroke: https://github.com/intuit/karate/tree/master/karate-core#input
e.g. * input('#card_expDate', '0828', 100)
try setting the value using value(): https://github.com/intuit/karate/tree/master/karate-core#valueset
e.g. * value('#card_expDate', '08/28')
resort to executing custom JS in the page to do what you want: https://stackoverflow.com/a/60800181/143475
Else please follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

Youtrack: Resubmission after n days possible?

I have a ticket in our custom youtrack which is assigned to me.
I contacted the customer and he wants to give me the needed information in the next week.
I want to this issue to vanish out of my "assigned to me and open" view for 7 days.
What is the most easy way to do this?
My favourite solution wearing the "I am a lazy user" glasses looks like this: +7 ENTER :-)
I guess while the details are not provided by customer, you can set State of the issue to "Wait for reply" or similar.
Once the customer replied with details, the State will be updated with "Open" value. For example, if the user is not included in one of internal groups, re-opening can be achieved with workflow:
rule Reopen on answer
when State=={Wait for Reply} && comments.added !=null
&& comments.added.isNotEmpty && comments.added.last !=null
&& !comments.added.last.author.isInGroup("Internal Developers"){
State={Open};
}

How to search a given time range for every day in Splunk?

I am trying to search for an event that happens in a specific time range in Splunk but I want that search to encompass all of the data I have indexed which covers a wide date range.
For example, I want to see if a line in an indexed log file contains the word 'Error' between the hours of 9am and 4pm from the 25 days worth of logs I have indexed. If the word 'Error' shows up outside of that time range, I don't want that displayed in my search results.
For date/time format I am using mm/dd/yyyy:hh:mm:ss
Any ideas how I might go about this?
You can try a search something like this:
index=foo earliest=-25d (date_hour > 9 and date_hour < 16) "Error"
while the selected answer is great, it did not work in my case (splunk v6), however this did work (it was mainly adding the | eval date_hour... )
and my full working search (between hours of 6am to 11pm , for each of the prior 25 days):
index=mymts earliest=-25d | eval date_hour=strftime(_time, "%H") | search date_hour>=6 date_hour<=23 host="172.17.172.1" "/netmap/*"
hope this helps others.

Sharethis api top shared urls

I'm working on building a block on my site that contains the top 5 most shared urls on my domain via the sharethis api, I've been testing it and have gotten some unexpected results...
when I check the domain statistics api, I get the expected results:
request:
http://rest.sharethis.com/analytics/V2/getDomainStats.php?domain={my-domain}&pub_key={my-publisher-key}&access_key={my-secret-key}
response:
{"status":"SUCCESS","from_date":"20120620","to_date":"20120627","data":
{"domain_summary":[{"clicks":1092,"shares":134,"traffic":1393,"date":"06\/20","channel_stats":
[{"shares":86,"clicks":404,"traffic":412,"channel":"facebook"},
{"shares":25,"clicks":617,"traffic":898,"channel":"email"},
{"shares":12,"clicks":0,"traffic":0,"channel":"fblike"},
{"shares":7,"clicks":42,"traffic":31,"channel":"twitter"},
{"shares":3,"clicks":0,"traffic":0,"channel":"plusone"},
{"shares":1,"clicks":0,"traffic":0,"channel":"pinterest"},
{"shares":0,"clicks":17,"traffic":19,"channel":"blogger"},
{"shares":0,"clicks":12,"traffic":33,"channel":"google_bmarks"}]}.....
I've truncated those results obviously since they go back for a week...
when I try to find out what urls are the most active from my domain:
request:
http://rest.sharethis.com/analytics/V2/getTopUrlStats.php?domain={my-domain}&from_date=2012-06-27&to_date=2012-01-01&pub_key={my-publisher-key}&access_key={my-secret-key}
response:
{"status":"SUCCESS","from_date":"20120627","to_date":"20120101","last_batch_date":"20120626","data":{"top_urls_summary":[]},"today":""}
Obviously this is not what I'm looking for, I have the clicks and on the sharethis site I can go to my metrics and view the info I'm looking for with no problem, but the api is not answering with any data. I have tried changing the date range or omitting it completely (which for some reason returns an empty data set) to no avail. Has anyone else run into a similar problem?
Ok Sharethis support finally got back to me about the problem:
According to sharethis api :
To Date End date for data. Note: date must be in yyyy-mm-dd format. Default is 7 days ago.
From Date Start date for data. Note: date must be in yyyy-mm-dd format. Default is 'today'.
These are backwards, that's 1 reason why my call wasn't working, "To date" should be the more recent date when defining the date range... the "defaults" don't work so you must enter both values, and when you enter todays date as the "To Date" it may return "collection failed", so best to start with yesterday

Apache wicket: how to add a zero padding to DateTimeField?

I've got a page with DateTimeField.
When i'm filling only date field (leaving hours and minutes fields empty) and have a validation error (page get's reloaded, feedback panel is shown), time fields got filled in with 0:00. But the thing is, that I want to have 00:00.
As I inspected, minutes field got ZeroPaddingIntegerConverter(2), so I just simply add it to hours field. But the thing is I cannot add anything to hours field as it is private.
So is there a way to add a ZeroPaddingIntegerConverter(2) to a hours field in DateTimeField of Apache Wicket ?
I use the DateTextField provided in the org.apache.wicket.extensions.markup.html.form package
DateTextField myDateTextField = DateTextField("endTime", "HH:mm");
You can define a date pattern that will be used for formatting the date. The time will be displayed with two digits for the hour and a leading zero if necessary.