Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Suggestions and Feature Requests

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-25-2015, 01:11 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 86,955
Kyttias is on a distinguished road
Question Shop Stock

Shops with 'stock' that depletes and replenishes... I'm trying to wrap my head around how I might implement this. I'm pretty good with manipulating the framework to my needs but, conceptually, I'm wondering what the best way to do this would be...

I don't want cron jobs. Surely there is another way to fudge some automation?

More database tables will be needed. I'm thinking 'stock' for current stock, a restock threshold, and a timestamp for when the item was last purchased. (In addition to the current restock threshold, its constant restock threshold -the amount it'll always reset to when the stock falls to zero.)

PHP Code:
if ((($item->stock == 0) && ($item->restockthreshold <= 0)) && (strtotime('+30 minutes'$item->timestamp) < $this->currenttime)){ 
/* 
If the item's stock and the item's current restock threshold are both zero (or less) 
and it has been more than 30 minutes since the item was last bought... 
then bump the stock available up to a positive number! 
*/ 

Which isn't pretty, but the jist is that the item's stock will eventually fall to zero. An item will restock when its stock and restock thresholds are both zero.

Each time any item in that shop is bought we'll call a function that'll decrease the restock threshold of every item in that shop whose current stock is equal to zero. Rarer items you want to restock less often should have greater restock thresholds.

In addition, every hour, the item's restock threshold will diminish by 1 every hour - this will be determined on page load of viewing shop, calculated from the last time the item was bought.

Does this sound feasible?
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 03-25-2015 at 01:15 AM.
Reply With Quote
Reply

Tags
restock, shop, stock

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Art Shop here on site! Mortain Art Gallery 0 11-20-2015 08:30 AM
Shop to buy an adoptable? SilverDragonTears Questions and Supports 8 08-16-2011 02:17 PM
System Shop sensacion Questions and Supports 0 05-08-2011 06:40 PM
Shop and... 12345 Questions and Supports 1 03-05-2009 07:59 AM
Shop? trollis76 Questions and Supports 6 02-20-2009 12:46 AM


All times are GMT -5. The time now is 10:18 AM.

Currently Active Users: 353 (0 members and 353 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636