Template Marker

Here is a collection of marker that can be used in email templates, cms pages and static blocks. Get system configuration fields {{config path=”web/unsecure/base_url”}} Customer data {{var customer}} -> print all customer data {{var customer.ID}} {{var customer.email}} {{var customer.firstname}} {{var customer.lastname}} {{var customer.name}} {{var customer.password}} {{var customer.created_in}} -> store name where customer was created in {{var […]

Protect directory with username and password

 To protect a folder with an password prompt, you only need to place a .htaccess and a .htpasswd into the target directory. .htaccess AuthUserFile /root/path/to/.htpasswd AuthGroupFile /dev/null AuthName “Title for the popup window” AuthType Basic <Limit GET> require valid-user </Limit> .htpasswd username:NiceCryptOrMD5encryptedPasswordHash The passwort can be crypted via crypt or MD5. On http://de.selfhtml.org/servercgi/server/htaccess.htm#verzeichnisschutz you can find […]

Directly query database

To directly send queries against the database: //$read = Varien_Db_Adapter_Mysqli extends Zend_Db_Adapter_Mysqli extend Zend_Db_Adapter_Abstract $read = Mage::getSingleton(‘core/resource’)->getConnection(‘core_read’); $query = ” SELECT SUM(`grand_total`) AS `grand_total`, SUM(`subtotal`) AS `subtotal`, SUM(`tax_amount`) AS `tax_amount`, SUM(`discount_amount`) AS `discount_amount`, SUM(`shipping_amount`) AS `shipping_amount`, FROM `sns_salesreport_monthstats` WHERE `year` = $year “; $data = $read->fetchRow($query); //fetches only the first row // or multiple rows: $sql […]