Show correct current category in menu w/ module

  • Posts: 51
  • Thank you received: 1
11 years 11 months ago #81001

So I have a content menu listing categories and a content module listing latest products.

If you click a product in the latest products module, the categories menu has classes "current active" on the last category visited not the category of that product.

There are also a range of other issues with this, including two URLs for the one product, depending on which way you get to it.
/our-wines/product/3-1992-semillon-museum-release.html
/categories-listing/product/3-1992-semillon-museum-release.html

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

  • Posts: 82818
  • Thank you received: 13360
  • MODERATOR
11 years 11 months ago #81310

Hi,

Regarding your second issue, you simply have to select the same category listing menu in the "menu" option of your modules.

For the first issue, that's something we didn't think about actually. You can fix that by editing the file "listing_list" of the view "category" via the menu Display->Views and add the code:

if(empty($cid)){
						$database = JFactory::getDBO();
						$query = "SELECT category_id FROM ".hikashop_table('product_category').' WHERE product_id='.hikashop_getCID('product_id').' OR product_parent_id='.hikashop_getCID('product_id').' ORDER BY product_category_id ASC';
						$database->setQuery($query);
						$cid = $database->loadResult();
					}
after the code:
$cid = JRequest::getInt('category_pathway',0);

The following user(s) said Thank You: Dorgo

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

  • Posts: 51
  • Thank you received: 1
11 years 11 months ago #81313

Is this after each of the three places that

$cid = JRequest::getInt('category_pathway',0);
appears?

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

  • Posts: 13201
  • Thank you received: 2322
11 years 11 months ago #81627

Yes, try to add the code after the three sentences.

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

  • Posts: 51
  • Thank you received: 1
11 years 11 months ago #81745

yep, works great. Thanks

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

Time to create page: 0.074 seconds
Powered by Kunena Forum