Exemplo n.º 1
0
            Yii::app()->clientScript->registerScript('amount_' . $position, "\r\n\t\t\t\t\t\$('.amount_" . $position . "').keyup(function() {\r\n\t\t\t\t\t\t\$.ajax({\r\n\t\t\t\t\t\t\turl:'" . $this->createUrl('//shop/shoppingCart/updateAmount') . "',\r\n\t\t\t\t\t\t\tdata: \$('#amount_" . $position . "'),\r\n\t\t\t\t\t\t\tsuccess: function(result) {\r\n\t\t\t\t\t\t\t\$('.amount_" . $position . "').css('background-color', 'lightgreen');\r\n\t\t\t\t\t\t\t\$('.widget_amount_" . $position . "').css('background-color', 'lightgreen');\r\n\t\t\t\t\t\t\t\$('.widget_amount_" . $position . "').html(\$('.amount_" . $position . "').val());\r\n\t\t\t\t\t\t\t\$('.price_" . $position . "').html(result);\t\r\n\t\t\t\t\t\t\t\$('.price_total').load('" . $this->createUrl('//shop/shoppingCart/getPriceTotal') . "');\r\n\t\t\t\t\t\t\t\$('.shipping_costs').load('" . $this->createUrl('//shop/shoppingCart/getShippingCosts') . "');\r\n\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\terror: function() {\r\n\t\t\t\t\t\t\t\$('#amount_" . $position . "').css('background-color', 'red');\r\n\t\t\t\t\t\t\t},\r\n\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t\t\t");
        }
    }
    if ($shippingMethod = Shop::getShippingMethod()) {
        printf('<tr>
				<td></td>
				<td>1</td>
				<td>%s</td>
				<td></td>
				<td class="text-right shipping_costs">%s</td>
				<td class="text-right shipping_costs">%s</td>
				<td>%s</td></tr>', Shop::t('Shipping costs'), Shop::priceFormat($shippingMethod->getPrice()), Shop::priceFormat($shippingMethod->getPrice()), CHtml::link(Shop::t('edit'), array('//shop/shippingMethod/choose')));
    }
    echo '<tr>
<td class="text-right no-border" colspan="6">
<p class="price_total">' . Shop::getPriceTotal() . '</p></td>
<td class="no-border"></td></tr>';
    echo '</table>';
    ?>

<?php 
    if (Yii::app()->controller->id != 'order') {
        echo '<div class="buttons">';
        echo CHtml::link(Shop::t('Buy additional Products'), array('//shop/products'), array('class' => 'btn-previous'));
        echo CHtml::link(Shop::t('Buy this products'), array('//shop/order/create'), array('class' => 'btn-next'));
        echo '</div>';
    }
    ?>
<div class="clear"></div>

<?php 
Exemplo n.º 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 actionGetPriceTotal()
 {
     echo Shop::getPriceTotal();
 }