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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-16-2016, 03:43 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 133,013
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 10:31 PM.
Reply With Quote
  #2  
Old 02-16-2016, 05:41 PM
gunpowdercat gunpowdercat is offline
Member
 
Join Date: Feb 2016
Posts: 29
Gender: Female
Credits: 1,919
gunpowdercat is on a distinguished road
Default

Did everything, but I seem to get this when I try to visit it:
Fatal error: Uncaught exception 'Exception' with message 'Fatal Error: Class AdoptsView either does not exist, or has its include path misconfigured!' in /home/felidaef/public_html/classes/class_loader.php:83 Stack trace: #0 [internal function]: Loader->load('AdoptsView') #1 /home/felidaef/public_html/classes/class_controller.php(135): spl_autoload_call('AdoptsView') #2 /home/felidaef/public_html/classes/class_appcontroller.php(115): Controller->loadView(Object(Resource\Native\String)) #3 /home/felidaef/public_html/classes/class_frontcontroller.php(71): AppController->getView() #4 /home/felidaef/public_html/index.php(73): FrontController->getView() #5 /home/felidaef/public_html/index.php(78): IndexController::main() #6 {main} thrown in /home/felidaef/public_html/classes/class_loader.php on line 83

edit; I also get this when I try to visit any user profiles;

Fatal error: Uncaught exception 'MemberNotfoundException' with message 'The specified user 3 does not exist...' in /home/felidaef/public_html/classes/class_member.php:30 Stack trace: #0 /home/felidaef/public_html/classes/class_friendlist.php(51): Member->__construct('3') #1 /home/felidaef/public_html/classes/class_userprofile.php(161): Friendlist->display() #2 /home/felidaef/public_html/classes/class_userprofile.php(82): UserProfile->getfriends(Object(Member)) #3 /home/felidaef/public_html/view/profileview.php(83): UserProfile->display('friends', Object(Member)) #4 /home/felidaef/public_html/classes/class_frontcontroller.php(100): ProfileView->view() #5 /home/felidaef/public_html/index.php(74): FrontController->render() #6 /home/felidaef/public_html/index.php(78): IndexController::main() #7 {main} thrown in /home/felidaef/public_html/classes/class_member.php on line 30

Last edited by gunpowdercat; 02-16-2016 at 05:44 PM.
Reply With Quote
  #3  
Old 02-16-2016, 06:16 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 110,780
Kyttias is on a distinguished road
Default

Other than the view page having two "?>" closing brackets at the end (one renders as plain text to the page, it works perfectly for me! Awesome~!! I'd love to see something like this done for the item shops, too... I managed a lot with my mod but it was kind of complicated in comparison. This opens up a lot of freedom for the adopt shops~~

(Unrelated: I wish it was easier to retroactively add pets to shops...? Am I missing something? I created a new one to test it, so whatever, but..... =T)

Also, this should be fairly easy to integrate with this mod, right, since it's just based on on the original adopts page?

--

gunpowdercat - Be sure everything is named properly and saved in the proper locations. The second error is unrelated since this mod does touch user profiles.
__________________
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; 02-16-2016 at 06:28 PM.
Reply With Quote
  #4  
Old 02-16-2016, 08:45 PM
Kasandra Kasandra is offline
Member
 
Join Date: Feb 2016
Posts: 11
Gender: Female
Credits: 926
Kasandra is on a distinguished road
Default

One of your animated gifs to show what these actually do before installing would be awesome, Kyttias ;)
Reply With Quote
  #5  
Old 02-16-2016, 09:13 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 110,780
Kyttias is on a distinguished road
Default

If you don't understand what this mod is for, then the default shop mod is probably good enough for your site's needs. This mod will allow further customization for those who know how to program and have ideas for custom pages. This is basically just allowing a custom page to access shop information and sell pets on behalf of a hidden shop. See my signature for information on custom pages.

I'm happy for this mod because it'll allow me to uniquely decorate each shop individually, rather than using the default adopt shop page. By default, this mod's visual appearance is 100% identical to the freely available adoption page, the only difference is that pets are not free. If you know how add your own html (again, see the custom page guide), you can easily modify the appearance of the page, add in a shop keeper, etc.
__________________
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; 02-16-2016 at 09:16 PM.
Reply With Quote
  #6  
Old 02-17-2016, 12:12 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 133,013
Abronsyth is on a distinguished road
Default

gunpowdercat, as Kyttias said one of your files is misnamed, or you did not change these lines properly;
PHP Code:
class SHOPController extends AppController
PHP Code:
class SHOPView extends View
Kassandra, I added a gif to the first post :)

Kyttias, actually I was planning on testing how your Know-Gender mod can work with this! It definitely should work, in fact the differences are very minor so you'd only have to change the wording bits in yours to customize it more. So yep, should work perfectly!
Edit: Tested and yesiree it does work! You just need to go through and do the modifications for all of the view files :)
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 02-17-2016 at 12:51 PM.
Reply With Quote
  #7  
Old 02-17-2016, 01:06 PM
gunpowdercat gunpowdercat is offline
Member
 
Join Date: Feb 2016
Posts: 29
Gender: Female
Credits: 1,919
gunpowdercat is on a distinguished road
Default

I have gone through and checked, multiple times-- There is no error in my editing, at all..

I keep getting this now;


Fatal error: Uncaught exception 'Exception' with message 'Fatal Error: Class LeopardView either does not exist, or has its include path misconfigured!' in /home/felidaef/public_html/classes/class_loader.php:83 Stack trace: #0 [internal function]: Loader->load('LeopardView') #1 /home/felidaef/public_html/classes/class_controller.php(135): spl_autoload_call('LeopardView') #2 /home/felidaef/public_html/classes/class_appcontroller.php(115): Controller->loadView(Object(Resource\Native\String)) #3 /home/felidaef/public_html/classes/class_frontcontroller.php(71): AppController->getView() #4 /home/felidaef/public_html/index.php(73): FrontController->getView() #5 /home/felidaef/public_html/index.php(78): IndexController::main() #6 {main} thrown in /home/felidaef/public_html/classes/class_loader.php on line 83

Last edited by gunpowdercat; 02-17-2016 at 01:21 PM.
Reply With Quote
  #8  
Old 02-17-2016, 01:09 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 110,780
Kyttias is on a distinguished road
Default

Does a file named leopardsview.php exist in your view folder? All the error says is that it doesn't exist. Make sure you named the files before placing them!
__________________
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
  #9  
Old 02-17-2016, 01:24 PM
gunpowdercat gunpowdercat is offline
Member
 
Join Date: Feb 2016
Posts: 29
Gender: Female
Credits: 1,919
gunpowdercat is on a distinguished road
Default

Yes, it does. and it is titled "leopardview" (I deleted and tried again, this time naming them all leopard and putting leopard in instead of leopards because I decided I did not want that name.)

http://prntscr.com/a4jb7p
Reply With Quote
  #10  
Old 02-17-2016, 01:38 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 110,780
Kyttias is on a distinguished road
Default

Have you tried it lowercase like all the other files?
__________________
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
Reply


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 08:12 AM.

Currently Active Users: 750 (0 members and 750 guests)
Threads: 4,081, Posts: 32,029, 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