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 / Add new static type customer attribute Magento 2
Last active August 7, 2020 10:49
Add new static type customer attribute Magento 2
#File app/code/Vendor/CustomerDemo/Setup/Patch/Data/CustomerAgeAttribute.php
<?php
namespace Vendor\CustomerDemo\Setup\Patch\Data;
use Magento\Customer\Model\Customer;
use Magento\Customer\Setup\CustomerSetup;
use Magento\Customer\Setup\CustomerSetupFactory;
use Magento\Framework\Setup\Patch\DataPatchInterface;
@mrkhoa99
mrkhoa99 / Get response time with curl (MacOs)
Last active March 30, 2018 09:21
Get response time with curl
curl -o /dev/null -s -w {time_connect}:%{time_starttransfer}:%{time_total}\\n <api_url>
@mrkhoa99
mrkhoa99 / Search using REST APIs
Last active October 7, 2017 15:10
Search using REST APIs
Should Read here first:
http://devdocs.magento.com/guides/v2.2/rest/performing-searches.html
Examples:
1) Quick Search:
http://mage217.loc/rest/V1/search?searchCriteria[requestName]=quick_search_container
&searchCriteria[filterGroups][0][filters][0][field]=search_term
&searchCriteria[filterGroups][0][filters][0][value]=test
@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
@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 / 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">
Magento\Framework\Translate::loadData()
#Load Cache first
$this->_loadModuleTranslation();
$this->_loadThemeTranslation();
$this->_loadPackTranslation();
$this->_loadDbTranslation();
@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
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
#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)
{