Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.3.x Mods

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-15-2014, 03:50 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,343
Kyttias is on a distinguished road
Arrow Shop Listing Display

*This may work in versions earlier than v1.3.4, but I wouldn't know.

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 Code:
        $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 Code:
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 Code:
# $cells->add(new TCell($shopTable->getHelper()->getSalestax($shop->salestax))); 
And add "Sales Tax" back to the end of the headers, as follows:
PHP Code:
$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.
__________________
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; 12-15-2014 at 04:11 AM.
Reply With Quote
 

Tags
shop image, shops


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
Mys v1.3.4 Item Shop Mod(s): NPC + Item Display + Tooltips Kyttias Mys v1.3.x Mods 55 06-19-2020 11:21 AM
Display on Phone? Glow Questions and Supports 1 01-05-2015 08:56 AM
Changing Shop and Item Display? Abronsyth Questions and Supports 2 12-16-2014 03:25 PM
Display AdoptSpotlight anywhere? c: pachoofoosh Questions and Supports 11 07-07-2013 02:53 PM
Display codes for all of your adoptables kisazeky Questions and Supports 9 09-03-2010 03:32 PM


All times are GMT -5. The time now is 07:21 AM.

Currently Active Users: 9729 (0 members and 9729 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