On the checkout page, you have the firstname and the lastname from the following code:

<li class="fields">
    <?php echo $this->getCustomerWidgetName()->toHtml(); ?>

But if you have a problem, the HTML code is already mounted from the file name.phtml and that same form is used on the new clients' registration page and I would need to make modifications to the same HTML and CSS.

How could I proceed so that I could make changes to it, without this influencing the new customer registration page (customer / account / create /)?

  • You mean to say same file (name.phtml) is calling on Registration and Checkout page? Commented Sep 22, 2017 at 17:46
  • That's right... Commented Sep 22, 2017 at 17:51

1 Answer 1


You can add if...else condition to differentiate it.

$request = $this->getRequest();
$module = $request->getModuleName();  // Get Current Module Name
$controller = $request->getControllerName();  // Get Current Controller Name

For Customer Account Registration page - customer is module and account is controller name

whereas on Checkout page - checkout is module name and onepage is controller name

For Example,

<?php if($module=='checkout' && $controller=="onepage"): ?> 
    // Do your stuff
<?php endif; ?>

Other way is to use parent class to add your CSS only on checkout page

Hope it helps :)

  • I did not understand in detail what you meant. Commented Sep 22, 2017 at 18:44
  • please check my updated answer with condition. You can use it inside name.phtml file. Commented Sep 22, 2017 at 18:48
  • It worked very well. Thank you very much for all the help! Commented Sep 22, 2017 at 19:12
  • You're Welcome @MatheusPortela Commented Sep 22, 2017 at 19:13

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.