Skip to content

Instantly share code, notes, and snippets.

View codesprint's full-sized avatar

a.ostermeyr codesprint

View GitHub Profile
// via Mage_Core_Helper_Url
$currentUrl = Mage::helper('core/url')->getCurrentUrl();
@codesprint
codesprint / 1.sh
Created March 15, 2015 14:56
wget with basicauth
wget --http-user=[user] --http-password=[password] [url]
@codesprint
codesprint / htaccess
Last active August 29, 2015 14:17
Redirect http to https via .htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
@codesprint
codesprint / 1.txt
Created March 13, 2015 11:18
Magento: Category tree
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Categories.php
@codesprint
codesprint / 1.sh
Created March 13, 2015 11:15
Mysqldump with exampledata
--where="1 limit 30"
@codesprint
codesprint / 1.php
Created March 13, 2015 11:11
Magento: find products without images
$products = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('image', 'no_selection');
@codesprint
codesprint / 1.txt
Created March 13, 2015 11:09
Magento: debug mysql
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '55851-168-1-7128' for key 'PRIMARY'' in /kunden/web1/webseiten/example.com/www/lib/Zend/Db/Statement/Pdo.php:229
Stack trace:
#0 /kunden/web1/webseiten/example.com/www/lib/Zend/Db/Statement/Pdo.php(229): PDOStatement->execute(Array)
#1 /kunden/web1/webseiten/example.com/www/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /kunden/web1/webseiten/example.com/www/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /kunden/web1/webseiten/example.com/www/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /kunden/web1/webseiten/example.com/www/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
#5 /kunden/web1/webseiten/example.com/www/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend in /kunden/web1/webseiten/example.com/www/lib/Zend/Db/Statement
@codesprint
codesprint / 1.php
Created March 13, 2015 11:08
Magento: echo static block
<?php echo Mage::getModel('cms/block')->load('footer_links')->toHtml() ?>
@codesprint
codesprint / 1.sql
Created March 13, 2015 11:02
Magento: delete all products from the database
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `catalog_product_bundle_option`;
TRUNCATE TABLE `catalog_product_bundle_option_value`;
TRUNCATE TABLE `catalog_product_bundle_selection`;
TRUNCATE TABLE `catalog_product_entity_datetime`;
TRUNCATE TABLE `catalog_product_entity_decimal`;
TRUNCATE TABLE `catalog_product_entity_gallery`;
TRUNCATE TABLE `catalog_product_entity_int`;
TRUNCATE TABLE `catalog_product_entity_media_gallery`;
@codesprint
codesprint / 1.js
Last active February 28, 2017 16:07
Magento: countryRegions not defined
countryRegions is not defined