X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Hide Category from sidebar (https://forum.x-cart.com/showthread.php?t=71151)

Hanypa 02-08-2015 10:02 AM

Hide Category from sidebar
 
Hello again,

I would like to know how to hide an active category item from the sidebar without disabling it.


P.S.
Not sure if I'm supposed to create a new thread for each new question or add on to my existing thread. If I'm in violation of any rules please let me know and I will adjust my post.

P.S.S.
Is there a way to bulk add existing products to a category? like the way you can add existing items to the Featured Products.

totaltec 02-08-2015 06:06 PM

Re: Hide Category from sidebar
 
New questions, belong in new threads. Unless it is just an extension of the original question.

In answer to your PSS: You can modify multiple products at once, try doing this and adding them to category.

I don't believe that hiding an active category is possible without modification of smarty or PHP code. I would start by adding the option to the category page in admin, a simple checkbox for "hide". Then you can work on the front side, taking action based on that checkbox.

Adding a custom variable to a category is relatively simple to do. I have a tutorial that shows how to do it for a product: https://www.youtube.com/watch?v=-7ESOW0pKU4

Adapting what you learn there, the same technique can easily be applied to a category.

Hanypa 02-08-2015 09:45 PM

Re: Hide Category from sidebar
 
Quote:

Originally Posted by totaltec
New questions, belong in new threads. Unless it is just an extension of the original question.

In answer to your PSS: You can modify multiple products at once, try doing this and adding them to category.

I don't believe that hiding an active category is possible without modification of smarty or PHP code. I would start by adding the option to the category page in admin, a simple checkbox for "hide". Then you can work on the front side, taking action based on that checkbox.

Adding a custom variable to a category is relatively simple to do. I have a tutorial that shows how to do it for a product: https://www.youtube.com/watch?v=-7ESOW0pKU4

Adapting what you learn there, the same technique can easily be applied to a category.


Thanks for the reply! I was hoping to be able to do it with custom CSS with an nth-child, something to the effect of

li.whateverclassname:nth-child(2){
display:none;
}

Since I've never even seen CSS before this past friday it's hard for me to figure out the class hierarchy when using inspect element in chrome. Also the seeming random use of line item class by xcart when generating the sidebar is confusing.

As for editing multiple products categories I don't seem to be able to do that. I can only delete, clone, enable, or disable multiple products at once.

totaltec 02-09-2015 04:49 AM

Re: Hide Category from sidebar
 
Ahh, we are talking about XC5. I was confused, thinking you meant XC4. You are right, there is no way to do this at the moment, besides perhaps an export/import involving modifying the spreadsheet.

tony_sologubov 02-18-2015 05:00 AM

Re: Hide Category from sidebar
 
Do you mean that if you are in iGoods category, then this category should not be clickable as shown on my snapshot?

If so, then this can be achieved relatively easily via mod:
http://awesomescreenshot.com/0494fp3183

Hanypa 02-22-2015 06:45 AM

Re: Hide Category from sidebar
 
Quote:

Originally Posted by tony_sologubov
Do you mean that if you are in iGoods category, then this category should not be clickable as shown on my snapshot?

If so, then this can be achieved relatively easily via mod:
http://awesomescreenshot.com/0494fp3183


No, I would like to have igoods active but not show up in the category sidebar at all.

tony_sologubov 03-06-2015 04:52 AM

Re: Hide Category from sidebar
 
Quote:

Originally Posted by Hanypa
No, I would like to have igoods active but not show up in the category sidebar at all.


OK, got it.

In this case you need to create a module and decorate the getCategories() method of the \XLite\View\TopCategories class. There you should walk through each category object and put it into return array unless the category is not the same one you are in.

Please, let me know if it makes sense to you.

Tony.


All times are GMT -8. The time now is 05:44 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.