Skip to content

Instantly share code, notes, and snippets.

View antoinekociuba's full-sized avatar

Antoine Kociuba antoinekociuba

View GitHub Profile
@0-Sony
0-Sony / call-custom-js-everywhere.js
Last active September 6, 2024 06:42
Magento 2 : Work around JS : Call a js file using requireJs or call a js file before another one or override existing js method
/**
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Phuong LE <sony@menincode.com> <@>
* @copyright Copyright (c) 2018 Menincode (http://www.menincode.com)
*/
/** MyNamespace/MyModule/view/frontend/web/js/call-custom-js-everywhere.js */
/** check the requirejs-config.js file */
@ejlp12
ejlp12 / gist:059373f1785c52114d778a4ee7277ccb
Created October 25, 2017 01:45
upgrade vagrant on mac os-x
brew cask reinstall vagrant
# this might take a long time
vagrant plugin update
@schmengler
schmengler / add-checkout-form-key.sh
Last active September 2, 2022 16:23
Magento SUPEE-9767 Checkout Form Key Theme Patch
find -L app/design/frontend -regex '.*\(shipping\|billing\|shipping_method\|payment\).phtml' -exec grep -L formkey {} \; \
| xargs sed -i 's/<\/form>/<?php echo $this->getBlockHtml("formkey") ?><\/form>/g'
find -L skin/frontend -name 'opcheckout.js' -exec grep -L form_key {} \; \
| xargs sed -i 's/if (elements\[i\].name=='\''payment\[method\]'\'') {/if (elements[i].name=='\''payment[method]'\'' || elements[i].name == '\''form_key'\'') {/g'
@timneutkens
timneutkens / README.md
Last active April 15, 2021 12:10
Magento2 | Execute data-mage-init and x-magento-init in dynamic content (ajax request)

Execute data-mage-init and x-magento-init in dynamic content (ajax response)

Trigger .trigger('contentUpdated') on the element where dynamic content is injected.

$.ajax({
    url: 'https://www.example.com',
    method: 'POST',
    data: {
 id: '1'
@0-Sony
0-Sony / customValidation.js
Last active December 17, 2016 00:46
Custom Validation[FR] Js for Magento
Validation.addAllThese([
['validate-zip-fr', 'Please enter a valid zip code. For example 75001.', function (v) {
return Validation.get('IsEmpty').test(v) || /(^\d{5}$)/.test(v);
}],
['validate-mobile-fr', 'Please enter a valid cellphone number. For example 0601020304.', function (v) {
return Validation.get('IsEmpty').test(v) || /(^[0][6-7]\d{8}$)/.test(v);
}],
['validate-fix-fr', 'Please enter a valid cellphone number. For example 0101020304.', function (v) {
return Validation.get('IsEmpty').test(v) || /(^[0]([1-5]|9)\d{8}$)/.test(v);
}],
@peterjaap
peterjaap / supee-7405-1.1.md
Last active April 11, 2017 01:55
Overview of Magento patch SUPEE-7405 1.1

Patch SUPEE-7405 1.1 overview

This patch is not to be confused with the SUPEE-7405 that was released on January 20th, 2016. This is a fix for that patch.

"Yo dawg, we heard you like patching so here's a patch for your patch so you can patch while you're patching." - Xzibit, MCD+

Changed files

  • app/code/core/Mage/Adminhtml/Helper/Sales.php +1/-1
  • app/code/core/Mage/Core/Model/Config.php +2/-2
  • app/code/core/Mage/Sales/Model/Quote/Item.php +3/-2
  • lib/Varien/File/Uploader.php +2/-2
  • app/etc/applied.patches.list +7/-0
@Vinai
Vinai / M2 acl.xml
Last active October 17, 2023 05:38
My current Magento 2 PHPStorm File Templates (Feb 2016)
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
</resource>
</resources>
</acl>
</config>
@herveguetin
herveguetin / next_business_day.php
Last active August 26, 2017 18:22
Retrieve the next business or calendar day in Magento with an optional leadtime. Magento weekend days config is taken into account.
<?php
/**
* Retrieve the next business day with an optional leadtime.
* If leadtime = 1 => find the next business day
* If leadtime = 2 => find the "next next" business day
* etc...
*
* @param int $leadtime
* @return string|bool
*/
@Schrank
Schrank / ConfigAsXml.php
Created December 27, 2014 12:21
Get magento XML configuration for default, websites and stores
<?php
// app/code/local/Ikonoshirt/Shared/Model/Adminhtml/
class Ikonoshirt_Shared_Model_Adminhtml_ConfigAsXml
extends Mage_Core_Model_Config_Data
{
protected function _afterLoad()
{
/** @var $xml Mage_Core_Model_Config */
@tegansnyder
tegansnyder / debugging reindex locks mysql commands.md
Created December 2, 2014 23:57
Useful Mysql Commands for Debugging Magento Reindex Locks

Sometimes you may have a run away reindex process that aborted due to a MySQL connection error of some sorts. It may be useful to use the following MySQL commands to aid in debugging.

Determining if a lock exists

Magento Enterprise labels the reindex lock via the constant REINDEX_FULL_LOCK in app/code/core/Enterprise/Index/Model/Observer.php

SELECT IS_FREE_LOCK('mydatabase_name.reindex_full')

Returns 1 is specified lock is free and can be acquired, 0 if it’s in use, NULL if an error occurs.

Determing the thread that is holding the lock