Skip to content

Instantly share code, notes, and snippets.

View mrkhoa99's full-sized avatar
🎯
Don't repeat yourself

Mr Khoa mrkhoa99

🎯
Don't repeat yourself
View GitHub Profile
@mrkhoa99
mrkhoa99 / addPageLayoutHandles Plugin
Created March 12, 2017 15:19
addPageLayoutHandles Plugin
<?php
namespace Some\Module\Plugin;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\View\Result\Page;
class ProductLayout
{
@mrkhoa99
mrkhoa99 / Magento 2 strick
Created March 12, 2017 15:41
Magento 2 strick
1) Using an expression as a join: new Zend_Db_Expr
$query = 'SELECT author_id, SUM(amount) AS author_debit_amount FROM author_debits GROUP BY author_debits.author_id';
$collection->getSelect()->joinLeft(
new Zend_Db_Expr('('.$query.')'),
'main_table.author_id = t.author_id',
array('author_debit_amount')
);
We should take a look `\Magento\Framework\App\RouterList`
#vendor/magento/module-vault/Model/PaymentTokenManagement.php::getListByCustomerId()
/**
* Lists payment tokens that match specified search criteria.
*
* @param int $customerId Customer ID.
* @return \Magento\Vault\Api\Data\PaymentTokenSearchResultsInterface[] Payment tokens search result interface.
*/
public function getListByCustomerId($customerId)
{
Date: March 28 2017
##On Mac:
Simple use brew:
Firstly install Brew on your MAC
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew update
@mrkhoa99
mrkhoa99 / Magento 2 Discussion on Github
Created March 28, 2017 14:02
Magento 2 Discussion on Github
Compilation enforces coupling to parent class Context contents: https://github.com/magento/magento2/issues/6114
Magento\Framework\Translate::loadData()
#Load Cache first
$this->_loadModuleTranslation();
$this->_loadThemeTranslation();
$this->_loadPackTranslation();
$this->_loadDbTranslation();
@mrkhoa99
mrkhoa99 / Magento 2 - change the form fields sort order in checkout
Created May 16, 2017 08:31
Magento 2 - change the form fields sort order in checkout
Magento 2 - change the form fields sort order in checkout
#app/code/Vendor/Checkout/view/layout/checkout_index_index.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
@mrkhoa99
mrkhoa99 / Server on Mac
Last active June 27, 2018 02:48
Server on Mac
<h2>APACHE Server<h2>
To start httpd:
`sudo /usr/sbin/apachectl start`
To stop httpd:
`sudo /usr/sbin/apachectl stop`
@mrkhoa99
mrkhoa99 / Blogs post
Last active September 8, 2017 10:12
Blogs post
PHP topic:
- http://nikic.github.io/
Magento topic:
- https://community.magento.com/t5/Magento-DevBlog/Magento-2-2-Deployment-Improvements/ba-p/73119
- https://12factor.net/
- https://community.magento.com/t5/Magento-DevBlog/Introducing-Magento-PWA-Studio/ba-p/74636