2

Is there a way to retrieve the colour assigned to a status to use on a front-end template?

For instance, I have an ecommerce system that uses a status of "Declined". I have made this status display in red so on the back end the store administrator can easily see any declined transactions.

Now, say I wanted to output a list of a customer's transactions for them on the front end. Would it be possible to grab that colour to use in my template or will I need to create a series of conditionals and set colours that way (using CSS classes)?

I guess a quick hack around it would be to do something like

<p class="{status}">Status: {status}</p>
1
  • 3
    It might be good to add prefix to the class -- "status-{status}" -- but that's obviously just preference. Jul 31 '13 at 13:15
0

You can't, my friend. Your suggestion of code is the best option.

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.