Fix Credit Card Payment Checkout Issue in Magento 1.4.1.x

The Magento team has changed the way credit card numbers are validated in Magento version 1.4.1.0. The new method requires an additional JS include in your page.xml.

The new file is located at /js/lib/ccard.js.

If you update to Magento 1.4.1.0 and your theme does not include this file, your checkout will not work for credit card payment methods. When a Credit Card payment method is selected, the one page checkout will not proceed past the payment section. The continue button will not be clickable, rendering your Credit Card payment method completely unusable.

The solution is to add this new JS include in two places in your /app/design/frontend/default/[YourThemeName]/layout/page.xml

The first is in the default layout section around line 37.

<block type="page/html_head" name="head" as="head">
<action  method="addJs"><script>prototype/prototype.js</script></action>
<action method="addJs"  ifconfig="dev/js/deprecation"><script>prototype/deprecation.js</script></action>
<action  method="addJs"><script>lib/ccard.js</script></action>
<action  method="addJs"><script>prototype/validation.js</script></action>
<action  method="addJs"><script>scriptaculous/builder.js</script></action>
<action  method="addJs"><script>scriptaculous/effects.js</script></action>
<action  method="addJs"><script>scriptaculous/dragdrop.js</script></action>
<action  method="addJs"><script>scriptaculous/controls.js</script></action>
<action  method="addJs"><script>scriptaculous/slider.js</script></action>
<action  method="addJs"><script>varien/js.js</script></action>
<action  method="addJs"><script>varien/form.js</script></action>
<action  method="addJs"><script>varien/menu.js</script></action>
<action  method="addJs"><script>mage/translate.js</script></action>
<action  method="addJs"><script>mage/cookies.js</script></action>
 
<action  method="addCss"><stylesheet>css/styles.css</stylesheet></action>
<action  method="addItem"><type>skin_css</type><name>css/styles-ie.css</name><params/><if>lt  IE 8</if></action>
<action  method="addCss"><stylesheet>css/widgets.css</stylesheet></action>
<action  method="addCss"><stylesheet>css/print.css</stylesheet><params>media="print"</params></action>
 
<action  method="addItem"><type>js</type><name>lib/ds-sleight.js</name><params/><if>lt  IE 7</if></action>
<action  method="addItem"><type>skin_js</type><name>js/ie6.js</name><params/><if>lt  IE 7</if></action>
</block>

The second place you need to add this JS file is in the print section around line 113.

<block type="page/html_head" name="head" as="head">
<action method="addJs"><script>prototype/prototype.js</script></action>
<action method="addJs"><script>mage/translate.js</script></action>
<action method="addJs"><script>lib/ccard.js</script></action>
<action method="addJs"><script>prototype/validation.js</script></action>
<action method="addJs"><script>varien/js.js</script></action>
 
<action method="addCss"><stylesheet>css/styles.css</stylesheet></action>
<action method="addItem"><type>skin_css</type><name>css/styles-ie.css</name><params/><if>lt IE 8</if></action>
<action method="addCss"><stylesheet>css/widgets.css</stylesheet></action>
<action method="addCss"><stylesheet>css/print.css</stylesheet><params>media="print"</params></action>
 
<action method="addItem"><type>js</type><name>lib/ds-sleight.js</name><params/><if>lt IE 7</if></action>
<action method="addItem"><type>skin_js</type><name>js/ie6.js</name><params/><if>lt IE 7</if></action>
 
</block>

Adding the new JS include in these two places should fix the checkout problem.

Change Magento Admin URL

It is very easy to change admin URL for magento. If you want to change URL from

http://www.example.com/admin

TO

http://www.example.com/customadmin

All you need is to properly set your custom admin url in the config file /app/etc/local.xml. In this file change this:

<frontName><![CDATA[admin]]></frontName>

to this:

<frontName><![CDATA[customadmin]]></frontName>

Now save the file and clear the cache (if you are using it). If you still don’t have access to the admin you may clear the cache by deleting the contentss of the /var/cache directory. This is it.

Include a Javascript file into Magento templates

Customising your magento store can be a good way to set your store apart from the competition so adding features that require javascript files is a common task when building a project.  Learn how to include a javscript file into your magento page templates with this quick how to.The default layout template load is made primarily through the page.xml file located at the following url for custom themed installs /app/design/frontend/your-instance-name/your-theme-name/layout/page.xml , or for the default theme at /app/design/frontend/default/default/layout/page.xml.

Find the following block encapsulator <block type=”page/html_head” name=”head” as=”head”> and simply add the following command inside the block

<action method=”addJs”><script>yourscriptname.js</script></action>

Then upload you updated page.xml file.

With that done, you need to now upload your javascript file to /skin/frontend/your-instance-name/your-theme-name/js/yourscriptname.js, or for the default theme /skin/frontend/default/default/js/yourscriptname.js

Get the current category name in Magento

A key part of the request execution has information stored into the Mage registry and accessing this information is a simple call requesting the needed data.  Learn how to access the registry to find the current category title.

The registry object we are interested in is ‘current_category’ and we will utilise the registry call getName() to create call to retrieve the needed information thusly;

Mage::registry('current_category')->getName();

src: http://www.magento-tutorial.com/

Creating new theme and apply it to a magento store

After finishing Magento installation its time to look at how you want your store to look, what theme will it have , and will the same theme feature across all your stores if you have more then one ?  Our tutorial shows you how to duplicate the default theme and begin to modify it to give you greater flexibility on the look and feel of your new e-commerce store.

Magentos’ file structure is divided into two key locations , one containing the files which our end user will have access to such as css and JavaScript and one containing the block, containers and actual code that will build up any given page.  For the default installations these paths are as follows when magento was installed to the root of your site:

For the building blocks of page construction – app/design/frontend/default/default/
For the accessible browser assets – skins/frontend/default/default/

In the installation above you can see that the file structure represent the hierarchy of the design aspects, in this case app/design/frontend/instance/theme/

When building a site it is a good idea to have a separate name for your instance and your theme , for example you may decide to call your instance e-commerce, and your theme standard-blue.  Giving your structures and assets a strong naming convention will help you to organise and navigate your files with ease.

So the first stage to building a new theme is to copy the two above folders and rename them as you see fit.  This will give you two new sets of files to upload to your server via FTP.

Magento will now be able to access your new instance and theme and that means we can apply our new files as standard to our store.  To do so log into your Magento admin area and choose ‘System’, from the drop down menu choose ‘Configuration’.  Once the configuration screen loads choose the ‘Design’ option from the menu on the left hand side.  If you have followed our tutorial ‘Setup a new store’ you can choose the store you wish to configure the design for by selecting it form the drop down menu in the configuration scope.

Within the design configuration panel there are two key elements we want to change, the value next to the label ‘Current Package Name’, change this to your new instance name, for example e-commerce’.  The value next to the ‘Default’ label under the themes section needs to be changed to your theme name, for example ’standard-blue’.

With these changes made choose ‘Save Config’ to have magento start to use your new files.

src: http://www.magento-tutorial.com/