Kien Wiliam

About Kien Wiliam

Magento Ecommerce Developer

Add captcha to contact form for magento1

NameSpace : MyPackage and Module: MyModule Module configuration location : app/etc/modules/MyPackage_MyModule.xml

Create config file for this module location : app/code/local/MyPackage/MyModule/etc/config.xml

Create a observer for that location: app/code/local/MyPackage/MyModule/Model/Observer.php

Create a local.xml to your active theme inside layout folder.

Now copy contacts/form.phtml to mymodule/contacts/form.phtml, add

Clear cache. Now Go to System -> Configuration […]

Read More >

How to translation text by csv file in magento2

To add translation csv file in magento2, you just need to add a folder named: “i18n” inside your module’s folder, i.e. app/code/Magebay/TestModule/i18n Then create a csv file with name of language code. forexample: for english (United state) => en_US.csv french (canada)=>fr_CA.csv Inside csv file you just need to add words which you want to translate, […]

Read More >

How to enable or disable modules in magento2

You can always use CLI command for managing modules. Disable module:

Enable module:

And you can check status of all modules:

It is useful to build a habit of controlling your installation via bin/magento. Also it will help to avoid any new features introduced for module commands. Hope it helps !

Read More >

How to get selected shipping method in magento

Magento 1 :

Magento 2 : You can do this by calling the \Magento\Checkout\Model\Session. Add it to your constructor and get it by using this code :

Or you can get by Object Manager Instance by using this code :

Thank for reading this post, Hope it helps.

Read More >

How to change product price by code for magento

Magento 1 : The code for change price of product, you can put on controller, model, helper or any where

Magento 2 : To change price of product you need to follow these functions:

Thank for reading this post, Hope it helps.

Read More >

How to clear items in cart magento 1&2

Magento 1 : The code for delete shopping cart items for logged in customer:

The code for delete shopping cart items for all customers:

If you have a large number of customers quotes then deleting them by using loop might be time and resource consuming. You can clear/delete all customers cart items (all […]

Read More >