Author Topic: Buying goods from the shop  (Read 3067 times)

Offline Iehova

Buying goods from the shop
« on: October 21, 2006, 06:48:16 am »
Sorry, that wasn't a very descriptive title.

What I'm looking for is to have it so that when a member purchases an item from the shop the money is sent to a specific account, rather than simply disappearing.

Can anyone help? The sooner I get this sorted the better. :)

Thanks,

Iehova

Offline Basil Beard

Re: Buying goods from the shop
« Reply #1 on: October 21, 2006, 07:09:09 am »
Interesting idea! Also very simple to code =D.

Ok. Open Shop-Buy.php

Find a line like this:
Code: [Select]
            $result = db_query("UPDATE {$db_prefix}members
                                SET money = money - {$row['price']}
                                WHERE ID_MEMBER = {$ID_MEMBER}
                                LIMIT 1",
                                __FILE__, __LINE__);

Add this:

Code: [Select]
            $result = db_query("UPDATE {$db_prefix}members
                                SET money = money + {$row['price']}
                                WHERE ID_MEMBER = XXXX
                                LIMIT 1",
                                __FILE__, __LINE__);

Where XXXX is the ID of the specific account you want to give the money to.
Arrrrr!

Offline matkins70

Re: Buying goods from the shop
« Reply #2 on: October 21, 2006, 07:18:19 am »
I have thought of implementing this before, mainly for a lottery style item, where users purchase lottery tickets, and the sales go into a lottery user account.  then the lottery is drawn, and then winner receives the winnings from the account.

I would imagine that to implement this, you would have to go into the shop-buy script, and find where it takes the users money, then add a quick db query to add the same amount to a particular account.  Daniel15 or Basil would be able to confirm this.

*Edit* Damn, beaten to it.  Told you daniel15 or basil would be the ones!!

Offline Iehova

Re: Buying goods from the shop
« Reply #3 on: October 21, 2006, 07:43:23 am »
You guys are absolutely AWESOME, thank you so much! :D