1

I want to display the company name by default inside the contact form. Just like the customer name and emailaddress.

I tried this, but that does not work.

<?php echo $this->escapeHtml($this->helper('contacts')->getCompany()) ?>

What line should I use?

1
  • try this Mage::app()->getStore()->getFrontendName()
    – Amit Bera
    Commented Oct 16, 2015 at 9:45

1 Answer 1

1

Pre-filled values for user email and name come from the contacts helper, if you take a look there, you will find those functions. To have user's comapny pre-filled too, you can try with something like this :

<?php
    if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
        echo '';
    }
    else {
        $customer = Mage::getSingleton('customer/session')->getCustomer();
        echo trim($customer->getCompany());
    }
?>

directly inside your phtml file.

Your Answer

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

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