To get a Magento URL parameter, use the following code:
1 2 |
// URL: http://localhost/project/index.php/admin/sales_order/index/id/123 $id = Mage::app()->getRequest()->getParam('id'); |
To get a Magento URL parameter, use the following code:
1 2 |
// URL: http://localhost/project/index.php/admin/sales_order/index/id/123 $id = Mage::app()->getRequest()->getParam('id'); |
To change the Magento upsell product areas column count programmatically, use the following code:
1 |
$this->setColumnCount(4); |
To get a categories URL by category id, use the following code:
1 2 |
$categoryId = 55; $url = Mage::getModel("catalog/category")->load($categoryId)->getUrl(); |
Use the following code to get the current URL in Magento:
1 |
$currentUrl = $this->helper('core/url')->getCurrentUrl(); |
Use the following code to get a Magento products URL and to display the image on a tempate page:
1 |
<img src="<?php echo $_product->getImageUrl(); ?>" alt="<?php echo $_product->getName();?>" /> |
Use the following code to get the underlying SQL of a Magento collection:
1 |
$sql = (string)$collection->getSelect(); |
The setting of the running status in the cron_schedule table in Magento 1.4 is not working correctly. The code in Magento 1.4 is not 100% correct. Create a local copy of Mage_Cron_Model_Observer and take a look at the dispatch function:…
To add the data from the admin to a CMS page, use the following code:
1 2 |
{{config path="general/imprint/vat_id"}} ... |
This code adds the vat id, you can easily add other info by looking up the correct path from the core_config table.
Using the following code, you can get the custom options from a Magento order item:
1 2 3 4 5 6 7 |
$items = $order->getAllItems(); foreach ($items as $item) { $options = $item->getProductOptions(); $options = $options['options']; $optionLabel = $option['label']; // ... } |