Magento - using the backend store configuration for custom work

If you need to use the backend settings for Magento for example the General Email, here is how you do it. This is helpful so you do not have to adjust your custom code, its all managed through the admin section of Magento.

//General Contact

$name = Mage::getStoreConfig('trans_email/ident_general/name'); //sender name

$email = Mage::getStoreConfig('trans_email/ident_general/email'); //sender email

//Sales Representative

$name = Mage::getStoreConfig('trans_email/ident_sales/name'); //sender name

$email = Mage::getStoreConfig('trans_email/ident_sales/email'); //sender email

Read more

install PEAR and PHING for Mac

export PATH=/usr/local/bin:/Users/russell/:$PATH
export PATH=/Users/russell/pear/:$PATH
export PATH=/usr/bin/pear/bin/:$PATH
export PATH=/usr/local/bin:$PATH
PATH=$PATH:/usr/local/bin; export PATH

export PATH=/usr/local/bin:/Users/russell/:$PATHexport PATH=/Users/russell/pear/:$PATHexport PATH=/usr/bin/pear/bin/:$PATHexport PATH=/usr/local/bin:$PATHPATH=$PATH:/usr/local/bin; export PATHFrom terminal: Install pear in home directory or cd ~ if unsure cd /Users/yourusername ( enter ) OR cd ~ ( enter ) (The instructions came straight from http://pear.php.net/manual/en/installation.getting.php)

For a system-wide installation, you will need to execute the go-pear script with increased permissions. This is only recommended for advanced users.
        $ wget http://pear.php.net/go-pear.phar $ sudo php -d detect_unicode=0 go-pear.phar

Then in terminal run this command $ wget http://pear.php.net/go-pear.phar make sure you change the

Read more

Setting up pear, PHING on mac OSX 10.7.2

These instructions are for: Computer/OS: Mac 10.7.2

Install pear in home directory or use command line "cd" to change directory using terminal:
$ cd ~ ( hit enter )

You need to change permissions on a few folders ( maybe create them ) to allow write access: If the folders do not exist, from command line you create them:

$ mkdir /usr/local
$ mkdir /tmp/pear
$ mkdir /usr/bin/pear

Now via command line change the permissions:

$ sudo chmod -R 777 /usr/local/
$ sudo chmod -R 777 /tmp/pear
$ sudo chmod -R 777 /usr/lib/php
$ sudo chmod -R 777 /usr/bin/pear

Read more

Setting up PEAR and PHING on Mac with MAMP PRO 2.0

From terminal: Install pear in home directory or cd ~ if unsure cd /Users/yourusername ( enter ) OR cd ~ ( enter )

To install/reinstall go to this site http://pear.php.net/go-pear.phar and then 'Save as...' and make sure you save this in your home directory Then in terminal run this command $ php go-pear.phar

Now make a symbolic link so you can just type in pear at the command line prompt

$ sudo ln /Users/yourusername/pear/bin/pear /usr/local/bin/

( note you may not have /usr/local/bin....you may just have /usr/bin and thats ok use that location ) Next, run these tow commands in terminal $ echo ‘export

Read more

jQuery ID's with a semicolon

If your form has semicolons, and your using jQuery, in order for it to work you have to use a double backslash for it to work:

This example, when executed, will copy the content from the billing input fields to the shipping input fields <form> <a href="javascript: void(0);" id="update_shipping_address_checkout">Update Shipping</a><input type="text" id="shipping:firstname"> <input type="text" id="shipping:lastname"> <input type="text" id="billing:firstname"> <input type="text" id="billing:lastname"> </form>

<script type="text/javascript">
         jQuery(document).ready(function($) {
          $('#update_shipping_address_checkout').live('click', function() {
                var partsArray 	= new Array();
                $(':input.billing-data').each(function() {
                     // Split this, using the : as the key
                     // We are gathering information so we know what shipping input fields to populate
                     // Examples are firstname, lastname
                     partsArray = $(this).attr('id').split(':');
                     // The results are something like:
                     // partsArray[0] = billing
                     // partsArray[1] = firstname
                     // update the related shipping input
                    $( ':input.#shipping\\:' + partsArray[1] ).val( $(this).val() );

JQuery no conflict

To use jQuery in no conflict you can use:

<script type="text/javascript">
  jQuery(document).ready(function($) {
    // Code that uses jQuery's $ can follow here.
  // Code that uses other library's $ can follow here.

Backing up and restoring mysql from command line

Back up From the Command Line (using mysqldump) If you have shell or telnet access to your web server, you can backup your MySQL data by using the mysqldump command. This command connects to the MySQL server and creates an SQL dump file. The dump file contains the SQL statements necessary to re-create the database. Here is the proper syntax:

$ mysqldump --opt -u [uname] -p[pass] [dbname] > [backupfile.sql]
  • [uname] Your database username
  • [pass] The password for your database (note there is no space between -p and the password)
  • [dbname] The name of your database
  • [backupfile.sql] The filename for your database backup
  • [--opt] The mysqldump option

For example, to backup a database named 'Tutorials' with the username 'root' and with no password to a file tut_backup.sql, you should accomplish this command:

Read more