themeable "There are no products in your shopping cart"

Project:Ubercart Contributions
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Description
Project: 
Ubercart

Hi,

Could the "There are no products in your shopping cart" message be moved to a themeable function? I would like to change this so that it displays some custom links back to the shopping section of my site, but right now I don't see a way of doing this without hacking it.

I think it should be as easy as changing a line in uc_cart_view() from:

return '<p>'. t('There are no products in your shopping cart.') . '</p>';

to:

return theme('uc_empty_cart');

and

function theme_uc_empty_cart() {
return '<p>'. t('There are no products in your shopping cart.') . '</p>';
}

Best,
Xerxes

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: themeable "There are no products in your shopping cart"

Sounds reasonable to me. I'll get it done this afternoon.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Committed.
xerbutter's picture
Offline
Bug Finder
Joined: 09/07/2007
Juice: 146
Re: Committed.
Assigned to:Ryan» xerbutter

Perfect. Thanks!

thinkbig's picture
Offline
Joined: 08/01/2008
Juice: 2
Then how to implement?
Assigned to:xerbutter» thinkbig

Sorry for the simpleton question but in what file would:

function theme_uc_empty_cart() {
return ''. t('There are no products in your shopping cart.') . '';
}

be placed and where in the directory structure would it need to be put?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Then how to implement?
Assigned to:thinkbig» Ryan

If you're a new user, it's already in there. If you've got an old version of Ubercart, you can patch this into your uc_cart.module or update to 1.3. If you want to override this in your theme, you'd add a function like phptemplate_uc_empty_cart() to your template.php file in your theme.

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: Then how to implement?
Assigned to:Ryan» TR

This will get you started on learning how to override theme functions: http://www.ubercart.org/faq/617

<tr>.