function vtwpr_show_product_you_save($product_id = null) { global $post, $vtwpr_setup_options, $vtwpr_info; //can only be executed when WPEC version less than 3.8.9 if (!(version_compare(strval('3.8.9'), strval(WPSC_VERSION), '>') == 1)) { //'==1' = 2nd value is lower return; } $pct = vtwpr_get_single_product_you_save_pct($product_id); $amt = $vtwpr_info['product_session_info']['product_yousave_total_amt']; $amt = vtwpr_format_money_element($amt); //CUSTOM function created by CUSTOMER if (function_exists('custom_show_single_product_you_save')) { custom_show_single_product_you_save($product_id, $pct, $amt); return; } if ($pct) { ?> <p class="pricedisplay product_<?php echo wpsc_the_product_id(); ?> "><?php _e('You save', 'wpsc'); ?> : <span class="yousave" id="yousave_<?php echo wpsc_the_product_id(); ?> "><?php echo $amt; ?> ! (<?php echo $pct; ?> %)</span></p> <?php } else { //original code from wpsc-single_product.php ?> <?php if (wpsc_product_on_special()) { ?> <p class="pricedisplay product_<?php echo wpsc_the_product_id(); ?> "><?php _e('You save', 'wpsc'); ?> : <span class="yousave" id="yousave_<?php echo wpsc_the_product_id(); ?> "><?php echo wpsc_currency_display(wpsc_you_save('type=amount'), array('html' => false)); ?> ! (<?php echo wpsc_you_save(); ?> %)</span></p> <?php } ?> <?php } return; }
function vtwpr_checkout_discount_detail_line($amt, $units, $msgType, $k) { global $vtwpr_cart, $vtwpr_cart_item, $vtwpr_info, $vtwpr_rules_set, $vtwpr_rule, $vtwpr_setup_options; $output; $amt = vtwpr_format_money_element($amt); //mwn $output .= '<tr class = "order_table_item">'; if (sizeof($vtwpr_cart->cart_items[$k]->variation_array) > 0) { $output .= '<td class="product-name vtwpr-product-name" ><span class="vtwpr-product-name-span">' . $vtwpr_cart->cart_items[$k]->parent_product_name . '</span>'; $output .= '<dl class="variation">'; foreach ($vtwpr_cart->cart_items[$k]->variation_array as $key => $value) { $name = sanitize_title(str_replace('attribute_pa_', '', $key)); //post v 2.1 $name = sanitize_title(str_replace('pa_', '', $name)); //pre v 2.1 $name = ucwords($name); $output .= '<dt>' . $name . ': </dt>'; $output .= '<dd>' . $value . '</dd>'; } $output .= '</dl>'; $output .= '</td>'; //$output .= '<strong class="product-quantity"> × ' . $units .'</strong>'; } else { $output .= '<td class="product-name" >' . $vtwpr_cart->cart_items[$k]->product_name; // $output .= '<strong class="product-quantity"> × ' . $units .'</strong>'; $output .= '</td>'; } $output .= '<td class="product-quantity" style="text-align:middle;">' . $units . '</td>'; $output .= '<td class="product-total">'; $output .= '<span class="amount">' . $vtwpr_setup_options['checkout_credit_detail_label'] . $amt . '</span>'; $output .= '</td>'; $output .= '</tr>'; return $output; }
public function vtwpr_show_discount_amt() { global $vtwpr_rule; $output; switch ($vtwpr_rule->rule_deal_info[0]['discount_applies_to']) { case 'each': $output .= '<span class="words-line"> -'; $output .= __('each product ', 'vtwpr'); break; case 'all': if ($vtwpr_rule->rule_template != 'C-forThePriceOf-inCart') { //Don't show for "Buy 5, get them for the price of 4/$400" $output .= '<span class="words-line"> -'; $output .= __('all products', 'vtwpr'); } break; case 'cheapest': $output .= '<span class="words-line"> -'; $output .= __('cheapest product in the group ', 'vtwpr'); break; case 'most_expensive': $output .= '<span class="words-line"> -'; $output .= __('most expensive product in the group ', 'vtwpr'); break; default: break; /* default: $output .= __(' discount_applies_to= ', 'vtwpr'); $output .= $vtwpr_rule->rule_deal_info[0]['discount_applies_to']; $output .= __('end ', 'vtwpr'); break; */ } $output .= '</span><!-- 018b --><span class="words-line"><span class="words-line-get">'; $output .= __('* For ', 'vtwpr') . '</span><!-- 018c -->'; switch ($vtwpr_rule->rule_deal_info[0]['discount_amt_type']) { case 'percent': $output .= $vtwpr_rule->rule_deal_info[0]['discount_amt_count'] . __('% off', 'vtwpr'); break; case 'currency': $amt = vtwpr_format_money_element($vtwpr_rule->rule_deal_info[0]['discount_amt_count']); $output .= $amt . __(' off', 'vtwpr'); break; case 'fixedPrice': $amt = vtwpr_format_money_element($vtwpr_rule->rule_deal_info[0]['discount_amt_count']); $output .= $amt; break; case 'free': $output .= __('Free', 'vtwpr'); break; case 'forThePriceOf_Units': case 'forThePriceOf_Currency': $output .= __('the Group Price of $', 'vtwpr'); $output .= $vtwpr_rule->rule_deal_info[0]['discount_amt_count']; break; } switch ($vtwpr_rule->rule_template) { case 'D-storeWideSale': case 'D-simpleDiscount': $output .= '<br> -'; $output .= __(' when catalog displays.', 'vtwpr') . '</span><!-- 019 -->'; //'</span><!-- 019 --> </span><!-- 019a -->'; break; default: $output .= '<br> -'; $output .= __(' when added to cart.', 'vtwpr') . '</span><!-- 020 -->'; //'</span><!-- 020 --> </span><!-- 020a -->'; break; } return $output; }