While being on the Magento category page, it might be useful to display the category name. Use the following code to do so.
1 |
Mage::getSingleton('catalog/layer')->getCurrentCategory()->getName(); |
While being on the Magento category page, it might be useful to display the category name. Use the following code to do so.
1 |
Mage::getSingleton('catalog/layer')->getCurrentCategory()->getName(); |
To get the order data on the Magento success page, use the following code. The key here is to create an order object and get the data from there.
1 2 3 |
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId()); $date = $order->getCreatedAtStoreDate(); // ... |
Using the folowing layout update, you can add a static block to the left sidebar:
1 2 3 4 5 6 |
<!-- left --> <reference name="left"> <block type="cms/block" name="STATIC_BLOCK_NAME"> <action method="setBlockId"><block_id>STATIC_BLOCK_ID</block_id></action> </block> </reference> |
To figure out whether you are on the home page or not, the following code will help:
1 2 3 4 |
$identifier = Mage::getSingleton('cms/page')->getIdentifier(); if($identifier == 'home') { //... } |
YOu want to know if you are on either the product or category page? The following code might help:
1 2 3 4 5 |
$controllerName = $this->getRequest()->getControllerName(); $isCategoryPage = $controllerName == 'category' ? true : false; $isProductPage = $controllerName == 'product' ? true : false; if(...) |
To change your Magento stores DOCTYPE to HTML5? To do so, you have to copy some template files and change the code there accordingly: Kopieren Sie die Templatedateien aus app\design\frontend\base\default\template\page in den entsprechenden lokalen Pfad. Es handelt sich um diese…
If you take a look at your Magento stores code, you might see the following JavaScript code:
1 |
var Translator = new Translate({...}); |
You might ask yourself, if its safe to remove that and what that code does. The code is responsible for translating your…
Use the following code to get all ordered items on the Magento success page.
1 2 3 4 5 |
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId()); $items = $order->getAllItems(); foreach($items as $item) { //... } |
Using the folowing code you can get the custom options of the ordered items on the Magento success page.
1 2 3 4 5 6 7 8 9 10 |
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId()); $items = $order->getAllItems(); foreach($items as $item) { $options = $item->getProductOptions(); foreach ($options['options'] as $itemOption) { $optionTitle = $itemOption['title']; $optionValue = $itemOption['value']; //... } } |
Create a local copy of \app\design\frontend\base\default\layout\page.xml and remove or comment the following line:
1 |
<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/> |