Check if there are any shipping methods available
public function haveShippingMethods() { if (count(Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingRatesCollection())) { return true; } return false; }
Not today Justin
will byers stan first human second

Kiana Khansmith
No title available

if i look back, i am lost

❣ Chile in a Photography ❣

⁂
styofa doing anything

roma★
NASA
DEAR READER

izzy's playlists!
Today's Document
Show & Tell

Andulka
Stranger Things

JVL
2025 on Tumblr: Trends That Defined the Year
Monterey Bay Aquarium
Keni

seen from Germany

seen from United States

seen from Romania

seen from Malaysia
seen from Spain

seen from Türkiye

seen from United Kingdom

seen from United States
seen from Brazil
seen from United States

seen from Mexico
seen from Chile

seen from Türkiye

seen from United States

seen from Singapore
seen from Nigeria
seen from Brazil

seen from Türkiye

seen from Germany

seen from Türkiye
@magento-code-snippets-blog
Check if there are any shipping methods available
public function haveShippingMethods() { if (count(Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingRatesCollection())) { return true; } return false; }
Get attribute set collection
$attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection') ->load();
Get a categories products ordered by number of sales
$categoryId = 1; //Change this to whatever the category id is - duh :) //Lets load up that category $category = Mage::getModel('catalog/category')->load($categoryId); $products = Mage::getResourceModel('reports/product_collection') ->addOrderedQty() ->addAttributeToSelect('*') ->setOrder('ordered_qty', 'desc') ->addCategoryFilter($category);
Get all of the top level categories
//Usually, the first base category added will have the id of 2 $defaultCategoryId = 2; $topLevelCats = Mage::getModel('catalog/category') ->getCollection() ->addAttributeToSelect('path','name','id') ->addAttributeToFilter('parent_id', $defaultCategoryId) ->setOrder('position', 'ASC');
Set current store (pass the integer id)
$storeId = 1; Mage::app()->setCurrentStore($storeId);
Print the SQL queries performed when calling a product collection
$_productCollection->printLogQuery(true);
Get store contact number
Mage::getStoreConfig('general/store_information/phone');
Unsubscribe customer using email address
Mage::getModel('newsletter/subscriber') ->loadByEmail($emailAddress) ->unsubscribe();
Get Base Secure URL
Mage::getBaseUrl('web', true);
Check if Google Analytics is available
Mage::helper('googleanalytics')->isGoogleAnalyticsAvailable()
Get product collection
$collection = Mage::getModel('catalog/product')->getCollection();
Check if RSS is enabled
Mage::getStoreConfig('rss/catalog/category');
Get the current category name
Mage::registry('current_category')->getName();
How many items are there in the basket?
Mage::getSingleton('checkout/cart')->getSummaryQty();
Get a configurable product child products
$childProducts = Mage::getModel('catalog/product_type_configurable') ->getUsedProducts(null, $product);
Get the number of products shown in the sidebar
Mage::getStoreConfig('checkout/sidebar/count');
Check if a product is configurable
$product->isConfigurable();