Magento
Category

By In Magento

Fixing currency rates in Magento 1.x

While Magento 1.x is slowly fading into history, still there are lot of stores that still use it and therefore need to be maintained on regular bases.

If you have multi currency store, than you are familiar with built-in service Webservicex, which was responsible to update currency rates. Webservicex service stopped working a year ago and to make things even worst it will return 1 for all currency rates. That can cause lot of issues, for example it will allow customers to order items with price of base currency but without conversion.

As alternative many stores switched to ‘Payserv GoogleFinance’ module, which use Google Finance API to retrieve currency rates. Module was free to use and can be found on GitHub (thanks Magento for removing old marketplace – thumb down):

https://github.com/ausger/GoogleCurrency

Recently I noticed that a notice in Magento admin:

WARNING: Cannot retrieve rate from http://www.google.com/finance/converter?a=1&from={{CURRENCY_FROM}}&to={{CURRENCY_TO}}

Message came from ‘Payserv GoogleFinance’ module and was outputted when module tries to update currency rates. This happen because Google Finance changed URL for API service that should return rates. To make module functional small modification is needed and we will make it in Model file:

app/code/local/Payserv/GoogleFinance/Model/Google.php

at line #32 we will replace existing code with this one:

protected $_url = ‘https://finance.google.com/finance/converter?a=1&from={{CURRENCY_FROM}}&to={{CURRENCY_TO}}’;

As you may notice, comparing URL from notice and new URL that we set everything is same except domain name so now it is: https://finance.google.com/finance/

After you made change in file and upload it back, please try to import rates to be sure that module works now properly. As additional check you may open a Google Finance in browser and compare rates, for example USD to EUR: https://finance.google.com/finance/converter?a=1&from=USD&to=EUR

If you have issues to make this small change you can contact me and I can send you version of module with fix applied:
http://magehelperblog.com/contact-me/

 

Read more

By In Magento

Extending CreareSEO module

CreareSEO module is really great addition to any Magento 1 store and helps a lot with basic SEO related settings, latest version can be found on GitHub. Among bunch of useful features there is also a ‘Twitter Cards and Open Graph’ section that will automatically add Twitter card and OG meta tags to product details page.

In few simple steps we will extend that feature to category page as well.

First we will add one more filed in section ‘Twitter Cards and Open Graph’ that we will use for Facebook app ID. Open in editor file: app/code/community/Creare/CreareSeoCore/etc/system.xml
and add code from attached file ‘system-update’. Be sure to copy code within section, we want to keep module consistency and usability.

Save file and open Magento admin: System->CreareSEO->General Settings tab, you will see a new field that we named ‘Facebook app id‘. Enter your Facebook app id and hit save button.

On our luck CreareSEO use base package and default theme so it is easy to find and edit layout files.
So next would be XML layout file:
app/design/frontend/base/default/layout/creareseo.xml

We will add this line:

< block type="core/template" name="ccreareseo.category.social" ifconfig="creareseocore/social/enabled" template="creareseo/social/category-social.phtml" />

For sections (for both sections reference is ‘head’):
catalog_category_layered
and:
catalog_category_view

After that we will create a template file by name ‘category-social.phtml’ and copy it into folder:
app/design/frontend/base/default/template/creareseo/social/

To save you some time I will provide template with code. Since code in template is quite simple so there is no need to explain it line by line. Of course code can be changed as it suit you and additional marks can be added. If you find something interesting you are more than welcome to shear it in comments 🙂

 

Finally we will use Facebook app ID on product details template too (it is missing for some reason), open template:
app/design/frontend/base/default/template/creareseo/social/social.phtml

and add this line:
< meta property=”fb:app_id” content=”< ? php echo Mage::getStoreConfig(‘creareseocore/social/facebookappid’) ? >” />

Once you save everything, clear Magento cache and test your page using official FB tool:
https://developers.facebook.com/tools/debug/

Read more

By In Magento

Lesti FPC on Nexcess Magento Hosting

Step by step guide how to setup Lesti FPC on Nexcess Magento Hosting.

Nexcess offers a full range of Magento hosting options, starting from servers with Shared Resource, Dedicated Servers up to platform specialized for Magento Enterprise.
While packages have a bit higher price that can be easily compensate with quality of service that they provide and technical support which is familiar with Magento platform.

Most interesting thing are Redis Cache & Memcached features that are available even on sheared servers, SIP 200
is lowest package that include those two. So if you have SIP 200 or better package there is no reason why you wouldn’t use all resources that you have and speed up your site significantly.

To make things clear if you have very slow Magento site with bad code and lot of 3rd party modules than there is no trick that would help you. You should simply reconsider fixing those issues first before start any work on optimization and fine tuning.

First step would be to create ticket on Nexcess help-desk and ask them to to create a redis instance on your server for Magento. They usually recommend a combination of Redis for caching and memcached for sessions storage, to get these two often accessed things into memory instead of on disk for performance. Also they can set up a memcached instance for sessions and put those settings in local.xml as well.

Once you have everything setup connect via SSH and test Redis with this command:
redis-cli -ping
if all is good you will get PONG

To flush Redis you can use this command, be sure to replace customer_specific_name in stirng with your customer name:
redis-cli -s /var/tmp/redis-multi_customer_specific_name_cache.sock FLUSHALL
if all is good you will get message OK

Once we have all this set it is time to install Gordon Lesti fpc module (thank you very much Gordon for all your help), it can be downloaded from: https://github.com/GordonLesti/Lesti_Fpc

Unpack zip file and in configuration file:
\app\etc\modules\Lesti_Fpc.xml
change value for ‘active’ node from ‘true’ to ‘false’

From file ‘fpc.xml.sample’ create config faile that we will use ‘fpc.xml’ and open it in editor.
In same time open ‘local.xml’ file of your Magento, Nexcess support already added Redis configuration code into it.
Copy those settings in ‘fpc.xml’ file by replacing code that start with: < ! -- example for redis -- >

Save file with changes and proceed with installation of FPC module via FTP. Once all files are copied open module config file and change value for ‘active’ node from ‘false’ to ‘true’ to enable module. Login into Magento back-end and navigate to System->Configuration->System and under tab ‘Lesti FPC’ you will find module settings. If you are using RWD theme module will work with default settings, in case that you have custom theme some additional directions are needed.
After you complete setup go to System->Cache Managemnt and enable FPC caching, than you can test site speed using your favorite tool.

Cheers !

Read more