Getting The Amount Of Items in the Cart
To get the amount of line items (i.e. 10 of 1 product is 1):
Mage::helper('checkout/cart')->getItemsCount();
To get the total number of items (i.e. 10 of 1 product is 10):
Mage::helper('checkout/cart')->getSummaryCount();
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 ...
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...
Getting the Theme In Use
How to get the theme for each component, works on the active store:
Mage::getSingleton('core/design_package')->getTheme('locale');
Mage::getSingleton('core/design_package')->getTheme('template');
Mage::getSingleton('core/design_packag...
Fetching All Attributes For An Entity From The DB In One Query
Using the database to inspect EAV-based entity types can be a real pain in the ass, so here are a bunch of queries that let you inspect some popular EAV entity types easily. This practice can be applied to any EAV entity type, however as there are...
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 ...
Allowing Import Of Invisible Attributes
By setting a Product Attribute to be invisible via the visible
property, you stop the ability to import that attribute unless you alter the _forcedAttributesCodes
property of...
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...
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...
Creating an EAV Entity
Overview
A overview for those familiar with making flat models:
- Your config is standard, your table name takes the form of the base (entity) table
- You name your resource models as normal (so by class name, you can't tell the difference b...
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...