Post by fido-x » Thu Jan 08, 2015 9:07 am

In catalog/controller/information/contact.php, the store opening times and store comment are retrieved from the database (at lines 95 and 96) with:

Code: Select all

$data['open'] = nl2br($this->config->get('config_open'));
$data['comment'] = $this->config->get('config_comment');
This doesn't work in a multi-store setup, as only the values for the default store are retrieved.

In admin/controller/setting/setting.php, at lines 531 to 541, we have:

Code: Select all

if (isset($this->request->post['config_open'])) {
	$data['config_open'] = $this->request->post['config_open'];
} else {
	$data['config_open'] = $this->config->get('config_open');
}

if (isset($this->request->post['config_comment'])) {
	$data['config_comment'] = $this->request->post['config_comment'];
} else {
	$data['config_comment'] = $this->config->get('config_comment');
}
And, in the template file (admin/view/template/setting/setting.tpl) at lines 112 and 118, we have:

Code: Select all

<textarea name="config_open" rows="5" placeholder="<?php echo $entry_open; ?>" id="input-open" class="form-control"><?php echo $config_open; ?></textarea>
and

Code: Select all

<textarea name="config_comment" rows="5" placeholder="<?php echo $entry_comment; ?>" id="input-comment" class="form-control"><?php echo $config_comment; ?></textarea>
Which sets the opening times and store comment for the default store but for any other store, the values are not set properly.

In admin/controller/setting/store.php, at lines 537 to 551, we have:

Code: Select all

if (isset($this->request->post['open'])) {
	$data['open'] = $this->request->post['open'];
} elseif (isset($store_info['config_open'])) {
	$data['open'] = $store_info['open'];
} else {
	$data['open'] = '';
}

if (isset($this->request->post['comment'])) {
	$data['comment'] = $this->request->post['comment'];
} elseif (isset($store_info['config_comment'])) {
	$data['comment'] = $store_info['comment'];
} else {
	$data['comment'] = '';
}
And in the template file (admin/view/template/setting/store.tpl), at lines 124 and 130, we have:

Code: Select all

<textarea name="open" rows="5" placeholder="<?php echo $entry_open; ?>" id="input-open" class="form-control"><?php echo $open; ?></textarea>
and

Code: Select all

<textarea name="comment" rows="5" placeholder="<?php echo $entry_comment; ?>" id="input-comment" class="form-control"><?php echo $comment; ?></textarea>
The opening times and comment for a sub-store will not display after saving, as the values be tested for are "$store_info['config_open']" and "$store_info['config_comment'}". Since the values being posted back to the form (and saved in the settings table) are called "open" and "comment", not "config_open" and "config_comment". And, since it is the "config_open" and "config_comment" values that are being retrieved on the front-end, only those for the default store will display.

To Fix
In admin/controller/setting/store.php, replace lines 537 to 551 with:

Code: Select all

if (isset($this->request->post['config_open'])) {
	$data['config_open'] = $this->request->post['config_open'];
} elseif (isset($store_info['config_open'])) {
	$data['config_open'] = $store_info['config_open'];
} else {
	$data['config_open'] = '';
}

if (isset($this->request->post['config_comment'])) {
	$data['config_comment'] = $this->request->post['config_comment'];
} elseif (isset($store_info['config_comment'])) {
	$data['config_comment'] = $store_info['config_comment'];
} else {
	$data['config_comment'] = '';
}
And in the template file (admin/view/template/setting/store.tpl), replace lines 124 and 130 with:

Code: Select all

<textarea name="config_open" rows="5" placeholder="<?php echo $entry_open; ?>" id="input-open" class="form-control"><?php echo $config_open; ?></textarea>
and

Code: Select all

<textarea name="config_comment" rows="5" placeholder="<?php echo $entry_comment; ?>" id="input-comment" class="form-control"><?php echo $config_comment; ?></textarea>
respectively.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia
Who is online

Users browsing this forum: No registered users and 5 guests