1

Is it possible on store/orders page to use different colors for different order statuses? This feature can be handy. Or doe's someone know how to implement it? thank you

1

Here's a possible Drupal-only solution that can get you there. You're going to need access to your theme css file to add a class for each of your order statuses, ex something like this:

.order-status-pending { color: yellow; }
.order-status-closed { color: green; }
.order-status-problem { color: red; }

Now go to views and edit the 'orders' view that is added by Ubercart and then select the field for 'order statuses' from the Fields display section. Next, select 'Style Settings', 'customize field HTML', 'Create a CSS class' and then use the tokens to add your custom class there, ex:

order-status-[status]

You could also rewrite the output of the field using the replacement tokens to something like this:

<span class='order-status-[status]'>[status]</span>

This won't work on multiple word order statuses, but you could use jquery instead to do this kind of conditional styling, using their much more powerful selectors.

  • hi, thank you for reply. Where exactly should I select 'style settings' and 'customize field html'... ? Where can I use the tokens? – loparr Apr 4 '12 at 21:34
  • whoops - forgot to add the edit 'orders' view line. Fixing now – schnippy Apr 4 '12 at 23:01
  • oh:) I apologise. Your advice is for drupal 7. I use drupal 6:) – loparr Apr 5 '12 at 1:22
  • are you familiar with drupal views theming? its not that much different from 6.x to 7.x -- if you click the field under the fields section in your orders view you're going to see most of these same options – schnippy Apr 6 '12 at 15:32
  • Yes I am familiar with themng views. Are you using ubercart views module? I use default admin/store/orders screen. Is it possible to create orders list without additional modules using views? Thank you. – loparr Apr 11 '12 at 14:50

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.