Time restricted access to check-out (or component)

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
8 years 2 months ago #250238

-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.2
-- PHP version -- : 7.0.6
-- Browser(s) name and version -- : na
-- Error-message(debug-mod must be tuned on) -- : none

Is there any way to automatically make checkout not possible (or the entire store offline) for certain times each week?

We would like to have the store be not accessible during a certain period of time each week, and we need to automate the process.

I have not found a way to do this within Hikashop itself; however I may have missed something.

I've looked for other HS extensions but didn't find anything like this.
If it isn't possible with core HS setttings, is there a way to do this through a work-around?
(Or possibly just a custom php script that runs by cron to set the 'Put the store offline" to YES (and then back to NO at a certain time? Is that field easily accessible somewhere to set externally?)

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13378
  • MODERATOR
8 years 2 months ago #250272

Hi,

You can do that with the "Business hours" setting of the HikaShop configuration where you can define open and close hours of the online store's checkout.

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
8 years 2 months ago #250329

Thanks. However, what I specifically need is the ability to JUST close the store on Mondays from 15:00 - 20:00. We need to have it open all other days 24/7.

Can I programattically (via cron) just change those hours on Monday and then reset them on Tuesday each week?

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 2 months ago #250331

Hi,

I know that PolishedGeek made a special plugin to handle more restrictions for the "close store".
Otherwise, you can perform a view override for your "checkout | step" and add some PHP code to close the shop only on monday between 15:00 and 20:00.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
8 years 2 months ago #250467

Although I'd love to help support Polished Geek, this project is for a small non-profit so can't afford outside plugins.

So the view override will be a good option for us.

Do you have any documentation about how to properly add PHP code to a view override for something like this (or ANY samples of PHP functionality within a view override would be helpful).
Also, do you have a list of what variables/data are available within different view files?

I've done only a few view overrides, so I'm not all that experienced with that.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13378
  • MODERATOR
8 years 2 months ago #250481

Hi,

Well, you don't need to know about any variable or data available in there.
It only requires knowing PHP.
It's quite simple if you know PHP.
You use the date() function of PHP to get the current day, or current hour, or current month, etc:
php.net/manual/en/function.date.php
And you compare it with the values you need for the restrictions you want.
And if the current time is outside of the ranges you have, you just use return; to stop the processing of the view file.

And you even have an example of such code with the first 50 lines of the checkout/step.php view file which handle the Business hour setting of the HikaShop configuration.

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
8 years 2 months ago #250580

Thanks for the reference to the checkout/ste.php file. Exactly what I needed for this.

However, I wasn't clear about the variables.
Can I use normal Joomla! JFactory::getUser() (and other Joomla functions) within this file?

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 2 months ago #250581

Hi,

Sure you can !

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Time to create page: 0.066 seconds
Powered by Kunena Forum