This mod allows you to selectively permit entry to the customer side of your store when the store is temporarily closed via the General options.
At the moment you are not able to test the customer side of the store when it is closed.
Mod instructions
~~~~~~~~~~
1) Apply SQL patch (via the Patch/Upgrade administration section):
INSERT INTO xcart_config VALUES ('admin_key', 'Access to site under construction', 'default', 'General', 0, 'text');
*Note that the key is set to 'default', which you change to your value
2) Replace customer/auth.php with (note the mod here is to V3.4.8):
Code:
<?
/*****************************************************************************\
+-----------------------------------------------------------------------------+
| X-Cart |
| Copyright (c) 2001-2003 Ruslan R. Fazliev <rrf@rrf.ru> |
| All rights reserved. |
+-----------------------------------------------------------------------------+
| PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" |
| FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE |
| AT THE FOLLOWING URL: http://www.x-cart.com/license.php |
| |
| THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE |
| THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. |
| FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING |
| AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). |
| PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT |
| CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, |
| COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY |
| (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS |
| LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS |
| AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND |
| OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS |
| AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE |
| THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.|
| THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. |
| |
| The Initial Developer of the Original Code is Ruslan R. Fazliev |
| Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2003 |
| Ruslan R. Fazliev. All Rights Reserved. |
+-----------------------------------------------------------------------------+
\*****************************************************************************/
#
# $Id: auth.php,v 1.29.2.1 2003/06/02 11:57:42 svowl Exp $
#
# Rubyaryat Shop closed mod. 2003/25/03. V3.4x.
x_session_register("admin_key");
if ($_GET["admin_key"]) {
$admin_key = $_GET["admin_key"];
}
if (($config["General"]["shop_closed"] == "Y" && $admin_key != $config["General"]["admin_key"] )) {
#mod end
#
# Close store front
#
if (file_exists("./".$shop_closed_file))
$shop_closed_file = "./".$shop_closed_file;
else
$shop_closed_file = "../".$shop_closed_file;
if ($fp = @fopen($shop_closed_file, "r")) {
echo fread($fp, filesize($shop_closed_file));
fclose($fp);
}
else {
echo "Sorry, the shop temporarily unaccessible. Try again later.";
}
exit();
}
#
# Display
#
x_session_register("wlid");
if ($HTTP_GET_VARS["wlid"])
$wlid = $HTTP_GET_VARS["wlid"];
$smarty->assign("wlid", $wlid);
#
# Browser have disabled/enabled javasript switching
#
x_session_register("js_enabled", "Y");
if (!isset($js_enabled)) $js_enabled="Y";
if ($HTTP_GET_VARS["js"]=="y")
$js_enabled = "Y";
elseif ($HTTP_GET_VARS["js"]=="n")
$js_enabled = "";
if ($js_enabled == "Y") {
$qry_string = ereg_replace("(&*)js=y", "", $QUERY_STRING);
$js_update_link = $PHP_SELF."?".($qry_string?"$qry_string&":"")."js=n";
}
else {
$qry_string = ereg_replace("(&*)js=n", "", $QUERY_STRING);
$js_update_link = $PHP_SELF."?".($qry_string?"$qry_string&":"")."js=y";
}
$smarty->assign("js_update_link", $js_update_link);
$smarty->assign("js_enabled", $js_enabled);
$current_area="C";
include "../include/partner_info.php";
include "../customer/referer.php";
include "../include/check_useraccount.php";
include "../include/get_language.php";
include "../customer/minicart.php";
include "../include/atracking.php";
if($active_modules["Interneka"]) {
include "../modules/Interneka/interneka.php";
}
if($active_modules["Subscriptions"]) {
if ($login) {
include "../modules/Subscriptions/get_subscription_info.php";
$smarty->assign("user_subscription", is_user_subscribed($login));
}
}
$pages_menu = func_query("SELECT * FROM $sql_tbl[pages] WHERE language='$store_language' AND active='Y' AND level='E'
ORDER BY orderby, title");
$smarty->assign("pages_menu", $pages_menu);
$smarty->assign("redirect","customer");
?>
3) In the Admin/General Settings, there is now a field called 'Access to site under construction: '.
Enter a
password and hit update.
4) When the store is closed, via the 'Check this to close your shop temporarily: ' option, you (or anyone you choose to give the password to) will be able to access your store via:
http://yoursiteURL/
pathtoyourstore/customer/home.php?admin_key=
password
Where
password is the password you entered into the admin configuration.
Hope this helps someone,
Rubyaryat