218967 Phpmydirectory payment system

Part 1

- Currently, the directory charges the user a set amount depending on the type of membership they choose, they pay via credit card after filling in the listing information.

- I want to change this to an 'account balance' function. I have added a 'credit my account' link in the members sidebox (visible when logged in) - you can change the href of this link to your page, in template/default/blocks/sidebox_menu.tpl. When you make this page, put the php file in the /members folder, and make sure to add the $auth function at the top (look at the existing files to see how this works, basically anything in the members folder should be protected so only members can view it).

- On this page users can enter the amount they want to add to their account. The user can type in a specific amount to add to their account in a text box, or select one of several radio boxes which give discounts for purchasing certain amounts. For example they can select 'spend $100 get $50 free", which will add $150 to the users account, but only charge them $100. Don't worry about the specific titles of these options, we can change that later. When they click 'submit' they will be taken to our chosen payment gateway, which we will decide later. When the transaction is confirmed, the specified amount will be added to the user's account and a line will be added to the transaction history table.

- A new field will need to be added to the 'users' database table to store their account balance.

- The user's current account balance will be shown on the [url removed, login to view] page (and other places where necessary).

- Obviously, this 'account balance' function will change several other aspects of the directory that will need to be modified.

Part 2

- Define a variable called $accountbalance on user_register.php. Echo it on [url removed, login to view], at the bottom.

- As you will know, when you first select a membership type when adding a listing, an onclick function is called, which redisplays the page depending on what fields are enabled for that type of membership. I have changed this drop down menu to radio buttons but it works the same way. Each membership type has a price associated with it. If the membership price is higher than the available account balance, set $accountbalance to "Your account balance is $xx.xx. You have insufficient funds, please click here to top up your account". If the account balance is greater than or equal to the membership price, set $accountbalance to "Your account balance is $[url removed, login to view]".

- This check will be repeated when the user clicks 'submit' - if there are insufficient funds to add the listing, the browser will redirect to the 'credit my account' page, and the listing will not be submitted. However if the account balance is higher than or equal to the listing fee, the listing fee will be subtracted from the account balance, and the listing will be submitted (after validation of course). This will be added to the transaction history (see below).

- If the custom_14 field (which defines if the listing is featured or not) has been set to 'YES' , then an additional fee will be deducted from the user's balance when the submit button is clicked. This fee is called $fprice, and is set near the bottom of user_register.php. It is allowed to take the account balance below zero. This will add an additional line to the transaction history table.

Part 3

- The invoicing function, currently on '[url removed, login to view]', will be renamed to 'transaction history', and changed to reflect the new account balance function. It will record all activity on the user's account balance in a table with the columns 'date, transaction description, credit, debit'. So when the user credits their account with $50, it will enter the date, '$50' in the credit column, and 'Credit card deposit' in the description column. When the user pays for a listing that costs $20, it will enter the date, '$20' in the debit column, and 'fee for listing ID #' plus the membership type.

- This may be easier if you create a new database table for the transaction history, rather than trying to modify the current invoices table.

Part 4

- If the listing/membership type is for a 'buy now' listing, the listing fee is zero, and instead, the seller is charged a percentage of the sale price when someone clicks the 'buy now' button on their listing.

- You can change the action of this button by going to near the bottom of [url removed, login to view], where it says $button = ... The final sale price of the listing is stored in the field 'finalprice' in the listings table.

When the buy now button is clicked, it will run your php script (lets call it members/[url removed, login to view]), and several things will happen.

1. It will first make sure the buy now button has not been clicked before - so check if the sold_to field is empty.

2. It will check if the user is logged in, if not, it will redirect to the user login screen and the script will abort. I think this is done easily by adding the $auth function at the top of the page (like the other scripts in the members folder).

3. Subtracts a set percentage (lets say 5%) of the sale price (the finalprice field) from the listing owner's account balance. It is allowed to go below zero. This transaction will be added to the 'transaction history' table (see Part 3 above)

4. Notifies the listing owner and the buyer of the sale via email. Just put some dummy text in these emails to start with, I will give you the final text later.

5. Remove the listing from public view (I think the best way of doing this is to set the expiry date to a date in the past.)

6. Populates some additional fields in the listings table with the date/time sold, and the IP address and user id of the buyer. I have already added these fields sold_to, sold_to_ip and sold_date in phpmyadmin.

I have added a link in template/default/blocks/[url removed, login to view] called 'My Sales'. Change the href of this to a new page you create. Through a mysql query, this will find all the listings owned by the currently logged in user that have been sold. You will know a listing has been sold if the 'date_sold' field has been filled. These results are to be displayed in search results format. Will probably be easiest for you to copy the code in members/[url removed, login to view] and just change the mysql query.

I have added a link in template/default/blocks/[url removed, login to view] called 'My Purchases'. Change the href of this to a new page you create. This is exactly the same as the 'my sales' page except it displays all the listings that the currently logged-in user has purchased. Through a mysql query, this will find all the listings where the 'buyer_id' field matches the user id of the currently logged-in user.

Users should be able to remove listings from their purchased/sold lists. I think this will require two more fields in the listing table - 'displaytobuyer' and 'displaytoseller'. They can be set to '1' by default, but if set to zero (by a 'remove from list' link, like the 'remove from watchlist' link on the watchlist page), they will stay in the DB, but not be visible anymore on the corresponding list. If you can think of a better way let me know. So this would just be added to the mysql query - on the 'my purchases' page it would only find records where 'displaytobuyer' equals '1', and on the 'my sales' page it would only find records where 'displaytoseller' equals '1'.

So this 'buy now' feature should require 3 new php files (one to execute when the button is clicked, one for the 'my purchases' link, and one for the 'my sales' link).

Kemahiran: Semua Boleh, MySQL, PHP

Lihat lagi: where i can find a sure buyer, what is a line card, we trying to function, transaction charges, top query, start up costs template, sales folder, purchased email lists, php scripts for sale, payment gateway script in php, n equals, membership transaction, i need to sale my card, how to make a line card, how to create top menu in php, how can i find email list buyer, free template price list, free radio code, enter your email address in the format, enabled plus, email lists for sale, drop card template, displays to go, define on-going, check call system

Tentang Majikan:
( 7 ulasan )

ID Projek: #1965200

Dianugerahkan kepada:


Thanks, Enayet

$525 USD dalam 7 hari
(641 Ulasan)