Engine23

Magento Ecommerce Strategy, Design & Development

Server emails and forwarding to outside email address

If you have a server that is sending emails, and you are curious when emails "bounce" and where do they go? Well, you can have them forward to an another email account. Via command line you need to edit /etc/aliases and change the section at the bottom to wherever you want it to go, here is an example of this page: At the very bottom I changed to: # trap decode to catch security attacks decode: root # Person who should get root's mail #root: russell root: whatever@company.com backup: usersnamegoeshere

Magento - get the total value in dollars for reward points

When designing a page in magento and you want to display the Reward Dollars for a customer by using their id number here is how:

$customer = Mage::getModel('customer/customer')->load($customer_id);
 $balance = Mage::getModel('enterprise_reward/reward')
 ->setCustomer($customer)
 ->setWebsiteId(Mage::app()->getWebsite()->getId())
 ->loadByCustomer()
 ->getCurrencyAmount();

Magento - Show reward balance using the user id

When designing a page in magento and you want to display the Reward Dollars for a customer by using their id number here is how:

$customer = Mage::getModel('customer/customer')->load($customer_id);
 $balance = Mage::getModel('enterprise_reward/reward')
 ->setCustomer($customer)
 ->setWebsiteId(Mage::app()->getWebsite()->getId())
 ->loadByCustomer()
 ->getCurrencyAmount();

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() );
             });
         });
 });
</script>