1

I have created a static block in magento in which i have inserted the following code in order to get the phone number information

{{config path="general/store_information/phone"}}

I am also echoing that static block in header.phtml but i am facing a problem. I want the phone number of my store to be displayed in the left side of the header in the homepage and in the categories page i want it to be displayed in the right sider of the header. The reason i want that is because some elements move around when the customer goes from the homepage to categories page. Is this possible?

1 Answer 1

2

Do as below for homepage:

if($this->getIsHomePage())
{
  your code 
}

Do as below for category page:

if (Mage::registry('current_category'))
{
  // your code
}

paste your {{config path="general/store_information/phone"}} in desired area and check.

Also you could use css for that purpose.

6
  • many ways we can achieve that. but without seeing your site, i could advise only this much. hop it fulfilled. May 25, 2015 at 12:38
  • can you give me an example how this can be done with css? Because css is the first thing i tried out. But how am i going to tell it where to appear? Can i write css code inside the if statement?
    – vasilisdmr
    May 25, 2015 at 12:39
  • 1
    for homepage, we have cms-index-index class and for category we have catalog-category-view class which is unique. based on this, we need to style. again, its completely depend on the template you are using. float right and left properties can be used. May 25, 2015 at 12:43
  • And where that classes are located?
    – vasilisdmr
    May 25, 2015 at 12:46
  • in body. use firebug in firefox to cehck. May 25, 2015 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.