Thread: Mys 1.3.4 Shop Listing Display
View Single Post
  #12  
Old 05-23-2015, 12:49 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 89,034
Kyttias is on a distinguished road
Default

I can tell you that the index function is wrong in shopview.php.

This is the original index function:
PHP Code:
    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("Image""Category""Type""Name""Description""Sales Tax""Enter");    
        
$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($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);  
    } 
This is what it needs to be:
PHP Code:
    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);
        }  
        
$document->add($shopTable);  
    } 
Or, basically, I replaced lines 19 through 40 in the original document with the ones from my first post. From where $shopList is defined to the end of the while loop, leaving everything before $shopList is defined intact, and leaving everything after the end of the while loop intact.
__________________
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.
Reply With Quote