Post by manish0101 » Sat Oct 22, 2016 2:46 pm

I want to develop a module of simple registration , want to insert some data of user like firstname, email id, payment type into database, please give me proper reply so that i can able to make this short module.
i have write following code in my Controller:

Code: Select all

<?php
public function insert()
    {
        //load the language related to this if any

        //load the model 

        //setting up the page title of this page is any.

        //manage the session data..
        if (isset($this->session->data['warning'])) {
            $this->data['error'] = $this->session->data['warning'];
 
            unset($this->session->data['warning']);
        } else {
            $this->data['error'] = '';
        }
        //getting the form data..
        if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
            $this->model_extension_news->addNews($this->request->post);
 
            $this->session->data['success'] = $this->language->get('text_success');
 
            $this->redirect($this->url->link('pro_membership/pro_membership', 'token=' . $this->session->data['token'], 'SSL'));
            
 
        $this->data['action'] = $this->url->link('pro_membership/pro_membership/insert', '&token=' . $this->session->data['token'], 'SSL');
        $this->data['cancel'] = $this->url->link('pro_membership/pro_membership', '&token=' . $this->session->data['token'], 'SSL');
        $this->data['token'] = $this->session->data['token'];
 
        $this->form();

        }

    }

this is my register.tpl file:
<?php require( DIR_TEMPLATE.$this->config->get('config_template')."/template/common/config.tpl" ); ?>
<?php echo $header; ?>
<?php if( $SPAN[0] ): ?>
    <aside class="col-lg-<?php echo $SPAN[0];?> col-md-<?php echo $SPAN[0];?> col-sm-12 col-xs-12">
        <?php echo $column_left; ?>
    </aside>
<?php endif; ?> 
<section class="col-lg-<?php echo $SPAN[1];?> col-md-<?php echo $SPAN[1];?> col-sm-12 col-xs-12"> 
<div id="content">
<div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>

    <div class="row">
    <?php if ($error) { ?>
  <div class="warning"><?php echo $error; ?></div>
  <?php } ?>

    <div class="col-sm-8 col-md-8 col-xs-8">
       <h1><?php echo $heading_title; ?></h1>
        <p><?php echo $description; ?></p>
    </div>  
    <div class="col-sm-4 col-md-4 col-xs-4"></div>      
    </div>
    <div class="row">
       <div class="col-sm-4 col-md-4 col-xs-4">
          <form role="form" action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
              <div class="form-group">
                  <label for="name"><?php echo $first_name; ?></label>
                  <input type="text" name="name" class="form-control">
              </div>
               <div class="form-group">
                  <label for="name"><?php echo $email_id; ?></label>
                  <input type="email" name="email" class="form-control">
              </div>   
               <div class="form-group">
                  <label for="name"><?php echo $telephone; ?></label>
                  <input type="text" name="contact" class="form-control">
              </div>
              <div class="form-group">
                  <label for="name"><?php echo $address_one ?></label>
                  <input type="text" name="address_1" class="form-control">
            </div>
            <div class="form-group">
                  <label for="name"><?php echo $address_two ?></label>
                  <input type="text" name="address_2" class="form-control">
            </div>

        <div class="form-group">
                  <label for="name"><?php echo $city; ?></label>
                  <input type="text" name="city" class="form-control">
        </div>
        
               
       </div>  <!--//end of left section of the form -->
       <div class="col-sm-4 col-md-4 col-xs-4">
       <div class="form-group">
                  <label for="name"><?php echo $state; ?></label>
                  <input type="text" name="state" class="form-control">
         </div>
         <div class="form-group">
            <label for="country"><?php echo $country; ?></label> 
            <select class="form-control" name="country_id">
                  <option value=""><?php echo $country_select; ?></option>
                  <?php foreach ($countries as $country) { ?>
                  <?php if ($country['country_id'] == $country_id) { ?>
                  <option value="<?php echo $country['country_id']; ?>" selected="selected"><?php echo $country['name']; ?></option>
                  <?php } else { ?>
                  <option value="<?php echo $country['country_id']; ?>"><?php echo $country['name']; ?></option>
                  <?php } ?>
                  <?php } ?>
                </select>

         </div>
          <div class="form-group">
                  <label for="name"><?php echo $pin_code; ?></label>
                  <input type="text" name="pin" class="form-control">
         </div>
        

         <div class="form-group">
                  <label for="name">Choose Plan:</label>
                   <input type="radio" name="plan_type" value="silver"> Silver  &nbsp;
                  <input type="radio" name="plan_type" value="gold"> Gold  &nbsp;
                   <input type="radio" name="plan_type" value="platinum"> Platinum 
              </div>     
          


         <div class="form-group">
                  <input type="submit" name="submit" class="btn btn-danger pull-right" value="Register">
                  <input type="reset" name="reset" class="btn btn-danger pull-right" value="Clear" style="margin-right:10px;">
              </div>  

       </div>   <!--//end of right section of the form -->
     </form>  <!-- //end of form -->  
       <div class="col-sm-4 col-md-4 col-xs-4"></div> 

     </div>
    </div>
    </section>
<?php echo $footer; ?>
please let me know how should i get the all value of this file register.tpl , and how should i proceed for the same.

Thanks in Advanced.
Manish
Last edited by Johnathan on Sat Oct 22, 2016 10:14 pm, edited 2 times in total.
Reason: Added [code] tags for readability

Newbie

Posts

Joined
Sat Oct 22, 2016 2:23 pm

Post by cyclops12 » Sun Oct 23, 2016 10:47 pm

If i was you i would first study some of the default controller and template files

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am
Who is online

Users browsing this forum: No registered users and 5 guests