Skip to content

Instantly share code, notes, and snippets.

@grafikchaos
grafikchaos / Magento - Add Custom Structure Blocks.md
Last active Aug 18, 2017
HowTo: Add Custom Structural Blocks to a Layout
View Magento - Add Custom Structure Blocks.md

Overview

Recently had a client that wanted to customize the layout for a category landing page so that the category's title and description would be displayed above the layered navigation and product grid — essentially creating a full-width section above the left sidebar and main content areas.

NOTE: For reference, this is based off the blog post from Collaboration133.com's Magento - Add Custom Structural Block Reference.

Custom Module (My_LayoutMods)

I created a custom module to help organize and identify that there are some custom modifications to layout templates. Not saying you have to, but it may be easier for other's (or your future self) to recognize and find what customizations were done (and hopefully why).

@grafikchaos
grafikchaos / Add SSH Keys.md
Last active Oct 21, 2018
Quickly add SSH Key to server
View Add SSH Keys.md
$ cat ~/.ssh/id_rsa.pub | ssh USER@HOST "mkdir -p ~/.ssh; cat >> ~/.ssh/authorized_keys; chmod 700 ~/.ssh; chmod 600 ~/.ssh/authorized_keys"
@grafikchaos
grafikchaos / gist:9938618
Last active Jul 22, 2016 — forked from petemcw/gist:1169053
Magento Snippets
View gist:9938618

Magento Snippets

Add Attribute Group and Attributes to Attribute Sets

In an install script, you can follow the below example:

<?php
/**
 * Pan_JewelryDesigner Extension
@grafikchaos
grafikchaos / Cherry Picking Multiple Commits.md
Last active Sep 7, 2020
Cherry pick multiple commits from a remote or upstream branch
View Cherry Picking Multiple Commits.md
@grafikchaos
grafikchaos / README.md
Last active Dec 25, 2015
Fixes issue in Markshust_Uspsav with getting data back from the USPS Address Verification API caused by using 9-digit zipcode instead of splitting it into their expected 5-digit and 4-digit values.
View README.md

Overview


UPDATE #2:

Added the getApiEndpoint() method and overrode the uspsSubmitRequest() method in the Helper/Data.php. Basically cheating like crazy to get the domain name and it's IP address so our server will use that instead of the humanized domain name. This is a bandaid approach specific to our client and their internal DNS issues, so I wouldn't suggest using that getApiEndpoint() method unless absolutely necessary.


View puma.sh
#!/usr/bin/env bash
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`.
# Please modify the CONSTANT variables to fit your configurations.
# The script will start with config set by $PUMA_CONFIG_FILE by default
PUMA_CONFIG_FILE=config/puma.rb
PUMA_PID_FILE=tmp/pids/puma.pid
PUMA_SOCKET=tmp/sockets/puma.sock
View gist:6652282
set :stage, 'production'
set :shared_children, shared_children << 'tmp/sockets'
puma_sock = "unix://#{shared_path}/sockets/puma.sock"
puma_control = "unix://#{shared_path}/sockets/pumactl.sock"
puma_state = "#{shared_path}/sockets/puma.state"
puma_log = "#{shared_path}/log/puma-#{stage}.log"
namespace :deploy do
desc "Start the application"
@grafikchaos
grafikchaos / gist:6640682
Created Sep 20, 2013
Update DEFINER of database triggers in MySQL databases
View gist:6640682
perl -pi -e 's/DEFINER\=\`developer\`/DEFINER\=\`staging_user\`/g' my_database_dump_file.sql
@grafikchaos
grafikchaos / A_README.md
Last active Dec 22, 2015
How to patch MageParts ReorderProduct module to correctly compare Magento versions
View A_README.md

We've had to patch this module several times for different projects because it is a useful module, just doesn't do version comparison correctly which can cause bugs. We submitted our code changes to MageParts developers and documented the errors we were experiencing with their module on a Magento EE 1.12.0.2 installation, but they have yet to incorporate our bug fixes — that's why I feel the need to document what the necessary changes are to be made to the module so that it works as expected.

This code is pulled from production code, so local package names have been replaced with "MYMOD" (or mymod_ for short codes or XML configuration files)

Pre-requisites:

  • Already have a successfully installed MageParts ReorderProduct module in the app/code/community directory
  • Have some familiarity with PHP and Magento application structure

View bootstrap-fluid-grid-mixin.scss
.fluid-row {
div, section, article, li { /* Needs testing on li's */
&:first-child { /* using first child and margin-left for IE support */
margin-left: 0;
}
}
}
.fluid-column(@columns: 1, @offset: 0, @reset: default) {
.input-block-level();