Recent Post

All Pages

Like Us On Facebook

About

Gallery

Thứ Hai, 25 tháng 8, 2014

Code - Những hàm thường dùng trong Magento



Get the path of your magento page.
1
echo $this->getUrl('mypage');
Get the path of the image in your skin folder.
1
echo $this->getSkinUrl('images/yourimage.gif');
Get the product link.
1
echo $this->getProductData()->getProductUrl();
Get the product name.
1
echo $this->htmlEscape($this->getProductData()->getName());
Call a static block in .phtml file.
1
echo $this->getLayout()->createBlock('cms/block')->setBlockId('YOURBLOCKID')->toHtml();
Get Image url of current category.
1
echo $this->getCurrentCategory()->getImageUrl();
Check whether the current category is Top category.
1
echo $this->IsTopCategory();
Get description of current category.
1
echo $this->getCurrentCategory()->getDescription();
Display products list page (list.phtml).
1
echo $this->getProductListHtml();
Display CMS block page.
1
echo $this->getCmsBlockHtml();

Get current store id.
1
echo $storeId = Mage::app()->getStore()->getId();
Get current store name.
1
echo $storeName = Mage::app()->getStore()->getName();
Get current store code.
1
echo $storeCode = Mage::app()->getStore()->getCode();
Get website name.
1
echo $websiteName = Mage::app()->getWebsite()->getName();
Get session id.
1
echo $sessionId = Mage::getModel('core/session')->getSessionId();
Get customer id.
1
echo $customerId = Mage::getModel('customer/session')->getCustomerId();
Get guest id.


1
echo $vistitorId = Mage::getModel('core/session')->getVisitorId();

Email Newsletter



Smiley :)
:D
:)
:[
;)
:D
:O
(6)
(A)
:'(
:|
:o)
8)
(K)
(M)

Không có nhận xét nào:

Đăng nhận xét

Biểu mẫu liên hệ

Tên

Email *

Thông báo *