コード例 #1
0
$gift_voucher = $vm->persistSessionVoucher();
// Add stocks to cart manager
$cm->addToCart($stock1, 2);
$cm->addToCart($stock2, 2);
$cm->addToCart($stock3, 2);
$cm->addToCart($stock4, 2);
$cm->addToCart($stock5, 2);
$cm->addToCart($stock6, 2);
$cm->addToCart($stock7, 2);
// Add addresses to order
$tools->addAddressForOrder($cm->getOrder()->getId());
$tools->addAddressForOrder($cm->getOrder()->getId(), 'shipping');
// Loop through stocks in order
$t->comment('');
$t->comment('*****************************************************************************');
$stock_info = $cm->getStockInfoArray();
$i = 0;
$compare_charge = array(40, 30, 36, 36, 27, 30, 36, 50);
foreach ($stock_info as $stock) {
    $prod_promo = Doctrine::getTable('rtShopPromotionProduct')->find($stock['rtShopPromotionProduct']['id']);
    $rt_shop_stock = Doctrine::getTable('rtShopStock')->find($stock['id']);
    $charge = $stock['price_promotion'] > 0 ? $stock['price_promotion'] : $stock['price_retail'];
    $message = $stock['rtShopProduct']['title'];
    $message .= " || PR: " . format_currency($stock['price_retail'], sfConfig::get('app_rt_currency', 'USD'));
    if ($stock['sku'] !== 'VOUCHER') {
        $message .= " || PP: " . format_currency($rt_shop_stock->getPricePromotion(), sfConfig::get('app_rt_currency', 'USD'));
    }
    $message .= " || QTY: " . $stock['rtShopOrderToStock'][0]['quantity'];
    $message .= " || Charge: " . format_currency($charge, sfConfig::get('app_rt_currency', 'USD'));
    // Show promotion details where applicable
    if ($prod_promo) {
コード例 #2
0
$vm->setSessionVoucherArray($welcome_voucher);
$gift_voucher = $vm->persistSessionVoucher();
// Add stocks to cart manager
$cm->addToCart($stock1, 2);
$cm->addToCart($stock2, 2);
$cm->addToCart($stock3, 2);
// Add addresses to order
$tools->addAddressForOrder($cm->getOrder()->getId());
$tools->addAddressForOrder($cm->getOrder()->getId(), 'shipping');
// Loop through stocks in order
$t->diag('');
$t->diag('');
$t->diag('-----------------------------------------------------------------------------------------------------------------------------');
$t->diag('Case 6');
$t->comment('*****************************************************************************');
$tools->displayOrderItems($t, $cm->getStockInfoArray(), array(40, 30, 36, 50), $gift_voucher);
$t->comment('*****************************************************************************');
// ItemsCharge
$t->is($cm->getItemsCharge(), 262, 'ItemsCharge: ' . format_currency($cm->getItemsCharge(), sfConfig::get('app_rt_currency', 'USD')));
// SubTotal
$t->is($cm->getSubTotal(), 262, 'SubTotal:    ' . format_currency($cm->getSubTotal(), sfConfig::get('app_rt_currency', 'USD')));
$t->comment('-----------------------------------------------------------------------------');
// Tax
$t->is($cm->getTaxCharge(), 21.2, 'Tax:          ' . format_currency($cm->getTaxCharge(), sfConfig::get('app_rt_currency', 'USD')));
// Promotion
$t->is($cm->getPromotionReduction(), 42.4, 'Promotion:   -' . format_currency($cm->getPromotionReduction(), sfConfig::get('app_rt_currency', 'USD')));
// Shipping
$t->is($cm->getShippingCharge(), 10, 'Shipping:     ' . format_currency($cm->getShippingCharge(), sfConfig::get('app_rt_currency', 'USD')));
$t->comment('-----------------------------------------------------------------------------');
// Pre total
$t->is($cm->getPreTotalCharge(), 250.8, 'PreTotal:    ' . format_currency($cm->getPreTotalCharge(), sfConfig::get('app_rt_currency', 'USD')));