wpsc_the_product_id

Located in: product-template.php
Version Introduced: 3.8

Description: This template tag is used to print the product ID – you would mostly use this as part of a class or id for your product containers.

you can also use this tag to save the product ID into a variable for whatever reason.

Note: This function just returns the value so to use this function you must use it with an echo to output the value to the browser. If you simply want to save it into another variable then no echo is required.

[php] <?php while (wpsc_have_products()) : wpsc_the_product(); ?>[/php]

Code Example:
[php]
<div class="product_grid_item product_view_<?php echo wpsc_the_product_id(); ?>">
[/php]

[php]$product_id = wpsc_the_product_id(); [/php]