Getting A Products URL
Potentially confusing due to the 3 methods you could use, all of which are in
Mage_Catalog_Model_Product
:
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:
To see what other params can be passed to
getUrlInStore()
, see URL Route Parameters.Using _ignore_category
The short version - I would not use this param, and instead use
Mage::getUrl($product->getUrlPath())
If you first fetch a products URL which includes the category, and then use the same product instance to attempt to fetch a non-category URL, you will instead both times get a URL which contains the category, see the below code:
The issue lies with the
request_path
key on the$product
model, which theMage_Catalog_Model_Product_Url::getUrl()
sets, to act as a cached value for an otherwise intensive process of resolving a URL rewrite to a product within a category.
To resolve this, unset
request_path
first, as below:
Note that any method listed at the top of this card which causes the category to be present in the returned URL will have the same effect of caching the category.
Product Price Index
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 data |
catalog_product_index_price | has data - main table |
catalog_product_index_price_bundle_idx | no data |
catalog_product_index_price_bundle_opt_idx | no data |
catalog_product_index_price_bundle_opt_tmp | no data |
catalog_product_index_price_bundle_sel_idx | no data |
catalog_product_index_price_bundle_sel_tmp | no data |
catalog_product_index_price_bundle_tmp | no data |
catalog_product_index_price_cfg_opt_agr_idx | no data |
catalog_product_index_price_cfg_opt_agr_tmp | no data |
catalog_product_index_price_cfg_opt_idx | no data |
catalog_product_index_price_cfg_opt_tmp | no data |
catalog_product_index_price_downlod_idx | no data |
catalog_product_index_price_downlod_tmp | no data |
catalog_product_index_price_final_idx | no data |
catalog_product_index_price_final_tmp | no data |
catalog_product_index_price_idx | has data |
catalog_product_index_price_opt_agr_idx | no data |
catalog_product_index_price_opt_agr_tmp | no data |
catalog_product_index_price_opt_idx | no data |
catalog_product_index_price_opt_tmp | no data |
catalog_product_index_price_tmp | has data |
From looking at query logs,
catalog_product_index_price
is the main table, as it is the only one that is included in any queries when loading a category or product page. I assume that all the rest of the tables are temporary.Display Out Of Stock Configuration Option
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:
- Product Attributes (catalog_product_attribute)
- Product Prices (catalog_product_price)
If you then refresh just the "Product Attributes" index, the product is still visible, if you then refresh the "Product Prices" index, it disappears, thus the "Product Prices" index is responsible for the implementation of this setting.
Setting Data Per-Store On Entites
Certain entities 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. To do this in code you must set the store id before you load the model, as such:
To set the name of a category for the default store scope:
To set the name on store 1:
The concept of calling
setStoreId()
is also used for other models that use a store scope, such as products.Altering Config Data During Setup
Assuming
$installer
refers toMage_Core_Model_Resource_Setup
or a subclass of it, you can do the following:
Setting a value in the default scope:
Setting a value in a specific store:
Deleting a value from all scopes:
Deleting a value from a certain scope (unfortunately you cannot choose which scope ID though:
Cache Clearing And General Information
Clean everything (use either):
Clean specific types:
Get all declared cache types:
Cache Types
Each cache has it’s own type id, which is a Magento concept to aid management of each type of cache, basically you would use the type id to clear by that type. Each type corresponds to a tag or a set of tags which will be cleaned when you clean that type. To find out the info for all the currently declared types use the "Get all declared cache types" snippet above and
var_dump()
it.
All cache types are stored in config, in the path
global/cache/types
, so you could also use something like the Magento Debug Toolbar to inspect the config stored at that path.Configuration
Type ID: config
Tags: CONFIG
Tags: CONFIG
Layouts
Type ID: layout
Tags:LAYOUT_GENERAL_CACHE_TAG
Tags:LAYOUT_GENERAL_CACHE_TAG
Blocks HTML output
Type ID: block_html
Tags: BLOCK_HTML
Tags: BLOCK_HTML
Translations
Type ID: translate
Tags: TRANSLATE
Tags: TRANSLATE
Collections Data
Type ID: collections
Tags: COLLECTION_DATA
Tags: COLLECTION_DATA
EAV types and attributes
Type ID: eav
Tags: EAV
Tags: EAV
Web Services Configuration
Type ID: config_api
Tags: CONFIG_API
Tags: CONFIG_API
(Full) Page Cache
Type ID: full_page
Tags: FPC
Tags: FPC
Note - full page cache is normally kept in a seperate cache backend, so you should use it’s own cache manager to reliably clear it
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 theincrement_last_id
column. Note that this is the last ID, so if you wish your next ID to be 100065000, then you must set yourincrement_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.Orders
Quotes
Invoices
Shipments
Credit Memos
General Info
The table looks like the following:
entity_store_id | entity_type_id | store_id | increment_prefix | increment_last_id |
---|---|---|---|---|
1 | 1 | 0 | 0 | 000017379 |
2 | 11 | 1 | 1 | 100058797 |
3 | 16 | 1 | 1 | 100056714 |
4 | 23 | 1 | 1 | 100004946 |
5 | 11 | 2 | 2 | 200000503 |
6 | 16 | 2 | 2 | 200000493 |
7 | 23 | 2 | 2 | 200000113 |
- entity_type_id
- The type of the entity for which the increment relates. This is a foreign key which relates to
eav_entity_type
, and through it’s foreign table relates to one of quote, order, invoice, shipment or creditmemo - store_id
- Fairly obvious
- increment_prefix
- The first digit of the
increment_last_id
- increment_last_id
- Fairly obvious
No comments:
Post a Comment