public function __construct() { parent::__construct(); $this->state_taxes = config_item('state_taxes'); $order = GC::getCart(); $taxType = config_item('tax_address'); if ($taxType == 'ship') { if ((bool) $order->shipping_address_id) { $this->address = CI::Customers()->get_address($order->shipping_address_id); } else { return 0; } } else { if ((bool) $order->billing_address_id) { $this->address = CI::Customers()->get_address($order->billing_address_id); } else { return 0; } } if (!$this->address) { return 0; } }
<td> <?php echo format_address($a, true); ?> </td> <td> <label><?php $checked = GC::getCart()->billing_address_id == $a['id'] ? true : false; echo form_radio(['name' => 'billing_address', 'value' => $a['id'], 'checked' => $checked]); echo lang('billing'); ?> </label> </td> <td> <label><?php $checked = GC::getCart()->shipping_address_id == $a['id'] ? true : false; echo form_radio(['name' => 'shipping_address', 'value' => $a['id'], 'checked' => $checked]); ?> <?php echo lang('shipping'); ?> </label> </td> <td> <i class="fa fa-pencil fa-lg text-white-blue" onclick="editAddress(<?php echo $a['id']; ?> )"></i> <i class="fa fa-times fa-lg text-red" onclick="deleteAddress(<?php echo $a['id']; ?>
echo lang('totals'); ?> </td> <td class="text-center"> <?php echo lang('product_action'); ?> </td> </tr> </thead> <tbody> <?php $cartItems = GC::getCartItems(); $options = CI::Orders()->getItemOptions(GC::getCart()->id); $charges = []; $charges['giftCards'] = []; $charges['coupons'] = []; $charges['tax'] = []; $charges['shipping'] = []; $charges['products'] = []; foreach ($cartItems as $item) { if ($item->type == 'gift card') { $charges['giftCards'][] = $item; continue; } elseif ($item->type == 'coupon') { $charges['coupons'][] = $item; continue; } elseif ($item->type == 'tax') { $charges['tax'][] = $item;
public function repriceItems() { $this->getCart(true); // refresh the cart and items again. $options = CI::Orders()->getItemOptions(GC::getCart()->id); foreach ($this->items as $item) { if ($item->type == 'product') { //grab the product from the database $product = \CI::Products()->getProduct($item->product_id); if (empty($product)) { //product can no longer be found. remove it $this->removeItem($item->id); continue; } //Clean up the product for the orderItems database $product = $this->cleanProduct($product); $totalPrice = 0; if ($product->{'saleprice_' . $this->customer->group_id} > 0) { //if it's on sale, give it the sale price $totalPrice = $product->{'saleprice_' . $this->customer->group_id}; } else { //not on sale give it the normal price $totalPrice = $product->{'price_' . $this->customer->group_id}; } if (isset($options[$item->id])) { foreach ($options[$item->id] as $option) { $totalPrice += $option->price; } } $product->id = $item->id; $product->hash = $item->hash; $product->total_price = $totalPrice; //updated price \CI::Orders()->saveItem((array) $product); } } $this->getCart(true); // refresh the cart and items just one more time. }