Skip to content

Instantly share code, notes, and snippets.

View kayintveen's full-sized avatar
💻

Kay in t Veen kayintveen

💻
View GitHub Profile
#! /bin/bash
TIMESTAMP=$(date +"%F")
BACKUP_DIR="/backup/$TIMESTAMP"
MYSQL_USER="backup"
MYSQL=/usr/bin/mysql
MYSQL_PASSWORD="password"
MYSQLDUMP=/usr/bin/mysqldump
mkdir -p "$BACKUP_DIR/mysql"

Magento Snippets

Set all categories to is_anchor 1

Find attribute_id

SELECT * FROM eav_attribute where attribute_code = 'is_anchor'

Update all of them with anchor_id from above (usually is ID 51)

UPDATE `catalog_category_entity_int` set value = 1 where attribute_id = 51
yum install php-pear php-devel httpd-devel pcre-devel gcc make
pecl install apc
echo "extension=apc.so" > /etc/php.d/apc.ini
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
yum install redis
service redis start
@kayintveen
kayintveen / remove-magento-images.php
Created June 14, 2015 10:26
Magento removing product images for all storeviews
<?php
/**
*
* By Microdesign B.V.
* Author: Kay in 't Veen
* Twitter: @kayintveen
* More info: k.veen@microdesign.nl
*
*/
@kayintveen
kayintveen / install.sh
Last active August 29, 2015 14:24
lamp install.sh mysql 5.6 (magento2)
sudo apt-get update
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
sudo apt-get install -y vim curl python-software-properties
sudo add-apt-repository -y ppa:ondrej/php5
sudo apt-get update
sudo apt-get install -y php5 apache2 libapache2-mod-php5 php5-curl php5-gd php5-mcrypt php5-readline mysql-server-5.6 php5-mysql git-core php5-xdebug
@kayintveen
kayintveen / magento-homepage
Created July 15, 2012 11:59
Magento if homepage condition
if ($this->getUrl('') == $this->getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true)) ) {
$_is_home_page = true;
}else {
$_is_home_page = false;
}
@kayintveen
kayintveen / wordpress-featured-images-except-featured
Last active December 11, 2015 07:39
Wordpress: featured image except featured
@kayintveen
kayintveen / Wordpress-get-featured-image
Created January 18, 2013 20:18
Wordpress: get featured image
@kayintveen
kayintveen / email php script with redirect
Created January 19, 2013 11:55
Basic email php script
<?php
$message = $_POST['comment'];
$headers = "Content-Type: text/html; charset=iso-8859-1\n";
$headers .= "From: ".$_POST['name']." <".$_POST['email'].">\n";
$headers .= "Reply-to: ".$_POST['name']." <".$_POST['email'].">\n";
$headers .= "\n";
mail('email@domein.nl','onderwerp',$message,$headers);