Getting the Theme In Use
How to get the theme for each component, works on the active store:
Mage::getSingleton('core/design_package')->getTheme('locale');
Mage::getSingleton('core/design_package')->getTheme('template');
Mage::getSingleton('core/design_package')->getTheme('skin');
Mage::getSingleton('core/design_package')->getTheme('layout');
Mage::getSingleton('core/design_package')->getTheme('default');
Related cards:
Set Next Increment ID For Orders, Quotes, Invoices, Shipments or Credit Memos
BIG NOTE! I'm not totally sure that all these entity types increment ID's are stored here any more. Check
The last order increment ID issued for all these entity types is stored in eav_entity_store
, in the increment_last_id
column. Note that ...
Non-Required Category Attribute Not Set in Global Scope
When a category is created whilst in a store scope, and a value is set against an attribute which has is_required
set to false
, and has a scope more specific than global
, then a value is not set against the global scope, resulting in the sto...
Fetching All Attributes For An Entity From The DB In One Query
Using the database to inspect EAV-based entity types can be a real pain in the ass, so here are a bunch of queries that let you inspect some popular EAV entity types easily. This practice can be applied to any EAV entity type, however as there are...
Reindex Via Code
An example of code qhich allows you to reindex:
$indexer = Mage::getSingleton('index/indexer');
$process = $indexer->getProcessByCode('catalog_product_price');
$process->reindexEverything();
The following are indexer codes which you ...
Product Attribute Addition
This code shows all possible configuration options for an attribute that I know of, you need not include all of these when adding an attribute (although it won't hurt)
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
...
Changing The Admin Theme
Put this in your local.xml
:
<config>
<stores>
<admin>
<design>
<theme>
<default>yourtheme</default>
</theme>
</design>
...
Getting The Amount Of Items in the Cart
To get the amount of line items (i.e. 10 of 1 product is 1):
Mage::helper('checkout/cart')->getItemsCount();
To get the total number of items (i.e. 10 of 1 product is 10):
Mage::helper('checkout/cart')->getSummaryCount();
![](http://mi...
Getting A Products URL
Potentially confusing due to the 3 methods you could use, all of which are in Mage_Catalog_Model_Product
:
public function getUrlPath($category=null)
public function getUrlInStore($params = array())
public function getProductUrl($use...
Creating an EAV Entity
Overview
A overview for those familiar with making flat models:
- Your config is standard, your table name takes the form of the base (entity) table
- You name your resource models as normal (so by class name, you can't tell the difference b...
Using Design Exceptions To Serve a Mobile Theme
In order to serve a different package, or any element of a theme (translations, templates, skin or layout) you can use design exceptions, which allow you to specify different values for each of the design-related settings by using user-agent strin...