1

Ubercart is only a small part of our site and we only want the default cart block to appear when a user is in that shopping section. Simple enough to do with "Show block on specific pages" rules.

However, when a user navigates away from the ubercart section, the cart block disappears, but I would still want to denote that the active cart exists. I don't want users to think their cart has completely vanished.

Preferably it would be a simple, tiny "View my cart" link to the default Ubercart cart page in the Header Block region. Or even added to the end of the main site navigation menu.

So, to reiterate, how can I make a Block (or menu link) render only when an item is placed in a user's cart?

0

Create a block with your "View Cart" html code then set block visisbility to "Pages on which this PHP code returns TRUE (experts only)" with the following:

<?php
$items = uc_cart_get_contents();
if (count($items) > 0) {
  return true;
}
return false;
?>

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.