public function update_groupdiscounts() { global $db; if (empty($this->params['id'])) { // look for existing discounts for the same group $existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id=' . $this->params['group_id']); if (!empty($existing_id)) { flashAndFlow('error', 'There is already a discount for that group.'); } } $gd = new groupdiscounts(); $gd->update($this->params); expHistory::back(); }
public function splitShipping() { global $user, $order; expHistory::set('viewable', $this->params); // get all the necessary addresses..shipping, billing, etc $address = new address(null, false, false); $addresses_dd = $address->dropdownByUser($user->id); if (count($addresses_dd) < 2) { expHistory::set('viewable', $this->params); flash('error', gt('You must have more than 1 address to split your shipment. Please add another now.')); redirect_to(array('controller' => 'address', 'action' => 'edit')); } // setup the list of orderitems $orderitems = array(); foreach ($order->orderitem as $item) { if ($item->product->requiresShipping == true) { for ($i = 0; $i < $item->quantity; $i++) { $orderitems[] = $item; } } } if (count($orderitems) < 2) { flashAndFlow('error', 'You must have a minimum of 2 items in your shopping cart in order to split your shipment.'); } expHistory::set('viewable', $this->params); assign_to_template(array('addresses_dd' => $addresses_dd, 'orderitems' => $orderitems, 'order' => $order)); }
function update_sales_reps() { if (!isset($this->params['id'])) { flashAndFlow('error', 'Unable to process request. Invalid order number.'); //expHistory::back(); } $order = new order($this->params['id']); $order->sales_rep_1_id = $this->params['sales_rep_1_id']; $order->sales_rep_2_id = $this->params['sales_rep_2_id']; $order->sales_rep_3_id = $this->params['sales_rep_3_id']; $order->save(); flashAndFlow('message', 'Sales reps updated.'); }