Checkout business hours. Need to be closed Sunday.

  • Posts: 50
  • Thank you received: 3
11 years 2 months ago #147486

-- url of the page with the problem -- : www.fricanospizzaalpine.com/order-online
-- HikaShop version -- : HikaShop Essential 2.3.0
-- Joomla version -- : 3.2.3
-- PHP version -- : 5.4.23
-- Browser(s) name and version -- : Internet Explorer 11.0.9600.16518

The business is closed on Sunday so therefore cannot accept online orders for pizzas that day of the week. In Configuration/Checkout - Business Hours, there is only Opens at and Closes at.

How do we prevent online orders on Sunday?

Also, business hours are different on Friday and Saturday.

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

  • Posts: 26235
  • Thank you received: 4036
  • MODERATOR
11 years 2 months ago #147512

Hi,

The open/close hour system is coded in the view "checkout | step".
You can override the view in order to change the rules. So thanks to it you can refuse to checkout during Sunday.
You can also put different hours depending the current day.

Regards,

PS : No need to send me a private message. We answer to all question but the week end more than other days, please be patient. Like you we are trying to taking some rest during the week end :)


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.
The following user(s) said Thank You: TerryHikashop

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

  • Posts: 50
  • Thank you received: 3
11 years 2 months ago #147544

Okay that is good news. Please give me complete instructions because I'm fairly new to your system and I do not know PHP or anything.

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

  • Posts: 83831
  • Thank you received: 13572
  • MODERATOR
11 years 2 months ago #147558

At the beginning of the file "step" of the view "checkout" that you can edit via the menu Display>Views, you can add such code:

if(date('w')==0){$closed = true;}
after the line:
$closed=false;

The following user(s) said Thank You: TerryHikashop

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

  • Posts: 50
  • Thank you received: 3
11 years 2 months ago #147570

How do I specify Sunday? All I see in that code is 'w'

How do I set different hours for Friday/Saturday?

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

  • Posts: 26235
  • Thank you received: 4036
  • MODERATOR
11 years 2 months ago #147582

Hi,

Please use the code that Nicolas gave you.
You just have to copy/paste it where he indicates you.

Doing such modifications requires some PHP/Development knowledge.
You need to detect the current day (using part of code that Nicolas gave you) and then change the open hour configuration depending this current day.

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: 50
  • Thank you received: 3
11 years 2 months ago #147602

Please provide the entire code and instructions because this would be the key to allow others to use your cart for restaurants.

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

  • Posts: 12953
  • Thank you received: 1778
11 years 2 months ago #147615

Hi,
At the beginning of the file "step" of the view "checkout" that you can edit via the menu Display>Views, you should add that code:

if(date('w')==0){$closed = true;}
after the line:
$closed=false;

Last edit: 11 years 2 months ago by Mohamed Thelji.
The following user(s) said Thank You: TerryHikashop

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

  • Posts: 50
  • Thank you received: 3
11 years 2 months ago #147955

It did work. It appears that Sunday is 1 so the code is:

if(date('w')==1){$closed = true;}

and needs to be placed after the first instance of:

$closed=false;

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

  • Posts: 50
  • Thank you received: 3
11 years 2 months ago #147971

What is the code to change the open hour configuration depending the current day?

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

  • Posts: 12953
  • Thank you received: 1778
11 years 2 months ago #147984

For example if you want your store to be closed Sunday from 1 AM to 11 AM you'll have to use that kind of code :

if(date('w')==1 && date('G') <= 1 && date('G') >= 11){$closed = true;}
Note that reading that "date" php documentation will probably help you.

The following user(s) said Thank You: TerryHikashop

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

  • Posts: 50
  • Thank you received: 3
11 years 2 months ago #148207

I tried placing the code in many places. It did not work. Where exactly do I place it?

if(date('w')==1 && date('G') <= 1 && date('G') >= 11){$closed = true;}

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

  • Posts: 12953
  • Thank you received: 1778
11 years 2 months ago #148299

You'll just have to replace this code :

if(date('w')==1){$closed = true;}
And add that code for example :
if(date('w')==1 && date('G') <= 1 && date('G') >= 11){$closed = true;}

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

  • Posts: 50
  • Thank you received: 3
11 years 2 months ago #148407

I have success on closed Sunday.
How to have store open Monday - Thursday: Noon - 9 p.m. and Friday - Saturday: Noon - 10 p.m.?

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

  • Posts: 26235
  • Thank you received: 4036
  • MODERATOR
11 years 2 months ago #148413

Hi,

Replace

		$open_hour = $this->config->get('store_open_hour',0);
		$close_hour = $this->config->get('store_close_hour',0);
		$open_minute = $this->config->get('store_open_minute',0);
		$close_minute = $this->config->get('store_close_minute',0);
By
		$open_hour = $this->config->get('store_open_hour',0);
		$close_hour = $this->config->get('store_close_hour',0);
		$open_minute = $this->config->get('store_open_minute',0);
		$close_minute = $this->config->get('store_close_minute',0);
		if(date('w')==1) { // Monday
			$open_hour = 9;
			$close_hour = 22;
			$open_minute = 0;
			$close_minute = 0;
		}

And replace
			$current_hour = hikashop_getDate(time(),'%H');
			$current_minute = hikashop_getDate(time(),'%M');
			$closed=false;
By
			$current_hour = hikashop_getDate(time(),'%H');
			$current_minute = hikashop_getDate(time(),'%M');
			$closed=false;
			if(date('w')==0) { // Sunday
				$closed=true;
			}

Please understand that we won't provide you more PHP code for that. It will become more than custom development than support.
If you want to go further, please look for a PHP developer.

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.
The following user(s) said Thank You: TerryHikashop

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

  • Posts: 50
  • Thank you received: 3
11 years 1 month ago #149357

The Hikashop value returned in the check for time is correct and how I want it and it is the same time as my location.
But where do you get the day of the week from?
The day of the week check in Hikashop is returning the value of UTC time which is different than my location and right now is Monday when it is actually 8 pm Sunday here, so my store opens back up, thinking it is Monday.
I tried replacing the 3 occurances of "time()" by "new JDate()" without success.

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

  • Posts: 83831
  • Thank you received: 13572
  • MODERATOR
11 years 1 month ago #149381

It's probably because of your timezone difference. You would have to add the timezone difference to the timestamp returned.
For example:
echo time(); //will return the UTC timestamp
echo (time()+3*60*60); //will return the UTC timestamp plus 3 hours (3*60*60 is the number of seconds in 3 hours).

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

  • Posts: 50
  • Thank you received: 3
11 years 1 month ago #149482

But the store does open and close at the correct time on other days. So isn't it something with your code?

Example:
In views/step I have the store set to close on Sunday.
In configuration I set the open and close time of 12 and 21. That is exactly when the store opens and closes on all other days.
However on Sunday at 20 hours, (8 pm Sunday here, USA Eastern time, with is midnight UTC because UTC is + 4 hours from here) my store opens back up, because it is thinking it is Monday?

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

  • Posts: 83831
  • Thank you received: 13572
  • MODERATOR
11 years 1 month ago #149495

Why would it be something with the code of HikaShop ? The fact that it works with the other days means that it is with your custom code, not with the default code of HikaShop.
It's probably that line:
if(date('w')==1 && date('G') <= 1 && date('G') >= 11){$closed = true;}

You probably need to adapt the conditions for the timezone difference.

Please understand that we're already way past normal support here... If you need to do advanced PHP modifications without any PHP knowledge, and that you don't want to read and understand the documentation of the date function that we gave you, please look for a third party developer to help you with the modifications you want.

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

  • Posts: 50
  • Thank you received: 3
11 years 1 month ago #149740

After all this work, I have failed to set anything as desired. My step file is back to default. I just have a store open 7 days a week from 12 pm to 9 pm. I want my store open from 12-9 M-Th and 12-10 F-S. Closed Sunday.

The drop down selections in configuration are too limiting.

Please consider making the functionality I need as part of the baseline business software set in configuration drop down menus.
We should be able to have the store open when we want.

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

Time to create page: 0.550 seconds
Powered by Kunena Forum