Wednesday 21 December 2016

How to get customer details in frontend of magento

Many time we need customer data when we go through custom module.

Customer is saved in session so we can get customer data using following script.

if (Mage::getSingleton('customer/session')->isLoggedIn()) {
$data = Mage::getSingleton('customer/session')->getCustomer();
}

Or you can direct get customer id or customer name using of following script.

For First name :
Mage::getSingleton('customer/session')->getCustomer()->getData('firstname');

For customer id :
Mage::getSingleton('customer/session')->getCustomer()->getId();

If you have any query then feel free to contact me at Jainish Senjaliya

How to get customer details in backend admin panel order of magento

If we go through custom module than many time we need customer data on order create page.

Customer is saved in session so we can get customer data using following script.

Mage::getSingleton('adminhtml/session_quote')->getCustomer();

Or you can direct get customer id or customer name using of following script.

For First name :
Mage::getSingleton('adminhtml/session_quote')->getCustomer()->getData('firstname');

For customer id :
Mage::getSingleton('adminhtml/session_quote')->getCustomer()->getId();

If you have any query then feel free to contact me at Jainish Senjaliya

Tuesday 8 November 2016

How to call static block in Magento


We have three method for call static block in magento.

=> PHP


Adding static block inline with PHP is the quickest way to get block in your template.

Following code will help you for display static block from your phtml file

echo $this->getLayout()->createBlock('cms/block')->setBlockId($identifer)->toHtml();


Note : $identifer = your_block_id

=>XML


Adding a static block to a page template is a great way to control global elements of your site
We can embed this code in app > design > frontend > default > your_theme > layout.

Open the appropriate the file, lets say catalog.xml and put the following code in the block for our category view

Following code will help you for display static block from your xml file


<block type="cms/block" name="your_block_id" before="-">
<action method="setBlockId"><block_id>your_block_id</block_id></action>
</block>


Or we can call block in another block also in CMS Page

=> Shortcode


This technique is used when we need to pull in a static block while in Magento’s admin creating CMS pages or other static blocks.

Following code will help you for display static block from other static blocks OR CMS pages.

{{block type="cms/block" block_id="your_block_id"}}


If you have any query then feel free to contact me at Jainish Senjaliya

Wednesday 26 October 2016

How to add js in magento


There is a two way to add js in magento module


/projectname/skin/frontend/base/default/js/myproduct.js

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
   <catalog_product_view>
       <reference name="head">
           <action method="addItem">
               <type>skin_js</type><name>js/myproduct.js</name>
           </action>
       </reference>
   </catalog_product_view>
</layout>

2. /projectname/js/myproduct.js

<layout version="0.1.0">
   <catalog_product_view translate="label">
       <reference name="head">
           <action method="addJs"><script>myproduct.js</script></action>
        </reference>        
   </catalog_product_view>
</layout>

I hope it will work for you. Good Luck

If you have any query then feel free to contact me at Jainish Senjaliya

What is Magento

Magento is a very powerful and ecommerce platform built on open source technology which provides online merchants with a flexible and smooth shopping cart system, created by Varien

Magento is a fast growing ecommerce script. It is an open-source platform using Zend PHP and MySQL databases. Magento control over the look, content and functionality of their online store. Magento offers great flexibility through its modular architecture, is completely scalable and has a wide range of control options that its users appreciate.

Magento offers powerful marketing, search engine optimization, and catalog-management tools.

I believe that Magento is one of the best ecommerce platforms available today

What is TYPO3

TYPO3 is a free, open source content management framework designed to simplify the creation of feature-rich websites that can be updated by nontechnical editors. It is written in PHP and is compatible with a number of popular databases, including MySQL.

TYPO3 is a small to midsize enterprise-class Content Management Framework offering the best of both worlds: out-of-the-box operation with a complete set of standard modules and a clean and sturdy high-performance architecture accomodating virtually every kind of custom solution or extension.

For authors, TYPO3 is a user-friendly, intuitive tool, allowing content editors to produce and maintain web pages, using sophisticated functions in just a few clicks of the mouse.

With TYPO3, everyone can participate in web-based communication and customer relations. Seamless integration of multimedia content types and dynamic server-side image manipulation and generation are among the numerous standard options inside this comprehensive toolbox for web-based communication. Also included is an internal messaging and workflow communication system for shared authoring and collaboration.

For administrators and content managers, TYPO3 features an extremely detailed user permissions system for implementing professional content creation and editing workflows. TYPO3 is a server-side platform-independent application that can be used with virtually every browser available.

Web developers and agencies will appreciate the complete separation of design and content. TYPO3 does not limit the design options expected by professional website designers and site redesigns are easily accommodated.

TYPO3 is database-driven and scales easily to deliver web pages and embedded formats in an enterprise content providing environment.

TYPO3 is open source software published under the GPL.