Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 09-14-2012, 04:16 PM
Aasixx's Avatar
Aasixx Aasixx is offline
.. your friendly geek. c:
 
Join Date: Nov 2011
Location: somewhere ur not.
Posts: 191
Gender: Female
Credits: 27,569
Aasixx is on a distinguished road
Default Adopt many adoptables at once.

Does anyone know how to make a code where I can set a number of adoptables (making custom adoption center/place) that they can adopt all at once? Like, let's say I set it to where you can adopt 14 horses, in the dropdown box you can choose how many you'd like to adopt 1-14 and whatever number they choose, that's how many adoptables will show up in their myadopts.php

I tried making one myself but it didn't turn out too great. Any help would be awesome! Thanks.
__________________
Reply With Quote
  #2  
Old 09-15-2012, 07:20 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 340,132
Hall of Famer is on a distinguished road
Default

Well you can just create a textfield in adopt.php in the adoption form, in which users can enter the number of adoptables they want to adopt for this particular species.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #3  
Old 09-16-2012, 01:58 PM
Aasixx's Avatar
Aasixx Aasixx is offline
.. your friendly geek. c:
 
Join Date: Nov 2011
Location: somewhere ur not.
Posts: 191
Gender: Female
Credits: 27,569
Aasixx is on a distinguished road
Default

Quote:
Originally Posted by Hall of Famer View Post
Well you can just create a textfield in adopt.php in the adoption form, in which users can enter the number of adoptables they want to adopt for this particular species.
What would I need to do to make it give that user that many adoptables? So, like I said, 14 adoptables.
__________________
Reply With Quote
  #4  
Old 09-16-2012, 10:45 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 340,132
Hall of Famer is on a distinguished road
Default

Well you can see a section of adoption form code in adopt.php like these:

PHP Code:
            $article_content $article_content."<br><img src='{$eggimage}' border='0'><br>
            <form name='form1' method='get' action='doadopt.php'>
              <p>Adoptable Name: 
                <input name='name' type='text' id='name'>
                <input name='id' type='hidden' id='id' value='
{$id}'>
                <input name='promocode' type='hidden' id='promocode' value='
{$promocode}'>
              </p>
              <p>
                <input type='submit' name='Submit' value='Adopt Me'>
            </p> 
You can add a new textfield called 'quantity' in this form section. You can place it anywhere above the submit line and below the form opening tag:

PHP Code:
<input name='number' type='text' id='number' value='1'
Now you will need to go to doadopt.php and retrieve this number from $_GET array:
PHP Code:
$id $_GET["id"];
$promocode $_GET["promocode"];
$name $_GET["name"]; 
Add below:

PHP Code:
$number $_GET['number'
The processing of multi-adopts is quite tricky, you will need a while or for loop to complete the task. Find this section of code:

PHP Code:
                // If we can adopt this creature, do the adoption
                
if($canadopt == "yes") {
                    if (
changecash(-$row->cost$GLOBALS['loggedinname'], $GLOBALS['money'])==true) {                
                        
// BEGIN the actual adoption process

                        // First we see if we have a custom name; if not, we use the default name
                        
if($name == ""$name $row->type;

                        
// Now we determine if we are using alternate images or not

                        
$alts getaltstatus($id00);

                        
// We need a unique code for the adoptable so we can show it to the user when we're done here...

                        
$code codegen(100);
                        
$genders = array('f''m');
                        
$rand rand(0,1);
  
                        
$adopts->insert("owned_adoptables", array("aid" => NULL"type" => $row->type"name" => $name"owner" => $loggedinname"currentlevel" => 0"totalclicks" => 0"code" => $code
                                        
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$rand], "lastbred" => 0));
                                                                        
                        
// Adoption complete, show the user a confirmation screen...

                        
$owned_adoptable $adopts->select("owned_adoptables", array(), "code='{$code}' and owner='{$loggedinname}'")->fetchObject();    
                        
$id $owned_adoptable->aid;

                        
$article_title $name." adopted successfully";
                        
$article_content "<img src='{$row->eggimage}'><br>{$congrats1} {$name}.  You can now manage {$name} on the 
                        <a href='myadopts.php'>My Adopts</a> page.<br><br><b><a href='myadopts.php?act=manage&id=
{$id}'>Click Here to Manage {$name}</a><br>
                        <a href='myadopts.php?act=bbcode&id=
{$id}'>Click Here to get BBCodes / HTML Codes for {$name}</a></b><br><br>
                        Be sure and <a href='levelup.php?id=
{$id}'>feed</a> {$name} with clicks so that they grow!";
                        unset(
$_SESSION["allow"]);
                        
// END the actual adoption process
                    
}
                    else {
                        
$article_title "Not enough money.";
                        
$article_content "You don't have enough {$GLOBALS['settings']['cost']} to buy this adoptable. Earn some money and then try again.";
                    }
                } 
Replace with:

PHP Code:
                // If we can adopt this creature, do the adoption
                
if($canadopt == "yes") {
                    if (
changecash(-$row->cost*$number$GLOBALS['loggedinname'], $GLOBALS['money'])==true) {                
                        
// BEGIN the actual adoption process

                      
for(0$numberi++){

                        
// First we see if we have a custom name; if not, we use the default name
                        
if($name == ""$name $row->type;

                        
// Now we determine if we are using alternate images or not

                        
$alts getaltstatus($id00);

                        
// We need a unique code for the adoptable so we can show it to the user when we're done here...

                        
$code codegen(100);
                        
$genders = array('f''m');
                        
$rand rand(0,1);
  
                        
$adopts->insert("owned_adoptables", array("aid" => NULL"type" => $row->type"name" => $name"owner" => $loggedinname"currentlevel" => 0"totalclicks" => 0"code" => $code
                                        
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$rand], "lastbred" => 0));
                                                                        
                        
// Adoption complete, show the user a confirmation screen...

                        
$owned_adoptable $adopts->select("owned_adoptables", array(), "code='{$code}' and owner='{$loggedinname}'")->fetchObject();    
                        
$id $owned_adoptable->aid;

                        
$article_title $name." adopted successfully";
                        
$article_content "<img src='{$row->eggimage}'><br>{$congrats1} {$name}.  You can now manage {$name} on the 
                        <a href='myadopts.php'>My Adopts</a> page.<br><br><b><a href='myadopts.php?act=manage&id=
{$id}'>Click Here to Manage {$name}</a><br>
                        <a href='myadopts.php?act=bbcode&id=
{$id}'>Click Here to get BBCodes / HTML Codes for {$name}</a></b><br><br>
                        Be sure and <a href='levelup.php?id=
{$id}'>feed</a> {$name} with clicks so that they grow!";
                        unset(
$_SESSION["allow"]);
                        
// END the actual adoption process
                      
}
                    }
                    else {
                        
$article_title "Not enough money.";
                        
$article_content "You don't have enough {$GLOBALS['settings']['cost']} to buy this adoptable with the entered quantity. Earn some money and then try again.";
                    }
                } 
Keep in mind that this is a drastic change of the script and I cannot promise that you won't be getting lots of unexpected errors. Lemme know if anything happens though, they should not be hard to fix.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #5  
Old 09-17-2012, 09:14 AM
Aasixx's Avatar
Aasixx Aasixx is offline
.. your friendly geek. c:
 
Join Date: Nov 2011
Location: somewhere ur not.
Posts: 191
Gender: Female
Credits: 27,569
Aasixx is on a distinguished road
Default

At first I got this after pressing "Adopt Me"
Parse error: syntax error, unexpected T_IF in /home/albisian/public_html/doadopt.php on line 17

and then I added a missing ";" for this
$number = $_GET['number']

and got a new error:
Parse error: syntax error, unexpected '=', expecting ';' in /home/albisian/public_html/doadopt.php on line 47
__________________
Reply With Quote
  #6  
Old 09-17-2012, 09:17 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 340,132
Hall of Famer is on a distinguished road
Default

Well what is line 47 for you?
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #7  
Old 09-17-2012, 09:23 AM
Aasixx's Avatar
Aasixx Aasixx is offline
.. your friendly geek. c:
 
Join Date: Nov 2011
Location: somewhere ur not.
Posts: 191
Gender: Female
Credits: 27,569
Aasixx is on a distinguished road
Default

Opened doadopt.php in Notepad++ and this is at line 47:
for(i = 0; i < $number; i++){
__________________
Reply With Quote
  #8  
Old 09-17-2012, 09:34 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 340,132
Hall of Famer is on a distinguished road
Default

Oh my what was I thinking... Replace this line with the code below:

PHP Code:
for($i 0$i $number$i++){ 
Guess I was so lost in the last Java programming assignment, which does not use dollar sign as their variable name. XD
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #9  
Old 09-17-2012, 10:14 AM
Aasixx's Avatar
Aasixx Aasixx is offline
.. your friendly geek. c:
 
Join Date: Nov 2011
Location: somewhere ur not.
Posts: 191
Gender: Female
Credits: 27,569
Aasixx is on a distinguished road
Default

Haha, it's okay. Thank you!
__________________
Reply With Quote
  #10  
Old 09-17-2012, 11:16 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 340,132
Hall of Famer is on a distinguished road
Default

No worries, I find it easier to use PHP's syntax though, since I am still at heart a PHP programmer. I am learning a Java course at school at this moment, hoping to strengthen my skills as an object-oriented programmer. Of course I try not to let this interfere with my php coding, since sometimes it can. XD
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adoptables not in Adopt Center? AlexC Questions and Supports 6 04-09-2012 10:05 AM
Would you adopt these adoptables? elfhome Other Chat 2 02-15-2011 03:54 PM
Is there a way to limit the amount of adoptables a person can adopt? crydrk Suggestions and Feature Requests 2 08-01-2009 04:34 PM
Organize adoptables on adopt.php kisazeky Questions and Supports 4 03-22-2009 07:14 PM
Remove Adoptables from adopt.php? Tequila Questions and Supports 8 03-13-2009 08:28 AM


All times are GMT -5. The time now is 01:29 PM.

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