1

On my Drupal 6 / Ubercart 2.9 cart website, I have the need to modify the CSS of the checkout page when a certain product is in the cart. For instance, if the customer is ordering red flowers, the background would change to a red flower background image. Is this possible via CSS? If not, any other ideas on how it can be done?

Thanks!

1 Answer 1

2

I have two ideas:

1) render the code of the article in the class attribute of the cart div. you can do that "intercepting" the render function in your template.php file.

2) using jquery

6
  • Do you have an example of the jquery method that you can point me towards?
    – hockey2112
    Commented Dec 20, 2012 at 21:37
  • Also, what about passing a value in the URL? Is that a possible method of providing the ability to customize the CSS for that page based on whether that parameter is passed in the URL? If so, how would that be accomplished?
    – hockey2112
    Commented Dec 20, 2012 at 22:21
  • 1
    JQUERY: I opened an ubercart cart and saw that -unfortunally- there wasn't an id of the product mentioned in the html <tr>. But there was the href (yourdomain/catalog/section/productname). So you can solve with this line of code in your script head tag: $(document).ready(function () { if ($("a['yourdomain/catalog/section/productname']")) { $("#cart-form-pane").css('background','red') } }); Commented Dec 21, 2012 at 8:12
  • URL: instead of url, you can intercept the cart render function in yourthemename/template.php file, in order to append a class to the <div id='cart-form-pane'> tag. But I can't help you there...maybe this post could be useful: www.ubercart.org/forum/development/3868/nifty_products_tutorial_part_1 Commented Dec 21, 2012 at 8:15
  • 1
    Looks like the Jquery Update (drupal.org/project/jquery_update) module was causing the issue. I disabled that module, and the jquery method now works fine on that other live site.
    – hockey2112
    Commented Jan 3, 2013 at 22:45

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.