Code snippets from different sections of Magento that are very useful.
<script>
//<![CDATA[
Translator.add(
<?php echo Mage::helper('core')->jsonEncode(array(
<?php | |
/** | |
* Wraps output from functions attached to the wp_footer hook with HTML comments | |
* Useful for finding stray bits of output. Save as an MU plugin and change the hook to whatever you want. | |
*/ | |
add_action( 'wp_footer', function() { | |
echo '<!-- Start wp_footer -->' . "\n"; | |
global $wp_filter; |
diff --git a/app/Mage.php b/app/Mage.php | |
index 0e650eebb4f..9c18e222689 100644 | |
--- a/app/Mage.php | |
+++ b/app/Mage.php | |
@@ -798,9 +798,9 @@ public static function log($message, $level = null, $file = '', $forceLog = fals | |
',', | |
(string) self::getConfig()->getNode('dev/log/allowedFileExtensions', Mage_Core_Model_Store::DEFAULT_CODE) | |
); | |
- $logValidator = new Zend_Validate_File_Extension($_allowedFileExtensions); | |
$logDir = self::getBaseDir('var') . DS . 'log'; |
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
var data | |
var formId = 'form' | |
function drawForm() { | |
if (!data) return | |
var outputEl = document.getElementById(formId); |
########################################################## | |
# PRODUCTS | |
########################################################## | |
DELETE FROM `catalog_product_bundle_option`; | |
DELETE FROM `catalog_product_bundle_option_value`; | |
DELETE FROM `catalog_product_bundle_selection`; | |
DELETE FROM `catalog_product_entity_datetime`; | |
DELETE FROM `catalog_product_entity_decimal`; | |
DELETE FROM `catalog_product_entity_gallery`; | |
DELETE FROM `catalog_product_entity_int`; |
# insert SD and find out where it is mounted | |
diskutil list | |
# /dev/disk0 | |
# #: TYPE NAME SIZE IDENTIFIER | |
# 0: GUID_partition_scheme *250.1 GB disk0 | |
# ... | |
# /dev/disk1 | |
# #: TYPE NAME SIZE IDENTIFIER | |
# 0: FDisk_partition_scheme *15.7 GB disk1 | |
# ... |
// (Really Simple) PID Class by Ivan Seidel | |
// GitHub.com/ivanseidel | |
// Use as you want. Leave credits | |
class PID{ | |
public: | |
double error; | |
double sample; | |
double lastSample; |
All custom modules should have a Namespace and Module Name.
These are used below as {Namespace}
and {Module}
.
Caution: The Magento autoloader is known to have problems with CamelCase namespaces and/or modules between Windows and *nix systems. If your module requires more than one word for either of these, it is best to just concatenate them to avoid any issues (Example:
{Namespace}_{Examplemodule}
).
# $Id: robots.txt,v magento-specific 2010/28/01 18:24:19 goba Exp $ | |
# Edited: 2014/10/30 by Byte.nl | |
# | |
# robots.txt | |
# | |
# This file is to prevent the crawling and indexing of certain parts | |
# of your site by web crawlers and spiders run by sites like Yahoo! | |
# and Google. By telling these “robots” where not to go on your site, | |
# you save bandwidth and server resources. | |
# |
#!/bin/bash | |
cd /root | |
wget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz | |
tar xzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz | |
cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so /usr/lib/php5/20090626/ | |
file=/usr/lib/php5/20090626/ZendGuardLoader.so | |
echo zend_extension=$file > /etc/php5/conf.d/zend_extensions.ini | |
chmod 644 $file |