Resolved
Apparently the moreless condition is not working for adoptables on my website. For several adoptables I have the limit set to 1 or 2, and yet users are able to adopt 10+ with no issue (and looking through old threads I see this has been an issue for a while now).
Note; this is only happening for Promo and shop adoptables, the condition is working just fine for free adoptables not sold in shops. Looking through the files I believe this is because only adopt.php has the code that tells it to check the conditions before making the adoptable available. Shops and promocodes do not have this code, so they don't bother checking, which results in users being able to get as many of pets sold in shops and through promocodes as they like.
Does anyone know how to fix this? It's kind of really messed up the values of pets on my website. I'm going to be playing with it a bit and see if I can get it to work, so if I find it before someone else does then I will post it.
---
Here are the two snippets I found in adopt.php;
PHP Code:
$adopt = new Adoptable($id);
$conditions = $adopt->getConditions();
if(!$conditions->checkConditions()) throw new NoPermissionException("condition");
and
PHP Code:
if($total == 0) $adopts = new Null;
else{
$adopts = new Arrays($total);
$available = 0;
foreach($ids as $id){
$adopt = new Adoptable($id);
$conditions = $adopt->getConditions();
if($conditions->checkConditions()) $adopts[$available++] = $adopt;
}
if($available == 0) $adopts = new Null;
else $adopts->setSize($available);
}
if($adopts instanceof Null) throw new InvalidActionException("adopt_none");
$this->setField("adopts", $adopts);
}
So now I just need to figure out what to do with these, and where to put something like them in files that deal with promocode adopts and shop adopts.
----
Now looking at the file .../classes/class_adoptshop.php I think that the conditions snippet should be included in the display function (which I've snipped to show below), so that the code can check conditions, and if the user HAS met the moreless limit, then the adoptable is no longer displayed in the shop at all. I'm still not sure about this (as you all likely know I'm very uneducated with PHP), but I'm hoping that my speculations aren't too off.
PHP Code:
public function display(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$document->addLangvar($mysidia->lang->select_adopt);
if($this->gettotal() == 0){
$document->addLangvar($mysidia->lang->empty);
return;
}
$adoptList = new TableBuilder("shop");
$adoptList->setAlign(new Align("center", "middle"));
$adoptList->buildHeaders("Image", "Breed", "Price", "Buy");
$adoptList->setHelper(new ShopTableHelper);
$this->adopts = $this->getadopttypes();
foreach($this->adopts as $stockadopt){
$adopt = $this->getadopt($stockadopt->type);
$cells = new LinkedList;
$cells->add(new TCell($this->getadoptimage($adopt->eggimage)));
#$cells->add(new TCell($adopt->class));
#$cells->add(new TCell($adopt->type));
$cells->add(new TCell($adopt->description));
$cells->add(new TCell($adopt->cost));
$cells->add(new TCell($adoptList->getHelper()->getAdoptPurchaseForm($this, $adopt)));
$adoptList->buildRow($cells);
}
$document->add($adoptList);
}