MarketPress commerce merges with % Sales donation service.

A part of my MarketPress/GridMarket shop network motto is "shop to make a difference", giving shop merchants the option to commit a % of their sales to donate to a worthy cause.

How can I design a way for a group of MarketPress shop merchants to:
1) track % of sales on a regular basis
2) follow through with their $donations
3) and inform public of total %sales/cause

I can manually tag each product to a cause, to create a searchable tag-group for public to "shop to make a difference" (I hope).

I can manually make a page with a table to track each cause or group, and their network of participating shop merchants, to inform the public of total donations to date (I hope).

But, how do I get the data? Can MarketPress feed the super admin total sales/group? (This data may have to come from the cause or group after a donation period.)

Can MarketPress work with a community or group plugin function? Would this help?

cause = community group
shop merchants = community members
How do I get total sales/group?
- Total sales/member?
- %sales committed/member?
= Total $donation/member?

Are there plugins that can help me do any part of this, or can MarketPress be modified to feed data to super admin from each participating shop (tag)?

I considered developing a custom plugin for this, to include making the PayPal donation per sales transaction. (But it gets tricky upon sales returns).

I have agencies waiting to find out if I can swing it with this infrastructure - to help them raise funds for their cause.

Your feedback is very welcome!
Thanks for your time.

  • Vaughan

    hiya

    you could probably get the data for total sales, you could get an idea for this by looking at the stats file

    marketpress/marketpress-includes/marketpress-stats.php & create a custom plugin.

    so in the 1st function

    function dashboard_widget() {
    		global $wpdb, $mp;
    		$year = date('Y');
    		$month = date('m');
    		$this_month = $wpdb->get_row("SELECT count(p.ID) as count, sum(m.meta_value) as total, avg(m.meta_value) as average FROM $wpdb->posts p JOIN $wpdb->postmeta m ON p.ID = m.post_id WHERE p.post_type = 'mp_order' AND m.meta_key = 'mp_order_total' AND YEAR(p.post_date) = $year AND MONTH(p.post_date) = $month");
    
    		$year = date('Y', strtotime('-1 month'));
    		$month = date('m', strtotime('-1 month'));
    		$last_month = $wpdb->get_row("SELECT count(p.ID) as count, sum(m.meta_value) as total, avg(m.meta_value) as average FROM $wpdb->posts p JOIN $wpdb->postmeta m ON p.ID = m.post_id WHERE p.post_type = 'mp_order' AND m.meta_key = 'mp_order_total' AND YEAR(p.post_date) = $year AND MONTH(p.post_date) = $month");
    
    		//later get full stats and graph
    		//$stats = $wpdb->get_results("SELECT DATE_FORMAT(p.post_date, '%Y-%m') as date, count(p.ID) as count, sum(m.meta_value) as total, avg(m.meta_value) as average FROM $wpdb->posts p JOIN $wpdb->postmeta m ON p.ID = m.post_id WHERE p.post_type = 'mp_order' AND m.meta_key = 'mp_order_total' GROUP BY YEAR(p.post_date), MONTH(p.post_date) ORDER BY date DESC");
    		?>
    		<div class="table table_content">
    			<p class="sub"><?php printf(__('This Month (%s)', 'mp'), date_i18n('M, Y')); ?></p>
    			<table>
    				<tbody>
    					<tr class="first">
    						<td class="first b<?php echo ($this_month->count >= $last_month->count) ? ' green' : ' red'; ?>"><?php echo number_format_i18n($this_month->count); ?></td>
    						<td class="t"><?php _e('Orders', 'mp'); ?></td>
    					</tr>
    					<tr>
    						<td class="first b<?php echo ($this_month->total >= $last_month->total) ? ' green' : ' red'; ?>"><?php echo $mp->format_currency(false, $this_month->total); ?></td>
    						<td class="t"><?php _e('Orders Total', 'mp'); ?></td>
    					</tr>
    					<tr>
    						<td class="first b<?php echo ($this_month->average >= $last_month->average) ? ' green' : ' red'; ?>"><?php echo $mp->format_currency(false, $this_month->average); ?></td>
    						<td class="t"><?php _e('Average Order', 'mp'); ?></td>
    					</tr>
    				</tbody>
    			</table>
    		</div>
    
    		<div class="table table_discussion">
    			<p class="sub"><?php printf(__('Last Month (%s)', 'mp'), date_i18n('M, Y', strtotime('-1 month'))); ?></p>
    			<table>
    				<tbody>
    					<tr class="first">
    						<td class="first b"><?php echo intval($last_month->count); ?></td>
    						<td class="t"><?php _e('Orders', 'mp'); ?></td>
    					</tr>
    					<tr>
    						<td class="first b"><?php echo $mp->format_currency(false, $last_month->total); ?></td>
    						<td class="t"><?php _e('Orders Total', 'mp'); ?></td>
    					</tr>
    					<tr>
    						<td class="first b"><?php echo $mp->format_currency(false, $last_month->average); ?></td>
    						<td class="t"><?php _e('Average Order', 'mp'); ?></td>
    					</tr>
    				</tbody>
    			</table>
    		</div>
    		<br class="clear"/>
    		<?php
    	}

    obviously put that in your own function.

    but the data is there, hopefully you might be able to work through that to get the data you want.

    hope this helps.

  • MoniQ

    Vaughan, wow. That is impressive. Thank you.

    Shop2Donate for cause1, I need:
    1) Total sales/shop (MarketPress, running total, annual, month?)
    2) %sales committed/shop (get from shop merchant)
    3) Total $donations/shop (get from cause1, or calculate estimate with MP data)

    How would I get an active list of all shops that support cause1?
    I was looking at the members directory plugin to get list of all users over network. Could I use that to create a page that lists all shops or "site admins" for cause1 (i.e. shop products that use cause1-tag).

    How would I create a page where all data comes together for cause1.
    I was looking at the fundraising plugin, to create a project for cause1 where I could link the directory list, and pull in MarketPress data perhaps using your function.

    How might I simplify? I do not have the php skills you have. Is there anyway to pull something together with the fundraising option, or should I focus on pulling data to super admin and build pages from there?

    What are your thoughts?

    Thank you for your time.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.