Wednesday 30 December 2015

order email confirmation not received in Magento 1.9.1

Just make a small change in order.php

/app/code/core/Mage/Sales/Model/Order.php

First, create one directory structure on the path below, then copy and paste the file to the path below.

/app/code/local/Mage/Sales/Model/Order.php

Now, change from

$mailer->setQueue($emailQueue)->send();

to

$mailer->send();

Tuesday 29 December 2015

magento 2 - how to enable developer mode

Open run cmd and go to magento root directory and run below command :-

php bin/magento deploy:mode:set developer

How to include css,js file on head in magento 2

First you paste your css file here :-  pub/static/frontend/{Package}/{theme}/en_US/css/ 
  your js file here :-  pub/static/frontend/{Package}/{theme}/en_US/js/

And open below directory file :-

app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml

And add your css or js file name in <head> tag :- 
<css src="css/custom.css"/>
<script src="js/custom.js"/>

Magento 2 - How to call a custom phtml file in another phtml file, xml layout, static block and cms page

custom file path

app/code/Magento/Theme/view/frontend/templates/html/test.phtml

calling in xml layout file

<block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::html/test.phtml"/>

calling in blocks and cms pages
 
{{block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::html/test.phtml"}}

calling in any phtml file
 
<?php include ($block->getTemplateFile('Magento_Theme::html/test.phtml')) ?>

or as before
 
<?php echo $this->getLayout()->createBlock("Magento\Framework\View\Element\Template")->setTemplate("Magento_Theme::html/test.phtml")->toHtml();?>

Thursday 17 December 2015

Magento 2 Installation: css/js/images not loading.(Solution).


First open the cmd command and goto magento installed directory
and run following command :-
php bin/magento setup:static-content:deploy

Note :- Please exceed memory_limit (If you an error of memory limit during running command).

How to install magento 2

Installing  Magento2 on XAMPP could be pretty painful for the developers, as Magento2 requires a lot of server configurations.
Before you start installing you need the following:
1. XAMPP server installed in your computer
2. Magento 2 can be downloaded from this link Magento2.
Apache Version :-  2.2 or 2.4
PHP            :-  5.5.x or 5.6.x
MySQL          :-  5.6.x

Installation :-
1.) Enter your Magento 2 url in browser and hit Enter.
 
2.) Click on “Agree and Setup Magento”.









3.) Now Magento 2 will check your environment for readiness for the setup. Click on “Start readiness check”.
 











4.) Now enter Empty database that you created previously, where you want to install Magento2.










5.) Click Next, now you will be asked for web configurations like store url, admin url, Apache rewrites, https options.
6.) Click Next, now you can select Timezone, Currency and language in “Customize Your Store” section.










7.)Click Next, Enter Admin username, email and password to setup Admin credentials.










8.)Click Next, Voila J, Now Magento 2 is ready to be installed on localhost. Click on “Install Now”. Don’t close your browser until setup is done.












9.)After the installer has completed the setup, it will show Success page.













10.) Now You can open Magento Admin panel and front page.

How to get instagram user id and access token

Get user id by user name through below Steps :-
Login with instagram account

https://www.instagram.com/developer/

create client_id and secret_key and  request_url

After that you should pass client_id and request_url in this url

https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token

we get access_token like this

http://your-redirect-uri#access_token=ACCESS-TOKEN

now you should pass token for find user information like this

https://api.instagram.com/v1/users/self?access_token=access_token

{"data": {"id": "XXXXX", "username": "XXXX", "profile_picture": "XXXX", "full_name": "Naresh Chaudhary", "bio": "", "website": "", "is_business": false, "counts": {"media": 4, "follows": 6, "followed_by": 52}}, "meta": {"code": 200}}