Author Topic: products belong in multiple categories=>product pathway takes wrong path  (Read 15366 times)

darengr

  • Beginner
  • *
  • Posts: 44
Hi to all!
I am experiencing a strange behaviour on my first J1.5.8, VM1.1.2, Joomfish 2, no SEF installed site and would like to share it with you as follows:

My products are assigned to more than 1 categories each, as following example:
Category Fashion, subcats Modern, Classical, ...
Category COlor, subcats Red, Blue, ...
Product A, belongs to Modern and Red, B belongs to Modern and Blue, C to Classical and Blue...

I click to 'Our Store' Menu for Category Fashion>Modern, then products A and B appear on the category browse page, and I click on the first one the get the product flypage. On the flypage of A, the pathway seems fine, and the left/right arrows to point to the next or previous item, ie B on the category seem fine too. When I click on one of them, say the right arrow, I correctly see the flypage of the next product B (as was sorted by the Modern category), BUT the pathway (breadcrumbs) has now followed and displays the other tree (by Color>Blue), so the browsing is interrupted (as I selected to see all Fashion>Modern items) and continues thru the COlor/Blue category!..
So the system 'chooses' to follow the other tree that a specific product is categorised, and forgets the user selection to browse all products of the desired category.
I would like to ask if this is considered normal behaviour or not, so to know how else I could use the ability to assign a product to multiple categories and browse correctly on each flypage to next/precious items, according to the category selection.

Many thanks for any of your thoughts and experience!

darengr

  • Beginner
  • *
  • Posts: 44
Re: products belong in multiple categories=>product pathway takes wrong path
« Reply #1 on: January 12, 2009, 17:07:20 pm »
It seems that either my descriptions are not good, or nobody else has had this problem before :-\. I have found a solution, to modify the relevant source file, however, this is not the way to go, I would like to stick with the standard VM product instead.
Does anybody know how to provide an alternative way to reach to the same products, according to different (multiple) categorisation, and give the user the ability to use more than one categories to reach the products? Actually, use the categories as filters? Is there any add-onn to provide filters on the pages, other that the categories and the attributes, on the advanced search?

klutzon

  • Jr. Member
  • **
  • Posts: 319
  • Knuckles the Echidna
    • Rage3D
Re: products belong in multiple categories=>product pathway takes wrong path
« Reply #2 on: January 21, 2009, 11:11:38 am »
Hey darengr,

I've tried following your description of the problem, and I'd like to help, but I need some clarification on how you've organized your items in your VirtueMart database. From what you've described, the breadcrumb is working properly, shifting the hierarchy to the Color parent category when you choose Product B, but I'd need to know exactly how you've structured your categories. For example, does your category tree look like this?

Home -> Fashion -> Modern
                -> Classical
Home -> Color -> Red
              -> Blue

Because it seems like that's how the breadcrumb is behaving.

To answer your second post, take a look at Gavick Pro's latest "eShop" template. http://demo.gavick.com/joomla15/dec2008/

I am very impressed with that Advanced Search bar, and I'm going to try figure out how to make it for myself, is this something similar to what you had in mind? :)

darengr

  • Beginner
  • *
  • Posts: 44
Re: products belong in multiple categories=>product pathway takes wrong path
« Reply #3 on: January 21, 2009, 12:49:33 pm »
Hi klutzon, and many thanks for replying! I found out that the product flypage was missing the category_id in each subsequent url, added it in the specific file (sorry I can't remember the exact filename now), and I can correctly browse to the next/previous product from the flypage.
My problem is to have a filter mechanism as follows:
(well yes, I have the product categories as you also described above.)
Imagine a user who wants to browse only items that are modern and blue at the same time. I wish there was a mechanism to do this combined filtering of the categories. As far as I have searched, there is no. What I found is a mechanism to use the product types>parameters>values hierarchy, but this introduces an extra maintenance level, that would include repeated info from the categories down to the types level, which I want to avoid.

I saw the template demo you referenced above, but I could not see multiple categorization of products. The advanced search could do, if you could combine the filters to be not text, but entries from the category hierarchies, so the listboxes would be filled (in my case) with Color>Red, Color>Red, etc, and Fashion>Modern, Fashion>Classical, etc.
Imagine having this as a multi-select interface, wouldn't it be perfect, to click on the tickboxes what exactly you want from each category (all levels), and it would produce the query ...
On another post I have found the FilterManufactorerxxx.zip, which shows the manufacturer listbox within the categ. browse page, and it really works as a second filter, to show on that page only matching records. So the user makes a major selection from the categories on the left, say, module, and then on the browse page, they may filter subsequently for the manufacturer.
Hope this helps clarifying the issue, best regards!

Marc O.

  • Jr. Member
  • **
  • Posts: 78
    • Onrust Yacht Charters
Re: products belong in multiple categories=>product pathway takes wrong path
« Reply #4 on: January 21, 2009, 13:52:04 pm »
FYI:

I think the best way to filter on multiple categories (like you also explained in your other post here: http://forum.virtuemart.net/index.php?topic=50137.0) is using the product types together with the module on this page. However you might "abuse" the manufacturer module with the same goal.
To be honest, I don't think it's a lot of work extra. You might choose your parameters equal to your main categories (in your example "color", "fashion") and the values of these parameters to equal the subcategories ("blue", "red", "modern", "classical"). It's a bit of extra work when setting up products, but I guess it's not a show stopper especially because there doesn't seem to be an alternative.
By the way, I also experience the phenomenon of changing categories and subcats when moving from one product to the next, so I'm very curious to how you solve(d) that.

klutzon

  • Jr. Member
  • **
  • Posts: 319
  • Knuckles the Echidna
    • Rage3D
Re: products belong in multiple categories=>product pathway takes wrong path
« Reply #5 on: January 21, 2009, 18:01:31 pm »
I will need to spend a little more time with this particular issue, because I don't yet fully understand what's going on, despite the instructions given here. I'm still not 100% sure how to properly use the Product Type feature, as well as Attributes and Items (which I'm sure don't play into this particular problem), but when I've had more experience with them and I know what I'm doing better, I'll take a look at this again.

Give me some time darengr. I'm not going anywhere, but teaching myself VirtueMart from scratch takes some time... ;)

darengr

  • Beginner
  • *
  • Posts: 44
Re: products belong in multiple categories=>product pathway takes wrong path
« Reply #6 on: January 21, 2009, 20:14:37 pm »
Marc,
here is what I modified, it's about 2-3lines of code (and a couple of hours searching what goes wrong...).
I noticed, by looking at the url when pointing my cursor above the right/left arrows in the product flypage, that it prepares a url which did not contain anything about category (ie the category id). When the product belongs to just 1 category, no problem, next/previous browsing worked fine. But in the multiple ctgry case, the categories and pathway consequently were randomly switching between those categories that the next product falled into. So I thought that if I added to the url the category id, then it would force it to stay on the chosen ctgry (by the user).
I searched all files that seemed relevant, and found shop.product_details.php in administrator/components/com_virtuemart/classes/html directory. I saw where it builds up the code for the url for neighbour products, as it is called in there (line 164). as you can see, there is nothing about category_id ??? when it builds up the $url_parameters. I added at line 177 :
Code: [Select]
else
{   
if( $category_id ) {
    $url_parameters .= "&category_id=" . $category_id;
    }
}
so this way the categoryid is propagated from product flypage to product flypage, as you browse the products of the chosen category!
Then I did the same for the previous product, a few lines below, and that's it :D :D :D
In the file, you may correct the identation, the 'else' should be below the
Code: [Select]
if ( keyword !='') to be more readable, it needs a TAB. I believe this is because when somebody has used a keyword to search and browse, then there is no category involved, so it's either keyword, or category, but not both! So they mutualy exclude each other, that is why the else is needed.
I hope this will help you, it was time for me to give something back to this forum, I got so much info last 2 weeks I am trying to put up my first J/VM site, and I am happy to help you.
Best regards and please keep in touch! ;) 8)
tell me if it works for you!
darenGR

[attachment cleanup by admin]

Marc O.

  • Jr. Member
  • **
  • Posts: 78
    • Onrust Yacht Charters
Re: products belong in multiple categories=>product pathway takes wrong path
« Reply #7 on: January 21, 2009, 20:43:00 pm »
That's just great!! I tried it out and it works! (one remark: in the code you copied into your post you need to add another }).

I think this should be included in the VM code. Strange it wasn't there already.

Thanks for this modification! ;D

klutzon

  • Jr. Member
  • **
  • Posts: 319
  • Knuckles the Echidna
    • Rage3D
Re: products belong in multiple categories=>product pathway takes wrong path
« Reply #8 on: January 21, 2009, 21:19:10 pm »
Thanks for that darengr! :D

darengr

  • Beginner
  • *
  • Posts: 44
Re: products belong in multiple categories=>product pathway takes wrong path
« Reply #9 on: January 21, 2009, 22:36:31 pm »
You are all welcome! I just corrected the missing } from the example. Just let me know whether you find a combined categories filter somewhere, somehow, I really need this combined filtering functionality, preferably included in a module, or the products browse page. I know for someone knowing php it is no more than 1/2 hour work, to produce the queries and code, but I myself stopped programming many-many years ago, and then the languages were quite different. Time for some rest now, it's kind of late here!...

Marc O.

  • Jr. Member
  • **
  • Posts: 78
    • Onrust Yacht Charters
Re: products belong in multiple categories=>product pathway takes wrong path
« Reply #10 on: January 21, 2009, 22:41:02 pm »
Will get back here in case I know of something that fulfills your needs.

Cheers,
Marc

darengr

  • Beginner
  • *
  • Posts: 44
Re: products belong in multiple categories=>product pathway takes wrong path
« Reply #11 on: January 22, 2009, 15:37:03 pm »
@Marc 0:
Hi Marc, I wonder, on your site, under 'New Charter Yachts in our Fleet', what is this positions with the 4 yachts? Is this a module, or what? How did you put it there, it appears in all category browse pages. What is the common denominator, I mean the place to put such a box with 3-4 images?
regards,
darenGR

klutzon

  • Jr. Member
  • **
  • Posts: 319
  • Knuckles the Echidna
    • Rage3D
Re: products belong in multiple categories=>product pathway takes wrong path
« Reply #12 on: January 22, 2009, 16:43:57 pm »
@Marc 0:
Hi Marc, I wonder, on your site, under 'New Charter Yachts in our Fleet', what is this positions with the 4 yachts? Is this a module, or what? How did you put it there, it appears in all category browse pages. What is the common denominator, I mean the place to put such a box with 3-4 images?
regards,
darenGR

What's the link to his site? I'd like to see this, perhaps I can give some input... :)

darengr

  • Beginner
  • *
  • Posts: 44
Re: products belong in multiple categories=>product pathway takes wrong path
« Reply #13 on: January 22, 2009, 17:15:14 pm »
Press the globe next to one of his posts!..

klutzon

  • Jr. Member
  • **
  • Posts: 319
  • Knuckles the Echidna
    • Rage3D
Re: products belong in multiple categories=>product pathway takes wrong path
« Reply #14 on: January 22, 2009, 17:26:31 pm »
Press the globe next to one of his posts!..

Sorry. Genius juice is flowing slowly tonight... :D