161 cards

Order States and Statuses

The only state to hold more than one status by default is payment_review, it seems a little odd to me that PayPal creates a state of pending_paypal - that seems like it should be a child of pending_payment.

  • new
    • pending
  • pending_payment
    • pending_payment
  • payment_review
    • payment_review
    • fraud
  • processing
    • processing
  • complete
    • complete
  • closed
    • closed
  • canceled
    • canceled
  • holded
    • holded

Boilerplate Controller

<?php
/**
 * Yourcompany.com
 *
 * PHP Version 5
 *
 * @category  Namespace
 * @package   Namespace_Module
 * @author    Your Name <your.name@yourcompany.com>
 * @copyright 2012 yourcompany.com
 * @license   http://www.yourcompany.com/license.txt Your license
 * @link      N/A
 */

/**
 * A description of the controller
 *
 * @category Namespace
 * @package  Namespace_Module
 * @author   Your Name <your.name@yourcompany.com>
 * @license  http://www.yourcompany.co...

Paypal Express Flow

The PayPal Express Checkout Integration Guide Archive 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 Checkout flow diagram illustrates the process well:

The same information as contained in the diagram above is also in the table
below:

|-------------------------------------------------------------------+-------------...

Disabling A Category

For some reason this does not work:

$category->setIsActive(false);

You must use this instead:

$category->setIsActive(0);

Stop Controller Dispatch

In an action controllers preDispatch() method you can stop dispatch by calling the following:

$this->setFlag('', self::FLAG_NO_DISPATCH, true);

If you were listening via an observer, your code would look like this:

public function someObserver(Varien_Event_Observer $observer)
{
    $action = $observer->getEvent()->getControllerAction();
    $action->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
}

Get A Products Stock Quantity

$product->getStockItem()->getQty();

Yes, there is no method for it - it's set using setStockItem() from Mage_CatalogInventory_Model_Stock_Item::assignProduct() via the catalog_product_load_after event.

Draft

URL Route Parameters

Mage_Core_Model_Url::getUrl()

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 |
|-----------------+---------------+---------------------------------------------------------...

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($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'...

Get The Current Product

Mage::registry('current_product');

Get The Current Category

Mage::registry('current_category');

Draft

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...

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_...

Setting Data Per-Store On Entites

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...

Altering Config Data During Setup

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');

...

Cache Clearing And General Information

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...
Draft

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 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.

Orders

UPDAT...
Draft

Remove Orders From MySQL

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...
Draft

Remove Customers From MySQL

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 website uses short-lived cookies to improve usability.
Accept or learn more