SMF Shop
SMFShop => Requested additions => Topic started by: CuTe_MaN on June 05, 2007, 03:29:37 pm
-
Hello all,
I have an idea to use it with the shop, is it possible to let the Trade centre open certain time a day or a week or somthing that is set by the admin and also the bank is it possible to make the same?
I am planning to allow users to sell thier products at a certain time or certain day only
and they can also entre the bank at certain time so they cant deposit or withdrawl only at the time that admin specify.
Thx
CuTe_MaN
-
This shouldn't be too hard to code. php has a built in date function that allows you to extract the current date. You can use that, along with an if-statement, to not show any bank functions if the time isn't right. In shop-bank.php find
isAllowedTo('shop_bank');
and add
if (//put your time frame here. Google the php date function to find how this works) {
and add the end add
}
else {
$context['shop_buy_message'] = 'You are not allowed to access the bank at this time';
// Set the page title
$context['page_title'] = $txt['shop'] . ' - ' . $txt['shop_bank'];
// Use the 'message' template
$context['sub_template'] = 'message';
}
A couple of examples of how your if statement might work:
Taking the Sabbith(bank closed on sunday)
if (date('w') != 0) {
Only weekends:
if (date('w') == 0 || date('w') == 6) {
Only open 9-5
if (9 <= date('G') < 17) {
Of course, there are many many other things you can do. Look here for how the date function works:
http://us.php.net/date
Edited by Daniel15: Fixed formatting