Adoptables Shop - Working Again!

Forum
Last Post
Threads / Messages

Fireballchad

Member
Member
Joined
Aug 28, 2009
Messages
49
Points
0
Age
32
Mysidian Dollar
4,928
Ok I am 100% done with this version. I will make a new version with more features. But this one works and is running.
First you will need to install Sea's cash system.
http://www.rusnakweb.com/forum/showthread.php?tid=1333
Next follow my steps (I will try to do this so it makes since)
Around line 169 in your admin.php add this:
PHP:
   <input name='cba' type='radio' value='pricenum'>
Only when users pay this much BP: 
<input name='price' type='text' id='price'>
 <p>
    <input name='shop' type='checkbox' id='shop' value='enabled'> 
   Sell This In Your Shop!</p>
<br>
In your nadopt.php file add this around line 112:
PHP:
$price = $_POST["price"];
$price = secure($price);

$shop = $_POST["shop"];
$shop = secure($shop);
Still in the same file change this:
PHP:
if($cba != "always" and $cba != "promo"  and $cba != "conditions"){
$error = "You did not choose a valid scenario when this adoptable can be adopted.  Please go back and either select the Always option, the Promo option or the Conditions option.";
}
To This:
PHP:
if($cba != "always" and $cba != "promo"  and $cba != "pricenum" and $cba != "conditions"){
$error = "You did not choose a valid scenario when this adoptable can be adopted.  Please go back and either select the Always option, the Promo option or the Conditions option.";
}
Around Line 172 add this:
PHP:
//If we are using money to buy this, we should have a amount in the box...
if($cba == "pricenum" and $price == ""){
$error = "You selected that this adoptable is available for adoption only with money, but you did not enter in a money amount.  Please go back and either change this setting or type in a valid amount.";
}
if($shop == "enabled") $shop2 = "1";
Add $shop2 also add $price into the data base insert around line 251:
PHP:
mysql_query("INSERT INTO ".$prefix."adoptables VALUES ('', '$name', '$description','$eggimage','$cba','$promocode', '$freqcond', '$number','$datecond','$date','$adoptscond','$maxnumcond','$morethannum','$usergroupcond','$usergroups','$alternates','$altoutlevel','$altchance','$shop2','$price')");
Insert this in doadopt.php around line 104:
PHP:
$price=@mysql_result($result,$i,"price");
In doadopt.php use this... Again it is done for my site so it may be wierd... and my coding isn't great lol... as in not neet
PHP:
$query = "SELECT * FROM `adopts_users` WHERE `username`='$loggedinname'";
$result = mysql_query($query);
$num = mysql_numrows($result);

$i = 0;
while ($i < 1) {
$money = @mysql_result($result, $i, "money");
$newbalance = $money - $price;
$i++;
}

if ($money < $price) $get ='';
else 
mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('', '$type', '$name','$loggedinname','0','0', '$code', '','$alts','notfortrade','no')");
//This Line Above This Comment Was Moved From Around Line 138 Delete That One!
//Prevents From getting an adopt if no money.

if ($price == 0) $get = '';
else $get = '<br> Thanks for buying your Bud! Now you have '.$newbalance.' coins!';
    
    if ($money < $price) $get ='<br><br>There was an Error!<br>You Do Not Have Enough Coins';
else    
mysql_query("UPDATE `adopts_users` SET `money`='" . $newbalance . "' WHERE `username`='$loggedinname'");
// money buying addon
//prevents from going negative money.
$article_title = "You got ".$name." successfully";
$article_content = "<img src='".$eggimage."'><br>".$congrats1." ".$name.".  You can now manage ".$name." on the 
<a href='myadopts.php'>My Buds</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> ".$get." </b><br><br>";
Last But not least insert this into your data base under adopts_adoptables
Code:
`shop` tinyint(1) NOT NULL default 'NULL', and `price` int(10) NOT NULL default 'NULL'
Ok I hope it works for you
shop.php is attached it is adopt.php but shows items that cost money instead of being free and adopt.php now should show items that do not cost money.


Credit goes to Sea and Arianna for the code to get this working
Sorry for not fixing broken links and such!
 

Attachments

  • shop.php
    8 KB · Views: 3
  • adopt.php
    8.1 KB · Views: 3
RE: Item Shop - 50% Done

enddayne said:
So will this be compatible with Sea's mod? If so, I'll stop working on mine. :)

Yup it uses Sea's mod :D and the beginnings of Arianna buying pets code :D
 
RE: Item Shop - 50% Done

Ooh, awesome! :D For the items, can it use my deco mod? Because that needs a shop and is already finished, so they could maybe work together, along with the cash. :)
 
RE: Item Shop - 50% Done

Arianna said:
Ooh, awesome! :D For the items, can it use my deco mod? Because that needs a shop and is already finished, so they could maybe work together, along with the cash. :)

Yup I can try to get it into it xD. Right now I am half way scraping what I have for the store... I realized the most easy way to do this and is way easier to put out to the public... so I am cutting my losses lol and going an easier route... I might even have it done tonight we will see :)
 
RE: Item Shop - 100% Done (For Now)

hmmm the thing doesn't turn green from edits :( so this is a bump I guess but I changed my first post so it really isnt a bump >.> :)
 
RE: Item Shop - 100% Done (For Now)

I already did something like this...? Apart from the else if, there's a code pretty much exactly like this on Sea's cash thread, on the last page, I think.
 
RE: Item Shop - 100% Done (For Now)

Arianna said:
I already did something like this...? Apart from the else if, there's a code pretty much exactly like this on Sea's cash thread, on the last page, I think.

Yup you did... it didn't work lol... I made it work and added a few things like the shop page. I am sorry in that thread I put the credit for you, I forgot to on this thread I will fix it :D And I am working on adding some cool things to it. I just got it working so it separates the free from the bought. Some cool things will be setting it so an item can be set to give its clicks to one of your adopts and I am working on adding your deco mod.
 
RE: Item Shop - 100% Done (For Now)

Oh, that's weird. xD Why didn't it work? The users of my site seem to be able to be buying pets just fine. xD
 
RE: Item Shop - 100% Done (For Now)

Arianna said:
Oh, that's weird. xD Why didn't it work? The users of my site seem to be able to be buying pets just fine. xD
I have no clue... I followed your guide but I had to add a few things before it worked lol...

Also has anyone tried this yet? lol I want to know if anyone can get it to install so I can make sure I did it right lol
 
RE: Item Shop - 100% Done (For Now)

I tried it but now i do see any of my regular adoptables on the adopt page and i dont see the 1 shop item i added in shop.php :s

It took me about 3 hours to set this up and get it working, but its def worth it, thanks for this mod :)

Here is what i had to do to get it working.

You have to change the "INSERT" code to this in nadopt.php

PHP:
mysql_query("INSERT INTO ".$prefix."adoptables VALUES ('', '$name', '$description','$eggimage','$cba','$promocode', '$freqcond', 

'$number','$datecond','$date','$adoptscond','$maxnumcond','$morethannum','$usergroupcond','$usergroups','$alternates','$altoutlevel','$altchance','$shop','$price')");

And then the next problem was caused by a small typo, this is also a part you add to nadopt.php but i have corrected it, in your original guide you told it to change the value of shop2 to 1 and it should be the value of shop

PHP:
//If we are using money to buy this, we should have a amount in the box...
if($cba == "pricenum" and $price == ""){
$error = "You selected that this adoptable is available for adoption only with money, but you did not enter in a money amount.  Please go back and either change this setting or type in a valid amount.";
} if($shop == "enabled") $shop = "1";
 
RE: Item Shop - 100% Done (For Now)

I cant seem to figure this part out.

One the shop adopt page, it doesnt tell you exactly how many credits you have, it just always says "You have -1000 Credits "
 
RE: Item Shop - 100% Done (For Now)

After spending most of today on this, i have finally figured it out.

After fixing the first few problems i found out that mod wasnt subtracting the cost of the shop item from the current balance, instead it was leaving the user with minus whatever the shop item cost, for example if i had 2000 credits and i bought an adoptable for 500 , it would say my balance was -500 :s , this was due to several things.

Basically all you have to do now is edit the shop.php file and tell it to use doadopt2.php for the actual adoption (search for doadopt.php in shop.php and change it to doadopt2.php) , i have attached my doadopt2.php for you to use with everything fixed.

Thanks again for this original mod, i would never have known where to start making something like this :)

EDIT : oops, it seems i cant attach the file, so i uploaded it here :)

http://www.speedyshare.com/files/19603746/doadopt2.rar
 
RE: Item Shop - 100% Done (For Now)

gjac1 said:
After spending most of today on this, i have finally figured it out.

After fixing the first few problems i found out that mod wasnt subtracting the cost of the shop item from the current balance, instead it was leaving the user with minus whatever the shop item cost, for example if i had 2000 credits and i bought an adoptable for 500 , it would say my balance was -500 :s , this was due to several things.

Basically all you have to do now is edit the shop.php file and tell it to use doadopt2.php for the actual adoption (search for doadopt.php in shop.php and change it to doadopt2.php) , i have attached my doadopt2.php for you to use with everything fixed.

Thanks again for this original mod, i would never have known where to start making something like this :)

EDIT : oops, it seems i cant attach the file, so i uploaded it here :)

http://www.speedyshare.com/files/19603746/doadopt2.rar

Sorry for the typos I will fix them. And I am glad you got it working!
 
RE: Item Shop - 100% Done (For Now)

Sorry if I sound stupid but I've read through this topic a few times and it sounds like this mod is for adopting pets but the title says its an item shop mod. So which is it? I'm getting kinda confused or I'm missing something really obvious...
 
RE: Item Shop - 100% Done (For Now)

I really don't get it either - I wrote something totally like this on Sea's thread, and I don't know why he couldn't just expand on that. :/
 
RE: Item Shop - 100% Done (For Now)

Its a mod for adopting pets via a shop system using the cash mod by Sea.
 
RE: Item Shop - 100% Done (For Now)

However, I wrote something just like this on Sea's thread. :)
 
RE: Item Shop - 100% Done (For Now)

gjac1 said:
Its a mod for adopting pets via a shop system using the cash mod by Sea.

Alright so its not an item mod? Because then I think he should change the title. That's what was confusing me.
 
RE: Item Shop - 100% Done (For Now)

Nope its not an item mod, its to place "items" (adoptables) into a shop page so they can be purchased with credits earned using the cash system created by Sea :)
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,122
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top