Freelance Jobs

Freelance Projects, Freelance Writing Jobs


Wp Plugin/ Mysql/php Amends Oct 02, 2009

$sSql = “CREATE TABLE `” . $tblOrders . “` (
`id` bigint(20) NOT NULL auto_increment,
`user_id` int(11) unsigned default NULL,
`branch_id` int(11) unsigned default NULL,
`team_id` int(10) unsigned default NULL,
`account_number` varchar(255) default NULL,
`account_name` varchar(255) default NULL,
`invoice_number` varchar(255) default NULL,
`create_time` int(11) default NULL,
`approved` tinyint(1) unsigned NOT NULL default ‘0′,
PRIMARY KEY(`id`))”;

$sSql = “CREATE TABLE `” . $tblOrderDetail . “` (
`order_id` bigint(20) unsigned default NULL,
`product_id` int(10) unsigned default NULL,
`quantity` int(11) unsigned NOT NULL default ‘0′,
`value` int(11) unsigned NOT NULL default ‘0′ )”;

$sSql = “CREATE TABLE `” . $tblProducts . “` (
`id` int(11) unsigned NOT NULL auto_increment,
`cat_id` int(11) unsigned default NULL,
`name` varchar(255) NOT NULL default ”,
`distributer_code` varchar(255) default NULL,
`point` int(11) unsigned NOT NULL default ‘0′,
PRIMARY KEY(`id`))”;

We have a php/mysql wordpress plugin which records orders, details of the order based on a list of products. See table definitions below.

I need to add to the plugin the ability to add a code like
[ADDORDER 2]
To a page which does the following.

Note: All the pages with this code on will only be displayed to logged in users. (Hopefully!)
Also the 2 in the shortcode above is a product id from the product table.

1. Check is the user logged in – if not logged in there is nothing to do.
2. do the following meta data
global $wpdb, $current_user;
$userId = $current_user->ID;
$branchId = get_usermeta( $userId, ‘branch_id’ );
$teamId = intval( get_usermeta( $userId, ‘team_id’ ) );

3. Get product id from code (2 in the example)

4. Check if there is already an order with this product in the order details. If so then nothing to do.

5. Create an order with account number 999999, account name ‘Bonus’, invoice_number 999999 time now and approved 1

6. create the order details for this order using the product id, quantity of 1 and value 1

You need to use wpdb-> wordpress php code. There is plenty of example code in the plugin.

I will give you FTP access to the wordpress blog and a wordpress admin login

Simple enough Wordpress php/mysql change.

Place bid

Freelance Jobs
Email This Project Email This Project

Get daily jobs to your email address,
Subscribe to Online Freelance Projects Feeds NOW!



  • Latest Freelance Projects

  • Get Custom Work Done for Your Website!

  • Cheap & reliable webhosting. Only $4.95 per month!
  • Cheap & reliable webhosting. Only $4.95 per month!
  • Your Ads Here