Creating Magento order programmatically and charging saved credit card.

Creating order is the basic functionality of Magento but its the trickiest one at the same time for developers. Yes, its true because its not straight forward like instantiating model, assigning some values and saving it. Sometimes you may want to create auto orders using some cron script.
Continue reading “Creating Magento order programmatically and charging saved credit card.”

Magento 2.0 : Fatal error: Uncaught exception ‘Magento\Framework\Exception\LocalizedException’ with message ‘Can’t create directory

You may encounter below fatal error While installing Magento 2.0

Fatal error: Uncaught exception ‘Magento\Framework\Exception\LocalizedException’ with message ‘Can’t create directory /home/tahir/www/magento-2.0/var/generation/Magento/Framework/App/ResourceConnection/.’ in /home/tahir/www/magento-2.0/vendor/magento/framework/Code/Generator.php:103 Stack trace: #0 /home/tahir/www/magento-2.0/vendor/magento/framework/Code/Generator/Autoloader.php(35): Magento\Framework\Code\Generator->generateClass(‘Magento\Framewo…’) #1 [internal function]: Magento\Framework\Code\Generator\Autoloader->load(‘Magento\Framewo…’) #2 [internal function]: spl_autoload_call(‘Magento\Framewo…’) #3 /home/tahir/www/magento-2.0/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct(‘Magento\Framewo…’) #4 /home/tahir/www/magento-2.0/vendor/magento/framework/ObjectManager/Definition/Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor(‘Magento\Framewo…’) #5 /home/tahir/www/magento-2.0/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(7 in /home/tahir/www/magento-2.0/vendor/magento/framework/Code/Generator.php on line 103

Solution:

Changing permissions of /var directory will solve the issue. Run below command from root of your Magento 2.0 directory.

sudo chmod 755 -R var

 

How to Conditionally remove Magento header/footer?

Are you looking for a solution to conditionally remove Magento header footer but don’t know where to start? Right in this post I will show you how to create custom layout handles and utilize them to conditionally remove header/footer blocks.

In some cases there is a need to remove Magento header or footer from pages, for example you are creating some custom landing page and you don’t want to put header or footer or want to remove both from that page, this tutorial will help you achieving it.
Continue reading “How to Conditionally remove Magento header/footer?”

Add custom Javascript in Magento admin form

In previous post we learnt how to render custom html in tabs block. Now lets add custom JavaScript in Magento admin form. Magento is flexible enough to insert your custom JavaScript code snippets in forms created by your very own Magento modules & extensions. Continue reading “Add custom Javascript in Magento admin form”

How to render custom phtml in Magento admin tabs block?

It’s possible to add custom tabs on any page of Magento administration panel. Normally tabs are generated by Form Blocks, this is fine if you want to create standard forms but what if you need to render something totally different. Life can get very easy if we can render our custom phtml file. Embrace the high flexibility of Magento because its possible to render custom phtml in Magento admin tabs block in two simple steps.
Continue reading “How to render custom phtml in Magento admin tabs block?”

Get custom attribute value in Magento

So you have created some custom attributes for your Magento products and now you want to fetch their values. Magento provides a function getAttributeText that takes attribute code and returns you the attribute value.
Continue reading “Get custom attribute value in Magento”

Configure Authorize.net in Magento

Magento has various built-in payment methods, one of them is Authorize.net. To enable and configure Authorize.net as your payment processor, you should have API Login ID and Transaction Key. You can get these credentials from your Authorize.net account.
Continue reading “Configure Authorize.net in Magento”

Magento Admin: 404 Error Page not found.

mag-admin-404Let’s suppose you are logged in to Magento admin panel and you are installing a new extension that adds some new sections to Magento Configurations.
You activate your new extension and it adds some new tabs/sections but when you click on newly added tab you see a 404 error, don’t worry!

Solution :

Just logout from admin panel and login again. Cheers!!!