示例#1
0
 public static function Display($intPromoCodeTypeId, $intAmount)
 {
     switch ($intPromoCodeTypeId) {
         case 0:
             return _xls_currency($intAmount);
         case 1:
             return sprintf('%s%s', $intAmount, '%');
         default:
             throw new QCallerException(sprintf(_sp('Invalid intPromoCodeTypeId') . ': %s', $intPromoCodeTypeId));
     }
 }
示例#2
0
 /**
  * Get the selected cart scenario from the session.
  * If there's no selected cart scenario, formatted the shopping cart in the same way.
  * TODO: Create a CartScenario.php component and change this function to
  * CartScenario::formatFromShoppingCart().
  * @return CartScenario @see Shipping::getCartScenarios.
  */
 public static function getSelectedCartScenarioFromSessionOrShoppingCart()
 {
     $selectedCartScenario = static::getSelectedCartScenarioFromSession();
     if ($selectedCartScenario !== null) {
         return $selectedCartScenario;
     }
     // Return a version of the shopping cart formatted like a cart scenario.
     $sc = Yii::app()->shoppingcart;
     return array('formattedCartSubtotal' => _xls_currency($sc->subtotal), 'formattedCartTax' => $sc->taxTotalFormatted, 'formattedCartTax1' => $sc->formattedCartTax1, 'formattedCartTax2' => $sc->formattedCartTax2, 'formattedCartTax3' => $sc->formattedCartTax3, 'formattedCartTax4' => $sc->formattedCartTax4, 'formattedCartTax5' => $sc->formattedCartTax5, 'formattedCartTotal' => $sc->totalFormatted, 'cartTax1' => $sc->tax1, 'cartTax2' => $sc->tax2, 'cartTax3' => $sc->tax3, 'cartTax4' => $sc->tax4, 'cartTax5' => $sc->tax5, 'formattedShippingPrice' => $sc->formattedShippingCharge, 'module' => null, 'priorityIndex' => null, 'priorityLabel' => null, 'providerId' => null, 'providerLabel' => null, 'shippingLabel' => null, 'shippingPrice' => null, 'shippingPriceWithTax' => null, 'shippingProduct' => null, 'shoppingCart' => null, 'sortOrder' => null);
 }
示例#3
0
						<?php 
$this->renderPartial('/cart/_carttaxes', array('model' => $model));
?>
					</table>
				</td>
			</tr>


			<tr>
				<td colspan="3"></td>
				<td class="visible1-mobile"><?php 
echo Yii::t('cart', "Total");
?>
</td>
				<td class="hidden1-mobile"><?php 
echo Yii::t('cart', "Total");
?>
</td>
				<td class="cart_price"><span id="cartTotal"><?php 
echo _xls_currency($model->total);
?>
</span></td>
			</tr>
			</tbody>
		</table>
	</div>
</div>



?>
</td>
							</tr>
							<?php 
$this->widget('ext.wsshippingestimator.WsShippingEstimator', array('updateShippingOptions' => true));
?>
						</tbody>
						<tfoot>
							<tr>
								<th colspan="2"><?php 
echo Yii::t('cart', 'Total');
?>
</th>
								<td id="addtocart-subtotal" class="wsshippingestimator-total-estimate total-estimate money">
									<?php 
echo _xls_currency($this->objCart->total);
?>
								</td>
							</tr>
						</tfoot>
					</table>
				</div>
				<form class="webstore-promo-form promo">
					<?php 
echo CHtml::tag('div', array('id' => CHtml::activeId($this->objCart, 'promoCode') . '_em_', 'class' => 'form-error', 'style' => 'display: none'), '<p>&nbsp;</p>');
?>
					<div style="position:relative;">
						<?php 
$this->controller->renderPartial('ext.wscartmodal.views._promocodeinput', array('modelId' => $this->objCart, 'updateCartTotals' => false, 'reloadPageOnSuccess' => false));
?>
					</div>
示例#5
0
		</div>

		<?php 
if (empty(Yii::app()->shoppingcart)) {
    ?>
			<div id="cartempty">
				<div class="emptymessage"><?php 
    echo Yii::t('cart', 'Your cart is empty');
    ?>
</div>
			</div>
		<?php 
}
?>


	</div>

	<div id="shoppingcartbottom">
		<div class="cart_label span7"><span class="subtotallabel"><?php 
echo Yii::t('cart', 'SubTotal');
?>
</span></div>
		<div class="cart_price span5"><span id="subtotal"><?php 
echo _xls_currency(Yii::app()->shoppingcart->subtotal);
?>
</span>&nbsp;&nbsp;</div>
	</div>

</div>
示例#6
0
<?php

if ($model->TaxTotal && Yii::app()->params['TAX_INCLUSIVE_PRICING'] == '0') {
    ?>
	<?php 
    foreach ($model->Taxes as $tax => $taxvalue) {
        ?>
		<?php 
        if ($taxvalue) {
            ?>
			<tr>
				<td class="visible1-mobile tax-mobile"><span class="cart_label"><?php 
            echo $tax;
            ?>
</span></td>
				<td class="hidden1-mobile"><span class="cart_label"><?php 
            echo $tax;
            ?>
</span></td>
				<td class="cart_price"><?php 
            echo _xls_currency($taxvalue);
            ?>
</span></td>
			</tr>
		<?php 
        }
        ?>
	<?php 
    }
}
							<td align="right" style="color:#666666;font-family:'Lucida Grande','Lucida Sans', Verdana, sans-serif;font-size: 12px;line-height:30px;">
								<?php 
echo _xls_currency($cart->shippingCharge);
?>
							</td>
						</tr>
						<tr>
							<td align="right" class="total-headers" style="color:#111111;font-family:'Lucida Grande','Lucida Sans', Verdana, sans-serif;font-size: 12px;line-height:30px;padding-right:61px;">
								<b><?php 
echo Yii::t('email', 'Total');
?>
</b>
							</td>
							<td align="right" style="color:#111111;font-family:'Lucida Grande','Lucida Sans', Verdana, sans-serif;font-size: 13px;line-height:30px;">
								<b><?php 
echo _xls_currency($cart->total);
?>
</b>
							</td>
						</tr>
						</tbody>
					</table>
				</td>
			</tr>
			<tr>
				<td bgcolor="#f8f8f8" style="padding:15px 15px 15px 15px;color:#111111;font-family:'Lucida Grande',
													 'Lucida Sans', Verdana, sans-serif;font-size: 12px;line-height:1.5em; border: 1px solid #dddddd;">
					<?php 
echo Yii::t('email', 'This email is a confirmation for the order. To view details or track your order, click on the visit link:');
?>
<br/>
示例#8
0
			    <?php 
    echo $item->discount ? sprintf("<strike>%s</strike> ", _xls_currency($item->sell_base)) . _xls_currency($item->sell_discount) : _xls_currency($item->sell);
    ?>
		    </div>

		    <div class="col-sm-1 centeritem cartdecor">x</div>

		    <div class="col-sm-1 centeritem"><span class="cart_qty"><?php 
    if (isset($this->intEditMode) && $this->intEditMode) {
        echo CHtml::textField(CHtml::activeId($item, 'qty') . "_" . $item->id, $item->qty, array('class' => 'cart_qty_box'));
    } else {
        echo $item->qty;
    }
    ?>
</span></div>

		    <div class="col-sm-1 centeritem cartdecor">=</div>

		    <div class="col-sm-2 cart_price"><?php 
    echo _xls_currency($item->sell_total);
    ?>
</div>

		</div>

	<?php 
}
?>

</div>
 /**
  * Test to see if Promo Code is valid, used by Model validation. Note this doesn't mean that all products will use it,
  * just that at least item in the cart (or free shipping) will accept the code. If this function returns true,
  * we still have to Apply the code to the cart which will determine which items actually get the discount.
  * @param $attribute
  * @param $param
  */
 public function validatePromocode($attribute, $param)
 {
     $strCode = $this->{$attribute};
     if ($strCode == '') {
         return;
     }
     $objPromoCode = PromoCode::LoadByCode($strCode);
     if (!$objPromoCode) {
         $this->addError($attribute, Yii::t('global', 'Promo Code is invalid.'));
         return;
     }
     if (!$objPromoCode->enabled) {
         $this->addError($attribute, Yii::t('global', 'Promo Code is invalid'));
         return;
     }
     $strLabel = Yii::t('global', 'Promo Code');
     if ($objPromoCode->Shipping) {
         $strLabel = Yii::t('global', 'Free Shipping');
     }
     //If start date is defined, have we reached it yet
     if (!$objPromoCode->Started) {
         $this->addError($attribute, Yii::t('global', '{label} is not active yet.', array('{label}' => $strLabel)));
         return;
     }
     //If end date is defined or remaining uses
     if ($objPromoCode->Expired || !$objPromoCode->HasRemaining) {
         $this->addError($attribute, Yii::t('global', '{label} has expired or has been used up.', array('{label}' => $strLabel)));
         return;
     }
     //Minimum price threshold
     if (!is_null($objPromoCode->threshold)) {
         if ($objPromoCode->Threshold > Yii::app()->shoppingcart->originalSubTotal) {
             $this->addError($attribute, Yii::t('global', '{label} only valid when your purchases total at least {amount}.', array('{label}' => $strLabel, '{amount}' => _xls_currency($objPromoCode->threshold))));
             return;
         }
     }
     //If this is for shipping, we need to make sure all items in the cart qualify
     if ($objPromoCode->Shipping) {
         //Test our two extremes -- all items or no items. The IsProductAffected() takes care of the reverse logic for No Items
         if ($objPromoCode->exception == PromoCode::QUALIFY_ALL_ITEMS || $objPromoCode == PromoCode::QUALIFY_NO_ITEMS) {
             $bolApplied = true;
             //We start with true because we want to make sure we don't have a disqualifying item in our cart
             foreach (Yii::app()->shoppingcart->cartItems as $objItem) {
                 if (!$objPromoCode->IsProductAffected($objItem)) {
                     $bolApplied = false;
                 }
             }
         }
         //Test for just one qualifying item
         if ($objPromoCode->exception == PromoCode::QUALIFY_MIN_ONE_ITEM) {
             $bolApplied = false;
             foreach (Yii::app()->shoppingcart->cartItems as $objItem) {
                 if ($objPromoCode->IsProductAffected($objItem)) {
                     $bolApplied = true;
                 }
             }
         }
         if ($bolApplied == false) {
             $this->addError($attribute, Yii::t('yii', 'We are sorry, but one or more of the items in your cart cannot be used with {label}.', array('{label}' => $strLabel)));
             return;
         }
     } else {
         //else for regular promo codes, see if any items in the cart match qualify for this promo code
         $bolApplied = false;
         foreach (Yii::app()->shoppingcart->cartItems as $objItem) {
             if ($objPromoCode->IsProductAffected($objItem)) {
                 $bolApplied = true;
             }
         }
         //If we have reached this point and $bolApplied is still false, none of our items qualify
         if (!$bolApplied) {
             $this->addError($attribute, Yii::t('yii', 'We are sorry, but one or more of the items in your cart cannot be used with {label}.', array('{label}' => $strLabel)));
             return;
         }
     }
 }
示例#10
0
echo $cartDisplay->shipping->shipping_data;
?>
							</small>
						</th>
						<td class="shipping-estimate">
							<?php 
echo _xls_currency($cartDisplay->shippingCharge);
?>
						</td>
					</tr>
					<?php 
$this->renderPartial('_checkout-taxes', array('cart' => $cartDisplay, 'selectedCartScenario' => null, 'confirmation' => true));
?>
					<tr class="total">
						<th colspan='3'>
							<?php 
echo Yii::t('cart', 'Total');
?>
						</th>
						<td id="totalCart" class="wsshippingestimator-total-estimate total-estimate">
							<?php 
echo _xls_currency($cartDisplay->total);
?>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
</article>
示例#11
0
<div id="shoppingcartbottom">


	<div class="cart_label">
        <?php 
echo CHtml::link(Yii::t('checkout', '{n} item in cart|{n} items in cart', Yii::app()->shoppingcart->cartQty), array('cart/index'));
?>
	</div>

	<div style="clear: both;"></div>

	<div class="cart_price">
		<?php 
echo CHtml::link(Yii::t('checkout', '{subtotal}', array('{subtotal}' => _xls_currency(Yii::app()->shoppingcart->subtotal))), array('cart/index'));
?>
	</div>


	<div class="carticon">&nbsp;</div>



</div>
示例#12
0
 /**
  * Format the totalDiscount string by adding the relevant
  * currency to it.
  * @return string
  */
 public function getTotalDiscountFormatted()
 {
     return _xls_currency($this->totalDiscount);
 }
示例#13
0
        ?>
</span>
						<span class="desktop-hide"><?php 
        echo date('m.d.y', strtotime($objCart->datetime_cre));
        ?>
</span>
					</td>
					<td class="n-items mobile-hide">
						<?php 
        $totalItemCount = $objCart->getTotalItemCount();
        echo Yii::t('profile', '{items} item|{items} items', array($totalItemCount, '{items}' => $totalItemCount));
        ?>
					</td>
					<td class="subtotal">
						<?php 
        echo _xls_currency($objCart->total);
        ?>
					</td>
				</tr>
			<?php 
    }
    ?>
		<?php 
} else {
    ?>
			<h5><?php 
    echo Yii::t('profile', 'You have no orders in your history');
    ?>
</h5>
		<?php 
}
示例#14
0
 /**
  * When a product's sell_web price is lower than its sell price,
  * we display a strikethrough on the original price. If a web price
  * is not set, sell_web is set to sell. This function will return the
  * original sell price formatted by the currency.
  *
  * @param int $intQuantity
  * @return null|string
  */
 public function getSlashedPrice($intQuantity = 1)
 {
     if (CPropertyValue::ensureInteger(Yii::app()->params['ENABLE_SLASHED_PRICES']) > 0) {
         return _xls_currency($this->getSlashedPriceValue($intQuantity));
     }
     return null;
 }
示例#15
0
 /**
  * @param string $strName
  * @return int|mixed
  */
 public function __get($strName)
 {
     switch ($strName) {
         case 'attributes':
             return $this->model->attributes;
         case 'CartItems':
         case 'cartItems':
             return $this->model->cartItems;
         case 'Link':
             return $this->model->Link;
         case 'ItemCount':
         case 'itemCount':
             return count($this->model->cartItems);
         case 'TotalItemCount':
         case 'totalItemCount':
             return $this->model->TotalItemCount;
         case 'tax1name':
         case 'tax1Name':
             return $this->model->tax1Name;
         case 'formattedCartTax1':
             return _xls_currency($this->model->tax1);
         case 'tax2name':
         case 'tax2Name':
             return $this->model->tax2Name;
         case 'formattedCartTax2':
             return _xls_currency($this->model->tax2);
         case 'tax3name':
         case 'tax3Name':
             return $this->model->tax3Name;
         case 'formattedCartTax3':
             return _xls_currency($this->model->tax3);
         case 'tax4name':
         case 'tax4Name':
             return $this->model->tax4Name;
         case 'formattedCartTax4':
             return _xls_currency($this->model->tax4);
         case 'tax5name':
         case 'tax5Name':
             return $this->model->tax5Name;
         case 'formattedCartTax5':
             return _xls_currency($this->model->tax5);
         case 'tax_total':
         case 'TaxTotal':
             return $this->model->TaxTotal;
         case 'taxTotalFormatted':
             return _xls_currency($this->model->TaxTotal);
         case 'subtotal':
             if (empty($this->model->subtotal)) {
                 return 0;
             }
             return $this->model->subtotal;
         case 'subtotalFormatted':
             if (empty($this->model->subtotal)) {
                 return '';
             }
             return _xls_currency($this->model->subtotal);
         case 'Taxes':
             return $this->model->Taxes;
         case 'Total':
             return $this->total;
         case 'TotalFormatted':
         case 'totalFormatted':
             return _xls_currency($this->total);
         case 'TotalDiscount':
         case 'totalDiscount':
             return $this->model->totalDiscount;
         case 'TotalDiscountFormatted':
         case 'totalDiscountFormatted':
             return $this->model->totalDiscountFormatted;
         case 'Length':
             return $this->model->Length;
         case 'Height':
             return $this->model->Height;
         case 'Width':
             return $this->model->Width;
         case 'Weight':
             return $this->model->Weight;
         case 'Pending':
             return $this->model->Pending;
         case 'HasShippableGift':
             return $this->model->HasShippableGift;
         case 'GiftAddress':
             return $this->model->GiftAddress;
         case 'shipping_sell':
             if ($this->model->shipping) {
                 return $this->model->shipping->shipping_sell;
             }
             return 0;
         case 'formattedShippingCharge':
             if ($this->model && $this->model->shipping) {
                 return _xls_currency($this->model->shippingCharge);
             }
             return _xls_currency(0);
         case 'shippingCharge':
             return $this->model->shippingCharge;
         case 'customer':
             if ($this->model->customer) {
                 return $this->model->customer;
             }
             return null;
         case 'payment':
             if ($this->model->payment) {
                 return $this->model->payment;
             }
             return null;
         case 'shipping':
             if ($this->model->shipping) {
                 return $this->model->shipping;
             }
             return null;
         case 'billaddress':
             if ($this->model->billaddress) {
                 return $this->model->billaddress;
             }
             return null;
         case 'shipaddress':
             if ($this->model->shipaddress) {
                 return $this->model->shipaddress;
             }
             return null;
         case 'originalSubTotal':
             return self::calculateOriginalSubtotal();
         default:
             // As a clever trick to get to our model through the component.
             if (isset($this->model) && $strName != "model" && $this->model->hasAttribute($strName)) {
                 return $this->model->{$strName};
             }
             return parent::__get($strName);
     }
 }
示例#16
0
 public function getSellOriginalTotalFormatted()
 {
     return _xls_currency($this->sellOriginalTotal);
 }
示例#17
0
<?php

// TODO: Make sure all the views call this partial use Shipping::getSelectedCartScenarioFromSessionOrShoppingCart()
// so we can remove this if/else
if ($selectedCartScenario === null) {
    $estimatedTax1 = _xls_currency($cart->tax1);
    $estimatedTax2 = _xls_currency($cart->tax2);
    $estimatedTax3 = _xls_currency($cart->tax3);
    $estimatedTax4 = _xls_currency($cart->tax4);
    $estimatedTax5 = _xls_currency($cart->tax5);
    $cartTax1 = $cart->tax1;
    $cartTax2 = $cart->tax2;
    $cartTax3 = $cart->tax3;
    $cartTax4 = $cart->tax4;
    $cartTax5 = $cart->tax5;
} else {
    $estimatedTax1 = $selectedCartScenario['formattedCartTax1'];
    $estimatedTax2 = $selectedCartScenario['formattedCartTax2'];
    $estimatedTax3 = $selectedCartScenario['formattedCartTax3'];
    $estimatedTax4 = $selectedCartScenario['formattedCartTax4'];
    $estimatedTax5 = $selectedCartScenario['formattedCartTax5'];
    $cartTax1 = $selectedCartScenario['cartTax1'];
    $cartTax2 = $selectedCartScenario['cartTax2'];
    $cartTax3 = $selectedCartScenario['cartTax3'];
    $cartTax4 = $selectedCartScenario['cartTax4'];
    $cartTax5 = $selectedCartScenario['cartTax5'];
}
if ($cart->tax_total > 0) {
    if ($cartTax1 > 0) {
        echo CHtml::tag('tr', array(), CHtml::tag('th', $confirmation ? array('colspan' => 3) : array(), $cart->tax1Name) . CHtml::tag('td', array('class' => 'tax1-estimate', 'id' => 'cartTax1'), $estimatedTax1));
    }