6

I want to close my store on specific dates, like on 15 dec 2015. Is this possible with Magento?

2
  • 1
    Can I ask why you want to do this? If you don't want to have to deal with dispatching orders etc surely you can just ignore them for a few days rather than scaring away potential customers? Dec 15, 2015 at 11:09
  • we want to disable to process orders on that particular date so we want to restrict the customers not to place orders Dec 16, 2015 at 10:43

4 Answers 4

6

There are a number of different ways which you could approach achieving this. Although as Luke mentioned, why you would want to is another matter. The approach that I would suggest that gives you an offline website without having too big and impact on customer experience would be to make use of the Magento maintanance flag.

You could setup a crontab job to trigger the creation and removal of the flag to put the site into maintianance mode during the effected periods.

59 23 15 12 * touch /var/www/maintanance.flag >/dev/null 2>&1

The result of the above would create the maintianance.flag file at 23:59, 15th December 2015, 2016, 2017 etc unless modified.

Likewise, you can remove it:

59 23 16 12 * rm /var/www/maintanance.flag >/dev/null 2>&1

This would trigger on the 16th at 23:59 during the window between creation and removal all visitors to the site would be displayed a HTTP 503 message that the site is currently unavailable - you can customise the output of this page to explain to customers why they cant access the website.

1
  • sir i want to restrict the customer not to place order for the specific dates Dec 16, 2015 at 8:24
3

I think the least intrusive way is to use the Demo Store Notice function and simply change the text to say that you are closed and specify the time.

Magento admin panel and go to:

  • System > Configuration > Design option in the left menu HTML Head.
  • At the bottom of this section you will see the option Display Demo Store Notice.
  • Set to Yes
  • Click Save Config.

Copy the following file: app/design/frontend/base/default/template/page/html/notices.phtml

to app/design/frontend/default/**THEME**/template/page/html/notices.phtml (Make sure it doesnt already exist in your theme first)

Edit notices.phtml

Line 46:

 <div class="notice-inner"><p><?php echo $this->__('This is a demo store. Any orders placed through this store will not be honored or fulfilled.') ?></p></div>

Change to:

 <div class="notice-inner"><p><?php echo $this->__('Please note that we will be closed December 15 and will return on January 4th 2016, no orders will be processed during this time.') ?></p></div>

UPDATE

To address your specific issue, in addition to the above, you can remove the add to cart buttons from your list.phtml and view.phtml by commenting out the respective portions. Look for <?php echo $this->getChildHtml('addtocart') ?> and comment out by putting:

 `<!---     <?php echo $this->getChildHtml('addtocart') ?> --->`

When the date passes, remove the <!--->

2
  • and also want to stop people to order for the specific dates Dec 16, 2015 at 8:16
  • Updated answer to include a work around that would least impact your SEO
    – SR_Magento
    Dec 16, 2015 at 18:45
2

I don't understand why you want to close your store by not allowing customer to place an order, I would suggest to put a message on the homepage (or somewhere else) that you wont process the orders on that day. But as you requested to disable the order function on a specific day, you can use the following extension to disable the store based on a date:

app/etc/modules/Genmato_ClosedStoreDate.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Genmato_ClosedStoreDate>
            <active>true</active>
            <codePool>community</codePool>
        </Genmato_ClosedStoreDate>
    </modules>
</config>

app/code/community/Genmato/ClosedStoreDate/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Genmato_ClosedStoreDate>
            <version>1.0.0</version>
        </Genmato_ClosedStoreDate>
    </modules>

    <global>
        <models>
            <genmato_closedstoredate>
                <class>Genmato_ClosedStoreDate_Model</class>
            </genmato_closedstoredate>
        </models>

        <events>
            <sales_quote_save_before>
                <observers>
                    <genmato_closedstoredate>
                        <type>singleton</type>
                        <class>genmato_closedstoredate/observer</class>
                        <method>salesQuoteSaveBefore</method>
                    </genmato_closedstoredate>
                </observers>
            </sales_quote_save_before>
        </events>
    </global>
</config>

app/code/community/Genmato/ClosedStoreDate/Model/Observer.php

<?php
class Genmato_ClosedStoreDate_Model_Observer
{

    protected $_checked = false;

    /**
     * Check if current quote order amount is allowed for customer
     *
     * @param Varien_Event_Observer $observer
     */
    public function salesQuoteSaveBefore(Varien_Event_Observer $observer)
    {
        if ($this->_checked) {
            return;
        }
        $quote = $observer->getEvent()->getQuote();
        $currentDate = Mage::getModel('core/date')->date('Y-m-d');
        if ($currentDate = '2015-12-16') {
            $this->_checked = true;

            $quote->setHasError(true);
            $quote->addErrorInfo(
                'error',
                'genmato_closedstoredate',
                null,
                'Sorry, we are currently closed and don't take orders, please try again later',
                null
            );
        }
    }
}

In the observer file the date is checked (you can change the date here to the date you want). If the date matched then on the checkout cart page the button to continue to the checkout is removed and a message is shown above the cart informing the customers why they can't continue with there checkout.

If you want you can add a backend configuration to update the day that you are closed or enter multiple days.

1
  • Now that's a fantastic approach!
    – SR_Magento
    Dec 17, 2015 at 12:31
0

Here's a free extension that may work for you. If you combine it with setting crons to run the process, you can make an automatic Sabbath mode, similar to what B&H uses.

http://www.magentocommerce.com/magento-connect/sitewards-disabledproducts.html

Basically, it removes the add to cart button and replaces it with a static block CMS where you can put the message. Also, creating a site-wide banner would be good to let people know when you'll start accepting orders again.

You can then make and set crons to run and change the settings globally at certain times so it's 'hands free'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.