Add hour as a parameter to Specials in Opencart - opencart2.x

Opencart has a function to set special price on items. But this special price is set with date start/date end. I'm wondering if anyone can help me to set also end hour for same promotions? Now they end at midnight.
Thanks!

I'm not sure what you have tried (which would've helped to see your code), so I will just point you in the right direction since there are a number of files you need to make edits to here:
First, in your database, when you go to your oc_product_special table, you can either:
a) add two new fields with the "type" set as datetime, or...
b) modify the types on on your date_start and date_ended from "date" to "datetime" instead.
If you don't know what you're doing (or you don't feel comfortable editing the table of your database), I would go with option a so you have a fall-back at least in case you need to restore a backup. Name them something similar like timedate_start and timedate_end
Next, you then need to edit the following files (I think I have all of them). Look for any lines of code with "special", and modify them accordingly. Beware that you may need to make multiple edits in multiple places on some of these files, and you will also need to edit for the datetime format (and not just just swapping names out):
admin/controller/catalog/product.php
admin/model/catalog/product.php
admin/view/catalog/product_form.tpl
catalog/model/catalog/product.php
system/library/cart/cart.php file
Another way to go on about all of this is to add two fields with type "time" separately, but that may end up involving more coding work on your end to join the variables together. That's my opinion though. It's easier to just use the datetime type since you can still use it for specials that you may want to run all day or for several days if you choose to.

Related

SSRS: expand the ultimate group of values by default upon initial execution

Is there a way to get SSRS to expand the ultimate group of values by default upon initial execution, regardless of values?
My report looks like this:
Current scenario
What I want to achieve:
Ideal Scenario
I've searched for an answer without any success, I can't even find a similar question! Most require the current date values which can be done through the visibility settings and setting an expression to hide when not current date (or if not date then a specific value) - I get that. That's not what i'm asking, I simply want the ultimate values to be displayed when the report is initially rendered.
Any help is much appreciated. Thanks in advance!

Send notification/email 7 days before given date

I have table with employees. It contains some information and also date of birth. Is it possible to send notification/email (directly from excel) let's say 7 days in advance to know that he/she will have birthday soon?
I found some tutorials, but all require Visual Basic. Unfortunately, it is for my sister without any knowledge of programming.
Yes, it is possible to do this via Word's mail merge feature. But since this would require quite a few manual steps (presumably on a daily/weekly basis), I'm afraid it's not what your sister is after. You could code a similar feature in VBA but that would still require her to open the document regularly to run the macro so perhaps it would be quicker and simpler to just check a filtered employee list.
If you want a closer look at mail merge, try this. You could use a helper column to identify which birthdays are close (e.g. using this) and filter on that column, then you show only those whose birthdays are in the next x days.

Remove a button in SuiteScript

I need to be able to remove the delete button when today is greater than a particular calculated date.
There are 2 ideas I had and issues with each:
1 - Set a custom field on the record for the particular calculated date. Then use a workflow action of Remove Button where the custom field is <= today. My issue is I am wondering if there is a way to get "today" because I expected the condition to change allowing me to do that. I tried to use a formula and can't find Now() as a valid function listed.
2 - Workflow are truly scripts in the background. That means the Remove Button should be available in API. Therefore, my idea was to do my conditioning in suite script and then call this function. However, this function also does not exist in supported form. Has anyone hacked this to find what the function that is called in Remove Button is?
If we can get either idea to work, or if you have a third I haven't thought of that accomplishes the same task, that would be great.
I figured out my own answer. In case someone else ever needs this (as I didn't see anything like this on stack overflow), here is how to do option #1:
Save the value to a custom field - custbody_block_dlt_date
In a workflow, use the Remove Button function and use a formula condition
The condition is: {custbody_block_dlt_date} < sysdate
"sysdate" is the way you can get "Now()" or "today" in the condition
An alternative could be to create a User Event Script, on the before load function, get the button object then use the .setVisible(visible) method to hide it based on a date criteria, you may also want to set other restrictions based on roles that allow certain individuals to still be able to delete the record, like high positioned accountants. That avoids creating unnecessary fields on your records, while still providing the functionality that you desire. This could easily be done in < 4 lines of JavaScript.
See nlobjButton for examples.

OBIEE prompts for separate reports interlinked

I have two separate reports on a page in OBIEE, each having its own prompt. Both the prompts are on the same column in a subject area. The problem is that when I change the value in one of these prompts, the other one also automatically changes. I do not want this to happen i.e I want them to remain independent of each other. I have changed the scope of both prompts to 'dashboard', but the problem still exists.
How can this be done? Any help would be appreciated.
Firstly, you may want to try changing the scope of the prompt to 'Page' and changing the break on the column containing the second prompt & Answer to 'Page Break with Column Break' first. I believe when I've tried it before though, that didn't work.
Otherwise, you can make a subtle edit to the column formula in one of the prompts and corresponding Answers. Essentially what you need to do is make OBI think the column is different in each prompt. Obviously you don't actually want to change the column result, so a neat way to do it is if it's a string append an empty string to the end, if it's a number then add 0 to it.
CONCAT("My Dimension"."My String Column", '')
"My Dimension"."My Number Column" + 0
Make sure to do that in one of the prompts and the Answers you want that prompt to affect.

infopath: create a multiple selection tree manually

I was hoping that you could answer a query I have with Microsoft INFOPATH.
How could I design a multiple selection list , where each entry has subsequent multiple options and each one among those multiple options further leads to some more.
To put it in a more simple manner, it will have the features of a tree structure.
Also the selected entries (parent along with their child and their child shall be concatenated in a numbered list).I will also like to add that there are no interaction with database or sharepoint lists- I want to have the data manually fed.
Example - Suppose there are 10 countries in a list. On selection of any one, all the states/districts on it populates. Further on selection of any state,the cities inside it populates. At the end those are all listed in a numbered list somewhere.
Could this be done?
There are several ways this could be accomplished, I don't know the scope of what you need to do, but you could do it with conditional rules.
ddl "Country" (France, U.K., Germany, Italy, Spain)
You would have an additional ddl for each possible choice for country that is hidden through a rule, have it hidden unless it matches the value of "Country". So say you want to show cities in France, if the Country of France is selected you would have an additional rule on it that looks something like this...
if "Country" does not equal "France" hide+disable this control.
ddl "FranceCities" (Paris, Marseille, Lyon, Toulouse)
ddl "UKCities" (London, Bath, Birmingham, Lichfield)
Additionally it would be important to do testing and find out how it behaves if you select a street for "France" but realize you meant to select "Germany".
Hope that helps!
(Once again, I don't know the scope of what you need to do, so the best method for you could be something different.)

Resources