Skip to content

Instantly share code, notes, and snippets.

@zeloc
zeloc / m2clean.sh
Created August 16, 2018 08:21
clean caches and setup
#!/usr/bin/env bash
cd /var/www/vhosts/partyshowroom/production/htdocs/
composer install
echo 'Clearing magento cache...'
rm -rf /var/www/vhosts/partyshowroom/production/htdocs/var/cache/*
echo 'Clearing page cache...'
rm -rf /var/www/vhosts/partyshowroom/production/htdocs/var/page_cache/*
echo 'Setting developer mode'
php /var/www/vhosts/partyshowroom/production/htdocs/bin/magento deploy:mode:set developer
echo 'Restarting Varnish service'
@zeloc
zeloc / cleanall.sh
Created August 16, 2018 08:21
clean all with static content deploy and di compile
#!/usr/bin/env bash
cd /var/www/vhosts/partyshowroom/production/htdocs/
echo 'Clearing magento cache...'
rm -rf /var/www/vhosts/partyshowroom/production/htdocs/var/cache/*
echo 'Clearing page cache...'
rm -rf /var/www/vhosts/partyshowroom/production/htdocs/var/page_cache/*
echo 'Restarting Varnish service'
sudo /etc/init.d/varnish restart
echo 'Clear generation files...'
rm -rf /var/www/vhosts/partyshowroom/production/htdocs/var/generation/*
@zeloc
zeloc / static_sign.sql
Created August 16, 2018 08:20
clear static sign
INSERT INTO `core_config_data` (`scope`, `scope_id`, `path`, `value`) VALUES ('default', 0, 'dev/static/sign', '0');
@zeloc
zeloc / cookie.js
Created August 16, 2018 08:20
javascript class example
@zeloc
zeloc / mageinit.sh
Created August 16, 2018 08:19
magento 2 initalisation
#!/usr/bin/env bash
cd /var/www/vhosts/partyshowroom/production/htdocs/
echo 'Turning off static signing'
mysql -uroot -proot -Dparty_local<<<"UPDATE party_local.core_config_data SET value=0 WHERE path='dev/static/sign'"
composer install
echo 'Clearing magento cache...'
rm -rf /var/www/vhosts/partyshowroom/production/htdocs/var/cache/*
echo 'Clearing page cache...'
rm -rf /var/www/vhosts/partyshowroom/production/htdocs/var/page_cache/*
echo 'Setting developer mode'
@zeloc
zeloc / observer.php
Created August 16, 2018 08:17
magento observer magento 1
<?php
use Varien_Event_Observer as Event;
class Test_PriceFilter_Model_Observer
{
public function catalogControllerCategoryInitAfter(Event $event)
{
//code goes here
<?php
namespace Haakym\UKBankHoliday;
use JsonSerializable;
class UKBankHoliday implements JsonSerializable {
protected $year;
protected $newYears;
protected $goodFriday;
protected $easterMonday;
protected $mayDay;
protected $whitSun;
@zeloc
zeloc / bundlesitems.php
Created August 16, 2018 08:16
magento get bundle selected
<?php
//ini_set('memory_limit','10G');
require_once('abstract.php');
class Bundle_Cart_Item_Option_Items extends Mage_Shell_Abstract
{
/**
* Entry point
*/
public function run()
@zeloc
zeloc / xdebugoffon.sh
Created August 16, 2018 08:16
unfinished
#!/bin/bash
# Simple script to enable or disable xdebug profiling
case $1 in
on)
sudo sed -i 's/;//g' /etc/php.d/xdebug.ini
sudo /etc/init.d/php-fpm restart
;;
off)
sudo sed -i 's/^/;/g' /etc/php.d/xdebug.ini
@zeloc
zeloc / magento2_upgrade_script_fields.txt
Created August 16, 2018 08:15
This is a list of fields used during upgrading an attribute
2018-05-10T07:56:38+00:00 INFO (6): Array
(
[attribute_id] => Array
(
[SCHEMA_NAME] =>
[TABLE_NAME] => eav_attribute
[COLUMN_NAME] => attribute_id
[COLUMN_POSITION] => 1
[DATA_TYPE] => smallint
[DEFAULT] =>