Skip to content

Ansyori's Blog Posts

My Android Games

My games no longer listed on Google Playstore 😢😭, but you can find on other platform 🥳😁, please take a look at this link https://apkpure.com/id/developer/Zaidan%20Lab

Continue reading My Android Games

Comments closed

Magento 2 : Disable ElasticSearch, Switch Search Engine to MySql (legacy)

End of year 2023  composer config repositories.mysqlsengine git https://github.com/swissup/module-search-mysql-legacy.git composer require swissup/module-search-mysql-legacy –prefer-source –ignore-platform-reqs php bin/magento setup:upgrade –safe-mode=1 php bin/magento setup:di:compile php bin/magento cache:flush php…

Continue reading Magento 2 : Disable ElasticSearch, Switch Search Engine to MySql (legacy)

Comments closed

[Magento 2] Get Salable Qty By SKU

publicfunction __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\CatalogInventory\Api\StockStateInterface $stockState, \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry ){ $this->storeManager = $storeManager; $this->stockState = $stockState; $this->stockRegistry = $stockRegistry; } public function getSalableQtyByPID($product) $websiteId = $this->storeManager->getStore()->getWebsiteId();…

Continue reading [Magento 2] Get Salable Qty By SKU

Comments closed

[Ubuntu] Setup https on localhost

install required library apt install libnss3-tools -y download, give permission & copy/move to bin folder: wget https://github.com/FiloSottile/mkcert/releases/download/v1.1.2/mkcert-v1.1.2-linux-amd64chmod +x mkcert-v1.1.2-linux-amd64cp mkcert-v1.1.2-linux-amd64 /usr/local/bin/mkcert Generate local CA sudo…

Continue reading [Ubuntu] Setup https on localhost

Comments closed

M2 : Override/Intercept REST API POST params

ok then in your di.xml <?xml version=”1.0″ ?> <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:ObjectManager/etc/config.xsd”> <type name=”Magento\Webapi\Controller\Rest\Router”> <plugin disabled=”false” name=”YourModule_ModuleName_Plugin_Magento_Webapi_Controller_Rest_Router” sortOrder=”10″ type=”YourModule\ModuleName\Plugin\Magento\Webapi\Controller\Rest\Router”/> </type> </config> and then finally, use plugin …

Continue reading M2 : Override/Intercept REST API POST params

Comments closed

Magento2 : Custom Sql Directive

$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // Instance of object manager $resource = $objectManager->get(‘Magento\Framework\App\ResourceConnection’); $connection = $resource->getConnection(); $tableName = $resource->getTableName(‘your_table_name’); //Select Data from table $sql = “Select *…

Continue reading Magento2 : Custom Sql Directive

Comments closed

[Magento] Update category attributes programmatically

here you go $resource = Mage::getResourceModel(‘catalog/category’); $collection = Mage::getModel(‘catalog/category’)->getCollection(); foreach($collection as $category) { $category->setStoreId(0); // 0 for default scope (All Store Views) $category->setData(‘page_layout’, ‘two_columns_left’); $resource->saveAttribute($category,…

Continue reading [Magento] Update category attributes programmatically

Comments closed

Magento 2 : Add Customer Address Attribute

in your ‘Company/Modulename/setup/InstallData.php’ here example code <?php namespace Company\Modulename\Setup; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Customer\Model\Customer; use Magento\Customer\Setup\CustomerSetupFactory; class InstallData implements InstallDataInterface { private…

Continue reading Magento 2 : Add Customer Address Attribute

Comments closed

CSS: Disable CSS Animations

below css code, to disable any related to css animation /*CSS transitions*/ -o-transition-property: none !important; -moz-transition-property: none !important; -ms-transition-property: none !important; -webkit-transition-property: none !important; transition-property: none…

Continue reading CSS: Disable CSS Animations

Comments closed

CSS: Styling Scroll Bar

let say you want to styling overflow div bar, here example css .yourdiv::-webkit-scrollbar { background:red; width:5px; } .yourdiv::-webkit-scrollbar-track { background-color: #eaeaea; border-left: 1px solid #ccc;…

Continue reading CSS: Styling Scroll Bar

Comments closed

Magento : Create Fake POST

$array_post = array( ‘var1’=>’content1’, ‘var2’=>’content2’, ); $array_post = http_build_query($array_post); $opts = array(‘http’ => array( ‘method’ => ‘POST’, ‘header’ => ‘Content-type: application/x-www-form-urlencoded’, ‘content’ => $array_post )…

Continue reading Magento : Create Fake POST

Comments closed