Skip to content

Instantly share code, notes, and snippets.

View groggu's full-sized avatar
🏠
Working from home

Greg Croasdill groggu

🏠
Working from home
View GitHub Profile
@groggu
groggu / post_tags.sql
Created August 3, 2022 17:30
List tags associated with wordpress posts
SELECT
wp_posts.ID AS 'Post ID' ,
wp_posts.post_title AS 'Post Title' ,
group_concat(
DISTINCT wp_terms.`name` SEPARATOR ', '
) AS 'Tags'
FROM
wp_term_relationships
JOIN wp_posts ON wp_term_relationships.object_id = wp_posts.ID
JOIN wp_term_taxonomy ON wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
@groggu
groggu / ta_reports.sql
Last active July 8, 2022 16:23
Reports for ThirstyAffiliates WordPress plugin
#Click details for last 7 days
SELECT
wp_posts.post_title as 'Link Name' ,
wp_ta_link_clicks.date_clicked ,
ip.meta_value as 'User IP Address',
redirect.meta_value as 'Affiliate Link',
cloaked.meta_value as 'Cloaked Link'
FROM
wp_ta_link_clicks
JOIN wp_posts ON wp_ta_link_clicks.link_id = wp_posts.ID
@groggu
groggu / installPorto.php
Created September 25, 2019 19:31
For use with the Porto Themes - If the Magento Proto Theme admin theme import is not working correctly, this script allows you to install themes via the command line.
<?php
/*
* Developed by Greg Croasdill
* Developed for Porto v3.1.8
* Sept 25, 2019
*
* For use with the Porto Themes (ThemeForest - http://bit.ly/2lAwRR2 or https://www.portotheme.com)
*
* Please read the Proto documentation to understand how to setup your selected Porto Theme.
*
@groggu
groggu / opcheckout.js
Last active April 18, 2016 16:49
GA Goal tracking for Magento One Page Checkout
/**
* Magento Enterprise Edition
*
* NOTICE OF LICENSE
*
* This source file is subject to the Magento Enterprise Edition End User License Agreement
* that is bundled with this package in the file LICENSE_EE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.magento.com/license/enterprise-edition
* If you did not receive a copy of the license and are unable to
@groggu
groggu / GCB.php
Last active December 19, 2019 16:12
For Fishpig WordPress Series - Custom Wordpress Short Code in Magento http://www.demacmedia.com/magento-commerce/custom-wordpress-shortcode-in-magento-with-fishpig/
<?php
/*
All extended shortcode class are extended from the helper class - Fishpig_Wordpress_Helper_Shortcode_Abstract
There are two abstract functions you must implement
public function getTag()
this functions defines [tagname].
@groggu
groggu / nsCountryCpdes.php
Created October 12, 2015 20:06
Convert standard ISO country codes to NetSuite's constants
/***
* Convert standard ISO country codes to NetSuite's world
*
* @param $isoCode
*
* @return string|bool
*/
public function convertCountryCode($isoCode)
{
@groggu
groggu / nsGetOrderRec.php
Created October 12, 2015 20:00
Get an order records from NetSuite
//assumes you are using the PHPToolKit and have already
require_once 'lib/NetSuite/NetSuiteService.php';
$service = new NetSuiteService();
//if you have the internal ID
$request = new GetRequest();
$request->baseRef = new RecordRef();
$request->baseRef->internalId = $nsOrderId;
$request->baseRef->type = "salesOrder";
@groggu
groggu / getNsPromo.php
Last active October 12, 2015 19:54
Lookup NetSuite promotion by coupon code (from custom Magento module)
//assumes you are using the PHPToolKit and have already
// require_once 'lib/NetSuite/NetSuiteService.php';
private function _getNsPromoCode($magePromoCode){
$service = new NetSuiteService();
//get the ID of the coupon by code
$searchData = new SearchStringField();
$searchData->operator = "is";
$searchData->searchValue = $magePromoCode;
@groggu
groggu / gist:c24ca84d56ee0adfd43e
Last active July 18, 2023 13:10
Here's a bit of SQL code to export all the configurable-simple product relations from a Magento database in a format that MAGMI can import!
SELECT
parent.sku as 'sku',
eav.attribute_code as 'configurable_attribute',
GROUP_CONCAT(child.sku SEPARATOR ',') as 'simples_skus'
FROM catalog_product_super_link
INNER JOIN catalog_product_entity as child ON catalog_product_super_link.product_id = child.entity_id
INNER JOIN catalog_product_entity as parent ON catalog_product_super_link.parent_id = parent.entity_id
INNER JOIN catalog_product_super_attribute as super ON super.product_id = parent.entity_id
INNER JOIN eav_attribute as eav ON eav.attribute_id = super.attribute_id
Group By parent.sku
@groggu
groggu / db_dump.sh
Created August 17, 2015 14:50
DB Dump script for Magento
#!/bin/bash
IGNORE_TABLES=( dataflow_batch_export dataflow_batch_import log_customer log_quote log_summary log_summary_type log_url log_url_info log_visitor log_visitor_info log_visitor_online report_viewed_product_index report_compared_product_index report_event index_event enterprise_logging_event_changes )
CONFIG_FILE="./app/etc/local.xml"
IGNORE_STRING=""
TMP_FILE="./var/.tmp.local.xml"
if [ ! -f "$CONFIG_FILE" ]; then
echo "$CONFIG_FILE does not exist"
exit