Showing posts with label magento. Show all posts
Showing posts with label magento. Show all posts

Sunday, November 22, 2015

magento block types

For understanding more about magento block types following are some built-in block types which are widely used in layout.
  1. core/template: This block renders a template defined by its template attribute. The majority of blocks defined in the layout are of type or subtype of core/template.
  2. page/html: This is a subtype of core/template and defines the root block. All other blocks are child blocks of this block.
  3. page/html_head: Defines the HTML head section of the page which contains elements for including JavaScript, CSS etc.
  4. page/html_header: Defines the header part of the page which contains the site logo, top links, etc.
  5. page/template_links: This block is used to create a list of links. Links visible in the footer and header area use this block type.
  6. core/text_list: Some blocks like contentleftright etc. are of type core/text_list. When these blocks are rendered, all their child blocks are rendered automatically without the need to call thegetChildHtml() method.
  7. page/html_wrapper: This block is used to create a wrapper block which renders its child blocks inside an HTML tag set by the action setHtmlTagName. The default tag is 
     if no element is set.
  8. page/html_breadcrumbs: This block defines breadcrumbs on the page.
  9. page/html_footer: Defines footer area of page which contains footer links, copyright message etc.
  10. core/messages: This block renders error/success/notice messages.
  11. page/switch: This block can be used for the language or store switcher.
This is a list of only commonly used block types. There are many other block types which are used in advanced theme implementations.

Wednesday, April 15, 2015

Magento : Get Base Url , Skin Url , Media Url , Js Url , Store Url and Current Url

Get Url in phtml files

1. Get Base Url :

Mage::getBaseUrl();


2. Get Skin Url :

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);


(a) Unsecure Skin Url :

$this->getSkinUrl('images/imagename.jpg');


(b) Secure Skin Url :

$this->getSkinUrl('images/imagename.gif', array('_secure'=>true));


3. Get Media Url :

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);


4. Get Js Url :

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);


5. Get Store Url :

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);


6. Get Current Url

Mage::helper('core/url')->getCurrentUrl();




Get Url in cms pages or static blocks

1. Get Base Url :

{{store url=""}}


2. Get Skin Url :

{{skin url='images/imagename.jpg'}}


3. Get Media Url :

{{media url='/imagename.jpg'}}


4. Get Store Url :

{{store url='mypage.html'}}

Tuesday, August 5, 2014

Magento Remote IP Address

//Get Visitor's information  
  $visitorData = Mage::getSingleton('core/session')->getVisitorData();  

  // printing visitor information data  
  echo "
"
; print_r($visitorData); echo "
"; // user's ip address (visitor's ip address) $remoteAddr = Mage::helper('core/http')->getRemoteAddr(true); // server's ip address (where the current script is) $serverAddr = Mage::helper('core/http')->getServerAddr(true);

Tuesday, June 17, 2014

Magento get product price

<?php
 
// assuming that you have known product object, $_product
 
//get product price snippet
echo $this->getPriceHtml($_product, true);
 
//get $_product price
echo $_product->getPrice();
echo number_format($_product->getPrice(), '2', '.', ',');
 
//get $_product special price
echo $_product->getSpecialPrice();
echo number_format($_product->getSpecialPrice(), '2', '.', ',');
 
//get $_product final price
echo $_prodcut->getFinalPrice();
echo number_format($_product->getFinalPrice(), '2', '.', ',');
 
//get $_product Msrp
echo $_product->getMsrp();
echo number_format($_product->getMsrp(), '2', '.', ',');
 
?>

Wednesday, May 7, 2014

Magento – Get Store Email Addresses

General Contact

/* Sender Name */
Mage::getStoreConfig('trans_email/ident_general/name'); 

/* Sender Email */
Mage::getStoreConfig('trans_email/ident_general/email');
------------------------------------------------------------

Sales Representative

/* Sender Name */
Mage::getStoreConfig('trans_email/ident_sales/name'); 

/* Sender Email */
Mage::getStoreConfig('trans_email/ident_sales/email');
------------------------------------------------------------

Customer Support

/* Sender Name */
Mage::getStoreConfig('trans_email/ident_support/name'); 

/* Sender Email */
Mage::getStoreConfig('trans_email/ident_support/email');
------------------------------------------------------------

Custom Email 1

/* Sender Name */
Mage::getStoreConfig('trans_email/ident_custom1/name'); 

/* Sender Email */
Mage::getStoreConfig('trans_email/ident_custom1/email');
------------------------------------------------------------

Custom Email 2

/* Sender Name */
Mage::getStoreConfig('trans_email/ident_custom2/name'); 

/* Sender Email */
Mage::getStoreConfig('trans_email/ident_custom2/email');

Tuesday, March 18, 2014

Path-based links:
<a href="{{store url="checkout/cart/"}}">Shopping Cart</a> - shopping cart
<a href="{{store url="checkout/onepage/"}}">Proceed to Checkout</a> - checkout
<a href="{{store url="catalog/category/view/id/36"}}">Women Apparel</a> - category
<a href="{{store url="catalog/product/view/id/16"}}">Nokia 2610 Phone</a> - product
<a href="{{catalog/product/view/id/85/category/16}}">Classic Jeans</a> - product in context of a category

Direct links:
<a href="{{store direct_url="customer-service"}}">Customer Service</a> - cms-page
<a href="{{store direct_url="apparel/women"}}">Women Apparel</a> - category
<a href="{{store direct_url="electronics/cell-phones/nokia-2610-phone.html"}}">Nokia 2610 Phone</a> - product in context of a category


About

Blogger templates