These are the core set of route parameters, you can be fairly sure that any
call to getUrl()
which accepts route parameters will come through this method,
so any of these parameters should work.
|-----------------+---------------+---------------------------------------------------------------------------|
| Param | Type | Does |
|-----------------+---------------+---------------------------------------------------------...
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($useSid = null)
The best way to explain is to simply show the results of several calls. Given a product whose URL key is mondrian-large-coffee-table-set-multicolour
on the domain of http://made.local
the results are:
$product->getUrlPath();
'mondrian-large-coffee-table-set-multicolour'...
The Display Out Of Stock Configuration Option
is implemented by this index. If you have chosen not to display out of stock products,
then the effect is that a product is not entered into this index.
These tables seem to supply the data for the price index:
| Table | Notes |
|------------------------------------------------+-----------------------|
| catalogindex_price | has...
The decision of whether to show or hide a product based on this setting is implemented
by the Product Price Index.
You can verify this by changing the setting to "Yes" and then viewing a category with an
out of stock product; you see the product is present. If you then change the setting to
"No" and view the category again you will see the out of stock product is still present.
You will also notice that these two indexes now need refreshing:
Certain entities (Products and Categories, for example) have the concept of a
store scope, whereby you can set the default value for all stores, or you can
set a value on a per-store basis.
You could do it this way, and this is probably how most guides will tell you to
do it, but I'll show you in a minute why not:
$product = Mage::getModel('catalog/product');
$product->setStoreId(1);
$product->load(100);
$product->setName('Store 1 Product Name');
$product->save();
So, you'll probably have noticed that worked, however w...
Assuming $installer
refers to Mage_Core_Model_Resource_Setup
or a subclass of it, you can do the following:
Setting a value in the default scope:
$installer->setConfigData('some/path', 'value');
Setting a value in a specific store:
$installer->setConfigData('some/path', 'value', 'stores', 1);
Deleting a value from all scopes:
$installer->deleteConfigData('some/path');
Deleting a value from a certain scope (unfortunately you cannot choose which scope ID though:
$installer->deleteConfigData('some/path', 'stores');
...
Clean everything (use either):
Mage::app()->getCacheInstance()->flush();
Mage::app()->getCache()->clean();
Clean specific types:
Mage::app()->getCacheInstance()->cleanType('config');
Mage::app()->getCacheInstance()->cleanType('layout');
Mage::app()->getCacheInstance()->cleanType('block_html');
Mage::app()->getCacheInstance()->cleanType('translate');
Mage::app()->getCacheInstance()->cleanType('collections');
Mage::app()->getCacheInstance()->cleanType('eav');
Mage::app()->getCacheInstance()->cleanType('co...
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 this is the last ID, so if you wish your next ID to be 100065000, then you must set your increment_last_id
to be 100064999. Also bear in mind that increment IDs are per store, so you need to decide which store you are updating the increment ID for, and find out the store ID.
UPDAT...
What version did flat come in? Are all these tables safe to truncate? Make different scripts for different versions.
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
TRUNCATE `sales_flat_creditmemo_item`;
TRUNCATE `sales_flat_invoice`;
TRUNCATE `sales_flat_invoice_comment`;
TRUNCATE `sales_flat_invoice_grid`;
TRUNCATE `sales_flat_invoice_item`;
TRUNCATE `sales_flat_order`;
TRUNCATE `sales_flat_order_address`;
TRUNCATE `sales_flat_or...
Is this ok?
TRUNCATE TABLE `customer_address_entity`;
TRUNCATE TABLE `customer_address_entity_datetime`;
TRUNCATE TABLE `customer_address_entity_decimal`;
TRUNCATE TABLE `customer_address_entity_int`;
TRUNCATE TABLE `customer_address_entity_text`;
TRUNCATE TABLE `customer_address_entity_varchar`;
TRUNCATE TABLE `customer_entity`;
TRUNCATE TABLE `customer_entity_datetime`;
TRUNCATE TABLE `customer_entity_decimal`;
TRUNCATE TABLE `customer_entity_int`;
TRUNCATE TABLE `customer_entity_text`;
TRUN...
This should go in adminhtml.xml. Also see Config ACL Definition (note that the XML path of the ACL entry needs to match up with the XML path of the menu entry).
To place an entry under the sales node (alter the name for other nodes):
<config>
<menu>
<sales>
<children>
<namespace_module translate="title" module="namespace_module">
<title>Your Module</title>
<sort_order>10...
This should go in adminhtml.xml
. Also see Config Menu Definition (note that the XML path of the menu entry needs to match up with the XML path of the ACL entry). To see how to implement the checking of an ACL within an admin controller see the _isAllowed()
method in Boilerplate Admin Controller.
To place an entry under the sales node (alter the name for other nodes):
<adminhtml>
<acl>
...
Doing this is a slight pain, to quote what Alan Storm said on StackOverflow:
So, if you really need to add a handle to a controller, you need to replace the call to $this->loadLayout()
with:
$update = $this->getLayout()->getUpdate();
$update->addHandle('default');
$thi...
<config>
<global>
<rewrite>
<namespace_module>
<from><![CDATA[#^/some/regex/([a-z]*/?$#]]></from>
<to><![CDATA[/frontname/whatever/whatever/blah/$1]]></to>
</namespace_module>
</rewrite>
</global>
</config>
<config>
<global>
<models>
<catalog>
<rewrite>
<product>Namespace_Module_Model_Catalog_Product</product>
</rewrite>
</catalog>
</models>
</global>
</config>
In app/code/core/Mage/Core/functions.php
Magento offers a function named mageDebugBacktrace()
which is nice, but I thought could be made nicer. This backtrace shows frame numbers, file names and line numbers, classes, methods and arguments where possible. It can be placed anywhere you fancy, as long as it is included by Magento - I normally add it to functions.php when needed, and remove when I'm done.
Example output:
[ 0] app/code/core/Enterprise/Search/Model/Adapter/Abstract.php:414 Enterprise_Search_Model_Adapter_HttpSt...
$afterElementHtml = '<p class="nm"><small>' . ' this is the hint! ' . '</small></p>';
$linkFieldset->addField('field_name', 'text', array(
'after_element_html' => $afterElementHtml,
));
<config>
<global>
<cache>
<backend>memcached</backend>
<slow_backend>database</slow_backend>
<id_prefix>cache_</id_prefix>
<memcached>
<servers>
<server1>
<host><![CDATA[localhost]]></host>
<port><![CDATA[11211]]></port>
<persistent><![CDATA[0]]></persistent>
<weight><![CDATA[1]]></weight>
...
You need Cm_Cache_Backend_Redis for this
<config>
<global>
<cache>
<backend>Cm_Cache_Backend_Redis</backend>
<backend_options>
<server>localhost</server> <!-- or absolute path to unix socket for better performance -->
<port>6379</port>
<database>0</database>
<force_standalone>0</force_standalone> <!-- 0 for phpredis, 1 for standalone PHP -->
...
This snippet provides a collection of products within a category
$cat = Mage::getModel('catalog/category')->load(1);
$coll = Mage::getResourceModel('catalog/product_collection');
$coll->addCategoryFilter($cat);
To cache a block individually, add this method to the blocks class:
protected function _construct()
{
$this->addData(array(
'cache_lifetime' => 3600,
'cache_tags' => array(Mage_Cms_Model_Block::CACHE_TAG),
'cache_key' => 'CACHE_KEY',
));
}
_Note - if you set cache_lifetime to 0 (or any other value which PHP evaluates to false) then the cache will actually last 7200 seconds (2 hours), so in order to have a very high cache time then the cache_lifetime should be set ...
<config>
<global>
<template>
<email>
<your_module_email_something_template translate="label" module="namespace_module">
<label>Something</label>
<file>namespace/module/something.html</file>
<type>html</type>
</your_module_email_something_template>
</email>
</template>
</global>
</config>
![](http://mikewhitby.co.uk/makandra-track.gif?a=config-transacti...