예제 #1
0
 public function actionIndex()
 {
     $this->htmlOption = array('class' => 'icon-head head-products', 'header' => "货运设置", 'button' => array(array('class' => 'scalable save', 'id' => 'form-save', 'header' => '保存')));
     $carrier = $this->loadModel();
     if ($_POST['SHIPPING']) {
         configuration::updateItems($_POST['SHIPPING']);
     }
     if ($_POST['feeAdd']) {
         foreach ($_POST['feeAdd'] as $key => $row) {
             if ($row != 0) {
                 $arr = explode('-', $key);
                 $delivery = new delivery();
                 $delivery->carrier_ID = $_POST['carrier_ID'];
                 $delivery->zone_ID = $arr[0];
                 $delivery->weight_range_ID = $arr[1];
                 $delivery->price = $row;
                 $delivery->save();
             }
         }
     }
     if ($_POST['feeUpdate']) {
         foreach ($_POST['feeUpdate'] as $key => $row) {
             $delivery = delivery::model()->findByPk($key);
             if ($row != 0 && $row != $delivery->price) {
                 $delivery->price = $row;
                 $delivery->save();
             } else {
                 if ($row == 0) {
                     $delivery->delete();
                 }
             }
         }
     }
     $config = configuration::item('SHIPPING', 'SHIPPING_FREE_PRICE');
     $this->constructScript('index');
     $this->render('index', array('config' => $config, 'carrier' => $carrier));
 }
예제 #2
0
파일: cart.php 프로젝트: htom78/XZB2c
 public function isFreeshipping()
 {
     $freeshippingPrice = configuration::item('SHIPPING', 'SHIPPING_FREE_PRICE');
     if ($this->getOrderTotal(4) >= $freeshippingPrice) {
         return TRUE;
     }
     $req = Yii::app()->db->createCommand('SELECT m2.discount_ID FROM {{cart_discount}} as m1 ' . ' LEFT JOIN {{discount_entity}} as m2 ON m1.discount_ID=m2.discount_ID' . " WHERE m2.discount_type=3 AND m1.cart_ID={$this->cart_ID}");
     if ($req->queryScalar()) {
         return TRUE;
     }
     return FALSE;
 }
예제 #3
0
파일: index.php 프로젝트: htom78/XZB2c
                        <td><span class="orange fw700">{$row['discount_description']}</span></td>
                        <td><span class="orange fw700">{$value}</span></td>
                        <td><a href="/cart/coupon/remove/{$row['discount_ID']}" class="button ubutton button_del"></a></td>
                    </tr>
EOC;
    }
    $discountTotal = product_entity::decoratePrice($cart->getOrderTotal(2), true);
    echo "</tbody></table><div class='ar t_count'><strong class='t_c1'>Total Coupon:<span class='red'>{$discountTotal}</span></strong></div>";
}
?>
                        <div class="ar t_count">
<?php 
//shipping segment
$grandTotal = $cart->getOrderTotal();
if (!$cart->isFreeshipping()) {
    $remain = product_entity::decoratePrice(configuration::item('SHIPPING', 'SHIPPING_FREE_PRICE') - $grandTotal, true);
    echo " <p style='margin-top: 3px; display: inline;'>Remaining amount to be added to your cart in order to obtain free shipping: <span class='green'>{$remain}</span></p>";
    if ($cart->cart_carrier_ID && $cart->cart_address_ID) {
        $shippingFee = product_entity::decoratePrice($cart->getOrderTotal(5), true);
        echo " <strong class='t_c1'>Total Shipping:<span class='red'>{$shippingFee}</span></strong>";
    }
} else {
    echo "<p style='margin-top: 3px; display: inline;'>You have obtain free shipping</p>";
}
?>
                    </div>

                    <div class="ar t_count">
                        <?php 
echo CHtml::dropDownList('currency', Yii::app()->user->getState('currency_ID'), currency::getCurrencies());
?>