Tuesday 7 July 2015

Magento website SEO skills/tips

Understand your audience with google trends

In google trends, any keywords can be put into the search box and google will display the search interests, related searches etc which can help you identify your audience, the potential search keywords the contents.

Use informative URLs

Magento has the functionality of generating the informative URLs by re-indexing the catalog_url index.
But it's only helpful for English categories and products. If your website is in other languages, you might need to specify the URL keys for categories and products, and the cms pages manually in admin pane or programmatically.

Add your site to major search engines

There are some common used search engines listed as below:
1. Google
2. Bing
3. Baidu
4. Sougou
Add your site to these search engines and submit the sitemap or URLs. The methods of adding your site vary from different engines. However, what you need to do is just to follow the instructions which shouldn't be difficult.

The method of checking whether you website has been indexed by search engines

For both google and baidu, you can just type 'site:yourdomaim' and the indexed pages will show up. Since in Magento the 404 pages are easy to occur if there is anything wrong with Magento index, you need to make sure the index system is correct and check and fix the 404 pages found in the search results.




Wednesday 1 July 2015

Magento Remove firstname and lastname for registration

Set the firstname and lastname fields in database not required

SELECT * FROM `eav_entity_type`;#find the customer entity_type_id
SELECT * FROM `eav_attribute` WHERE `attribute_code` IN ('lastname','firstname') and `entity_type_id`=1; #find firstname and lastname attributes;#find firstname and lastname attributes
UPDATE `eav_attribute` SET `is_required`=0  WHERE `attribute_code` IN ('lastname','firstname') and `entity_type_id`=1; #set is_required 0 which means it's not necessary

Copy and modify template file to remove the classes related to validation

Copy \app\design\frontend\base\default\template\customer\widget\name.phtml to your theme folder
Remove the following code for firstname and lastname field:
class='required'
<?php echo $this->helper('customer/address')->getAttributeValidationClass

Create a custom extension to override Mage_Customer_Model_Customer

Create a custom extension.
Add the following xml in config.xml
     <global>
        <models>
            <customer>
              <rewrite>
               <customer>Yourcompany_Yourmodule_Model_Customer</customer>
              </rewrite>
            </customer>
        </models>
     </global>
Copy the validate method from magento core to your module and remove the validation code of firstname and lastname

Hide firstname and lastname in registration form if needed

Add the following code in less file:
//hide first name and last name in registration form by bargainoverseas dev
.customer-account-create {
    .customer-name{
         display: none;
    }
}

Magento Add a link to top links or remove a link from top links

Add a link to top links via layout xml, for instance in the theme's local.xml

   <customer_logged_out>
        <reference name="top.links">
            <action method="addLink" translate="label title" module="customer"><label>Create an Account Imediately</label><url helper="customer/getRegisterUrl"/><title>Create an Account Imediately</title><prepare/><urlParams/><position>10</position></action>
        </reference>
        <remove name="reorder"></remove>
    </customer_logged_out>
note: this is for unsigned-in user, if you search addLink in the app/design folder, there will be more for specific pages. 

Remove a link from top links via layout xml

    <customer_logged_out>
        <reference name="top.links">
            <action method="removeLinkByUrl"><url helper="customer/getAccountUrl"/></action>
        </reference>
    </customer_logged_out>