Skip to content

Instantly share code, notes, and snippets.

View eriksimonic's full-sized avatar

Erik Simonič eriksimonic

  • Business Solutions d.o.o.
  • Slovenia
View GitHub Profile
@eriksimonic
eriksimonic / forcereindex.php
Last active August 29, 2015 14:19
Quick and dirty hack to force Google reindex on magento store.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<META NAME="ROBOTS" CONTENT="NOINDEX, FOLLOW">
</head>
<body>
<?php
/**
* Created by PhpStorm.
* User: erik.simonic
@eriksimonic
eriksimonic / gist:3591c933cbd212ad6bc4
Created May 4, 2015 07:41
SQL Create queries for all databases..
DECLARE @sql NVARCHAR(MAX) = N'';
SELECT @sql += N'ALTER DATABASE '+QUOTENAME(name)+N' SET RECOVERY SIMPLE WITH NO_WAIT; GO;'
from sys.databases
where database_id > 4;
PRINT @sql;
@eriksimonic
eriksimonic / gist:8570990f27133c426f48
Created May 8, 2015 09:19
Debug Magento Autoload problems with backtrace
Temporary edit the lib/Varien/Autoload.php
@eriksimonic
eriksimonic / gist:a3a99443fff3c185e371
Created June 9, 2015 07:26
Add EAV attribute to Flat catalog When selecting
$_product = Mage::getModel('catalog/product')->loadByAttribute( 'sku', 'ABC123' );
$coll = $_product->getTypeInstance()->getAssociatedProductCollection()
->joinAttribute( 'my_custom_attribute', 'catalog_product/my_custom_attribute', 'entity_id', null, 'left' )
->addAttributeToSelect( 'my_custom_attribute' )
;
@eriksimonic
eriksimonic / check_obsolete_media_files.php
Created June 21, 2015 20:47
Detect obsolete images in media/catalog/product
<?php
/**
* Created by PhpStorm.
* User: Admin
* Date: 20. 06. 2015
* Time: 15:21
*/
///catalog_product_entity_media_gallery
@eriksimonic
eriksimonic / create_dummy_products.php
Created June 21, 2015 20:49
Create product from existing product to populate the magento database for testing purposes.
<?php
/**
* Created by PhpStorm.
* User: Admin
* Date: 20. 06. 2015
* Time: 08:21
*/
// env config
@eriksimonic
eriksimonic / deleteAll.php
Created June 21, 2015 20:49
Delete all products from magent.
<?php
/**
* Created by PhpStorm.
* User: Admin
* Date: 20. 06. 2015
* Time: 11:48
*/
ini_set('display_errors', 1);
umask(0);
@eriksimonic
eriksimonic / addImages.php
Created June 21, 2015 20:50
Add random stock image to product, testing catalog.
<?php
/**
* Created by PhpStorm.
* User: Admin
* Date: 20. 06. 2015
* Time: 08:21
*/
// env config
@eriksimonic
eriksimonic / my.ini
Created June 23, 2015 19:23
MySQL Config TEST
# Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208
# Configuration name server-38 generated for erik.simonic@gmail.com at 2015-06-21 11:02:58
[mysql]
# CLIENT #
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld]
@eriksimonic
eriksimonic / extract_differences.sh
Created June 29, 2015 10:22
Copy only differing files from one location to another location. (A|B = B-A)
#!/bin/bash
SOURCE=source/
DESTINATION=destination/
DESTINATION_DIFF=destination_diff/
DIFF_FILE=differences.txt
DIFF_FILE_TMP=differences_tmp.txt
diff -bBqTrqN $SOURCE $DESTINATION >$DIFF_FILE
sed 's/Files //' $DIFF_FILE > $DIFF_FILE_TMP
sed 's/ and .*$//' $DIFF_FILE_TMP > $DIFF_FILE