Dec 26
2013

Installing Magento and Theming

Posted by bohemia in Untagged 

This little excerpt explains my experience with Magento 1.8 Community Edition. Although everything seems easy in theory; download, unzip the file, create a database and install the software, I had found it a bit a of a journey and experienced a lot of trouble shooting to get Magento to work as I had intended. 

The initial install went smoothly. But, as soon as I had got into the theming with the template the client had wanted, everything changed.

Backtracking, after you install Magento, you keep a key for safe keeping. The key sample is shown below.
Before you continue to your store, please make a note of your encryption key (Magento uses it to encrypt passwords, credit cards and more).

5e20757rrbcfe79fad6487cc0b0839a9

(Make sure you keep it in a safe place.)

Now that Magento seemed like a smooth, running machine, I installed the template as this tutorial explains.

After I had done that, I had various different password and admin issues for which I had to quickly solve my creating new users and updating passwords.
UPDATE admin_user SET password=CONCAT(MD5('zcmypassword'), ':zc') WHERE username='admin'
Installing with SSL seemed problematic, so, I decided to do it without and use a redirect later with .htaccess. At this point, I had done many installations.

After the template was setup, I inserted the 'sql' file into the database. The data needed a severe fixup. For one, the 'core_config_data' table needed proper named urls.
 
Also, the file '/home/username/public_html/app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/upgrade-1.6.0.0-1.6.0.0.1.php' needed to be renamed to '/home/username/public_html/app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/upgrade-1.6.0.0-1.6.0.0.1.php_ renamed'. This file was really problematic and caused frontend and backend errors. But, after this renaming after the template installation I was at least able to see the frontend looking proper. Unfortunately, I had backend 'logging in' issues. To fix those issues, I altered the 'app/code/core/Mage/Core/Model/Session/Abstract/Varien.php' file like shown below.
 // session cookie params
        $cookieParams = array(
            'lifetime' => $cookie->getLifetime(),
            'path'     => $cookie->getPath(),
            //'domain'   => $cookie->getConfigDomain(),
            //'secure'   => $cookie->isSecure(),
            //'httponly' => $cookie->getHttponly()
        );

At this point, I was able to login to the backend end and thought I was home free. Well, all worked well until I tried to set up the Payment methods. When I tried to alter the payment methods, I was deficient in memory. Therefore, I had to login to the server and change the PHP memory to 64M in the file php.ini. Then, I was able to make these changes. I can only imagine many users on shared hosting that run into a wall here. I assume you could alter the database tables to work around changing these settings in the backend, if you really had to.

For testing and setting prices, you can set up sandbox mode. Now, you can add categories, products, etc and test the checkout.

Rarely, does a template display the modular blocks as you want. In this case, I disabled 'Popular Tags' and other unwanted default blocks from appearing in the sidebar.
The sequence to disable the 'Popular Tags':
System > configuration > advanced > disable Mage_Tag

Although I had thought I had the currency setup, I went to the sequence below to set Canadian dollars.
General > Currency setup > Set your currency

Below, is another example of removing unwanted sidebar blocks.
System >Advanced >Remove 'Compare Products'

By default 'Out of stock' .. Needed to be changed I this or it won't show up. Alternatively, you can set the managing stock option to 'No'.

At this point, I was happy and thought I was in the clear... until the cart would not update properly or remove items in the cart.  I read through various forum posts and tried clearing the cache and clearing cache index data. But, this failed. I also tried the sequence below.
System >Cache Management >Select All >Enable > Submit
I also flushed the Magento cache. Still no luck.

With a little quick luck and research, I was directed to fix the template file shown below.
Go to app/design/frontend/default/my_template/template/checkout/cart.phtml
Change:
 <form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
        <fieldset>
Change to:
 <form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
    <?php echo $this->getBlockHtml('formkey'); ?>
        <fieldset>
After this change above, the checkout worked.

Now, I was a little concerned about the importance of the earlier login issue.
Therefore, I uncommented the varien.php file and checked if logging in to the backend worked, and it did.

File:
app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
comment out
 // session cookie params
        $cookieParams = array(
            'lifetime' => $cookie->getLifetime(),
            'path'     => $cookie->getPath(),
            'domain'   => $cookie->getConfigDomain(),
            'secure'   => $cookie->isSecure(),
            'httponly' => $cookie->getHttponly()
        );
Styling

At this point, it seemed like most of the storm was over and I could get down to some basic styling; such as removing unwanted blocks.

The CMS tab allowed some quick, simple, styling options. For example, I quickly changed the footer with the click and command sequence:
CMS > Static Blocks >Footer Static >Customize or (display:none)

The system tab was also useful. The sequence I used is show below.
System >configuration >General >Design tab >Add keywords, change template links, etc
To change the home page title,
CMS > Select 'Home page' >Change 'Page Title' >Save
Taxes and Shipping

Finally, I was able to start playing with the taxes and shipping settings.

Make a tax rule like for a country, state or province.
Here is where you need to set the Customer Tax Class, Product Tax Class, Tax Rate

Make a tax class for each area.

Manage Tax Zones and Rates

Conclusion:
After going through the events described above, I was able to run the shop effectively. Setting up and editing products, prices and taxes worked as expected.


comments powered by Disqus