Archive for the ‘Magento eCommerce Tips’ Category

Magento eCommerce Tips – Magento is a great shopping cart and here are some tips.

04
Jan

As of 1.4.2 it is deprecated to define order statues and states via config.xml. Then, how will you get more order statuses in the admin order details page?

Consider for example you have an order in ‘Pending Payment’ state and you want to change it to ‘Processing’. If, you go to the order details page in the admin you will find only one option in the order status drop down (which is ‘Pending Payment’ itself!)
What if you want to show ‘Processing’ too in the drop down?
You will need to make changes in the Magento sales_order_status_state table like this:

INSERT INTO `sales_order_status_state` (`status`, `state`, `is_default`) VALUES ('processing', 'pending_payment', '0');

[EDIT] Just for your info:
Before 1.4.2 you would need to override the Mage/Sales/etc/config.xml file and modify the <global><sales><order><states> section to look like this:

<global>
.....
.....
	<sales>
.....
.....
		<order>
.....
.....
			<states>
.....
.....
				<pending_payment translate="label">
					<label>Pending Payment</label>
					<statuses>
						<pending_payment default="1"/>
						<processing default="0"/>
					</statuses>
				</pending_payment>
.....
.....
			</states>
.....
.....
		</order>
.....
.....
	</sales>
.....
.....
</global>

, , ,

23
Dec

You have created a static block and now you want to add it to your CMS page.
You can do it in 2 ways. Assume you have created a block called sch_myblock:

1. CMS Page “Content” tab:
// In the CMS page “content” you can include a custom static block like this

{{block type="cms/block" block_id="sch_myblock" template="cms/content.phtml"}}

2. CMS Page “Design” tab:
// In the “Page layout” section you can add a custom block like this

// In the "Page layout" section you can add a custom block like this
<reference name="left">
	<block type="cms/block" name="sch_myblock" before="-">
		<action method="setBlockId"><block_id>sch_myblock</block_id></action>
	</block>
</reference>

, , ,

23
Dec

By default Magento Admin Url is:
http://[your magento shop]/admin

But, what if you do not want to use admin in the URL? For example, you want your admin URL to look like this:
http://[your magento shop]/shopadmin

If, you check your files via FTP you will not see a folder called admin. So, how do you do it?
Open app/etc/local.xml – you will find a section like this:

    <admin>
        <routers>
            <adminhtml>
                <args>
                    <frontName><![CDATA[mybiz]]></frontName>
                </args>
            </adminhtml>
        </routers>
    </admin>

The name that you enter in the “frontend” tag is the name that will be used to view the admin.
In this example, the Magento admin URL will be
http://[the magento shop]/mybiz

, ,

29
Nov

If you need to change the Magento {{base_url}} manually (hopefully, you have a very good reason to do this) – all you need to do is edit 2 rows in the core_config_data table:

#1 path: web/unsecure/base_url and
#2 path: web/secure/base_url

That’s it! Don’t forget to clear the cache (deleting var/cache should help)

, ,

03
Oct

Assuming you know how to create a custom module, consider a case where you need to create a URL for your module. Follow these steps:

In your module’s config.xml file:

<modules>
.....
</modules>
<global>
....
</global>
<frontend>
	<routers>
		<schurl> --> name that will used in the URL
			<use>standard</use>  ---> standard means its a frontend url; admin will mean it is a backend url
			<args>
				<module>Mage_Schogini</module>  ---> which is the module to be used
				<frontName>schurl</frontName>   ---> name that will used in the URL
			</args>
		</schurl>
	</routers>
</frontend>
<default>
.....
</default>

Create a controller file TestController.php in your module’s controller folder like this (as you may have guessed, my modules name is Schogini):

class Mage_Schogini_TestController extends Mage_Core_Controller_Front_Action
{
	public function showmsgAction()
	{
		echo 'Here';
	}
}

This is what happens when you browse this URL
http://mymagentostore.com/schurl/test/showmsg/

  • schurl tells that the controller to check is Mage_Schogini (the name that is specified in the config file in the section: args > module)
  • test tells that controllers/TestController.php file must be checked
  • showmsg tells that showmsgAction() method must be called.

Hence, it will look for the method showmsg() inside the Mage_Schogini_TestController class

, , , , , , , , , , , , , ,

07
Jul

If, you get a message like this:  “Please enter a valid credit card verification number.” every time you enable “CVV check” in your payment gateway, and you are sure that your payment module settings are correct and your card details are valid then, its most likely that the message is not coming from your payment module.

Instead it could be that the control is not reaching the payment module at all and the message is coming from this Magento file:
app/code/core/Mage/Payment/Model/Method/Cc.php line #150, validate credit card verification number section.

Why is this happening? Does this error occur for ‘Saved CC’ payment method too (it is the default card payment method got with Magento)?

Well, one reason that I found is – custom checkout module. Are you using any custom checkout module? If yes, then disable it and try the normal Magento one page checkout. The chances are all will work fine. I have noticed that some custom checkout modules fail to send the CVV number back to the code – hence, Magento will catch it and throw back the error – the payment module is nowhere in the picture yet.

So, before you panic that your card details are invalid or your Payment Gateway or payment module is not working, confirm that it is not your custom checkout module that is the culprit.

, , , , , , , , , , , , , , , ,

01
Mar
Download Sample Data zip file from Magento Website and extract the zip file.
Drop all the tables from your magento database.  It would be easy to drop the
magento database and then recreate it instead of dropping individual tables. Import sample data sql file into your magento database. You have to drop all tables from your magento database before importing the sample sql file. You will get error afterward if you import the sample data without dropping tables from your magento database. Go to your magento installation folder and delete local.xml file present inside app/etc folder.
Reinstall magento. Clear your browser cache or open your website in another browser and you are done

11
Feb
Try the following steps,
1. Try accessing your admin using your ip (if it is localhost, try 127.0.0.1).
2. If you cant get around with the above step, try the following steps,
Navigate within your Magento database to the MySQL table core_config_data and look for a row with the field path set to the valueweb/cookie/cookie_domain. There might be multiple entries, but the one with the scope_id set to 0 should be matching the domainname you’re using to access Magento.
3. Another problem could be that the so-called Secure URLs and/or Unsecure URLs do not match the current hostname.
In the same MySQL table core_config_data you might find various entries with path starting withweb/secure/base or web/unsecure/base. These also need to point to the right hostname. Note that the number of occurances could range from 0 (nothing configured) to 10 (everything configured).

Try the following steps,1. Try accessing your admin using your ip (if it is localhost, try 127.0.0.1). 2. If you cant get around with the above step then as a last step try the following steps,                            Navigate within your Magento database to the MySQL table core_config_data and look for a row with the field path set to the valueweb/cookie/cookie_domain. There might be multiple entries, but the one with the scope_id set to 0 should be matching the domainname you’re using to access Magento.3. Another problem could be that the so-called Secure URLs and/or Unsecure URLs do not match the current hostname.                             In the same MySQL table core_config_data you might find various entries with path starting withweb/secure/base or web/unsecure/base. These also need to point to the right hostname. Note that the number of occurances could range from 0 (nothing configured) to 10 (everything configured).

06
Dec

EDIT: This article is applicable for Magento versions 1.5.0.1 too

The latest 1.4.x series of Magento has some small changes/enhancements which are not exactly backward compatible. This is especially true with themes.

As payment module developers, we get a lot of people coming back saying that after upgrade or fresh installation of the latest version, the payment step on the one page checkout doesn’t work.

If, you have a custom theme installed and, after upgrade, you find that your checkout is not working – that is after entering your credit card information and click ‘Next’ nothing happens – follow these steps: More »

, , , , , , , , , , , , , , ,

01
Dec

With latest versions of Magento being churned out regularly and quite rapidly it may seem a little odd to write about installing an old version of Magento. But, module developers like us need to ensure that our modules work across all major and widely used versions of Magento and believe it or not there is a very large majority of businesses that use Magento version 1.3.2.4

After, encountering quite a few errors and going through even more forums I was able to successfully install this version. So, here we go – all the steps I have followed to install Magento 1.3.2.4

  1. Create a blank database
  2. If, you want to populate your shop with the dummy Magento products then, import the sample data NOW. It is very important to do this BEFORE you start the installation process. You can download the sample data here:

    http://www.magentocommerce.com/download

  3. Download Magento version 1.3.2.4 and unzip it into your web-server. Here is the link to download:
    http://www.magentocommerce.com/download (click the ‘Release Archives’ tab)
  4. From the sample data zip that you got in step 2 – copy the media folder to your magento root folder (that is the folder you just unzipped in step 3)
  5. Browse the Magento folder to start the installation process.
    Please note: If, you are working on XAMPP or WAMPP then browse 127.0.0.1 instead of localhost and ensure that you set your locale correctly.
  6. Follow the installation steps
  7. After installation – browse the main shop, order flow and the admin area.
    If, you do not get any errors then you are lucky and you can stop here.
    Else, proceed.
  8. Open the file: <magento folder>/app/code/core/Mage/Payment/Model/Config.php and change this
    public function getCcTypes()
    {
    $_types = Mage::getConfig()->getNode(‘global/payment/cc/types’)->asArray();

    uasort($_types, array(‘Mage_Payment_Model_Config’, ‘compareCcTypes’));

    $types = array();
    foreach ($_types as $data) {
    $types[$data['code']] = $data['name'];
    }
    return $types;
    }

    to this
    public function getCcTypes()
    {
    $_types = Mage::getConfig()->getNode(‘global/payment/cc/types’)->asArray();

    uasort($_types, array(‘Mage_Payment_Model_Config’, ‘compareCcTypes’));

    $types = array();
    foreach ($_types as $data) {
    if (isset($data['code']) && isset($data['name'])) {
    $types[$data['code']] = $data['name'];
    }
    }
    return $types;
    }

  9. Open this file <magento folder>/lib/Zend/Validate/Hostname.php and around line number 320 comment this line
    if (Zend_Loader::isReadable($classFile)) {

    and instead use this:
    if (file_exists($classFile) && Zend_Loader::isReadable($classFile)) {

  10. That’s it!

Hope this helps you get through the installation process smoothly.

,