Jump to content
olsonsp4c

Store Mode (Open | Closed | Maintenance)

Recommended Posts

I've chosen this contribution over the other ones for 'store closed' type contributions due to the added maintenance option, yet I seem to have encountered a problem.

 

When I put the store into a 'Closed' status, rather than getting the message advising that the store is closed, my page displays the following:

 

CLOSED_MESSAGEDate and Time

 

Now, here is the PHP code from the index.php file

 

<?php
// BOF: Store Mode  -  CRC
 if (STORE_MODE == 'Closed') {
?>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td class="storeClosed" align="center"><?php echo CLOSED_MESSAGE . ONLINE_DATE_TIME ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 }
// EOF: Store Mode
?>

 

Please, if someone could help me with this, I'd be most grateful.

 

Naloomi

 

 

It's not defined. The "CLOSED_MESSAGED" That is. You could simply define it there if you wanted ie;

 

define('CLOSED_MESSAGED', 'We are temporarily closed');

 

before it.

 

What you missed in the instructions was this

 

**********

* STEP 2 *

**********

 

in catalog/includes/languages/english/index.php

 

Find the ENDING:

 

?>

 

Insert this BEFORE:

 

define('CLOSED_MESSAGE', STORE_NAME . ' is temporarily <u>closed</u>. You may create a ' . STORE_NAME . ' account, login to your ' . STORE_NAME . ' account, and add products to your shopping cart. Your shopping cart will be saved for delayed checkout.<br><br>We plan to reopen: ');


Hip Hop Jewelry | Bling Bling | Iced Out

Share this post


Link to post
Share on other sites

disregard this, post in wrong thread.

 

Sorry

Edited by blr044

Share this post


Link to post
Share on other sites

Great contribution - thank you!! I love the differing options available.

 

Is there a way to add more than ONE Adminstrator IP address? We have two or more "data entry" people working and need to allow the addresses while working with store down?

 

Thanks!

Share this post


Link to post
Share on other sites

Hi

 

The IP address is causing problems as we have multiple users that will have the ability to change the shop status, so if one closes the store, another user cannot open the store as the IP address will be wrong.

 

I can see the benefits for single users, but this is causing major problems for multiple users.

Share this post


Link to post
Share on other sites

The IP address is causing problems as we have multiple users that will have the ability to change the shop status, so if one closes the store, another user cannot open the store as the IP address will be wrong.

 

I can see the benefits for single users, but this is causing major problems for multiple users.

 

 

 

 

----> I agree, most shops (with any growth) might need a web designer, a programmer or data entry staff to access the store. With this mod installed, you simply cannot add a second ip address as it assumes that you only have one to use and only one person (ever) will login the store. Its unfortunate, its a nice mod worth of alot of praise! We are going to see if we can tweak it with multiple ip and a non-auto add ip version...

Edited by carryG

Share this post


Link to post
Share on other sites

Thank you so much for the development of this contribution. Worked the first time with absolutely no errors. Thanks again.


Do or Do Not, there is no try.

Share this post


Link to post
Share on other sites

I've just installed Store Mode and gets the following error message when adding an item to the shopping cart:

 

"Fatal error: Call to undefined method currencies::calculate_price() in public_html/catalog/includes/classes/shopping_cart.php on line 272"

 

After that the shop stops working, I can't load the main index file and I have to shut down the browser and go back to the store - since the cart is empty it works again until I add another item.

 

Does anyone know what could be wrong? - it doesn't matter whether I have the store set to "Open" or "Closed".

I've made two changes to the catalog/index.php file, one for "Product Sort" and this one for Store Mode if that helps. I've also got STS installed and some minor contributions.

 

I did try to revert back to an older version by restoring the database in "Database Backup Manager" and later ran the SQL for Store Mode again and got en error message. Realized then that I'd only restored the database for products/orders etc and not the full database - but does the fact that I ran the SQL again matter?

Share this post


Link to post
Share on other sites

I've just installed Store Mode and gets the following error message when adding an item to the shopping cart:

 

"Fatal error: Call to undefined method currencies::calculate_price() in public_html/catalog/includes/classes/shopping_cart.php on line 272"

 

After that the shop stops working, I can't load the main index file and I have to shut down the browser and go back to the store - since the cart is empty it works again until I add another item.

 

Does anyone know what could be wrong? - it doesn't matter whether I have the store set to "Open" or "Closed".

I've made two changes to the catalog/index.php file, one for "Product Sort" and this one for Store Mode if that helps. I've also got STS installed and some minor contributions.

 

I did try to revert back to an older version by restoring the database in "Database Backup Manager" and later ran the SQL for Store Mode again and got en error message. Realized then that I'd only restored the database for products/orders etc and not the full database - but does the fact that I ran the SQL again matter?

 

I figured ut what was wrong with my store - the error was in currencies.php in catalog/includes/classes - I have been busy with something else since my post and my store won't go live yet for a while so I haven't had time to look more into this until recently.

 

Now it works except when in maintenance mode where the free STS template I'm using gets screwed up... I'll see what I'll do about it later on, it works when STS is turned off and I'll probably try to make my own template from the blank template that does work...

Share this post


Link to post
Share on other sites

Hi,

 

I think I have done a mistake by set the Maintenance Mode: Testing to true. Now i could not enter admin ya.. where can i adjust the script to enable back my shop to normal?

Share this post


Link to post
Share on other sites

Hi,

 

First I would like to thank you for this contribution that I really appreciate it works perfectly fine.

 

The only problem I have now is when I tried to install the contribution "[TiM's osC Solutions] Require customers to login", the maintenance page does not load anymore the open and closed mode are functioning properly with this contribution.

 

It only adds this to the application_top.php file.

 

In /catalog/inlcudes/application_top.php

 

*** At the end of the file, find ***

 

?>

 

 

*** Before that, add ***

 

// BOF: [TiM's osC Solutions] Require customers to login

if (!defined('REQUIRE_LOGIN')) {

tep_db_query(

"insert into configuration

(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function)

VALUES ('Require login', 'REQUIRE_LOGIN', 'false', 'Require users to login before they can see the catalog. This redirects any guests to the login page.', '1', '22', now(), null, 'tep_cfg_select_option(array(\'true\', \'false\'),');"

);

define('REQUIRE_LOGIN', 'false');

}

 

if (!tep_session_is_registered('customer_id') && REQUIRE_LOGIN == 'true') {

if (!in_array(basename($PHP_SELF), array(FILENAME_LOGIN, FILENAME_LOGOFF, FILENAME_PASSWORD_FORGOTTEN, FILENAME_CONTACT_US, FILENAME_SITEMAP, FILENAME_CREATE_ACCOUNT, FILENAME_CREATE_ACCOUNT_SUCCESS))) {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

}

// BOF: [TiM's osC Solutions] Require customers to login

 

I don't know exactly how to add a check that if STORE_MODE is in maintenance mode, to define('REQUIRE_LOGIN', 'false');

 

and I'm not sure if it's the right place to modify or should the maintenance_index.php file should be modified in some way instead.

 

Any help would be greatly appreciated.

 

Thanks.

Share this post


Link to post
Share on other sites

Hi,

 

I think it was too obvious for me who don't know much about PHP, I got my self a book and found out that I just needed to add the maintenance_index.php file to the list of excluded files, so that it reads like this.

 

// BOF: [TiM's osC Solutions] Require customers to login

if (!defined('REQUIRE_LOGIN')) {

tep_db_query(

"insert into configuration

(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function)

VALUES ('Require login', 'REQUIRE_LOGIN', 'false', 'Require users to login before they can see the catalog. This redirects any guests to the login page.', '1', '22', now(), null, 'tep_cfg_select_option(array(\'true\', \'false\'),');"

);

define('REQUIRE_LOGIN', 'false');

}

 

if (!tep_session_is_registered('customer_id') && REQUIRE_LOGIN == 'true') {

if (!in_array(basename($PHP_SELF), array(FILENAME_LOGIN, FILENAME_LOGOFF, FILENAME_PASSWORD_FORGOTTEN, FILENAME_CONTACT_US, FILENAME_SITEMAP, FILENAME_CREATE_ACCOUNT, FILENAME_CREATE_ACCOUNT_SUCCESS, MAINTENANE_INDEX.PHP))) {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

}

// BOF: [TiM's osC Solutions] Require customers to login

 

 

For those who like me are begining with PHP.

Share this post


Link to post
Share on other sites

I get this message when i set the store to Maintenance:

 

Fatal error: Cannot redeclare do_magic_quotes_gpc() (previously declared in /customers/mysite.se/mysite.se/httpd.www/includes/functions/compatibility.php:18) in /customers/mysite.se/mysite.se/httpd.www/includes/functions/compatibility.php on line 30

 

I dont understand what to fix, so any help would make me happy!

thx in advance...

Rabarbervin

Share this post


Link to post
Share on other sites

I defined it in the names.php as you can see highlighted:

 

 

define('FILENAME_COOKIE_USAGE', 'cookie_usage.php');

define('FILENAME_CREATE_ACCOUNT', 'create_account.php');

define('FILENAME_CREATE_ACCOUNT_SUCCESS', 'create_account_success.php');

define('FILENAME_DEFAULT', 'index.php');

define('FILENAME_DOWNLOAD', 'download.php');

define('FILENAME_INDEX_MAINTENANCE', 'index_maintenance.php');

define('FILENAME_INFO_SHOPPING_CART', 'info_shopping_cart.php');

define('FILENAME_LOGIN', 'login.php');

define('FILENAME_LOGOFF', 'logoff.php');

define('FILENAME_NEW_PRODUCTS', 'new_products.php');

define('FILENAME_PASSWORD_FORGOTTEN', 'password_forgotten.php');

 

 

Is this properly done?

 

 

Rabarbervin

Share this post


Link to post
Share on other sites

The error message says that you added do_magic_quotes_gpc() to your includes/functions/compatibility.php twice: one on line 18 and one on line 30. Go delete one of them.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Thx for your help!

But i cant find it in line 30, it´s only on line 18 as you can see highlited below:

 

<?php

/*

$Id$

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2010 osCommerce

 

Released under the GNU General Public License

*/

 

////

// Recursively handle magic_quotes_gpc turned off.

// This is due to the possibility of have an array in

// $HTTP_xxx_VARS

// Ie, products attributes

function do_magic_quotes_gpc(&$ar) {

if (!is_array($ar)) return false;

 

reset($ar);

while (list($key, $value) = each($ar)) {

if (is_array($ar[$key])) {

do_magic_quotes_gpc($ar[$key]);

} else {

$ar[$key] = addslashes($value);

}

}

reset($ar);

}

 

if (PHP_VERSION >= 4.1) {

$HTTP_GET_VARS =& $_GET;

$HTTP_POST_VARS =& $_POST;

$HTTP_COOKIE_VARS =& $_COOKIE;

 

 

 

Does it mean that it wants it to be written ones again in to line 30??

 

Rabarbervin

Share this post


Link to post
Share on other sites

Well, that's what the error is saying. Check that you didn't add that definition into some other file somewhere.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Hi Scott

 

I trying to install the contribution http://addons.oscommerce.com/info/8030

 

But in Step 5 and 6 i didn'f find these files on my oscommerce store: catalog/includes/template_top.php and catalog/includes/template_bottom.php

 

I don't use templates, and i don't know if these changes are necessary to contribution works

 

 

What can I do ??

 

 

Thanks

Share this post


Link to post
Share on other sites

HI.

 

 

I istalled store mode for v.22 and open/closed mode its OK, but in maintenenance something is wrong. My clients told me that when the store is in maintenance mode, they seen anything, white screen only.

 

Why ? something is wrong in my installation ? don't redirect correctly.

 

 

In other hand, can I set the time and date to open/closed my store automatically ¡????

 

Thank you very much !!!

 

 

pd. sorry for my bad english.

Share this post


Link to post
Share on other sites

goto admin/Configuration/Store Mode and make sure 'Maintenance Page' is set to index_maintenance.php.

 

make sure index_maintenance.php actually exists in the root folder of your website.

 

assuming both of those things are correct, and you haven't made any changes to index_maintenance.php, then I'm outta ideas.. ;)

Share this post


Link to post
Share on other sites

Actually one more thing, I assume you are not using english..

 

copy includes/languages/english/index_maintenance.php to includes/languages/YOUR_LANGUAGE/index_maintenance.php, changing YOUR_LANGUAGE to whatever language you are using....

Share this post


Link to post
Share on other sites

Hi SLiCK_303

 

 

index_maintenance.php are actually in my root folder

 

my language is spanish, and there are a copy of index_maintenanc.php frome english language in spanish languaga folder.

 

 

The same error. white screen

 

 

 

If I type mydomain.com/index_maintenance.php I can see the maintenance page. But something still wrong with redirection

 

 

 

Restore the last backup and reinstall ???

 

THanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×