Este script pertenece a una web tipo tienda online y es el wpsc-single_product.php en el cual muestra las imagenes del producto precio con descuentos si los hay descripcion del producto y el TITULO del producto y este titulo es el que quiero recortar si estuviera entre "corchetes" lo tendria bastante claro pero al estar en php
Código PHP:
<?php echo wpsc_the_product_title(); ?>
no consigo extraer el titulo concretamente es este el script:
Código PHP:
<?php
global $wp_query;
$image_width = get_option( 'single_view_image_width' );
$image_height = get_option( 'single_view_image_height' );
clear('space');
?>
<div class="inner layout-sidebar-no">
<div class="hentry">
<div id="single_product_page_container">
<?php
// Breadcrumbs
wpsc_output_breadcrumbs( array( 'before-breadcrumbs' => '', 'after-breadcrumbs' => '' ) );
// Plugin hook for adding things to the top of the products page, like the live search
do_action( 'wpsc_top_of_products_page' );
?><br /><br />
<div class="single_product_display group productdisplay">
<?php
/**
* Start the product loop here.
* This is single products view, so there should be only one
*/
while ( wpsc_have_products() ) : wpsc_the_product(); ?>
<div class="textcol"> <!-- textcol -->
<div class="imagecol">
<?php if ( wpsc_the_product_thumbnail() ) : ?>
<a rel="<?php echo wpsc_the_product_title(); ?>" class="<?php echo wpsc_the_product_image_link_classes(); ?>" href="<?php echo wpsc_the_product_image(); ?>">
<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_thumbnail(get_option('product_image_width'),get_option('product_image_height'),'','single'); ?>"/>
</a>
<?php
if ( function_exists( 'gold_shpcrt_display_gallery' ) )
echo gold_shpcrt_display_gallery( wpsc_the_product_id() );
?>
<?php else: ?>
<a href="<?php echo wpsc_the_product_permalink(); ?>">
<img class="no-image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="No Image" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo get_bloginfo('template_url') . '/images/no_image.jpg'; ?>" width="<?php echo get_option('product_image_width'); ?>" height="<?php echo get_option('product_image_height'); ?>" />
</a>
<?php endif; ?>
<?php if( wpsc_product_on_special() ) echo ' <div class="sale-icon-big">Sale!</div>'; ?>
</div><!--close imagecol-->
<div class="producttext productcol">
<h2 class="prodtitles no-cufon">
<?php echo wpsc_the_product_title(); ?><br /><br />
<?php /*
function cut_string($string, $charlimit)
{
if(substr($string,$charlimit-1,1) != ' ')
{
$string = substr($string,'0',$charlimit);
$array = explode(' ',$string);
array_pop($array);
$new_string = implode(' ',$array);
return $new_string.' ...';
}
else
{
return substr($string,'0',$charlimit-1).' ...';
}
}
//adaptarlo aqui pero no me sale
$cadena = wpsc_the_product_title();
//para que aparezca aqui
echo cut_string($cadena, 5);
*/?>
<?php if (wpsc_have_custom_meta()) : ?>
<div class="rating"><!-- linea -->
<div class="custom_meta">
<?php while ( wpsc_have_custom_meta() ) : wpsc_the_custom_meta(); ?>
<p><strong><?php echo wpsc_custom_meta_name(); ?>: </strong><?php echo wpsc_custom_meta_value(); ?></p>
<?php endwhile; ?>
</div><!--close custom_meta-->
</div>
<?php endif; ?>
<!-- <?php echo str_replace('>' . __( 'Edit', 'wpsc' ) . '<', '><img src="' . get_template_directory_uri() . '/images/icons/pencil16.png" alt="' . __( 'Edit', 'wpsc' ) . '" /><', wpsc_edit_the_product_link()); ?>-->
</h2>
<?php do_action('wpsc_product_before_description', wpsc_the_product_id(), $wp_query->post); ?>
<!-- <div class="rating">-->
<div class="product_description">
<?php echo do_shortcode( wpsc_the_product_description() ); ?>
</div><!--close product_description -->
<!-- </div>-->
<?php do_action( 'wpsc_product_addons', wpsc_the_product_id() ); ?>
<?php if ( wpsc_the_product_additional_description() ) : ?>
<div class="single_additional_description">
<p><?php echo do_shortcode( wpsc_the_product_additional_description() ); ?></p>
</div><!--close single_additional_description-->
<?php endif; ?>
<?php do_action( 'wpsc_product_addon_after_descr', wpsc_the_product_id() ); ?>
<?php
/**
* Custom meta HTML and loop
*/
?>
<?php if(wpsc_show_stock_availability()): ?>
<?php if(wpsc_product_has_stock()) : ?>
<div id="stock_display_<?php echo wpsc_the_product_id(); ?>" class="in_stock"><?php _e('Producto en stock', TEXTDOMAIN); ?></div>
<?php else: ?>
<div id="stock_display_<?php echo wpsc_the_product_id(); ?>" class="out_of_stock"><?php _e('Producto no disponible', TEXTDOMAIN); ?></div>
<?php endif; ?>
<?php endif; ?>
<?php if(wpsc_product_rater()): ?>
<div class="rating">
<?php
$old_star = site_url() . '/wp-content/plugins/wp-e-commerce/wpsc-core/images/';
$new_star = get_template_directory_uri() . '/wpsc-images/';
$rater = str_replace( $old_star . 'grey-star.gif', $new_star . 'grey-star.gif', wpsc_product_rater() );
$rater = str_replace( $old_star . 'gold-star.gif', $new_star . 'gold-star.gif', $rater );
echo $rater; clear();
?>
</div>
<?php endif; ?>
<div class="price-text">
<?php if(wpsc_product_is_donation()) : ?>
<label for="donation_price_<?php echo wpsc_the_product_id(); ?>"><?php _e('Donacion', TEXTDOMAIN); ?>: </label>
<input type="text" id="donation_price_<?php echo wpsc_the_product_id(); ?>" name="donation_price" value="<?php echo wpsc_calculate_price(wpsc_the_product_id()); ?>" size="6" />
<?php else : ?>
<h2 class="prodtitles no-cufon"><?php _e( 'Precio', TEXTDOMAIN ) ?></h2>
<div class="price">
<?php if( wpsc_product_on_special() ) : ?>
<span class="oldprice" id="old_product_price_<?php echo wpsc_the_product_id(); ?>"><?php echo wpsc_product_normal_price(); ?></span>
<?php endif; ?>
<span class="price-value" id='product_price_<?php echo wpsc_the_product_id(); ?>'><?php echo wpsc_the_product_price(); ?></span>
<?php if(wpsc_product_on_special()) : ?>
<p class="pricedisplay product_<?php echo wpsc_the_product_id(); ?> pricesave"><?php _e('Descuento de ', TEXTDOMAIN); ?> <span class="yousave" id="yousave_<?php echo wpsc_the_product_id(); ?>"> <?php echo wpsc_currency_display(wpsc_you_save('type=amount'), array('html' => false)); ?> un <?php echo wpsc_you_save(); ?> % del Precio total</span></p>
<?php endif; ?>
<?php if( wpsc_product_has_multicurrency() ) : ?>
<span class="textsmall">
<?php echo wpsc_display_product_multicurrency(); ?>
</span>
<?php endif; ?>
<?php if( wpsc_show_pnp() ) : ?><br/>
<span class="pricedisplay wpscsmall">
<?php echo __('Transporte', TEXTDOMAIN); ?>:
<?php echo wpsc_product_postage_and_packaging(); ?>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
<?php clear() ?>
</div><!--close wpsc_product_price-->
<!--sharethis-->
<?php if ( get_option( 'wpsc_share_this' ) == 1 ): ?>
<div class="st_sharethis" displayText="ShareThis"></div>
<?php endif; ?>
<!--end sharethis-->
a ver si hay algun alma caritativa que me entienda lo que quiero
Muchas gracias y Saludos a todos