Hi,
in my cms has this code that creates a table of products on a shopping cart checkout page. How can it be made to apply a class “alt” to every second row it creates? (but not the header row which has class “firstrow”)
So that I can use CSS to color every second row.
I believe this is all the relevant PHP that builds the table. I can post the whole file if needed.
Thanks in advance, Mark
<div id="checkout_page_container">
<h3><?php _e('Please review your order', 'wpsc'); ?></h3>
<table class="productcart">
<tr class="firstrow">
<td class='firstcol'></td>
<td><?php echo __('Product', 'wpsc'); ?>:</td>
<td><?php echo __('Quantity', 'wpsc'); ?>:</td>
<?php if(wpsc_uses_shipping()): ?>
<td><?php echo __('Shipping', 'wpsc'); ?>:</td>
<?php endif; ?>
<td></td>
<td class="price" style="text-align:right;padding-right:10px;"><?php echo __('Price', 'wpsc'); ?>:</td>
</tr>
<?php while (wpsc_have_cart_items()) : wpsc_the_cart_item(); ?>
<?php //this displays the confirm your order html ?>
<tr class="product_row">
<td class="firstcol"><img src='<?php echo wpsc_cart_item_image(48,48); ?>' alt='<?php echo wpsc_cart_item_name(); ?>' title='<?php echo wpsc_cart_item_name(); ?>' /></td>
<td class="firstcol">
<a href='<?php echo wpsc_cart_item_url();?>'><?php echo wpsc_cart_item_name(); ?></a>
</td>
<td>
<form action="<?php echo get_option('shopping_cart_url'); ?>" method="post" class="adjustform">
<input type="text" name="quantity" size="2" value="<?php echo wpsc_cart_item_quantity(); ?>" />
<input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>" />
<input type="hidden" name="wpsc_update_quantity" value="true" />
<input type="submit" value="<?php echo __('Update', 'wpsc'); ?>" name="submit" />
</form>
</td>
<?php if(wpsc_uses_shipping()): ?>
<td><span class="pricedisplay" id='shipping_<?php echo wpsc_the_cart_item_key(); ?>'><?php echo wpsc_cart_item_shipping(); ?></span></td>
<?php endif; ?>
<td>
<form action="<?php echo get_option('shopping_cart_url'); ?>" method="post" class="adjustform">
<input type="hidden" name="quantity" value="0" />
<input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>" />
<input type="hidden" name="wpsc_update_quantity" value="true" />
<button class='remove_button' type="submit"><span><?php echo __('Remove', 'wpsc'); ?></span></button>
</form>
</td>
<td class="price" style="text-align:right;padding-right:10px;">
<span class="pricedisplay"><?php echo wpsc_cart_item_price(); ?></span>
</td>
</tr>
<?php endwhile; ?>