Drupal is up and running but how do I ...?

How to extract Shopping Cart status out of the block? (so I can provide users a simpler overview)

Hi,

I'd like to display a Shopping Cart icon (either empty or full based on whether user has added anything) at the top of the page... similar to http://www.macromedia.com/ site (take a look at the top of the page). This is a very popular way of displaying the status of a shopping cart and I'd like to emulate it. Basically, Shopping cart block already does everything that I need but I'd like to "extract" that info out of it.

So, which variable holds the status and how do I call it from PHP inside the page.tpl.php? :) Here's the code of the block...

Thanks!!!

Mel

<?php
function theme_cart_display_block() {
global $user;
$output = '';

/**
* Until Drupal can handle partial page caching, We should only display a
* View Cart link for anonymous users and the full fancy items and total cart
* for authenticated users since those pages aren't cached.
*/
if ($user->uid == 0 && variable_get('cache', 0)) {
$output .= l(t('View your cart'), 'cart/view');
}
else {

$item = cart_get_items();
$item_count = count($item);
$item_suffix = ($item_count == 1) ? t('item') : t('items');

$output .= '

'. t("%item_count %item_suffix in %your_cart", array("%item_count" => $item_count, "%item_suffix" => $item_suffix, "%your_cart" => l(t("your cart"), "cart/view"))). "

\n";

if (!empty($item)) {
$output .= "

";
foreach ($item as $i) {
$node = node_load(array("nid" => $i->nid));
$total += product_adjust_price($node) * $i->qty;
$output .= l("$i->qty x $node->title", "node/$node->nid"). "

...use Drupal for a social networking site?

I installed Drupal. It looks good for basic blogging/forums, but here's what I really need:

anonymous user access disappeared, used to work fine

Hi,

I seem to be having the same problem. I do have a record in table "users" with a uid=0, and "access content" is checked for anonymous users (and I unchecked and rechecked it).

The problem wasn't happening before, but suddenly began when I tried to configure an "account rule" under "access control" (I was trying to restrict access to some pages, before I found the taxonomy_access module). It didn't do what I wanted it to, so I deleted the account rule. Now there are no account rules, but since then whenever I log out I cannot see any content.

Quoting from other posts?

So... running around the Drupal forum for a while, I notice people are quote other people's posts quite easily. Case in point: http://drupal.org/node/32356#comment-56505

Wiki - possible to align images?

Hi everyone

I've just added the Wiki module to a site, it looks good.
It does not seem possible to set the alignment for an image when inserted using the Wiki command [imagepath.ext].
Is this possible?

Thanks

Darren

How do I use drupal_goto()

Hi everyone,

I'm very new to Drupal and PHP and I'm trying to put together a custom user profile page, similar to the one in this thread, but I'm having problems. I need to send a couple of variables in the url of a page that displays a user's Amazon wishlist (if they have one). The code so far in my user_profile.tpl.php looks like this:


<?php  if ($user->picture): ?>
<img src="/ <?php print $user->picture ?>">
<?php endif; ?>
<div class="fields"><b>Name: </b><?php print $user->profile_name ?></div>
<div class="fields"><b>Date of birth: </b><?php print $user->profile_dob ?></div>
<div class="fields"><b>Interests: </b><?php print $user->profile_interests ?></div>
<div class="fields"><b>
<?php  if ($user->profile_amazon_wishlist_id): ?>
<a href="/node/8?wishListID=<?php print $user->profile_amazon_wishlist_id ?>&page=1">My Amazon wishlist</a>
<?php endif; ?>
</b></div>

and node/8 contains the code:


$wishListID = $_GET['wishListID'];

$page = $_GET['page'];

This seems to work OK - I can visit node/8 and other pages it generates, and every other page on my site. However, when I try to log out I get a blank page with the warning,


warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/winkleweb.org/httpdocs/themes/bluemarine/template.php:11) in /home/httpd/vhosts/winkleweb.org/httpdocs/includes/common.inc on line 192.

Pages

Subscribe with RSS Subscribe to RSS - Post installation