*This may work in versions earlier than v1.3.4, but I wouldn't know.
What we'll be doing:
Inside view/shopview.php, public function index, starting from where $shopList is defined, down to the end of the while($iterator->hasNext()) loop:
Inside classes/class_shoptablehelper.php, replace public function getShopStatus with:
Notes: I have rearranged what order the columns are in and removed the Sales Tax column, as it is not something my site uses. Also? My category column is called Location, so rename as necessary.
To re-add the Sales Tax column, simply uncomment this line by removing the # at the start of it:
And add "Sales Tax" back to the end of the headers, as follows:
You can also comment out the above line entirely if you don't want a row with header names. ^^
On an unrelated note, clever users can still find their way into 'Closed' shops if they know the shop's name or have it bookmarked or whatever. Therefore, I recommend inside of classes/class_itemshop.php and classes/class_adoptshop.php to find inside public function display the statement foreach($this->items as $stockitem){ ... } and wrapping it inside if ($this->status == "open"){ ... } (being sure to close it afterward), and then adding in if ($this->status == "closed"){ $document->add(new Comment("Sorry, this shop is closed.")); } so that your shop items will be hidden from view if the shop is closed but the page is still somehow accessed.
What we'll be doing:
- the enter button will now be the shop image
- closed shops will be the shop image at a lower opacity
- the description and other details for closed shops will be hidden
- replacing the shop type with a nicer word, 'itemshop' becomes 'Items' and 'adoptshop' becomes 'Pets'
Inside view/shopview.php, public function index, starting from where $shopList is defined, down to the end of the while($iterator->hasNext()) loop:
PHP:
$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);
}
Inside classes/class_shoptablehelper.php, replace public function getShopStatus with:
PHP:
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";
}
Notes: I have rearranged what order the columns are in and removed the Sales Tax column, as it is not something my site uses. Also? My category column is called Location, so rename as necessary.
To re-add the Sales Tax column, simply uncomment this line by removing the # at the start of it:
PHP:
# $cells->add(new TCell($shopTable->getHelper()->getSalestax($shop->salestax)));
And add "Sales Tax" back to the end of the headers, as follows:
PHP:
$shopTable->buildHeaders("Enter", "Sells", "Description", "Location", "Sales Tax");
You can also comment out the above line entirely if you don't want a row with header names. ^^
On an unrelated note, clever users can still find their way into 'Closed' shops if they know the shop's name or have it bookmarked or whatever. Therefore, I recommend inside of classes/class_itemshop.php and classes/class_adoptshop.php to find inside public function display the statement foreach($this->items as $stockitem){ ... } and wrapping it inside if ($this->status == "open"){ ... } (being sure to close it afterward), and then adding in if ($this->status == "closed"){ $document->add(new Comment("Sorry, this shop is closed.")); } so that your shop items will be hidden from view if the shop is closed but the page is still somehow accessed.
Last edited: