Get the store ID for multi store setup with opencart

浪子不回头ぞ 提交于 2019-12-11 03:19:53

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!