In Stock Product Collection
This snippet provides a collection of in-stock products, or products which do not have stock management enabled on them
$productCollection = Mage::getResourceModel('catalog/product_collection');
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($productCollection);
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 ...
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 ...
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...
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 prod...
Stock Availability on Credit Note, Cancellation and Payment Deny
In summary - making a credit memo can increase the stock quantity but will never set the "Stock Availability" of the product to "In Stock", whereas a config option can control whether an order cancellation sets "In Stock" automatically. Denying a ...
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');
...
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...
Product Types
Type | Composite[^1] | Inventory[^2] | Description | Example |
---|---|---|---|---|
Simple | - | Yes | The most basic form of product | Example |
Grouped | Yes | No | Several simple products displ... |
Paypal Express Flow
The PayPal Express Checkout Integration Guide is a great
source of well-written information for anything relating to the Express
checkout, including information regarding all of the API calls. Also, the PayPal
Express Checko...
Category Product Collection
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);
![](http://mikewhitby...