Add hour as a parameter to Specials in Opencart
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!
opencart2.x
add a comment |
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!
opencart2.x
At midnight, the day changes. So I don't understand why you need to set a specific time. Assuming it's based on your server time, then I don't see what change needs to be made to implement this. For example, today is 11/11. At midnight, the day changes to 11/12. So changing according to date is how you'd work with something like this. The only reason you'd want to manipulate the exact time is if something ends at 7pm in the evening.
– Nancy Savescu
Nov 11 '18 at 16:21
Well, I need to set a promotion that will end at noon. But I'm not sure that changing server time is an option :) Also, it's possible to login and remove promotion manually, but here comes the problem with a countdown timer that will show 12 hours and 1 minute left at 11:59... which will not be true and will mislead the customers.
– Aaviya
Nov 11 '18 at 20:26
Ok, i get it now. Your original question didn't specify "noon." It was a bit vague, sorry. It made it sound like it expired at midnight. So to clarify, you want it to expire at noon-time?
– Nancy Savescu
Nov 11 '18 at 23:25
add a comment |
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!
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!
opencart2.x
opencart2.x
asked Nov 11 '18 at 14:42
Aaviya
1,09511324
1,09511324
At midnight, the day changes. So I don't understand why you need to set a specific time. Assuming it's based on your server time, then I don't see what change needs to be made to implement this. For example, today is 11/11. At midnight, the day changes to 11/12. So changing according to date is how you'd work with something like this. The only reason you'd want to manipulate the exact time is if something ends at 7pm in the evening.
– Nancy Savescu
Nov 11 '18 at 16:21
Well, I need to set a promotion that will end at noon. But I'm not sure that changing server time is an option :) Also, it's possible to login and remove promotion manually, but here comes the problem with a countdown timer that will show 12 hours and 1 minute left at 11:59... which will not be true and will mislead the customers.
– Aaviya
Nov 11 '18 at 20:26
Ok, i get it now. Your original question didn't specify "noon." It was a bit vague, sorry. It made it sound like it expired at midnight. So to clarify, you want it to expire at noon-time?
– Nancy Savescu
Nov 11 '18 at 23:25
add a comment |
At midnight, the day changes. So I don't understand why you need to set a specific time. Assuming it's based on your server time, then I don't see what change needs to be made to implement this. For example, today is 11/11. At midnight, the day changes to 11/12. So changing according to date is how you'd work with something like this. The only reason you'd want to manipulate the exact time is if something ends at 7pm in the evening.
– Nancy Savescu
Nov 11 '18 at 16:21
Well, I need to set a promotion that will end at noon. But I'm not sure that changing server time is an option :) Also, it's possible to login and remove promotion manually, but here comes the problem with a countdown timer that will show 12 hours and 1 minute left at 11:59... which will not be true and will mislead the customers.
– Aaviya
Nov 11 '18 at 20:26
Ok, i get it now. Your original question didn't specify "noon." It was a bit vague, sorry. It made it sound like it expired at midnight. So to clarify, you want it to expire at noon-time?
– Nancy Savescu
Nov 11 '18 at 23:25
At midnight, the day changes. So I don't understand why you need to set a specific time. Assuming it's based on your server time, then I don't see what change needs to be made to implement this. For example, today is 11/11. At midnight, the day changes to 11/12. So changing according to date is how you'd work with something like this. The only reason you'd want to manipulate the exact time is if something ends at 7pm in the evening.
– Nancy Savescu
Nov 11 '18 at 16:21
At midnight, the day changes. So I don't understand why you need to set a specific time. Assuming it's based on your server time, then I don't see what change needs to be made to implement this. For example, today is 11/11. At midnight, the day changes to 11/12. So changing according to date is how you'd work with something like this. The only reason you'd want to manipulate the exact time is if something ends at 7pm in the evening.
– Nancy Savescu
Nov 11 '18 at 16:21
Well, I need to set a promotion that will end at noon. But I'm not sure that changing server time is an option :) Also, it's possible to login and remove promotion manually, but here comes the problem with a countdown timer that will show 12 hours and 1 minute left at 11:59... which will not be true and will mislead the customers.
– Aaviya
Nov 11 '18 at 20:26
Well, I need to set a promotion that will end at noon. But I'm not sure that changing server time is an option :) Also, it's possible to login and remove promotion manually, but here comes the problem with a countdown timer that will show 12 hours and 1 minute left at 11:59... which will not be true and will mislead the customers.
– Aaviya
Nov 11 '18 at 20:26
Ok, i get it now. Your original question didn't specify "noon." It was a bit vague, sorry. It made it sound like it expired at midnight. So to clarify, you want it to expire at noon-time?
– Nancy Savescu
Nov 11 '18 at 23:25
Ok, i get it now. Your original question didn't specify "noon." It was a bit vague, sorry. It made it sound like it expired at midnight. So to clarify, you want it to expire at noon-time?
– Nancy Savescu
Nov 11 '18 at 23:25
add a comment |
1 Answer
1
active
oldest
votes
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.
Thank you very much for these hints. I'll try to implement it with additional columns in the database.
– Aaviya
Nov 12 '18 at 15:49
My pleasure. There are a lot of edits here. If you have trouble with any of them though specify which ones, and I can take a look further.
– Nancy Savescu
Nov 13 '18 at 0:38
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249802%2fadd-hour-as-a-parameter-to-specials-in-opencart%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
Thank you very much for these hints. I'll try to implement it with additional columns in the database.
– Aaviya
Nov 12 '18 at 15:49
My pleasure. There are a lot of edits here. If you have trouble with any of them though specify which ones, and I can take a look further.
– Nancy Savescu
Nov 13 '18 at 0:38
add a comment |
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.
Thank you very much for these hints. I'll try to implement it with additional columns in the database.
– Aaviya
Nov 12 '18 at 15:49
My pleasure. There are a lot of edits here. If you have trouble with any of them though specify which ones, and I can take a look further.
– Nancy Savescu
Nov 13 '18 at 0:38
add a comment |
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.
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.
edited Nov 12 '18 at 0:35
answered Nov 12 '18 at 0:07
Nancy Savescu
302112
302112
Thank you very much for these hints. I'll try to implement it with additional columns in the database.
– Aaviya
Nov 12 '18 at 15:49
My pleasure. There are a lot of edits here. If you have trouble with any of them though specify which ones, and I can take a look further.
– Nancy Savescu
Nov 13 '18 at 0:38
add a comment |
Thank you very much for these hints. I'll try to implement it with additional columns in the database.
– Aaviya
Nov 12 '18 at 15:49
My pleasure. There are a lot of edits here. If you have trouble with any of them though specify which ones, and I can take a look further.
– Nancy Savescu
Nov 13 '18 at 0:38
Thank you very much for these hints. I'll try to implement it with additional columns in the database.
– Aaviya
Nov 12 '18 at 15:49
Thank you very much for these hints. I'll try to implement it with additional columns in the database.
– Aaviya
Nov 12 '18 at 15:49
My pleasure. There are a lot of edits here. If you have trouble with any of them though specify which ones, and I can take a look further.
– Nancy Savescu
Nov 13 '18 at 0:38
My pleasure. There are a lot of edits here. If you have trouble with any of them though specify which ones, and I can take a look further.
– Nancy Savescu
Nov 13 '18 at 0:38
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249802%2fadd-hour-as-a-parameter-to-specials-in-opencart%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
At midnight, the day changes. So I don't understand why you need to set a specific time. Assuming it's based on your server time, then I don't see what change needs to be made to implement this. For example, today is 11/11. At midnight, the day changes to 11/12. So changing according to date is how you'd work with something like this. The only reason you'd want to manipulate the exact time is if something ends at 7pm in the evening.
– Nancy Savescu
Nov 11 '18 at 16:21
Well, I need to set a promotion that will end at noon. But I'm not sure that changing server time is an option :) Also, it's possible to login and remove promotion manually, but here comes the problem with a countdown timer that will show 12 hours and 1 minute left at 11:59... which will not be true and will mislead the customers.
– Aaviya
Nov 11 '18 at 20:26
Ok, i get it now. Your original question didn't specify "noon." It was a bit vague, sorry. It made it sound like it expired at midnight. So to clarify, you want it to expire at noon-time?
– Nancy Savescu
Nov 11 '18 at 23:25