<label for="billingAddress3">Address 3:</label> <?php echo @form_input('billingAddress3', set_value('billingAddress3', $data['billingAddress3']), 'id="billingAddress3" class="formelement"'); ?> <br class="clear" /> <label for="billingCity">City:</label> <?php echo @form_input('billingCity', set_value('billingCity', $data['billingCity']), 'id="billingCity" class="formelement"'); ?> <br class="clear" /> <label for="billingState">State:</label> <?php echo display_states('billingState', $data['billingState'], 'id="billingState" class="formelement"'); ?> <br class="clear" /> <label for="billingPostcode">Post /ZIP Code:</label> <?php echo @form_input('billingPostcode', set_value('billingPostcode', $data['billingPostcode']), 'id="billingPostcode" class="formelement"'); ?> <br class="clear" /> <label for="billingCountry">Country:</label> <?php echo display_countries('billingCountry', $data['billingCountry'], 'id="billingCountry" class="formelement"'); ?> <br class="clear" />
function account($redirect = '') { // get partials $output = $this->partials; // check user is logged in, if not send them away from this controller if (!$this->session->userdata('session_user')) { redirect('/shop/login/' . $this->core->encode($this->uri->uri_string())); } // set object ID $objectID = array('userID' => $this->session->userdata('userID')); // required $this->core->required = array('email' => array('label' => 'Email', 'rules' => 'valid_email|unique[users.email]|required|trim'), 'password' => array('label' => 'Password', 'rules' => 'matches[confirmPassword]'), 'firstName' => array('label' => 'First name', 'rules' => 'required|trim|ucfirst'), 'lastName' => array('label' => 'Last name', 'rules' => 'required|trim|ucfirst'), 'address1' => array('label' => 'Address1', 'rules' => 'required|required|trim|ucfirst'), 'address2' => array('label' => 'Address2', 'rules' => 'trim|ucfirst'), 'address3' => array('label' => 'Address3', 'rules' => 'trim|ucfirst'), 'city' => array('label' => 'City / State', 'rules' => 'required|trim|ucfirst'), 'postcode' => array('label' => 'ZIP/Postcode', 'rules' => 'required|trim|strtoupper'), 'phone' => array('label' => 'Phone', 'rules' => 'required|trim')); // get values $data = $this->core->get_values('users', $objectID); // force postcode to upper case $this->core->set['postcode'] = strtoupper($this->input->post('postcode')); // security check if ($this->input->post('username')) { $this->core->set['username'] = $data['username']; } if ($this->input->post('premium')) { $this->core->set['premium'] = $data['premium']; } if ($this->input->post('siteID')) { $this->core->set['siteID'] = $this->siteID; } if ($this->input->post('userID')) { $this->core->set['userID'] = $data['userID']; } if ($this->input->post('resellerID')) { $this->core->set['resellerID'] = $data['resellerID']; } if ($this->input->post('kudos')) { $this->core->set['kudos'] = $data['kudos']; } if ($this->input->post('posts')) { $this->core->set['posts'] = $data['posts']; } // update if (count($_POST) && $this->core->update('users', $objectID)) { // get updated row session $user = $this->shop->get_user(); // remove the password field unset($user['password']); // set session data $this->session->set_userdata($user); if ($redirect) { redirect('/shop/' . $redirect); } else { $output['message'] = 'Your details have been updated.'; } } // populate template $output['form:email'] = set_value('email', $data['email']); $output['form:displayName'] = set_value('displayName', $data['displayName']); $output['form:firstName'] = set_value('firstName', $data['firstName']); $output['form:lastName'] = set_value('lastName', $data['lastName']); $output['form:phone'] = set_value('phone', $data['phone']); $output['form:address1'] = set_value('address1', $data['address1']); $output['form:address2'] = set_value('address2', $data['address2']); $output['form:address3'] = set_value('address3', $data['address3']); $output['form:city'] = set_value('city', $data['city']); $output['select:state'] = @display_states('state', $data['state'], 'id="state" class="formelement"'); $output['form:postcode'] = set_value('postcode', $data['postcode']); $output['select:country'] = @display_countries('country', set_value('country', $data['country']), 'id="country" class="formelement"'); $output['form:billingAddress1'] = set_value('billingAddress1', $data['billingAddress1']); $output['form:billingAddress2'] = set_value('billingAddress2', $data['billingAddress2']); $output['form:billingAddress3'] = set_value('billingAddress3', $data['billingAddress3']); $output['form:billingCity'] = set_value('billingCity', $data['billingCity']); $output['select:billingState'] = @display_states('billingState', $data['billingState'], 'id="billingState" class="formelement"'); $output['form:billingPostcode'] = set_value('billingPostcode', $data['billingPostcode']); $output['select:billingCountry'] = @display_countries('billingCountry', set_value('billingCountry', $data['billingCountry']), 'id="billingCountry" class="formelement"'); // load errors $output['errors'] = validation_errors() ? validation_errors() : FALSE; // set page title $output['page:title'] = 'My Account' . ($this->site->config['siteName'] ? ' - ' . $this->site->config['siteName'] : ''); // display with cms layer $this->pages->view('shop_account', $output, TRUE); }
<br class="clear" /> <div class="hidetax"> <label for="shopTaxRate">Tax Rate:</label> <?php echo @form_input('shopTaxRate', set_value('shopTaxRate', $data['shopTaxRate']), 'id="shopTaxRate" class="formelement small"'); ?> <span class="price">%</span> <br class="clear" /> <div class="hidetaxstate"> <label for="shopTaxState">Tax by State:</label> <?php echo display_states('shopTaxState', $data['shopTaxState'], 'id="shopTaxState" class="formelement"'); ?> <br class="clear" /> </div> </div> <label for="shopVariation1">Variation 1:</label> <?php echo @form_input('shopVariation1', set_value('shopVariation1', $data['shopVariation1']), 'id="shopVariation1" class="formelement"'); ?> <br class="clear" /> <label for="shopVariation2">Variation 2:</label> <?php
create_field("SPass", "Password", "password", "password", false, null); createSubmit("login", "Sign In!", "SErr"); ?> </ul> </form> </fieldset> <!-- Register --> <fieldset> <legend>Register</legend> <form name="register" onsubmit="return clientvalidate(this);" method="POST" action="Account.php" > <ul class="textcontrols"> <?php create_field("RUser", "Username", "username", "text", false, "Must start with a letter, and only contain letters and numbers."); create_field("RAddr", "Address", "address", "text", false, "ie. 5 Streetname, Suburb 4504"); display_states("RState", "QLD"); create_field("REmail", "Email Address", "email", "email", false, null); create_radios("RGend", "gender", "M", "Male", "F", "Female"); create_field("RPass", "Password", "password", "password", false, null); create_field("RConf", "Confirm Password", "confpassword", "password", false, null); createSubmit("register", "Register Account!", "RErr"); ?> </ul> </form> </fieldset> <?php } ?> </div> <?php
<br class="clear" /> </div> <div class="formrow ccstreet-row"> <label for="cccity">Address:</label> <textarea name="x_address" id="address" class="formelement small"><?php echo $this->input->post('x_address') ? $this->input->post('x_address') : @$user['billingAddress1'] . "\n" . @$user['billingCity']; ?> </textarea> <br class="clear" /> </div> <div class="formrow ccstate-row"> <label for="ccstate">State:</label> <?php echo @display_states('x_state', $this->input->post('x_state') ? $this->input->post('x_state') : @$user['billingState'], 'id="ccstate" class="formelement"'); ?> <br class="clear" /> </div> <div class="formrow cczip-row"> <label for="cczip">Zip/Post Code:</label> <input type="text" name="x_zip" id="cczip" class="formelement" value="<?php echo $this->input->post('x_zip') ? $this->input->post('x_zip') : @$user['billingPostcode']; ?> " /> <br class="clear" /> </div> <div class="formrow cccountry-row"> <label for="cccountry">Country:</label>