1 02, 2016

Magento 2: Create Custom Query

February 1st, 2016|MAGENTO, MAGENTO 2|3 Comments

Now You are thinking How we will get write the core Query in Magento.

Let’s Start. Here We give the example of insert, update, delete, select.

1. Insert

$themeId=3;
$this->_resources = \Magento\Framework\App\ObjectManager::getInstance()
->get('Magento\Framework\App\ResourceConnection');
$connection= $this->_resources->getConnection();

$themeTable = $this->_resources->getTableName('theme');
$sql = "Insert into " . $themeTable . "(theme_id,theme_path) Values (" . $themeId . ",'webmull/christmastheme' )";
$connection->query($sql);

 2. […]

29 01, 2016

Magento 2: PHP extension error at the time of Installation

January 29th, 2016|MAGENTO, MAGENTO 2|0 Comments

When we try to install Magento 2 in our wamp server we got the error

error1

Solution:

1) Go to the path D:/wamp/bin/php/php5.5.12 select all file and select and copy the file which start with “icu”

solution1

2) Paste […]

27 01, 2016

Magento 2: Add New Massaction in the Admin Grid

January 27th, 2016|MAGENTO, MAGENTO 2|0 Comments

Now, You are thinking how we will overwrite the grid.php in Magento 2. Because some module has grid.php and some has not.
Now We are adding the one massaction in Sales_order Grid at admin side which has no grid.php for order.

1. Create the file sales_order_grid.xml in the path app\code\[Vendor Name]\[Module Name]\view\adminhtml\ui_component

2. […]

20 11, 2015

Magento 2: Remove Add new button from admin grid

November 20th, 2015|MAGENTO, MAGENTO 2|0 Comments

In magento when we create grid, magento automatically create the “Add New” button. But now we are thinking how we will delete this same as Magento 1.

Don’t Worry. Write the below code in your block file

protected function _construct()
{

parent::_construct();

$this->removeButton('add'); // Add this code to remove the [...]

3 11, 2015

Magento 2: Add customer logout link in My Account navigation

November 3rd, 2015|MAGENTO, MAGENTO 2|0 Comments

In Magento 1, To add the logout link we can directly write in customer.xml file.

But now we are thinking how to add logout link

Now,Let’s Start

1. Create the customer_account.xml in the path app/design/frontend/<vendor>/<theme>/Magento_Customer/layout

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="customer_account_navigation"><!--ifconfig="wishlist/general/active"-->
<block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-logout-link">
<arguments>
<argument name="path" xsi:type="string">customer/account/logout</argument>
<argument name="label" xsi:type="string">Logout</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>

Now then refresh the page […]

30 10, 2015

Magento 2: Add new Custom Breadcrumb in checkout page

October 30th, 2015|MAGENTO, MAGENTO 2|3 Comments

In Magento 1, we can directly add the breadcrumb in checkout page using XML.

But in Magento 2 there are some changes to add the breadcrumb

1. Copy the checkout_cart_index.xml file in your theme. And then write code in body tag

<referenceBlock name="breadcrumbs">
<action method="addCrumb">
<argument name="crumbName" xsi:type="string">Home</argument>
<argument name="crumbInfo" xsi:type="array">
<item name="title" [...]

27 10, 2015

Magento 2: Send the email

October 27th, 2015|MAGENTO, MAGENTO 2|0 Comments

In Magento 2 we can send the mail using their function but there are some changes in Magento 2.

Now Let’s start how to send the email.

1. create email_templates.xml in the path app/code/Webmull/Email/etc

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd">
<template id="send_email_email_template" label="Email Form" file="send_form.html" type="text" module="Webmull_Email" area="frontend"/>
</config>

 

2. create send_form.html in the […]

26 10, 2015

Magento 2: Display image using static block

October 26th, 2015|MAGENTO, MAGENTO 2|0 Comments

In Magento 1 we used the {{media url=””}} to display the image in frontend. But now how to display in Magento 2.

Let’s Start

1. Put the image in the path app/design/frontend/{Vendor Name}/{Theme name}/web/images

2. In static block or cms page content write

{{view url="images/image-1.jpg"}}

now check the page or […]

15 10, 2015

Magento 2: Get url in template file

October 15th, 2015|MAGENTO, MAGENTO 2|0 Comments

In Magento 1, we can directly get the image url using Mage::getUrl() function.

But in Magento 2 there are some changes to call the images

Use this code to phtml file to get the Url

<?php echo $block->getUrl('call/index/view') ?>

Here:

call:- Module frontname
index:- Controller name
view:- Action name

Now Refresh the page and […]

15 10, 2015

Magento 2: Get image url in template file

October 15th, 2015|MAGENTO, MAGENTO 2|0 Comments

In Magento 1, we can directly get the image url using $this->getSkinUrl() function.

But in Magento 2 there are some changes to call the images

1. Put the image on this path app/code/Webmull/Call/view/frontend/web/images

2. Use this code to phtml file to call the image

<img src="<?php echo $block->getViewFileUrl('Webmull_Call::images/call_img.png'); ?>" alt="<?php [...]