问题
We have a multi-store set up and I wanted to change the template slightly for each store. I had a good look through the code already in place and found these:
$this->config->get('config_store_id')
$this->load->model('setting/store');
$results = $this->model_setting_store->getStores();
$this->model_setting_setting->getSetting('config', $order_info['store_id']);
The first line only ever returns the default store ID. I would want this to work even if we have not order details.
What is the most reliable way to get the store ID?
回答1:
The current store ID is in $this->config->get('config_store_id')
It gets changed to the correct store ID in this code in the index.php
file
if ($store_query->num_rows) {
$config->set('config_store_id', $store_query->row['store_id']);
} else {
$config->set('config_store_id', 0);
}
来源:https://stackoverflow.com/questions/9916282/get-the-store-id-for-multi-store-setup-with-opencart