Engine23

Development

Magento - How to create custom Customer Tab and submit a form

If you ever needed to create a custom Customer tab and put some information there, as well as submit a form, this should give you enough information to accomplish this task.

Create Module declaration

app/etc/modules/Russellalbin_Customertab.xml

<?xml version="1.0"?>
<config>
<modules>
<Russellalbin_Customertab>
<active>true</active>
<codePool>local</codePool>
</Russellalbin_Customertab>
</modules>
</config>

Create the module configuration file

Read more

Zend framework 1.x getting database config from application.ini

$configuration = new Zend_Config_Ini(
APPLICATION_PATH.'/configs/application.ini',
'development'
);
$host = $configuration->resources->db->params->host;
$pass = $configuration->resources->db->params->password;
$user = $configuration->resources->db->params->username;
$dbname = $configuration->resources->db->params->dbname;

$db = Zend_Db::factory('Pdo_Mysql', array(
'host' => $host,
'username' => $user,
'password' => $pass,
'dbname' => $dbname
));

Read more

Setting up a NEW MySQL Master Slave replication

Step 1: SSH into both servers

Step 2: Install mysql 

sudo apt-get install mysql-server -y

Step 3: Master Server update to my.cnf. If your my.cnf has 

#server-id              = 1
#log_bin                = /var/log/mysql/mysql-bin.log

Simply remove the # and then restart your mysql server and if not, just add them it should look like this:

Read more

Magento - How to get the Products per Page on Grid Default Value

So, here is the scenario, you have a custom module that is returning a list of products.

You want to make sure that your using the Products per Page on Grid Default Value from the Magento Admin to stay true to whats normally done.

In order to get this value in your code, here is how to access it:

$limit = Mage::getStoreConfig('catalog/frontend/grid_per_page');

GIT code push

#!/bin/bash

NOW=$(date +"%Y%m%d%H%M%S")

NEW_FOLDER_PATH="/var/www/magento/releases/$NOW"

VAR_FOLDER="/var/www/magento/shared/var/"

MEDIA_FOLDER="/var/www/magento/shared/media/"

SHARED_ETC_FOLDER="/var/www/magento/shared/app/etc"

MAGENTO_ROOT="/var/www/magento/"

GROUP="www-data"

REPO="ssh://username@192.168.1.1/~/git/projectname.git --depth 1 "

Read more

Magento - Customize Magento top links

Customize or add to the Magento topLinks ( top.links )

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
        <reference name="root">
            <reference name="top.links">
                <!-- Add custom links. Pretty self-explanatory.
 Dig into app/code/core/Mage/Page/Block/Template/Links.php for more info -->
                <action method="addLink" translate="label title">
                    <label>About Us</label>
                    <url>about</url>  <!-- can use full url also -->        

Read more

Setup Ubuntu 12.04, LAMP, PhpStorm, Adminer, SVN and prep for Magento

Part 1 - Ubuntu

  1. Download iso from http://www.ubuntu.com/download/desktop and burn it to a disc or you can use http://www.pendrivelinux.com/ if you have boot from flash drive support
  2. Stick in the disc, start your computer and press F12 during boot, then select to boot from cd ( this step may be different for your computer )

    The install will take a good 20 minutes..

  3. I highly recommend plugging in your laptop and a wired internet connection to get the updates and 3rd party software during install
  4. I go and figure out what updates I want to install at this point, as I havn't invested a bunch of time and depending on your hardware they could cause problems that are easiest to fix by reinstalling. You do this by going to the top right icon and "Software Up to Date". If you run into troubles with the updates, I recommend going into settings and turning off "Indepent updates" under other software and all but "Important security updates". Then trying all of the above again.

Read more