SMFShop > Requested additions

trade centre open at a certain time and also the bank

(1/1)

CuTe_MaN:
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

Basil Beard:
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


--- Code: ---isAllowedTo('shop_bank');


--- End code ---

and add

--- Code: ---if (//put your time frame here. Google the php date function to find how this works) {

--- End code ---

and add the end add


--- Code: ---}
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';

}

--- End code ---

A couple of examples of how your if statement might work:

Taking the Sabbith(bank closed on sunday)

--- Code: ---if (date('w') != 0) {

--- End code ---

Only weekends:

--- Code: ---if (date('w') == 0 || date('w') == 6) {

--- End code ---

Only open 9-5

--- Code: ---if (9 <= date('G') < 17) {

--- End code ---

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

Navigation

[0] Message Index

Go to full version