Magento Themes and Magento Extensions

How long customer is inactive ?

Share
Posted on January 17th, 2013 | Posted by admin

How long customer is inactive ?

1 $customer = Mage::getSingleton('customer/session')->getCustomer();
2 $log = Mage::getModel('log/customer')->load($customer->getId());
3 $inctive_time = now() - $log->getLastVisitAt();

Magento: Programtically Cancel the coupon code on the shopping cart

Share
Posted on January 15th, 2013 | Posted by admin

Magento: Programtically Cancel the coupon code on the shopping cart

$quote = Mage::getSingleton(‘checkout/session’)->getQuote();
$oldCouponCode = $quote->getCouponCode();
if (strlen($oldCouponCode)) {
$quote->setCouponCode(”)->collectTotals()->save();
}

Magento: Shopping Cart Total Quantity vs Total Items

Share
Posted on January 14th, 2013 | Posted by admin

When it comes to Magento Shopping Carts, people tend to get confused between total items and total quantities. A shopping cart item is a unique product within the shopping cart and the quantity is the total number of each unique item that customers want to order. In other words, if you have two different products (ex. shirt and pants) in your shopping cart, but want to order five of each of these products, the two products are the items and the five of each product is the quantity.

For these reasons, the methods that are typically used by people to return the cart quantity is incorrect. If you find yourself using the getItemsCount()method to return the total quantity of items in your shopping cart, you’re doing it wrong. Instead, what you should be using is the getItemsQty()method, which returns the total quantity of all the items combined within your shopping cart.

isDevAllowed – IP Restriction in Magento

Share
Posted on January 13th, 2013 | Posted by admin

A lot of Magento developers like to test their code privately before they set it public. The way they normally do this is to develop code on a development domain and then synchronise the files across to the live production server. Unfortunately sometimes this is not possible and we need to just have a quick restriction that we can apply and then remove when we’re happy with the code.

The normal way to do this is to use

1 if($_SERVER['REMOTE_ADDR'] == 'MY.IPA.DDR.ESS' ){
2
3 // do something here
4
5 }

Translate/change/customize Pages titles of Contact Us, Site Maps, and Search Term pages in Magento

Share
Posted on January 12th, 2013 | Posted by admin

Magento provides the functionality to manage more than one store. And we can translate the sentences and words in content according to our requirements. But what about the page titles? We can change CMS page titles using magento backend. But for some pages like contact us, site maps and search terms it requires much efforts than normal.

You can translate or customize your page titles in magento by using layout files.

So just follow the following steps:

Go to your theme folder. E.g.; rootfolder/app/design/frontend/default/mytheme
In this folder you will generally find following three directories.