Jump to content

Prestashop - open/closed ?


Recommended Posts

Hi!
Is there a way to change the state of the shop to closed (during night when the stuff is missing).
Something like the message for maintenance, but in more elegant way.
To be possible to create accounts and so on, but without 'check out' option.
Thanks in advance!

ps. I strongly believe that Prestashop is the best e-Commerce software!

Link to comment
Share on other sites

  • 10 months later...

Yes, I came up with a solution that barely works. I will share it with you and lets hope that someone will get into it.
In file cart.php where is the line:

$add = Tools::getIsset('add') ? 1 : 0; 


you add this code:

$workday = date("N");
$workhour = date("G");
if( ($workday >= 1) && ($workday <= 5) && ($workhour >= 12) && ($workhour <= 21)){
// presta string
$add = Tools::getIsset('add') ? 1 : 0;
}
else {
   if( ($workday == 6) && ($workhour >= 10) && ($workhour <= 13) ){
// presta string
$add = Tools::getIsset('add') ? 1 : 0;  
}
   else
    $errors[] = Tools::displayError('The shop doesn't work!');
  }



It means that the fixed worktime is from monday to friday from 12:00 to 22:00, and in saturday from 10:00 to 14:00.
That message "The shop doesn't work!" can be translated to your language by converting the string itself to md5 hash, which will look exactly 'The shop doesn't work!' = '668ab0b840a4ae6f956dddcf62886837'.
You put that string

$_ERRORS['668ab0b840a4ae6f956dddcf62886837'] = 'The shop doesnt work! in your language';


into /translations/your lang dir/errors.php
So, by this you have message on the site when the shop is not working. The annoying thing is that the message appears everytime you click on the page, not only by clicking on button 'add to cart'.
If there is someone willing to help to make it work better it will be really nice.
I already posted this issue, but no answer.

In addition I use the same script to show image with sign 'open/closed' on the website.
It's really nice, but to make it work you have to add code to heather.php, heather.tpl and global.css into your theme dir.
If someone is willing to see how I done 'open/closed' image to work, I will post it.
That of corse can be tuned up, because it doubles a code, and defines the variables $workday $workhour.
Maybe there is a chance to put it somehow to the global php files (I am not much of a programmer).
I hope that this helps.

Link to comment
Share on other sites

  • 2 weeks later...

Hi Again!
To have a image open/closed you have to do this:
add this code at the end of the file to the file header.php (before "?>")

$workday = date("N");
$workhour = date("G");
if( ($workday >= 1) && ($workday <= 5) && ($workhour >= 12) && ($workhour <= 20)){
  echo "

";
}
else {
   if( ($workday == 6) && ($workhour >= 10) && ($workhour <= 13) ){
echo "

";   
}
   else
     echo "

";
  }



After that you have to add this code to global.css file corresponding for your current theme:

/* side image open/closed */
.sideLinkField {
position: fixed;
left: 0px;
top: 100px;
}                                                                                                                                                                                         

/* non-print for open/closed */
@media print
{
.non-print { display: none; }
}



The image will stay in the left and 100px away from the top of the page. You may put it where you like.
The non-print clause remove the image while you print, so if you want to print a product it doesn't makes mess.
I hope that helps ;)
Let's hope that some day somebody will release a module for that after all.

Link to comment
Share on other sites

×
×
  • Create New...