Hey,
I'm working on a new site design and I noticed there is no class for the paragraph tag that displays when a cart is empty, nor is there a body class ("cart-empty" or something would've been good) so I can't easily tell the CSS how to display the text. Note, that I don't want to re-theme the empty cart function - I'd like to do this purely in CSS.
The attached patch adds a class to both the div and the paragraph text that are rendered in theme_uc_empty_cart() and theme_uc_cart_block_items(). Please add this (it's a tiny patch) as a designer shouldn't have to write a theme override function for this.
Comment | File | Size | Author |
---|---|---|---|
#3 | uc_cart.empty_text.patch | 738 bytes | TR |
#2 | uc_cart.904986.theme_.patch | 396 bytes | torgosPizza |
uc_cart.empty_text.patch | 840 bytes | torgosPizza | |
Comments
Comment #1
torgosPizzaFixing title.
Comment #2
torgosPizzaHere's an alternative way to do it. If you insist that this modification be done through theme overrides, then we should make sure that the theme('uc_cart_empty) function is actually called on the /cart page if the cart is empty.
Attached patch adds that.
EDIT: Note this patch will cause Hunk #1 to fail in my previous patch.
Comment #3
TR CreditAttribution: TR commented@torgosPizza: I made a new patch which combines both of yours - it calls the theme function as in the OP and it adds the CSS classes as in #2. I changes the underscores to hyphens in the CSS class names to conform with Drupal conventions. Let me know if this works for you.
Comment #4
TR CreditAttribution: TR commentedTagging.
Comment #5
torgosPizzaI just realized a mistake I made in these patches - the 2nd one patches the "block" display and not the cart page. I'm not sure why I didn't make that distinction earlier. But I would imagine you don't want the block to display the entire same message that the cart page would.
For example the /cart page, when empty, I have themed to show some "suggestions" which wouldn't work the same way in a block.
So, I think the only part this patch needs to keep is where it adds the empty classes to the theme function as a sane default (otherwise there's no easy way to style it (since using .page-cart would affect both full and empty carts).
i can re-roll this to make more sense based on this, if you want.
Comment #6
longwaveAgreed that the "empty cart" block message should stay separate and more simple than the page.
Also I think you only need a class on the <div> tag - if you want to target the <p> with CSS you can do that anyway, and if you're overriding the theme function then you can do what you like :)
Comment #7
torgosPizzaGood point. Yeah I'm not sure what I was thinking when I patched that. Obviously I was a little confused. But the overall idea is solid ;) I'll try to roll a new patch when I can.
Comment #8
longwaveFixed in both branches:
http://drupalcode.org/project/ubercart.git/commit/44a8239
http://drupalcode.org/project/ubercart.git/commit/00f7949