Magento SQL Average Total Orders Per Customer

First we need to get the total number of orders: $result = mysqli_query($con,” SELECT count(mg_sales_flat_order.status) as grand_count FROM mg_sales_flat_order WHERE mg_sales_flat_order.status NOT LIKE ‘canceled’ AND mg_sales_flat_order.status NOT LIKE ‘closed’ AND mg_sales_flat_order.status NOT LIKE ‘fraud’ AND mg_sales_flat_order.status NOT LIKE ‘holded’ AND mg_sales_flat_order.status NOT LIKE ‘paypal_canceled_reversal’ $totalorders1 = $row[‘grand_count’]; “); while($row = mysqli_fetch_array($result)) { $totalorders = $row[‘grand_count’]; […]

Magento SQL Repeat Customers vs New Customers

First off get the total number of customers: SELECT COUNT(*) AS grand_count FROM( SELECT customer_email FROM mg_sales_flat_order WHERE mg_sales_flat_order.status NOT LIKE ‘canceled’ AND mg_sales_flat_order.status NOT LIKE ‘closed’ AND mg_sales_flat_order.status NOT LIKE ‘fraud’ AND mg_sales_flat_order.status NOT LIKE ‘holded’ AND mg_sales_flat_order.status NOT LIKE ‘paypal_canceled_reversal’ GROUP BY customer_email   Then get the number of new customers: SELECT COUNT(*) […]

Magento SQL Average Order Value

I need to get the AOV from our store. Simple SQL code is as follows: SELECT SUM( grand_total ) / COUNT( * ) FROM `mg_sales_flat_order` WHERE mg_sales_flat_order.status NOT LIKE ‘canceled’ AND mg_sales_flat_order.status NOT LIKE ‘closed’ AND mg_sales_flat_order.status NOT LIKE ‘fraud’ AND mg_sales_flat_order.status NOT LIKE ‘holded’ AND mg_sales_flat_order.status NOT LIKE ‘paypal_canceled_reversal’ Instead of using grand_total there […]

Woocommerce

I have recently started working with Woocommerce, after¬†years of being developing on Magento. ¬†The reason for me learning to develop on Woocommerce is simple, it’s very easy to develop on and the main reason I’ve been using it is due to it’s brilliant subscription engine extension. Woo’s subscription engine module is fair superior to the […]


Notice: ob_end_flush(): failed to send buffer of zlib output compression (0) in /home/wwwwebam/public_html/blog/wp-includes/functions.php on line 4339