This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Location: app/code/JLNarvaez/CustomLog/Logger/Handler.php | |
<?php | |
namespace JLNarvaez\CustomLog\Logger; | |
use Monolog\Logger; | |
class Handler extends \Magento\Framework\Logger\Handler\Base | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Initialice uiRegistry (for Chrome debug) | |
var uiRegistry = require('uiRegistry'); | |
// Get all UI Components names registered on the page | |
uiRegistry.get(uiItem => console.log(uiItem.name)); | |
// Get all UI Components index registered on the page | |
uiRegistry.get(uiItem => console.log(uiItem.index)); | |
// Get a specific UI Component by name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This snippet is useful to debug in production environments. | |
* DON'T USE THIS CODE TO LOG IN YOUR MODULES. | |
* To create a custom log check Magento official documentation | |
* (https://devdocs.magento.com/guides/v2.4/config-guide/log/custom-logger-handler.html) | |
*/ | |
// Custom Log for Magento v2.3 or < |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function objectToArray($object) | |
{ | |
if (!is_object($object)) { | |
return $object; | |
} | |
return array_map([$this, 'objectToArray'], (array) $object); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Jlnarvaez/Checkout/view/frontend/web/js/action/place-order-mixin | |
define([ | |
'mage/utils/wrapper' | |
], function (wrapper) { | |
'use strict'; | |
return function (placeOrderFunction) { | |
return wrapper.wrap(placeOrderFunction, function (originalPlaceOrder, paymentData, messageContainer) { | |
originalPlaceOrder(paymentData, messageContainer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div | |
id="mymodal" | |
class="modal-card" | |
data-mage-init='{"Magento_Ui/js/modal/modal":{"responsive": true, "innerScroll": true,"buttons": []}}' | |
> | |
<!-- Content --> | |
<a href="" class="action primary confirm"><?= __('Confirm') ?></a> | |
<a href="" class="action cancel"><?= __('Cancel') ?></a> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form id="form-send-mail" action="<?= $block->getUrl('jlnarvaez_mymodule/sample/send') ?>" method="POST" > | |
<div class="field required"> | |
<div class="control"> | |
<input type="email" name="my_email" class="inpt-mail input-text" | |
id="email_address" value="" | |
placeholder="<?= __('Email') ?>" | |
title="<?= __('Email') ?>" data-validate="{required:true, 'validate-email':true}" /> | |
</div> | |
<a href="" class="confirm-send"><?= __('Confirm') ?></a> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ignore file permissions as changes in git | |
alias ignore_git_chmod="git config core.fileMode false" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | |
// PRODUCT | |
$product = $objectManager->create('\Magento\Catalog\Model\ProductRepository')->get(/* SKU Product */); | |
// ORDER | |
$order = $objectManager->create('\Magento\Sales\Model\OrderRepository')->get(/*ID Order*/); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete all containers that contains a name passed by argument | |
# (If argument not passed, all containers will be deleted) | |
# Example: dockrm php | |
dockrm() { | |
docker ps --filter name="$1" -aq | xargs docker stop | xargs docker rm | |
} | |
# Exec container that contains a name passed by argument | |
# Example: dockexec php bash | |
# Can execute a command inside container too |