Author Topic: [BUG] Hidden category shown on breadcumb  (Read 1367 times)

Marttyn

  • Jr. Member
  • **
  • Posts: 93
[BUG] Hidden category shown on breadcumb
« on: January 26, 2018, 12:52:36 pm »
Hi!
Im experiencing some issue i think it should not be the regular behaviour.
In my store i have "regular" categories, and "hidden" categories. The hidden categories are for backend administration purposes. I have one hidden category for every of my product suppliers. So i may have 5 products that i purchase to "Supplier 1", this 5 products have their regular category, and also the hidden category associated to that supplier. This way i can manage stock more easily. And when i need to purchase to one supplier, i can see all the products i purchase from them and also see the stock. This is the way ive found to manage purchasing.
Everything is correct... this are hidden categories, and dont show up in the frontend
But for example, when i create a stockable variant, the child product has a hidden category associated, but no "regular" category, otherwise the child would be shown in that category listing, and i only want to show the parent in the listing.
The problem is that that child shows the hidden category in the breadcrumb  :o
If i remove all categories from the child product, then its ok, and show the correct breadcumb path (the parent path).
Can anyone test this and see if it only happens to me or if its a bug?
Thanks!

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3394
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: [BUG] Hidden category shown on breadcumb
« Reply #1 on: January 27, 2018, 17:22:54 pm »
Is the "hiden" category published ?
It's only a bug, iif category is unpublished and not if you dont added links to menu.

Marttyn

  • Jr. Member
  • **
  • Posts: 93
Re: [BUG] Hidden category shown on breadcumb
« Reply #2 on: January 27, 2018, 20:57:35 pm »
Sure, my "hidden" categories are unpublished. Otherwise they would show in the categories module.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3394
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: [BUG] Hidden category shown on breadcumb
« Reply #3 on: January 27, 2018, 23:53:21 pm »
Have you update VM ?
I dont see your virtuemart release in the post

Marttyn

  • Jr. Member
  • **
  • Posts: 93
Re: [BUG] Hidden category shown on breadcumb
« Reply #4 on: January 28, 2018, 10:40:56 am »
I have v3.2.12

aftertaf

  • Jr. Member
  • **
  • Posts: 206
    • sO couture
  • VirtueMart Version: 3.2.14
Re: [BUG] Hidden category shown on breadcumb
« Reply #5 on: January 28, 2018, 10:43:06 am »
i've had this happen too... i changed my backend structure to avoid the issue, in the end...
Webmaster for my wife (link in my profile ;)
Extensions / plugins : POSForWebshops, TemplatecreatorCK ,MaximenuCK, and PageBuilderCK, VM BatchEdit Pro, VM CustomFilters Pro, Awocoupon Pro, slogin, supersaas,  among other things...
Joomla! 3.8.6//VM 3.2.14//PHP7.0.18 & mariadb 10.1.22 on Debian
big up to notepad++!!!!

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3394
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: [BUG] Hidden category shown on breadcumb
« Reply #6 on: January 28, 2018, 15:53:49 pm »
Here the solution
file JOOMLAROOT/administrator/components/com_virtuemart/models/category.php line 709
Code: [Select]
$select = 'SELECT '.implode(', ',self::joinLangSelectFields($langFields));
$joins = implode(' ',self::joinLangTables('#__virtuemart_categories','c','virtuemart_category_id','FROM'));
replace with
Code: [Select]
$select = 'SELECT c.published,'.implode(', ',self::joinLangSelectFields($langFields)) .' FROM #__virtuemart_categories as c ';
$joins = implode(' ',self::joinLangTables('#__virtuemart_categories','c','virtuemart_category_id'));

And
file JOOMLAROOT/components/com_virtuemart/views/productdetails/view.html.php line 210
Code: [Select]
$pathway->addItem(strip_tags(vmText::_($c->category_name)), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id, FALSE));
replace with
Code: [Select]
if($c->published) {
$pathway->addItem(strip_tags(vmText::_($c->category_name)), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id, FALSE));
}
 
And breacrumb cannot display published categories anymore ;)

Marttyn

  • Jr. Member
  • **
  • Posts: 93
Re: [BUG] Hidden category shown on breadcumb
« Reply #7 on: January 28, 2018, 18:57:34 pm »
Thanks friend for taking the time to check this!
Your mod "kind of fix" the problem, but there are still some other things that still remain unfixed. I think the whole multivariant solution its quite buggy and needs some improvement.
This still have problems (look at the picture):
1. Hidden category name still show on the name of the site
2. URL becomes "broken" with 404 in the path
3. The product path in the breadcrumb is now in root, while it should be the parent path
4. Name of the product dont update when changing from one variant to the other

Regards!

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3394
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: [BUG] Hidden category shown on breadcumb
« Reply #8 on: January 29, 2018, 02:29:12 am »
I know that you have other problems, what i don't understand is why published categories can be set in front(i have see comment about price rules that can use unpublished categories , but i think this is bad too).
MAx or other from dev teeam, can you fix this ? i don't want give 20 lines of core hack to reapply each Vm updates.

But how you can have 404 in the breadcrumb, if this is not set ?
Perhpas a solution is to use ordering and set your categories to higher level, or in another category not in root ?
Do you tested such tricks, so the canonical category is not the hidden one ?

Marttyn

  • Jr. Member
  • **
  • Posts: 93
Re: [BUG] Hidden category shown on breadcumb
« Reply #9 on: January 29, 2018, 13:47:11 pm »
I dont understand what you want me to try.
I have a parent category called "Suppliers", and children categories with the names of my suppliers. Just an example:
Suppliers
|_ Amazon
|_ Ebay
|_ Aliexpress

Both the parent and the children categories are hidden (unpublished). And i only apply one child category to each of my product so i know where to purchase them.
On regular products i also have other published categories added to them, but on child multivariant products i only have the hidden category.

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1720
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: [BUG] Hidden category shown on breadcumb
« Reply #10 on: January 29, 2018, 13:57:16 pm »
I have also seen this issue. In my case using different calculation rules applied to categories. Assigning categories to a Child overrides the categories that otherwise are  inherited from the parent Product. It doesn´t add a new category it replaces the existing ones.

Couldn´t You assign a custom field that is hidden in the front end callied supplier ? You can create a nice drop down of suppliers to choose from.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3394
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: [BUG] Hidden category shown on breadcumb
« Reply #11 on: January 29, 2018, 16:07:30 pm »
@Jörgen, i think that he only want use this as filter in back-end, not front, currently VM have only filter category or manufacturer (and vendors).

It seems that VM do not override categories, if some are set in children because it not check if this are unpublished or not.
My trick was to remove the bug, but the problem is that product model do not check for unpublished categories set it in child(and perhaps in parent to ?) and not override it.

A solution, is to use vendor, but you have to manually modify all your products in shop and can give other issues in your case.


Marttyn

  • Jr. Member
  • **
  • Posts: 93
Re: [BUG] Hidden category shown on breadcumb
« Reply #12 on: January 29, 2018, 16:35:19 pm »
Couldn´t You assign a custom field that is hidden in the front end callied supplier ? You can create a nice drop down of suppliers to choose from.
In my case, a custom field will not give me a filter on the BE. I use the categories to group all the products from the same supplier. And when i have to order parts to one supplier, i can see all products from that supplier at the same time, and see the stocks for them, and also order other products that have low stock.

A solution, is to use vendor, but you have to manually modify all your products in shop and can give other issues in your case.
It wont be a problem to manually change all the vendors from my products if that solve the problem. And i wasnt doing it that way because my older template was showing the Vendor in the productdetails view. But my new template now doesnt show it, so maybe i can do that! Thanks Patrick!  :D

In any case, although i could solve the problem this way, the bug is still there.

Regards!

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9667
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: [BUG] Hidden category shown on breadcumb
« Reply #13 on: January 29, 2018, 19:58:16 pm »
The solution is to fix the problem, of course. But it is not soo easy to replicate it. I just tried and had no success. VM recognises the unpublished categories, except in some circumstances. I know I could reproduce the problem of Jörgen.

So in your case the problem is that the parent category is completly unpublished, or? btw, buying membership helps me to pay the time for the fix https://extensions.virtuemart.net/support/virtuemart-supporter-membership-silver-detail I looked already into it for Jörg, I also found some, but was not able todo the final fix, yet. There is imho no fast quickndirty solution.
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: 9667
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/