1

I have a webshop were I have to hide away the login and create user form, because I only want customers with a specific link to be able to register. When they have registered they will be able to see a category that only they have a link for. What I want to do is create a static block that contains links to this category, customers dashboard etc. that only logged in users/or users in a specific customer can see. How can i achieve this?

1
  • are you want to show .... category after register?? which have static block??
    – Amit Bera
    Aug 26, 2014 at 14:07

1 Answer 1

7

Use Mage::getSingleton('customer/session')->isLoggedIn() before your block as a conditional and you have scenario 1 fixed.

Also you can use Mage::getSingleton('customer/session')->getCustomerGroupId() to get the Customer group Id as another conditional before echoing your block. See how to echo a block here.

Complete code:

<?php if (Mage::getSingleton('customer/session')->isLoggedIn() && Mage::getSingleton('customer/session')->getCustomerGroupId() == "something") :?>
    <?php echo $this->getChildHtml('sample_links') ?>
<?php endif;?>

Remember to define your block in your XML file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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