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 install Laravel on Ubuntu

1. Install curl if not already installed

sudo apt-get install curl

2. install composer if not already installed

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

3. Now run blow command to install laravel

composer global require "laravel/installer=~1.1"

4. Add laravel to PATH to make it available everywhere

export PATH="~/.composer/vendor/bin:$PATH"

5. Create your Laravel app

Now that Laravel is added to path, now all sudoers can create laravel apps using below command

laravel new app-name

if you are not a sudoer, above command will show below error

laravel: command not found

You can create a link in /usr/local/bin to solve this problem

sudo ln -s /root/.composer/vendor/bin/laravel /usr/local/bin/laravel

Now non sudoers can create laravel apps like

sudo laravel new app-name

6.Install mod_rewrite if not already installed

sudo a2enmod rewrite
service apache2 restart

You can confirm if its enabled using below command

sudo apache2ctl -M

if you created your app inside web server root directory (/var/www/html/) then you can access it like

http://localhost/app-name/public

Creating VHOST for Laravel application

1. Create vhost file

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/app-name.com.conf
sudo nano /etc/apache2/sites-available/app-name.com.conf

The file will look something like this (I’ve removed the comments here to make the file more approachable):

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

First, we need to change the ServerAdmin directive to an email that the site administrator can receive emails through.

ServerAdmin admin@app-name.com

Then ServerName and ServerAlias

ServerName app-name.com
ServerAlias www.app-name.com

The only other thing we need to change for a basic virtual host file is the location of the document root for this domain. We already created the directory we need, so we just need to alter the DocumentRoot directive to reflect the directory we created:

DocumentRoot /var/www/app-name

In total, our virtualhost file should look like this:

<VirtualHost *:80>
    ServerAdmin admin@app-name.com
    ServerName app-name.com
    ServerAlias www.app-name.com
    DocumentRoot /var/www/html/app-name/public
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

save and close the file.

2. Enable the Virtual Host File

sudo a2ensite app-name.com.conf

When you are finished, you need to restart Apache to make these changes take effect:

sudo service apache2 restart

3. Set Up Local Hosts File (Optional)

sudo nano /etc/hosts

hosts file will look something like this

127.0.0.1   localhost
111.111.111.111 app-name.com

For the domain that I used in this guide, assuming that my VPS IP address is 111.111.111.111, if you are creating vhost locally, you can replace 111.111.111.111 with 127.0.0.1

Now that you have your virtual hosts configured, you can test your laravel app easily by going to the domain that you configured in your web browser:

http://app-name.com

Install WordPress plugins, themes & upgrades without providing FTP access?

You must have experienced that WordPress asks for FTP credentials if you initiate upgrade or install plugins. And sometimes developers don’t have FTP access and all they have is WordPress admin panel access. Let’s see why WordPress asks for FTP info and how to bypass it and enable WordPress to install updates and plugins without FTP info. Continue reading “Install WordPress plugins, themes & upgrades without providing FTP access?”

Get selected value of radioButtonList using jQuery in Yii

Sometimes you want to get selected value of radioButtonList using jQuery in your Yii powered application and it feels difficult due to Yii’s field naming conventions, as every field name contains array. Continue reading “Get selected value of radioButtonList using jQuery in Yii”

My 3 days trip to Swat, Malam Jabba and Kalam (20th Mar to 23rd Mar)

Pakistan is a land of natural beauty and has been blessed with the abundance of awe-inspiring outdoor areas. From the unspoiled golden beaches,across the desolate desserts and through fertile plains onto the mighty snow capped peaks, Pakistan is the land of many lands. There are few areas in the world where mountains rise in such awesome splendor as they do in the northern areas of Pakistan and I can also acclaimed it now as I experienced it all myself. I started my journey from Lahore to this lavishly adorned area at 20th march 2015 with some of my friends and colleagues. We approached a well-famed local travel agency The Trekkerz for our voyage which gave us three days package of Swat, Malam Jabba and Kalam. Continue reading “My 3 days trip to Swat, Malam Jabba and Kalam (20th Mar to 23rd Mar)”

Lamudi.pk is The Fastest growing real estate startup in Pakistan

There are several online real estate portals running in Pakistan, a couple of them have captured the market and leading the industry. In such a scenario it’s hard to take an initiative to start a parallel venture and compete but Lamudi.pk’s case is different. They get recognized in very less time and now they are strong competitors of existing giants of real estate industry in Pakistan. Continue reading “Lamudi.pk is The Fastest growing real estate startup in Pakistan”

Adding Custom Fields to WordPress User Profile and Add New User page

Adding custom profile fields in WordPress made easy through action hooks. .Most of the solutions available on internet tell you about adding custom fields on “Edit User” screen, in this tutorial I will tell you how to add your custom fields to Add New User screen
Continue reading “Adding Custom Fields to WordPress User Profile and Add New User page”

How to parse Salesforce tables and put data in SugarCRM?

In previous post you learnt how to create REST API to fetch data from SugarCRM application, in this tutorial you will learn to migrate data from Salesforce to SugarCRM application. Continue reading “How to parse Salesforce tables and put data in SugarCRM?”

Get list of records from SugarCRM module using REST API

Its very common problem for many people to fetch data from SugarCRM application and feed it to some other application. Using REST API we can easily fetch list of records from any SugarCRM module. This tutorial show you how can you create your own API endpoint. In the example below, you’ll need to replace the URL, Username, Password, then locate ‘{Module}’ and replace it with the corresponding module name. And if you want a list of records from Projects, you would replace {Module} with Projects.
Continue reading “Get list of records from SugarCRM module using REST API”

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?”