WordPress.org

Ready to get started?Download WordPress

Forums

WP eCommerce
You Save Amount on single product (1 post)

  1. jhobbsy89
    Member
    Posted 10 months ago #

    I am having trouble getting the ''you save'' part on the product page to show the % as well as the amount.

    If anyone can help I would be greatful.

    Thanks

    Below is the code on product-template.php:

    function wpsc_the_product_price_display( $args = array() ) {
    if ( empty( $args['id'] ) )
    $id = get_the_ID();
    else
    $id = (int) $args['id'];

    $defaults = array(
    'id' => $id,
    'old_price_text' => __( 'RRP: %s', 'wpsc' ),
    'price_text' => __( 'Our Price: %s', 'wpsc' ),
    /* translators : %1$s is the saved amount text, %2$s is the saved percentage text, %% is the percentage sign */
    'you_save_text' => __( 'You save: %s', 'wpsc' ),
    'old_price_class' => 'pricedisplay wpsc-product-old-price ' . $id,
    'old_price_before' => '<p %s>',
    'old_price_after' => '</p>',
    'old_price_amount_id' => 'old_product_price_' . $id,
    'old_price_amount_class' => 'oldprice',
    'old_price_amount_before' => '<span class="%1$s" id="%2$s">',
    'old_price_amount_after' => '</span>',
    'price_amount_id' => 'product_price_' . $id,
    'price_class' => 'pricedisplay wpsc-product-price ' . $id,
    'price_before' => '<p %s>',
    'price_after' => '</p>',
    'price_amount_class' => 'currentprice pricedisplay ' . $id,
    'price_amount_before' => '<span class="%1$s" id="%2$s">',
    'price_amount_after' => '</span>',
    'you_save_class' => 'pricedisplay wpsc-product-you-save product_' . $id,
    'you_save_before' => '<p %s>',
    'you_save_after' => '</p>',
    'you_save_amount_id' => 'yousave_' . $id,
    'you_save_amount_class' => 'yousave',
    'you_save_amount_before' => '<span class="%1$s" id="%2$s">',
    'you_save_amount_after' => '</span>',
    'output_price' => true,
    'output_old_price' => true,
    'output_you_save' => true,
    );

    $r = wp_parse_args( $args, $defaults );
    extract( $r );

    // if the product has no variations, these amounts are straight forward...
    $old_price = wpsc_product_normal_price( $id );
    $current_price = wpsc_the_product_price( false, false, $id );
    $you_save = wpsc_you_save( 'type=amount' ) . '! (' . wpsc_you_save() . '%)';
    $you_save_percentage = wpsc_you_save();

    http://wordpress.org/plugins/wp-e-commerce/

Reply

You must log in to post.

About this Plugin

About this Topic