Catalogue mode access level

  • Posts: 298
  • Thank you received: 5
  • Hikashop Business
7 years 9 months ago #275885

-- HikaShop version -- : 3.1.1

Could catalogue mode be controlled by user access level?
I.E.
(a) Normal shop for all
(b) Catalogue mode with prices for all
(c) Catalogue mode without prices for all
(d) Normal shop for club members, catalogue mode with prices for non-members
(e) Normal shop for club members, catalogue mode without prices for non-members

In this particular instance non-members can still buy things by visiting the high street shop.
Already have a pay at and collect from high street shop checkout feature.
Option (d) may need 2 sets of prices, rather than global fixed member discount.

Can add this functionality using plugins / template code, but should something along these lines be part of core Hikashop.

Please Log in or Create an account to join the conversation.

  • Posts: 26232
  • Thank you received: 4035
  • MODERATOR
7 years 9 months ago #275897

Hello,

The catalogue mode is a global configuration setting, I'm afraid that you can't add ACL on it.
By definition, the mode block completely all cart features, including the checkout. So if you try to plug ACL on it, you will have unwanted side effect.
That's why I'm afraid that it will be very complicated to integrate it in the HikaShop core.

Afterwards you can see to add some extra restrictions thanks to plugins, so you will authorize or not the addition of products into the cart but you won't have a real catalogue mode because you can't make the two systems working in the same time.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 298
  • Thank you received: 5
  • Hikashop Business
7 years 8 months ago #276216

I am using Hikashop class overrides elsewhere and the idea occurred to me that the same technique could be used with the config class like this...

class hikashopConfigClassOverride extends hikashopConfigClass{
  function load(){
    parent::load();
    
    if (mycataloguecondition()) {
      $this->values['catalogue']->config_value = 1;
    }
}

However, turns out the current structure of helpers/helper.php appears to prevent the config class override working as intended without having to customise Hikashop core code.

Something like this would be a step in the right direction (not tested to see if it fully resolves issue)...
if (!function_exists('hikashop_config')) {
  function &hikashop_config($reload = false){
    ... as existing ...
  }
}

Might be useful to apply same check to all the functions in helper.php

Last edit: 7 years 8 months ago by brainforge. Reason: Text correction.

Please Log in or Create an account to join the conversation.

  • Posts: 298
  • Thank you received: 5
  • Hikashop Business
7 years 8 months ago #276222

Might have found a solution to the config class override issue...

class hikashopConfigClassOverride extends hikashopConfigClass{
  function load(){
    parent::load();
    
    if (mycataloguecondition()) {
      $this->values['catalogue']->config_value = 1;
      $this->values['default_params']->config_value['show_price'] = 0;
    }
}
hikashop_config(true);

Looks good so far, will pursue this further.

Last edit: 7 years 8 months ago by brainforge. Reason: Added show_price parameter to example.

Please Log in or Create an account to join the conversation.

  • Posts: 26232
  • Thank you received: 4035
  • MODERATOR
7 years 8 months ago #276223

Hello,

If you want to dynamically change a setting in the configuration ; just load the configuration objet and perform a "set".

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Time to create page: 0.061 seconds
Powered by Kunena Forum