Converting A Quote Attribute To An Order
<config>
<global>
<fieldsets>
<sales_convert_quote>
<some_attribute>
<to_order>*</to_order>
</some_attribute>
</sales_convert_quote>
</fieldsets>
</global>
</config>
Related cards:
Add All Attributes To A Collection
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
$collection->addAttributeToSelect($attributes);
Adding A Column to a Flat Table
Handy to add attributes to sales_flat_order:
$installer->getConnection()->addColumn(
$this->getTable('sales/order'),
'some_attribute',
[
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
'length' => ...
Creating a Datetime attribute that stores time
Magento has a Datetime backend model but formats a Zend_Date
object without the time. So if you want to store datetime (actually with time) you will need to setup your own backend model.
Here is how i've done it:
class Namespace_Module_Mod...
Adding Attribute To Category List Product Collection
Only a core set of attributes are added to the product collection (for the list page) by default. This bit of XML will allow you to add additional attributes to that collection:
<config>
<frontend>
<product>
...
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...
Creating a New Attribute Set Programatically
$entityTypeId = Mage::getModel('catalog/product')
->getResource()
->getEntityType()
->getId();
$attributeSet = Mage::getModel('eav/entity_attribute_set')
...
Add A Tab To The Admin Product Screen
Declare an admin layout XML file for your module in your config.xml
:
<config>
<adminhtml>
<layout>
<updates>
<your_module>
<file>your-module.xml</file>
...
Adding A CSS Class To The Body Tag
To add a class via layout XML:
<reference name="root">
<action method="addBodyClass"><classname>whatever</classname></action>
</reference>
Or to add via code, from a controller or block
if ($root = $this->getLayout()->getBlo...
Add A Tab To The Admin Product Screen
Adding A Tab To The Product Screen
-
Declare an admin layout XML file for your module in your config.xml:
...
Adding Attributes To Other Entities With getDefaultEntities()
Don't do it!! I did the below:
public function getDefaultEntities()
{
return array(
'catalog_product' => array(
'attributes' => array(
'size_guide_id' => array(
...