Skip to content

Instantly share code, notes, and snippets.

@vanWittlaer
vanWittlaer / install.sh
Last active October 22, 2024 09:32
Shopware 6 - ddev Quick Install
#!/usr/bin/env bash
# What it does:
# - Creates a local Shopware installation using the Symfony Flex template for local development of client projects
# - Prerequisites: ddev installed on your machine, see https://ddev.com/get-started/
#
# How to use:
# - create a project folder
# - copy this file into the project folder
# - chmod +x install.sh
@rafaelstz
rafaelstz / magedeploy.sh
Created May 12, 2020 21:35
Magento 2 Deploy script
#!/usr/bin/env bash
LANGUAGES="en_US pt_BR"
# production or developer
ENVIRONMENT="production"
COMPOSER=$(which composer)
PHP=$(which php)
ROOT=$(pwd)
@madeincosmos
madeincosmos / functions.php
Created May 23, 2019 10:11
Add customer username and ID to WooCommerce emails
add_filter( 'woocommerce_email_customer_details_fields', 'add_user_id_to_woocommerce_emails', 10, 3);
function add_user_id_to_woocommerce_emails( $fields, $sent_to_admin, $order ) {
$user_id = $order->get_customer_id();
$user_info = get_userdata( $user_id );
$fields['user_id'] = array(
'label' => __( 'User ID', 'woocommerce' ),
'value' => $user_id
);
@ProcessEight
ProcessEight / Anatomy of Magento 2: Layered Navigation.md
Last active February 17, 2024 05:39
In-depth exploration of how layered navigation is implemented in Magento 2

Anatomy of Magento 2: Layered Navigation

Points for investigation

  • Generate high-level overview of all the main components
  • How are the total item counts for each option generated?
  • How is the catalog updated to display the matching products?
  • How are options rendered?
  • What are the customisation points?
  • What events are dispatched?
@sgtoj
sgtoj / persistent_c_mount_wsl.sh
Last active June 24, 2024 21:32
Ubuntu for Windows: Mounting C: Drive to WSL's Root
# allow `mount` cmd without password
echo "$USER ALL=NOPASSWD: /bin/mount" | (sudo su -c 'EDITOR="tee -a" visudo')
# add the mount directive to `fstab`
sudo mkdir -p /c
sudo sh -c "echo '/mnt/c /c none bind' >> /etc/fstab"
# update to `.bashrc` to auto mount at login
echo "sudo mount -a" >> ~/.bashrc
# now reload it
source ~/.bashrc
@yanknudtskov
yanknudtskov / woocommerce-update-prices.sql
Last active August 1, 2023 23:45
Queries for updating all prices including variations in WooCommerceIn this instance all prices are subtracted 20% (0.8)#woocommerce #mysql
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_regular_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_sale_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_regular_price_tmp' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_sale_price_tmp' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_price_tmp' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_min_variation_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_max_variation_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_min_variation_regular_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHE
@kingsloi
kingsloi / AnyPage.vue
Created January 14, 2017 01:33
Vue 2 - VueRouter - Simple Dynamic breadcrumbs + Microdata
export default {
beforeRouteEnter(route, redirect, next) {
next(vm => {
vm.$http.get(`${API.BASE}/${API.PAGE}/${route.name}`).then((response) => {
vm.page = response.data.page;
vm.eventHub.$emit('update-breadcrumb', [
{
title: 'Home',
@ishu3101
ishu3101 / reset-wsl.sh
Created July 22, 2016 23:38
Resetting your Windows Subsystem for Linux (WSL) Environment
# Resetting your Windows Subsystem for Linux (WSL) Environment
lxrun.exe /uninstall /full
lxrun.exe /install
@peter-hank
peter-hank / Collection.php
Created January 5, 2016 19:13
Sort product attribute options by the position property in Magento (app/code/local/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php)
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
@vielhuber
vielhuber / query.sql
Last active September 3, 2019 09:21
individual delivery charges Versandkosten #shopware
SUM(
IF(at.attr5 IS NOT NULL AND at.attr5 <> '', at.attr5 * b.quantity,
IF(d.weight * b.quantity < 3, 4.99,
IF(d.weight * b.quantity < 5, 6.90,
IF(d.weight * b.quantity < 10, 9.50,
IF(d.weight * b.quantity < 15, 10.90,
IF(d.weight * b.quantity < 20, 12.90,
IF(d.weight * b.quantity < 31, 17.90,
IF(d.weight * b.quantity < 40, 49.90,
(49.90+(0.59*(d.weight * b.quantity - 40)))