Skip to content

Instantly share code, notes, and snippets.

View asherrard's full-sized avatar

Andrew Sherrard asherrard

  • Minneapolis, MN
View GitHub Profile
@asherrard
asherrard / salsify shopify variants formula.rb
Last active December 9, 2022 19:34
Salsify Variant name and option formula for shopify
## Because picklists have 2 values whether referencing the PATH_ID or the PATH_Name you can split them.
## The Id's will be the variant option names and the Names, will be salsify properties for pulling out values
## Salsify Picklist Property needs to be setup like the following -
ID: Color,Size,Number Of Items
Name: shirt_color,shirt_size,qty
##VALUE 2
let variantProperty = SPLIT(PATH_ID("Variant Selectors",1),',') in ##change to property of your variant selector as needed
IF(
@asherrard
asherrard / magento-export-checkboxes.js
Last active October 20, 2020 18:08
Magento2 Import exclude all attributes. Quickly exclude all attributes from magento2 product export. Useful to select 1 single attribute for export via the console
jQuery('.data-grid-checkbox-cell-inner .checkbox').prop('checked', true)
@asherrard
asherrard / clean-magento2-quote-item-table.sql
Created June 18, 2020 23:08
Cleans Magento2 Quote Item table
DELETE FROM DB.quote_item where item_id in (
select * From (
select item_id from DB.quote_item where quote_id not in (SELECT distinct entity_id FROM DB.quote)
) AS P
)
@asherrard
asherrard / js-amasty-amorderattr-payment.js
Created July 24, 2017 17:19
fix for magento formkey issues with masty order attributes extension 1.9.3
if (typeof(Payment)!='undefined'){
Payment.prototype.init = function ()
{
if ('function' == typeof(this.beforeInit))
{
this.beforeInit();
}
var elements = Form.getElements(this.form);
if ($(this.form)) {
$(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
@asherrard
asherrard / install-php-fastcgi.sh
Created February 22, 2016 20:49
Shell script for installing php fast cgi update www-data:www-date with your web user / group
sudo apt-get -y install apache2-mpm-worker
sudo apt-get -y install libapache2-mod-fastcgi php5-fpm
sudo a2dismod php5 mpm_prefork
sudo a2enmod actions fastcgi alias mpm_worker
sudo touch /usr/lib/cgi-bin/php5.fcgi
sudo chown -R www-data:www-data /usr/lib/cgi-bin
cat <<EOF >/etc/apache2/conf-available/php5-fpm.conf
<IfModule mod_fastcgi.c>
AddHandler php5.fcgi .php
Action php5.fcgi /php5.fcgi
@asherrard
asherrard / pagecache.xml
Last active September 23, 2015 17:07
Simple js function for the admin to hide and safegaurd the clear image cache on magento 1.9 but reveal with key combination
<layout>
<adminhtml_cache_index>
<reference name="cache.additional">
<block type="pagecache/adminhtml_cache_additional" name="page.cache.additional" template = "pagecache/cache/additional.phtml" />
</reference>
<!-- add your new js adminhtml file only to the cache page -->
<reference name="head">
<action method="addJs"><script>safeimagecache.js</script></action>
</reference>
</adminhtml_cache_index>
@asherrard
asherrard / Bookmarklet to create a dynamically updated google analytics bookmark
Last active November 30, 2017 15:14
Create a dynamic dated bookmarklet or bookmark for viewing google analytics data and selected report for the last 14 or (x) number of days. After getting tired of having to change the date in google analytics I wrote this little bit of js to dynamically set the date for you when you open the bookmark.
javascript:(function() {
var daysBack = 14;
var report = "trafficsources-overview";
var id = "YOUR GOOGLE ANALYTICS REPORT ID";
var today = new Date();
var from = new Date(new Date().setDate(new Date().getDate()-daysBack));
from = from.toISOString().slice(0, 10).replace(/-/g, '');
today = today.toISOString().slice(0, 10).replace(/-/g, '');
var url = "https://www.google.com/analytics/web/#report/"+ report +"/"+ id +"/%3F_u.date00%3D"+ from + "%26_u.date01%3D" + today;
location.assign(url);
@asherrard
asherrard / days-and-their-hashtags
Created October 21, 2014 13:34
THE list of unofficial approved day-naming hashtags
Monday:
#mondays
Tuesday:
#NotaThingTuesday
Wednesday:
#humpday
Thursday:
#tbt
Friday:
#fbf