Author Topic: Bug in VmConfig::set  (Read 163 times)

balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1287
Bug in VmConfig::set
« on: July 13, 2017, 11:25:11 am »
I am checking your VmConfig::set function.
You are using that in views like : components/com_virtuemart/views/category/view.html.php
Though none of these seem to work.

You can try your own
Code: [Select]
VmConfig::set('myVar', 10);
echo VmConfig::get('myVar',5); //gives 5

Ghost

  • Jr. Member
  • **
  • Posts: 320
Re: Bug in VmConfig::set
« Reply #1 on: July 13, 2017, 14:14:30 pm »
You have to be logged in as VM admin for some reason https://dev.virtuemart.net/projects/virtuemart/repository/entry/branches/com_virtuemart.3.0.12.4/administrator/components/com_virtuemart/helpers/config.php

Code: [Select]
static function set($key, $value){

if (empty(self::$_jpConfig->_params)) {
self::loadConfig();
}

if($admin = JFactory::getUser()->authorise('core.admin', 'com_virtuemart')){
if (!empty(self::$_jpConfig->_params)) {
self::$_jpConfig->_params[$key] = $value;
}
}

}

balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1287
Re: Bug in VmConfig::set
« Reply #2 on: July 14, 2017, 12:18:19 pm »
It makes no sense to be logged in, because this is used by the server to generate the front end views.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9092
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Bug in VmConfig::set
« Reply #3 on: July 25, 2017, 08:27:36 am »
Only admins are allowed to change the config!
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/