Skip to content

Instantly share code, notes, and snippets.

@jerrylopez
jerrylopez / Topmenu.php
Created January 29, 2020 13:18 — forked from elenakondrateva/Topmenu.php
Move Magento2 top menu categories under second level
<?php
namespace Acme\Topmenu\Plugin\Theme\Block\Html;
use Magento\Framework\Data\Tree\NodeFactory;
use Magento\Framework\Data\TreeFactory;
use Magento\Framework\Data\Tree\Node;
use Magento\Framework\Data\Tree;
class Topmenu
{
@jerrylopez
jerrylopez / README.md
Last active May 3, 2019 21:25
Unintentional Adminhtml Login Page Redirect Patch

Usage

  1. Download the github-issue-22590.diff and save it to MAGENTO_ROOT/patches/composer/
  2. Require composer-patches: composer require cweagans/composer-patches
  3. Add the patches section to your composer.json extra field.
  4. Remove existing packages: rm -rf vendor/magento/framework
  5. Run composer install to re-install and apply patches.
@jerrylopez
jerrylopez / README.md
Last active May 3, 2019 16:39
Asynchronous Email Fix for Magento 2

Usage

  1. Require composer-patches: composer require cweagans/composer-patches
  2. Add the patches section to your composer.json extra field.
  3. Remove existing packages: rm -rf vendor/magento/module-sales vendor/magento/framework
  4. Run composer install to re-install and apply patches.
@jerrylopez
jerrylopez / get_latest_release.sh
Created September 7, 2017 06:09 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@jerrylopez
jerrylopez / test.attr.php
Created August 17, 2017 16:27 — forked from DevertNet/test.attr.php
Magento Adding existing attribute to all attribute sets
<?php
/*
replace show_in_price_search_engine with your attr code
replace General with antoher Tab
*/
$dir = dirname(__FILE__);
chdir($dir);
@jerrylopez
jerrylopez / check_docker_container.sh
Created April 26, 2017 18:30 — forked from ekristen/check_docker_container.sh
Bash Script for Nagios to Check Status of Docker Container
#!/bin/bash
# Author: Erik Kristensen
# Email: [email protected]
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# Depending on your docker configuration, root might be required. If your nrpe user has rights
# to talk to the docker daemon, then root is not required. This is why root privileges are not
@jerrylopez
jerrylopez / API.md
Created April 20, 2017 00:48 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@jerrylopez
jerrylopez / export.sql
Created February 7, 2017 21:32 — forked from sashas777/export.sql
Export Magento Related, Crosssell, Upsell Products from Database
/* Related Products */
SELECT e.sku as sku, GROUP_CONCAT(ee.sku) as related_product FROM catalog_product_link l
INNER JOIN catalog_product_entity e on e.entity_id=l.product_id
INNER JOIN catalog_product_entity ee on ee.entity_id=l.linked_product_id
WHERE l.link_type_id=1
GROUP BY e.sku
/* Crosssell Products */
SELECT e.sku as sku, GROUP_CONCAT(ee.sku) as crossel_product FROM catalog_product_link l
INNER JOIN catalog_product_entity e on e.entity_id=l.product_id
@jerrylopez
jerrylopez / magento-secure-img-url.php
Created December 2, 2015 15:10
Magento image URL secure or non-secure based on page being secure or not.
<?php echo $this->getSkinUrl(‘images/ sampleimage.gif’,array(‘_secure’=> Mage::app()->getStore()->isCurrentlySecure())) ?>
@jerrylopez
jerrylopez / csv_to_array.php
Last active September 11, 2015 14:50 — forked from jaywilliams/csv_to_array.php
Convert a comma separated file into an associated array.
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array