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 02-16-2016, 02:43 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,745
Abronsyth is on a distinguished road
Default Adoptable Shops With Conditions

**Works perfectly with Kyttias' Know-Gender-Before-Naming Mod!

Here's a rough example of viewing the new shop page, adopting a pet, and then showing that it subtracts currency. This also allows users to name pets they are purchasing, which is a small thing but pleasant.


Why this exists:
For those who do employ adoptable shops on their sites, they'll find that the adoptable conditions (for example, the number limiting condition) do not work with adoptables purchased from shops. This can be a major head ache if your adoptables are supposed to have certain rarities, and for other reasons.

What this mod does:
This mod simply is a copy of the Adopt page, which allows for you to customize each shop page with a custom description, images, and even a custom table for the adoptables for each shop, if you like. The big part, of course, is that conditions now work so, say you have a pet that you only want users to be able to buy 3 of, once they've purchased 3 that pet no longer shows.

Who contributed to this mod:
I'd really like thank Kyttias for assisting me in getting it so that users actually do pay for the adoptables that they purchase. Couldn't have done it without her help!

How to set up this mod:
OK, so I have attached the BASE files for this mod, but they MUST be edited or they will not work with your website.

----------------------

Step One:
Download the zip file below and unzip it however you like. There should be a folder called Shop Mod, and within that a file called NAME.php, and a view and lang file. Inside of the view and lang files should be NAMEview.php and lang_NAME.php
Once you're sure you have all of this, we're ready to edit.

Step Two: Create a Shop
If you don't have one already, you're going to want to create an adoptable shop. Set the status of it to "Hidden" and everything else is up to you. Keep the name handy, since you'll need it.

Step Three: NAME.php
Now, open up NAME.php in your favorite file editor (mine is notepadd++). The first thing we'll edit is right at the top;
PHP Code:
class SHOPController extends AppController
Replace SHOP with the URL you want the shop to be viewable at. For example, I have a shop called Mao Cats, so I named my base file mao, so that users can go to .../mao to see the shop. So mine looks like this;
PHP Code:
MaoController 
And finally scroll down to find this;
PHP Code:
$ids $mysidia->db->select("adoptables", array("id"), "shop='SHOP NAME'")->fetchAll(PDO::FETCH_COLUMN); 
Change SHOP NAME to reflect that 100% same name of the shop, it must be word-for-word and even caps matter (my shop is called Mao Cats, so I changed this to Mao Cats).

Save the file, replacing NAME with whatever you put in place of SHOP. (ex: mine is mao.php) Make sure the filename is lowercase (mao.php instead of Mao.php).

Step Four: NAMEview.php
Now open up the file NAMEview.php, within the view folder. We have to change a couple of things in here. The first part is this;
PHP Code:
class SHOPView extends View
Change SHOP so that it matches whatever you changed it to in step three.

Now find this line;
PHP Code:
$document->addLangvar("{$name} with clicks so that they grow!<br><br><a href='http://YOURSITE.com/NAME'>Back to SHOP NAME</a>"); 
I add the back link for the sake of ease, so that after adopting users can go right back to the shop. You can either remove this, or you can change it to suit your site.

Now scroll down until you find this line;
PHP Code:
$adoptForm = new Form("form""SHOP""post"); 
Change SHOP to whatever you changed SHOP to in the previous steps (for me it's "mao").

Now scroll down to find this;
PHP Code:
$cost = new Comment("{$adopts[$i]->getCost()} CURRENCY"); 
Change CURRENCY to the name of your site's currency.

Now save this so that it matches the file name of the previous file, but with view tacked on (ex: for me it's maoview.php). Make sure the filename is lowercase (maoview.php instead of Maoview.php).

***Goodies***
$adoptTable = new Table("table", "", FALSE);
This line is fun because you can use it to actually customize a specific shop's table! If you create a new section in your CSS file like so, and replace "table" with your own words (for example; "maotable") and then changed TABLENAME to match that, then you can customize this specific table.
HTML Code:
#TABLENAME {stuff here}
Step Five: lang_NAME.php
Now, open up lang_NAME.php...you'll want to edit a good deal of this. The lang file displays most of the text users actually see. The first line to edit is the title;
PHP Code:
$lang['title'] = "SHOP NAME"
Just replace SHOP NAME with whatever you'd like the title to be. The next line you can use to place a shop description (or even include an image, if you like, using html);
PHP Code:
$lang['member'] = "Enter your shop description here.<br>"
It's pretty self-explanatory.
You can edit most of this text to your liking, honestly. But the only other thing I'll specifically point out is this line;
PHP Code:
$lang['adopt_none'] = "Sorry, it would seem the store is out of stock. Please come back later!"
This is the line that people will see if there is not a pet for sale, or if there are no pets due to conditions. You can leave it as-is or change it to suit your needs.

Now save this file, and replace NAME with the same thing you replaced it with for the past two files (mine is lang_mao.php).

Step Six:
Well, you're just about all done! Just upload the files to your site in the appropriate folders (NAME.php goes in the home directory, NAMEview.php goes in the view folder, and lang_NAME.php goes in the lang folder). Go check it out on your site by visiting the url .../NAME (name obviously changed to whatever you changed it to).

To create more adoptable shops like this, just repeat the process but replace all of the edits to reflect the new shop.

If you have any questions or run into any errors, let me know!
Attached Files
File Type: zip Shop Mod V2.zip (3.3 KB, 25 views)
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 02-17-2016 at 09:31 PM.
Reply With Quote
 

Thread Tools
Display Modes

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


All times are GMT -5. The time now is 02:42 AM.

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