Category: Net: Techy: PHP

  • PHP SplFileInfo string values

    Whilst PHP’s documentation of SplFileInfo isn’t “bad” as such, it can be tricky to remember what string functions (such as getBasename, getExtension, getFilename, getPath, getPathname, getRealPath and __toString) return under which circumstances. Hence this post! To generate this data, we’re going to start off with a RecursiveDirectoryIterator with an optional callback filter (to enable us […]

  • PHP: Flow of data: WordPress – MagicMembers Plugin

    I hope this post comes in handy to any one else which has to support/deal with the MagicMembers plugin for WordPress. The [user_register\ calls mgm_content_hooks.php “function mgm_shortcode_parse” which then calls mgm_user_register_form which is in mgm_form_functions. If fetches the main registration fields using: $register_fields = mgm_get_config(‘default_register_fields’,array()); [fields such as username, email address] and the custom ones […]

  • New Relic, cPanel, Apache and FastCGI PHP

    How to install NewRelic on cPanel so that, under a PHP suPHP environment, the newrelic.appname is set dynamically to the hostname of each site

  • PHP: Magento: Extract orders based on tax status and payment type

    When you are doing your quarterly VAT returns and inputting details of your Magento shopping cart ordersinto your accounting software (such as the brilliant Crunch system), wouldn’t it be handy to be able to get a simple list of all orders between two dates, whether tax was paid on the order or not (note: this […]

  • Magento: Get customers ordered by order value

    Want to know which of your Magento e-commerce shopping cart customers have ordered the most this year? Well, I’ve written the following SQL query to help: SELECT SUM(sales_flat_order.base_total_invoiced) AS totalvalue,sales_flat_order.customer_firstname,sales_flat_order.customer_lastname,sales_flat_order.customer_email,sales_flat_order_address.street,sales_flat_order_address.city,sales_flat_order_address.region,sales_flat_order_address.postcode FROM sales_flat_order,sales_flat_order_address WHERE sales_flat_order.state=’complete’ AND sales_flat_order.created_at>’2012-01-01′ AND sales_flat_order_address.entity_id=sales_flat_order.billing_address_id GROUP BY sales_flat_order.customer_email ORDER BY totalvalue DESC