Getting The Last Order ID From The Session
Mage::getSingleton('checkout/session')->getLastOrderId();
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 ...
Associating An Orphan Sage Pay Suite Transaction With An Order
We had a situation whereby a client placed an order and went through Sage Pay
succesfully, however the order was not able to be created on Magento, so we had
an error stating "WARNING - There are approved Sage Pay transactions that have
no associa...
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...
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...
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();
![](http://mi...
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`;
...
Changing The Admin Theme
Put this in your local.xml
:
<config>
<stores>
<admin>
<design>
<theme>
<default>yourtheme</default>
</theme>
</design>
...
Widget Parameter ID Weirdness
I've not yet found out why, but this will not work:
<widgets>
<some_widget type="some_module/block" translate="name description" module="some_module">
<name>Widget</name>
<description>Foo</description>
...
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 ...
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...