Post by 27eleven » Tue Nov 15, 2016 10:00 pm

Hi there

My wish is to put the DBdata 'company' from 'oc_address' to the edit.tpl. For this, i've added all items in the

- /catalog/view/theme/default/template/account/edit.tpl
- /catalog/controller/account/edit.php
- /catalog/model/account/customer.php

It seams to work, because the company field appears but only with the placeholder in. I don't see the real company name. In the DB appears the real company name.

My code in edit.tpl is:

Code: Select all

          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-company"><?php echo $entry_company; ?> </label>
            <div class="col-sm-10">
              <input type="text" name="company" value="<?php echo $company; ?>" placeholder="<?php echo $entry_company; ?>" id="input-company" class="form-control" />
            </div>
          </div>
Where is the error? Any idea?
Thanks

Version 2.3.0.2

Working on Opencart Version 2.3.0.2


User avatar
New member

Posts

Joined
Tue Sep 20, 2016 1:05 pm
Location - Switzerland


Post by thekrotek » Wed Nov 16, 2016 4:21 am

It's hard to say, what exactly is wrong, because you didn't provide your code. Copy your code here and I might point you on some inconsistencies.

Professional OpenCart extensions, support and custom work.
Contact me via email support@thekrotek.com


User avatar
Active Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by 27eleven » Mon Nov 21, 2016 10:42 pm

Hi thekrotek

Here a piece of the code, because of limited caracters:

Code: Select all

<?php echo $header; ?>
<div class="container">
  <ul class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
    <?php } ?>
  </ul>
  <?php if ($error_warning) { ?>
  <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?>   </div>  
<?php } ?>
  <div class="row"><?php echo $column_left; ?>
    <?php if ($column_left && $column_right) { ?>
    <?php $class = 'col-sm-6'; ?>
    <?php } elseif ($column_left || $column_right) { ?>
    <?php $class = 'col-sm-9'; ?>
    <?php } else { ?>
    <?php $class = 'col-sm-12'; ?>
    <?php } ?>
    <div id="content" class="<?php echo $class; ?>"><?php echo $content_top; ?>
      <h1><?php echo $heading_title; ?></h1>
      <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" class="form-horizontal">
        <fieldset>
          <legend><?php echo $text_your_details; ?></legend>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-customer_id"><?php echo $entry_customer_id; ?> </label>
            <div class="col-sm-10">
              <input type="text" name="customer_id" value="<?php echo $customer_id; ?>" placeholder="<?php echo $entry_customer_id; ?>" id="input-customer_id" class="form-control" readonly />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-company"><?php echo $entry_company; ?> </label>
            <div class="col-sm-10">
              <input type="text" name="company" value="<?php echo $company; ?>" placeholder="<?php echo $entry_company; ?>" id="input-company" class="form-control" />
            </div>
          </div>
	<div class="form-group required">
            <label class="col-sm-2 control-label" for="input-firstname"><?php echo $entry_firstname; ?> </label>
            <div class="col-sm-10">
              <input type="text" name="firstname" value="<?php echo $firstname; ?>" placeholder="<?php echo $entry_firstname; ?>" id="input-firstname" class="form-control" />
              <?php if ($error_firstname) { ?>
              <div class="text-danger"><?php echo $error_firstname; ?></div>
              <?php } ?>
            </div>
          </div>
          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input-lastname"><?php echo $entry_lastname; ?></label>
            <div class="col-sm-10">
              <input type="text" name="lastname" value="<?php echo $lastname; ?>" placeholder="<?php echo $entry_lastname; ?>" id="input-lastname" class="form-control" />
              <?php if ($error_lastname) { ?>
              <div class="text-danger"><?php echo $error_lastname; ?></div>
              <?php } ?>
            </div>
          </div>
          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input-email"><?php echo $entry_email; ?></label>
            <div class="col-sm-10">
              <input type="email" name="email" value="<?php echo $email; ?>" placeholder="<?php echo $entry_email; ?>" id="input-email" class="form-control" />
              <?php if ($error_email) { ?>
              <div class="text-danger"><?php echo $error_email; ?></div>
              <?php } ?>
            </div>
          </div>
          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input-telephone"><?php echo $entry_telephone; ?></label>
            <div class="col-sm-10">
              <input type="tel" name="telephone" value="<?php echo $telephone; ?>" placeholder="<?php echo $entry_telephone; ?>" id="input-telephone" class="form-control" />
              <?php if ($error_telephone) { ?>
              <div class="text-danger"><?php echo $error_telephone; ?></div>
              <?php } ?>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-fax"><?php echo $entry_fax; ?></label>
            <div class="col-sm-10">
              <input type="text" name="fax" value="<?php echo $fax; ?>" placeholder="<?php echo $entry_fax; ?>" id="input-fax" class="form-control" />
            </div>
          </div>
</div>

Working on Opencart Version 2.3.0.2


User avatar
New member

Posts

Joined
Tue Sep 20, 2016 1:05 pm
Location - Switzerland


Post by thekrotek » Tue Nov 22, 2016 3:23 pm

You don't have to put the whole code here, just company related part. And this is only template, but what about controller? Did you define "company" index for $data array in it?

Professional OpenCart extensions, support and custom work.
Contact me via email support@thekrotek.com


User avatar
Active Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by gogoweb » Wed Mar 22, 2017 7:05 am

Hi 27eleven
you need to modify the SQL query in the model editCustomer function as well as the DB table PREFIX_customer (oc_customer in most cases).
See how it has email, phone, firstname, lastname columns. You need a company column as well.
Then in the controller you need to assign that company field to the $data variable. Like this

Code: Select all

$data['company'] =  $customer_info['company'];
Hope it helps!

All mods | OpenCart Bulk Related Products Ultimate Edition |GeoIP hide Prices / no add to cart by country| CSS override | Direct link to checkout / skip add to cart / buy now link | AUTO pilot - reward & purchase points


New member

Posts

Joined
Sat Oct 18, 2014 6:45 pm

Who is online

Users browsing this forum: No registered users and 9 guests