I know you're busy, but, when you have the chance...I'm not sure what I'm messing up and I'm by no means an experienced coder...but I'm getting this error:
Quote:
Fatal error: Uncaught exception 'Resource\Exception\NosuchElementException' in /hermes/bosoraweb162/b1009/ipg.ferrepetscom/classes/resource/collection/linkedhashmapiterator.php:83 Stack trace: #0 /hermes/bosoraweb162/b1009/ipg.ferrepetscom/classes/resource/collection/entrylinkediterator.php(26): Resource\Collection\LinkedHashMapIterator->nextEntry() #1 /hermes/bosoraweb162/b1009/ipg.ferrepetscom/view/shopview.php(47): Resource\Collection\EntryLinkedIterator->next() #2 /hermes/bosoraweb162/b1009/ipg.ferrepetscom/classes/class_frontcontroller.php(100): ShopView->index() #3 /hermes/bosoraweb162/b1009/ipg.ferrepetscom/index.php(74): FrontController->render() #4 /hermes/bosoraweb162/b1009/ipg.ferrepetscom/index.php(78): IndexController::main() #5 {main} thrown in /hermes/bosoraweb162/b1009/ipg.ferrepetscom/classes/resource/collection/linkedhashmapiterator.php on line 83
|
Here's my shopview:
PHP Code:
<?php
use Resource\Collection\LinkedList;
class ShopView extends View{
public function index(){
$document = $this->document;
$document->setTitle($this->lang->access);
$typeForm = new Form("shoptypes", "shop", "post");
$typeSelection = new DropdownList("shoptype");
$typeSelection->add(new Option("Itemshop", "itemshop"));
$typeSelection->add(new Option("Adoptshop", "adoptshop"));
$typeForm->add($typeSelection);
$typeForm->add(new Button("Go", "submit", "submit"));
$document->add($typeForm);
$shopList = $this->getField("shopList");
$document->addLangvar($this->lang->select);
$shopTable = new TableBuilder("shoplist");
$shopTable->setAlign(new Align("center", "middle"));
$shopTable->buildHeaders("Enter", "Sells", "Description", "Location");
$shopTable->setHelper(new ShopTableHelper);
$iterator = $shopList->iterator();
while($iterator->hasNext()){
$entry = $iterator->next();
$shop = $shopList->createshop($entry->getKey());
$cells = new LinkedList;
$cells->add(new TCell($shopTable->getHelper()->getShopStatus($shop)));
if($shop->status == "open") {
if ($shop->shoptype == "itemshop"){ $cells->add(new TCell("Items")); }
if ($shop->shoptype == "adoptshop"){ $cells->add(new TCell("Pets")); }
$cells->add(new TCell($shop->description));
$cells->add(new TCell($shop->category));
# $cells->add(new TCell($shopTable->getHelper()->getSalestax($shop->salestax)));
}
if($shop->status == "closed") {
$cells->add(new TCell(""));
$cells->add(new TCell("Not Open."));
$cells->add(new TCell(""));
}
$shopTable->buildRow($cells);
} {
$entry = $iterator->next();
$shop = $shopList->createshop($entry->getKey());
$cells = new LinkedList;
$cells->add(new TCell($shopList->getshopimage($shop->imageurl)));
$cells->add(new TCell($shop->category));
$cells->add(new TCell($shop->shoptype));
$cells->add(new TCell($shop->shopname));
$cells->add(new TCell($shop->description));
$cells->add(new TCell($shopTable->getHelper()->getSalestax($shop->salestax)));
$cells->add(new TCell($shopTable->getHelper()->getShopStatus($shop)));
$shopTable->buildRow($cells);
}
$document->add($shopTable);
}
public function browse(){
$document = $this->document;
$document->setTitle($this->lang->welcome);
$shop = $this->getField("shop");
$shop->display();
}
public function purchase(){
$mysidia = Registry::get("mysidia");
$cost = $this->getField("cost");
$document = $this->document;
if($mysidia->input->post("shoptype") == "itemshop"){
$document->setTitle($this->lang->global_transaction_complete);
$document->addLangvar("{$this->lang->purchase_item}{$cost->getValue()} {$mysidia->settings->cost}");
}
elseif($mysidia->input->post("shoptype") == "adoptshop"){
$document->setTitle($this->lang->global_transaction_complete);
$document->addLangvar("{$this->lang->purchase_adopt}{$cost->getValue()} {$mysidia->settings->cost}");
}
else return;
}
}
?>
And here's my shoptablehelper:
PHP Code:
<?php
/**
* The ShopTableHelper Class, extends from the TableHelper class.
* It is a specific helper for tables that involves operations on shops.
* @category Resource
* @package Helper
* @author Hall of Famer
* @copyright Mysidia Adoptables Script
* @link http://www.mysidiaadoptables.com
* @since 1.3.3
* @todo Not much at this point.
*
*/
class ShopTableHelper extends TableHelper{
/**
* Constructor of ShopTableHelper Class, it simply serves as a wrap-up.
* @access public
* @return Void
*/
public function __construct(){
parent::__construct();
}
/**
* The getSalestax method, formats and retrieves the salestax of a shop.
* @param Int $salestax
* @access public
* @return String
*/
public function getSalestax($salestax){
return "{$salestax}%";
}
/**
* The getShopstatus method, returns the shop status with an enter link or a closed message.
* @param Shop $shop
* @access public
* @return Link|String
*/
public function getShopStatus($shop){
if($shop->status == "open") return new Link("shop/browse/{$shop->shopname}", new Image($shop->imageurl));
if($shop->status == "closed") return "<img src='{$shop->imageurl}' style='opacity:0.3;'>";
else return "Closed";
}
/**
* The getItemPurchaseForm method, constructs a buy form for an itemshop table.
* @param Itemshop $shop
* @param Item $item
* @access public
* @return Form
*/
public function getItemPurchaseForm(Itemshop $shop, Item $item){
$mysidia = Registry::get("mysidia");
$buyForm = new FormBuilder("buyform", "../purchase/{$mysidia->input->get("shop")}", "post");
$buyForm->setLineBreak(FALSE);
$buyForm->buildComment("<br>")
->buildPasswordField("hidden", "action", "purchase")
->buildPasswordField("hidden", "itemname", $item->itemname)
->buildPasswordField("hidden", "shopname", $shop->shopname)
->buildPasswordField("hidden", "shoptype", "itemshop")
->buildPasswordField("hidden", "salestax", $shop->salestax);
$quantity = new TextField("quantity");
$quantity->setSize(3);
$quantity->setMaxLength(3);
$quantity->setLineBreak(TRUE);
$buy = new Button("Buy", "buy", "buy");
$buy->setLineBreak(FALSE);
$buyForm->add($quantity);
$buyForm->add($buy);
return $buyForm;
}
/**
* The getAdoptPurchaseForm method, constructs a purchase form for an adoptshop table.
* @param Adoptshop $shop
* @param Adoptable $adopt
* @access public
* @return Form
*/
public function getAdoptPurchaseForm(Adoptshop $shop, $adopt){
$mysidia = Registry::get("mysidia");
$buyForm = new FormBuilder("buyform", "../purchase/{$mysidia->input->get("shop")}", "post");
$buyForm->setLineBreak(FALSE);
$buyForm->buildComment("<br>")
->buildPasswordField("hidden", "action", "purchase")
->buildPasswordField("hidden", "adopttype", $adopt->type)
->buildPasswordField("hidden", "shopname", $shop->shopname)
->buildPasswordField("hidden", "shoptype", "adoptshop")
->buildPasswordField("hidden", "salestax", $shop->salestax);
$buy = new Button("Buy", "buy", "buy");
$buy->setLineBreak(FALSE);
$buyForm->add($buy);
return $buyForm;
}
/**
* Magic method __toString for ShopTableHelper class, it reveals that the object is a shop table helper.
* @access public
* @return String
*/
public function __toString(){
return new String("This is an instance of Mysidia ShopTableHelper class.");
}
}
?>
Are you able to spot my mistake?