Skip to content

Instantly share code, notes, and snippets.

View vasilii-b's full-sized avatar
🙂

Vasilii Burlacu vasilii-b

🙂
View GitHub Profile
@vasilii-b
vasilii-b / find-customer-address-with-wrong-region-id.sql
Last active June 7, 2024 09:03
Magento 2 (adobe commerce) find customers with wrong region ID in the address
select
cae.entity_id as "Address ID",
cae.parent_id as "Customer ID",
c.firstname,
c.lastname,
c.email,
cae.country_id,
cae.city,
cae.postcode,
cae.region as "Current Address Region",
@vasilii-b
vasilii-b / query.sql
Created May 13, 2024 10:57
Magento 2 - get grouped products child count number
select cpe_parent.entity_id as 'Parent ID', cpe_parent.sku as 'Parent Sku', count(cpe_child.entity_id) as 'Child #', cpe_child.sku as 'Child Sku'
from catalog_product_entity cpe_parent
join catalog_product_link cpl on cpe_parent.type_id = 'grouped' and cpl.link_type_id = 3 and cpe_parent.row_id = cpl.product_id
left join catalog_product_entity cpe_child on cpl.linked_product_id = cpe_child.entity_id
group by cpe_parent.sku
order by 'Child #' DESC
@vasilii-b
vasilii-b / namecheap SSL.md
Created June 11, 2023 07:56 — forked from Shourai/namecheap SSL.md
Letsencrypt SSL certificate with namecheap hosting

source: https://savedlog.com/uncategorized/letsencrypt-ssl-certificate-namecheap-hosting/

The “Positive SSL” certificate I bought along with my domain is invalid with any of my subdomains and cannot be used with wildcards. One annoying thing is that namecheap doesn’t offer auto installation of free let’s encrypt certificates, even though, they are saying “Namecheap is dedicated to data security and privacy for all internet users. We believe the movement to encrypt nearly all web traffic is a positive direction. As more sites embrace HTTPS and use of security products, providers of free SSL are beginning to come online.”

Let me show you what it needs to be done in order to “encrypt nearly all web traffic”.

First, not required but it’s helpful to enable ssh access, it is not enabled by default on the base hosting plans, just go an start a live chat and request ssh access.

@vasilii-b
vasilii-b / README.md
Last active March 13, 2023 12:28
Collect Klevu results from JS templating for later usage (send to GA4 for example)

Magepal GA4 <> Klevu Search using JS Templating

The files mentioned in the gist are supposed to be added under a custom theme (app/design/frontend/<vendor>/theme) inside the folder Klevu_Search.

Alternatively, the same could be achieved by having the files (layouts, templates) inside a custom module.

@vasilii-b
vasilii-b / check-db-size.sh
Last active March 3, 2023 07:56
Check database size on disk and see the table sizes with SQL
df -h | grep 'mysql\|Filesystem'
@vasilii-b
vasilii-b / Show database size.sql
Last active November 8, 2022 09:51
Magento 2 - Check database size
SELECT table_schema "Data Base Name",
SUM( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB",
SUM( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema;
@vasilii-b
vasilii-b / FormatPriceViewModel.php
Created January 17, 2022 10:10
Magento 2 View Model helpers
<?php
namespace ImaginationMedia\CaspianFrontend\ViewModel;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\View\Element\Block\ArgumentInterface;
/**
* Class FormatPriceViewModel
*/
@vasilii-b
vasilii-b / grep-and-run-cli.sh
Created October 25, 2021 18:45
Grep and with result run command
bin/magento mod:st | grep SampleData | xargs -0 sh -c 'for name; do bin/magento mod:e $name; done' sh
@vasilii-b
vasilii-b / cli.sh
Created October 21, 2021 15:21
Change filename extension or replace part of filename
find ./ -name "*.css" -exec sh -c 'mv "$1" "${1%.css}.txt"' _ {} \;
@vasilii-b
vasilii-b / webpack.config.js
Created May 9, 2021 06:32
PWA Studio webpack server build show errors
const config = await configureWebpack({
[...]
devServer: {
stats: 'errors-warnings'
}
});