Hey there customizers,
here’s a small trick I figured out about changing button values ( the text of a button, e.g., “Submit” ). A trick I turned up when I was stressing about having to edit a core file in order to deliver the same copy as was indicated in the mockup.
If you’re working as much as me, you can’t possibly keep track of every line you edited in core of every site you hand off when prepping for webstore version upgrades ( for every site you maintain). Not that you should ever edit core – but, unfortunately there’s a lot of plain text in LightSpeed Webstore that’s sequestered in core files and sometimes you have to.
Most clients have no idea that most of this stuff is in core – they see “Shipping is the same as Billing address” and they want it to read “My Billing & Shipping Address are the Same for This Order”. While I can go into /where-webstore-is-installed/xlsws_includes, find the file that contains the line “Shipping is the same as Billing address” and edit it, I’m not supposed to. Not that it will break stuff (editing plain text rarely breaks anything) but imminent upgrades will possibly overwrite the edit and I might not remember to add it back.
Because of this issue I’m always looking for ways to edit stuff without touching core so when I saw this line in /templates/deluxe/promo_code.tpl.php which renders the submit button for the Promo Code input field:
[php]<?php $this->btnPromoVerify->Render(‘Text=’._sp("Apply Promo Code")) ?>[/php]
I tried it out on other render hooks and found out I could use it practically anywhere I wanted to. I could also use this other handy line I’d seen sprinkled about in template files which generates the CSS class for a HTML element such as for the Login/Register buttons in
/templates/deluxe/checkout_login_register.tpl.php:
[php]
<?php $this->butLogin->Render(‘CssClass=button rounded’) ?>
<?php $this->butRegister->Render(‘CssClass=button rounded’) ?>
[/php]
I combined the lines in one render hook and was real (stupidly pleased) with myself. Example:
[php]
<?php $this->whatEver->Render(‘CssClass=awesome’,
‘Text=’._sp("Awesome")) ?>
[/php]
Keep your eyes peeled for $this->something->Render() in your templates and try it out for yourself.