Skip to content

Instantly share code, notes, and snippets.

@Alexander-Pop
Alexander-Pop / mage2-multiweb-subdir.md
Last active September 5, 2019 16:00 — forked from thagxt/mage2-multiweb-subdir.md
[Magento 2 multiple websites] Magento 2 multiple websites in sub directories #magento2

Set up Magento 2 multiple websites in sub directories

  1. Go to Admin > Stores > All Stores
  2. Click > Create Web Site
  3. In the Name field, enter store name.
    • e.g. Japan
  4. In the Code field, enter a unique string without spaces and > Save Web Site
    • e.g. super_jp
  5. Create Store
  6. Create Store View
@Alexander-Pop
Alexander-Pop / magento2-get-product-info.php
Last active September 5, 2019 15:59 — forked from thagxt/get-product-info.php
[get Product URL, Name and ID] get Product URL, get Product Name and get Product ID #magento2
<?php
// get current page URL
$URL = $this->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true]);
// get current product name & ID
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product'); //get current product
$id = $product->getId();
$title = $product->getName();
@Alexander-Pop
Alexander-Pop / curl-download-extract-zip.php
Last active February 23, 2022 18:45 — forked from thagxt/dl-ex.php
Download & Extract .zip with cURL #php #curl #file #zip
<?php
$url = "https://wordpress.org/latest.zip";
$zipFile = "wordpress.zip"; // Local Zip File Path
$zipResource = fopen($zipFile, "w");
// Get The Zip File From Server
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
@Alexander-Pop
Alexander-Pop / form_key_checks.txt
Last active February 1, 2019 16:50 — forked from drobinson/form_key_checks.txt
Magento - form key validation #magento
List (and command that generated it) of places that form key validation has been added in 1.13.1
Controllers that have added form key validation:
$ git grep --files-with-matches "this->_validateFormKey())" <core_sources_update_commit_hash>
<core_sources_update_commit_hash>:app/code/core/Enterprise/Checkout/controllers/CartController.php
<core_sources_update_commit_hash>:app/code/core/Enterprise/GiftRegistry/controllers/IndexController.php
<core_sources_update_commit_hash>:app/code/core/Enterprise/GiftRegistry/controllers/ViewController.php
<core_sources_update_commit_hash>:app/code/core/Enterprise/Reward/controllers/CustomerController.php
<core_sources_update_commit_hash>:app/code/core/Enterprise/Wishlist/controllers/SearchController.php
<core_sources_update_commit_hash>:app/code/core/Mage/Catalog/controllers/Product/CompareController.php