Skip to content

Instantly share code, notes, and snippets.

@DominicWatts
DominicWatts / php-symfony-var-dumper.md
Last active September 12, 2024 15:59
PHP : Symfony VarDumper #php

install

composer require --dev symfony/var-dumper

use

\Symfony\Component\VarDumper\VarDumper::dump( );

or

@DominicWatts
DominicWatts / mysql-magento-2-option-ids-by-sku-and-option-sku.md
Last active September 12, 2024 15:54
Mysql : Magento 2 Specific option IDs by SKU and option SKU #mysql

query

SELECT 
    p.sku AS product_sku,
    cpo.option_id,
    cpot.title,
    cpov.sku AS custom_option_sku
FROM 
 catalog_product_option AS cpo
@DominicWatts
DominicWatts / docker-install.md
Last active September 12, 2024 13:31
Cli : Docker install #CLI
@DominicWatts
DominicWatts / magento-2-pixie-media-patcher.md
Last active September 12, 2024 15:53
Magento 2 : Pixie Media patcher #magento2

Install

composer require pixie-media/patching

Use

mkdir -p ./m2-hotfixes
echo ".patch files go here" > ./m2-hotfixes/readme.md
chmod 775 ./vendor/pixie-media/patching/bin/ece-patches

./vendor/pixie-media/patching/bin/ece-patches apply

@DominicWatts
DominicWatts / cpanel-php-versions.md
Last active September 12, 2024 13:48
Server : cPanel php versions #server

php versions

multi php paths

/opt/cpanel/ea-php74/root/usr/bin/php

/opt/cpanel/ea-php81/root/usr/bin/php

/opt/cpanel/ea-php82/root/usr/bin/php

@DominicWatts
DominicWatts / magento-2-csp-inline-scripts.md
Last active November 4, 2024 09:28
Magento 2 : CSP inline scripts #magento2

Here's an example script to include in your phtml file, which will be whitelisted by CSP. You can use a similar method for other inline scripts:

    <?php
    /** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
    
    $scriptString = <<<script
    require(['jquery'],function($){
        $(document).ready(function() {
            zE('webWidget', 'setLocale', 'NB');
@DominicWatts
DominicWatts / magento-2-send-email-without-transport-builder-or-template-command-line.md
Created July 19, 2024 13:43
Magento 2 : send email without transport builder or template command line #magento2
use Magento\Framework\Mail\TransportInterfaceFactory;
use Magento\Framework\Mail\Message;

[...]

    protected $mailTransportFactory;

    public function __construct(
@DominicWatts
DominicWatts / magento-2-get-country-using-amasty.md
Created July 18, 2024 11:28
Magento 2 : Geo IP get country using Amasty #magento2

Geo class

<?php
namespace PixieMedia\General\Helper;

use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\Helper\Context;
use Magento\Store\Model\ScopeInterface;
use Amasty\Base\Model\GetCustomerIp;
@DominicWatts
DominicWatts / braintree-test-card-details.md
Created June 17, 2024 14:54
Note: Braintree test card details #notes
Test Value Card Type
378282246310005 American Express
371449635398431 American Express
36259600000004 Diners Club*
6011000991300009 Discover
3530111333300000 JCB
6304000000000000 Maestro
5555555555554444 Mastercard
2223000048400011 Mastercard
@DominicWatts
DominicWatts / magento-2-get-confirgurable-linked-attributes.md
Created June 10, 2024 09:58
Magento 2 : get configurable linked attributes #magento2

Steps to Determine the Linked Attributes

To identify the attributes linking a configurable product (e.g., product ID 123) to its child products, follow these steps:

Find the Attribute IDs for the Configurable Product:

Query the catalog_product_super_attribute table to get the attribute_id values linked to the configurable product.