About webmull

This author has not yet filled in any details.
So far webmull has created 65 blog entries.
27 07, 2015

WordPress Introduction

July 27th, 2015|WORDPRESS|0 Comments

WordPress Introduction:

Initially wordpress know as simple blogging application, but actually it is full content management system. We can use it as publish tool for web. Now a days all most 18% website is built in wordpress. we can see few of wordpress website showcases here.

History:

WordPress development initiate […]

9 07, 2015

Magento 2: Get Currency Symbol

July 9th, 2015|MAGENTO, MAGENTO 2|1 Comment

To get the currency code and symbol, you need to write the code in .php file

protected $_storeManager;


public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Store\Model\StoreManagerInterface $storeManager,
array $data = []
) {
parent::__construct($context, $data);
$this->_storeManager = $storeManager;
}


public function getCurrencyData(){
$currencyCode = $this->_storeManager->getStore()->getCurrentCurrencyCode(); // give the currency code
$currencyRate = $this->_storeManager->getStore()->getCurrentCurrencyRate(); // give the currency rate
}

[…]

9 07, 2015

Magento 2: Get Store configuration value

July 9th, 2015|MAGENTO, MAGENTO 2|0 Comments

Here we are giving the code to get the store configuration value

In .php file (Block)

protected $_scopeConfig;


public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
array $data = []
) {
parent::__construct($context, $data);
$this->_scopeConfig = $scopeConfig;
}


public function getTelephoneConfig(){

$showTemplateHint = $this->_scopeConfig->getValue('general/store_information/phone', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
return $showTemplateHint;
}

 

In .Phtml file

<?php echo $block->getTelephoneConfig(); ?>

 

9 07, 2015

Magento2 : Create Category attribute

July 9th, 2015|MAGENTO, MAGENTO 2|1 Comment

/** @var EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);


/**
* Add attributes to the eav/attribute
*/
$eavSetup->addAttribute(
\Magento\Catalog\Model\Category::ENTITY,
'external_link',
[
'group' => 'General',
'type' => 'varchar',
'label' => 'External Link',
'input' => 'text',
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => '',
]
);

 

9 07, 2015

Magento2: Create Product Attribute

July 9th, 2015|MAGENTO, MAGENTO 2|0 Comments

In magento 2 Attribute is create using Setup file. If we need to install the data in the system (database) create InstallData.php file in Setup folder so path should be

app/code/<package name>/<module name>/Setup/InstallData.php

In the InstallData.php we need to create class for module.We need to add the below content to create attribute.

[…]

9 07, 2015

Magento 2: Error to PHP version check for always_populate_raw_post_data

July 9th, 2015|MAGENTO, MAGENTO 2|2 Comments

always_populate_raw_post_data always_populate_raw_post_data

There are 2 solution to change the value

1) change in php.ini

In Php.ini file

always_populate_raw_post_data = -1

2) change in .htaccess file

Solution to change in .htaccess file

php_value always_populate_raw_post_data -1

9 07, 2015

Magento 2: Create configuration file system.xml in our custom module

July 9th, 2015|MAGENTO, MAGENTO 2|0 Comments

Yes, In magento 2 we can create system configuration file same as Magento 1. But we need to create some file. Lets start how to create it

We need to use following file to create it.

app/code/Webmull/Helloworld/etc/adminhtml/system.xml

app/code/Webmull/Helloworld/etc/acl.xml

This 2 files are important to create system configuration.

In System.xml file

Adding the common content

6 06, 2015

Magento2: Truncate the string

June 6th, 2015|MAGENTO, MAGENTO 2|0 Comments

We have to use the below syntax if we need to truncate the string from .phtml file

<?php $length = 10; ?>

<?php $string = new \Magento\Framework\Stdlib\StringUtils;?>
<?php echo $string->substr($data->getContent(),0,$length); ?>

 

6 06, 2015

Magento2: Display static block in Phtml file & CMS page

June 6th, 2015|MAGENTO, MAGENTO 2|0 Comments

In Phtml File:

<?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('block_identifier')->toHtml();?>

in CMS Content:

{{block class="Magento\\Cms\\Block\\Block" block_id="block_identifier"}}

In Xml File:

<referenceContainer name="content">


<block class="Magento\Cms\Block\Block" name="block_identifier">
<arguments>
<argument name="block_id" xsi:type="string">block_identifier</argument>
</arguments>
</block>


</referenceContainer>

 

6 06, 2015

Magento: Add custom category in navigation

June 6th, 2015|MAGENTO|0 Comments

Instead of display the Root category in menu, we need custom category in menu structure:

Copy the Mage/catalog/Model/Observer.php to local Mage/catalog/Model/Observer.php

Current Code:

public function addCatalogToTopmenuItems(Varien_Event_Observer $observer)
{ 

$block = $observer->getEvent()->getBlock();
$block->addCacheTag(Mage_Catalog_Model_Category::CACHE_TAG);
$this->_addCategoriesToMenu(
Mage::helper('catalog/category')->getStoreCategories(), $observer->getMenu(), $block, true
);
}

 Replace Code:

[…]