Skip to content

Instantly share code, notes, and snippets.

View mrtuvn's full-sized avatar
👨‍💻
Keep calm and enter your center

Tu Nguyen mrtuvn

👨‍💻
Keep calm and enter your center
View GitHub Profile
@mrtuvn
mrtuvn / events_dispatch_m2.md
Last active February 22, 2020 05:06
use full events

CONTROLLER

controller_action_predispatch

controller_action_predispatch_[frontName][class][action]

controller_action_postdispatch

VIEW

@mrtuvn
mrtuvn / generate_basic_data
Created January 22, 2020 00:51
Magento script generate basic data
#!/bin/bash
host_name="magento.test"
adminToken=$(curl -sb -X POST "http://${host_name}/rest/V1/integration/admin/token" \
-H "Content-Type:application/json" \
-d '{"username":"admin", "password":"123123q"}')
adminToken=$(echo ${adminToken} | sed -e 's/"//g')
category_creation_response=$(curl -sb -X POST "http://${host_name}/rest/V1/categories" \
@mrtuvn
mrtuvn / new-update-after2.3.2p2.txt
Last active December 13, 2019 02:15
this di added new in 2.3.2-p2 for security patch
<type name="Magento\Framework\View\Element\UiComponent\Argument\Interpreter\ConfigurableObject">
<arguments>
<argument name="classWhitelist" xsi:type="array">
<item name="0" xsi:type="string">Magento\Store\Ui\Component\Listing\Column\Store\Options</item>
</argument>
</arguments>
</type>
@mrtuvn
mrtuvn / totals.html
Created December 11, 2019 01:46
html code custom totals block
<div class="pdf-section-totals1">
<div class="outer-pdf-totals-tbl pdf-totals-container">
<table class="custom-pdf-totals-tbl pdf-totals-tbl">
<tbody>
<tr>
<td class="pdf-totals-label">Subtotal</td>
<td class="pdf-totals-value">{{var order.subtotal}}</td>
</tr>
<tr>
<td class="pdf-totals-label">Tax</td>
/app/design/frontend/Company/default/Magento_Checkout/js/view/shipping-address/list.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'underscore',
'ko',
@mrtuvn
mrtuvn / template.phtml
Last active December 4, 2019 08:33
pdfpro template used in magento2
<?php
$mpdf = $block->getPdf();
?>
<?php $config = $block->getConfig(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
@mrtuvn
mrtuvn / classes_and_interfaces.txt
Last active January 29, 2020 23:57
Interfaces, Classes Helpful In Magento 2
#Catalog
> Magento\Catalog\Model\Locator\LocatorInterface
getProduct getStore getWebsiteIds getBaseCurrencyCode
> Magento\Catalog\Api\ProductLinkManagementInterface
> Magento\Catalog\Model\ResourceModel\Product\Website\Link
#Framework
Interface for entities which can be extended with custom attributes.
@mrtuvn
mrtuvn / get_table_name_from_collection.txt
Created July 19, 2019 02:36
Get table name from collection magento 2
$from = $this->collection->getSelect()->getPart('from');
$table = $from['e']['tableName'];
@mrtuvn
mrtuvn / Collection.php
Last active June 18, 2019 15:17
PdfPro Fix storeview
<?php
namespace Vnecoms\PdfPro\Model\ResourceModel\Key;
use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;
class Collection extends AbstractCollection
{
protected function _construct()
{
@mrtuvn
mrtuvn / auth.json.sample
Created April 19, 2019 02:05
auth.json.sample
{
"github-oauth": {
"github.com": "TOKEN"
},
"http-basic": {
"packages.vnecoms.com": {
"username": "key",
"password": "pass"
},
"repo.magento.com": {