Thursday, October 11, 2012

Can not login to magento admin and frontend

Im using centos. I had a problem, Magento frontend and admin login doesn’t work and loops back to login with no message. This happens because of session cookie problem. I solved this problem by installing ntp

In your shell type the below command to install ntp

    # yum install ntp

Turn on ntp service

    # chkconfig ntpd on

Synchronize system clock with 0.pool.ntp.org server:

    # ntpdate pool.ntp.org

Start the NTP service:

    # /etc/init.d/ntpd start
 
Now check whether this has solved the cookie problem. If not try the following. comment the below lines in "/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php".

if (!$cookieParams['httponly']) {
 unset($cookieParams['httponly']);
 if (!$cookieParams['secure']) {
  unset($cookieParams['secure']);
  if (!$cookieParams['domain']) {
   unset($cookieParams['domain']);
  }
 }
}

if (isset($cookieParams['domain'])) {
 $cookieParams['domain'] = $cookie->getDomain();
}

Wednesday, April 11, 2012

Thursday, March 8, 2012

How to get special price end date in magento?

Here is the code to get special price end date in magento.
$this->formatDate($product->getSpecialToDate())

How to get special price or offer price in magento?

Here is the code to get special price in magento.
$price = $_product->getPrice();
$specialprice = $_product->getFinalPrice();
if($specialprice != $price)
{
 //your stuff here
 echo $specialprice;
}

Default toggle text in input text box magento

In common web design form we may noticed some help text inside the text field. The help text automatically removed when the user clicks on the input field. It has the benefit of putting the help precisely where the user's looking. Something like this:



Here is the code. Enjoy coding:)

Wednesday, February 1, 2012

Show category description using category id

$ca = $category->load($category_id);
$ca->getProductCollection()->addCategoryFilter($ca)->addAttributeToSelect('*');
echo $ca->getDescription();