Beispiel #1
0
 public static function getPriceTotal()
 {
     $price_total = 0;
     $tax_total = 0;
     foreach (Shop::getCartContent() as $product) {
         $model = Products::model()->findByPk($product['product_id']);
         $price_total += $model->getPrice(@$product['Variations'], @$product['amount']);
         $tax_total += $model->getTaxRate(@$product['Variations'], @$product['amount']);
     }
     if ($shipping_method = Shop::getShippingMethod()) {
         $price_total += $shipping_method->price;
     }
     $price_total = Shop::t('Price total: {total}', array('{total}' => Shop::priceFormat($price_total)));
     $price_total .= '<br />';
     $price_total .= Shop::t('All prices are including VAT: {vat}', array('{vat}' => Shop::priceFormat($tax_total))) . '<br />';
     $price_total .= Shop::t('All prices excluding shipping costs') . '<br />';
     return $price_total;
 }
Beispiel #2
0
<div id="shopping-cart">
<div id="shopping-cart-content">
<?php 
if ($products) {
    echo '<h3>' . CHtml::link(Shop::t('Shopping cart'), array('//shop/shoppingCart/view')) . '</h3>';
    echo '<table cellpadding="0" cellspacing="0">';
    foreach ($products as $num => $position) {
        $model = Products::model()->findByPk($position['product_id']);
        printf('<tr>
				<td class="cart-left widget_amount_' . $num . '">%s</td>
				<td class="cart-middle">%s</td>
				<td class="cart-right price_' . $num . '">%s</td></tr>', $position['amount'], $model->title, Shop::priceFormat($position['amount'] * $model->getPrice(@$position['Variations'])));
    }
    if ($shippingMethod = Shop::getShippingMethod()) {
        printf('<tr>
				<td class="cart-left">1</td>
				<td class="cart-middle">%s</td>
				<td class="cart-right">%s</td></tr>', Shop::t('Shipping costs'), Shop::priceFormat($shippingMethod->price));
    }
    printf('<tr>
			<td colspan="3" class="cart-right cart-sum price_total"><strong>%s</strong></td>
			</tr>', Shop::getPriceTotal());
    echo '</table>';
}
?>
</div>
<div id="shopping-cart-footer"></div>
</div>
 public function actionGetShippingCosts()
 {
     echo Shop::getShippingMethod(true);
 }