Author Topic: Display subcategory products, full depth - VM 3.2.2  (Read 836 times)

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9415
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #15 on: August 24, 2017, 20:27:48 pm »
no, I asked for clearification and thanked for the answer.

Good, nice. We had often people in the forum, directly writing something which already existed. But I wonder that there no function already exists in the category model. We could extend the hidden 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/

Rune Rasmussen

  • Jr. Member
  • **
  • Posts: 157
  • Is the stable release stable?
    • SYNTAX ERROR
  • VirtueMart Version: Latest ;)
Re: Display subcategory products, full depth
« Reply #16 on: August 24, 2017, 20:52:30 pm »
But when you check the code, you see this config line. It is at the moment a hidden config and enables exactly the behaviour you want, imho.

You didn't read or understand what was written, or/and you didn't look at his code. Else that reply doesn't make any sense.

Did you test?

Here you state that you don't know if it work or not, imho.

ehrm, you should care, because we could add it as hidden option, so you have no problem updating.

Here you misunderstood what he wrote. What he tried to tell you is that you can do it your way, if that is better, if only the function is improved to work as the configuration setting implies. He/We only wants it to work as the config text tells us it should work, if you use his solution or comes up with something else is less important.

And instead of using the time and implementing it, I am disusssing with you competly nonsense. Because you come here and blame around, instead of constructive work.

First of I didn't see that you intended to do anything about it, only that «we could». Second, I don't see any blaming in this, before you started. Third, so translations isn't constructive work, even if your system wouldn't be so popular without it? Thank you!

Why you write this? Did I say that I do not believe bcohen0? So there is no reason to repeat, what he already wrote.

To confirm there is a issue, because you once again seemed to not understand it, or care about it. There was no "I understand. You are right, it doesn't work as expected, I will look at it" or similar expected replies.

Sorry for caring! Have a nice evening!

PS! Look at this image I'm adding once more, it's not a hidden config anymore:
Rune Rasmussen - http://www.syntaxerror.no
Norske nettløsninger og integrasjoner, CONSIGNOR EDI, Mamut ordreimport og produkteksport, kortbetaling og faktura m.m.

Norsk Joomla! - Norwegian Translation Team - http://www.norskjoomla.no

Rune Rasmussen

  • Jr. Member
  • **
  • Posts: 157
  • Is the stable release stable?
    • SYNTAX ERROR
  • VirtueMart Version: Latest ;)
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #17 on: August 24, 2017, 21:26:07 pm »
Anyhow, I also looked at it while having this nice chat ...

And by adding the new function posted by 'bcohen0' to the category model, in bottom of administrator/components/com_virtuemart/models/category.php:
Code: [Select]
    static public function categoryFlatList(&$cats, $category_id) {
      $catmodel  = VmModel::getModel('category');
      $childcats = $catmodel->getChildCategoryList(1, $category_id, null, null, true);
      foreach ($childcats as $childcat)
      {
         $cats .= ',' . $childcat->virtuemart_category_id;
         self::categoryFlatList($cats, $childcat->virtuemart_category_id);
      }
   }

And then modify the code in the product model (administrator/components/com_virtuemart/models/product.php) to something like:
Code: [Select]
         if (VmConfig::get('show_subcat_products',false) and !VmConfig::get('show_all_subcat_products',false)){
            /*GJC add subcat products*/
            $catmodel = VmModel::getModel ('category');
            $childcats = $catmodel->getChildCategoryList(1, $virtuemart_category_id,null, null, true);
            $cats = $virtuemart_category_id;
            foreach($childcats as $childcat){
               $cats .= ','.$childcat->virtuemart_category_id;
            }
            $joinCategory = TRUE;
            $where[] = ' `pc`.`virtuemart_category_id` IN ('.$cats.') ';
         } else if (VmConfig::get('show_all_subcat_products',false)) {
            $cats = $virtuemart_category_id;
            VmModel::getModel('category')->categoryFlatList($cats, $virtuemart_category_id);
            $this->filter_order = "";
            $orderBy="";
            $joinCategory = TRUE;
            $where[] = ' `pc`.`virtuemart_category_id` IN ('.$cats.') ';
         } else {
            $where[] = ' `pc`.`virtuemart_category_id` = ' . $virtuemart_category_id;
         }

It could work for those wanting only first sublevel, and those wanting all sublevels.

Sure it should also be added to the visible config, but that should be doable. And sure the code could be better, this is just a quick working proposal based on the existing code and proposal. ;)
Rune Rasmussen - http://www.syntaxerror.no
Norske nettløsninger og integrasjoner, CONSIGNOR EDI, Mamut ordreimport og produkteksport, kortbetaling og faktura m.m.

Norsk Joomla! - Norwegian Translation Team - http://www.norskjoomla.no

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9415
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #18 on: August 24, 2017, 21:36:18 pm »
But when you check the code, you see this config line. It is at the moment a hidden config and enables exactly the behaviour you want, imho.

You didn't read or understand what was written, or/and you didn't look at his code. Else that reply doesn't make any sense.
simple, I just forgot myself, that I added that 6 months ago. Read the feature list for vm3.2 and you can see how much I implemented. I also explained, why I asked for that, because we had often people who started to code, just because they did not find the option to enable the wanted behaviour.

Did you test?

Here you state that you don't know if it work or not, imho.
LoL. There is enough room for questions. Maybe it worked before that way and the function got broken. or we also had this often, also with skilled members, that they did a wrong test. False positiv, and so on.

ehrm, you should care, because we could add it as hidden option, so you have no problem updating.

Here you misunderstood what he wrote. What he tried to tell you is that you can do it your way, if that is better, if only the function is improved to work as the configuration setting implies. He/We only wants it to work as the config text tells us it should work, if you use his solution or comes up with something else is less important.

I understood that. But as mentioned before, a lot people use it that way and I want to ask first if some got used to this behaviour and want it that way. We had this often enough, that we "fix" something and others scream that their misuse of the function got broken. A funny example was preventing "minus costs" for payments, which is used as skonto. So i have to add another option for it.

Furthermore I write the code mainly so I hoped that he got my point with the "Already existing functions in the category model". Hoping that he takes another look, if it can be done with an already existing function.

And instead of using the time and implementing it, I am disusssing with you competly nonsense. Because you come here and blame around, instead of constructive work.

First of I didn't see that you intended to do anything about it, only that «we could». Second, I don't see any blaming in this, before you started. Third, so translations isn't constructive work, even if your system wouldn't be so popular without it? Thank you!
I expressed clearly, that it is in his interest, that we take the work. But we had also a release going on and it was delayed for too long time, so I just had no time todo it directly.
I told you, what I felt as blaming. Directly repeating that it does not work, while I am already on solving it.
That you did the translation does not give you the right to jump into a thread and play the troll. (be aware, I said "play" not that you are!)

Why you write this? Did I say that I do not believe bcohen0? So there is no reason to repeat, what he already wrote.

To confirm there is a issue, because you once again seemed to not understand it, or care about it. There was no "I understand. You are right, it doesn't work as expected, I will look at it" or similar expected replies.

Good, nice. We had often people in the forum, directly writing something which already existed. But I wonder that there no function already exists in the category model. We could extend the hidden config.
The "Good, nice" was that.

PS! Look at this image I'm adding once more, it's not a hidden config anymore:
Hehe, yes, thanks for clarification. :-)
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9415
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #19 on: August 24, 2017, 21:39:11 pm »
Anyhow, I also looked at it while having this nice chat ...

.....
Sure it should also be added to the visible config, but that should be doable. And sure the code could be better, this is just a quick working proposal based on the existing code and proposal. ;)

Thank you. Yes, it is almost what I have in mind. I would use the same config value, just as dropdown, because the options exclude each other. And it really looks like, that the function is not already in the category model. I checked that already some hours ago.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Rune Rasmussen

  • Jr. Member
  • **
  • Posts: 157
  • Is the stable release stable?
    • SYNTAX ERROR
  • VirtueMart Version: Latest ;)
Re: Display subcategory products, full depth - VM 3.2.2
« Reply #20 on: August 24, 2017, 21:55:46 pm »
I hardly see how confirming an issue is trolling, but enough about it, thanks for your clarifications on your views. I can live with it.

And yes, I didn't find any existing function to use either. And adding the config as a dropdown sounds like a good idea. Great, thanks.
Rune Rasmussen - http://www.syntaxerror.no
Norske nettløsninger og integrasjoner, CONSIGNOR EDI, Mamut ordreimport og produkteksport, kortbetaling og faktura m.m.

Norsk Joomla! - Norwegian Translation Team - http://www.norskjoomla.no