Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

X-Cart 5 Remove Categories from Homepage body

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 03-08-2014, 09:46 PM
 
Dbaker Dbaker is offline
 

Newbie
  
Join Date: Oct 2013
Posts: 2
 

Default X-Cart 5 Remove Categories from Homepage body

I was trying to remove the icons for the categories on the body of the homepage. Any assistance would be greatly appreciated.
__________________
5.0.11
Reply With Quote
  #2  
Old 03-11-2014, 03:02 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: X-Cart 5 Remove Categories from Homepae body

Hi!

Thanks for asking! First thing to try is to apply the following CSS code via the System Settings > Look & feel > Custom CSS section in your admin area:

Code:
ul.subcategory-list { display: none; }

Please, let me know if it works for you.

Note: this approach will hide the subcategories from all the pages, not from home page only.
Reply With Quote
  #3  
Old 03-11-2014, 07:23 AM
  Luisv's Avatar 
Luisv Luisv is offline
 

Member
  
Join Date: Oct 2005
Location: Nebraska
Posts: 20
 

Default Re: X-Cart 5 Remove Categories from Homepae body

I also want to know how to remove the categories from the bottom of the front page. Tony, your fix works but it also removed the sub-categories from the categories page. So when you click on a category you are taken to the page but it then does not show the sub-categories list. Any idea how to just remove them from the bottom of the main page? I have lots so it look bad on the main page.
Thank you.
__________________
Luis Villamonte
Computer Systems Engineer
Microsoft and CompTIA Certified
www.MagicKits.com
X-cart 5.0.12
Reply With Quote
  #4  
Old 03-12-2014, 10:56 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: X-Cart 5 Remove Categories from Homepae body

Hi Luis!

In this case, you need to create a simple mod. Create the module according to the article here:
http://kb.x-cart.com/display/XDD/How+to+create+a+module

and then add an additional class to your module:
<Module-root>/View/Subcategories.php

This class will decorate the \XLite\View\Subcategories class and it will re-define the getAllowedTargets() {} method. It should return array('category'), not array('category', 'main').

Please, let me know if it makes sense to you. If it is over-complicated, I will try to explain it in more details.
Reply With Quote
  #5  
Old 03-12-2014, 11:40 AM
  Luisv's Avatar 
Luisv Luisv is offline
 

Member
  
Join Date: Oct 2005
Location: Nebraska
Posts: 20
 

Default Re: X-Cart 5 Remove Categories from Homepae body

Thank you for reply. I am confused. Should I create a file called main.php and add all the text from the "sample" except use the correct names for XLite\Module\Tony\Example; (XLite\Module\myMode\myname)? Then add "<Module-root>/View/Subcategories.php" to the bottom of the Mod?

Sorry, I guess I'll need a more detailed explanation.
__________________
Luis Villamonte
Computer Systems Engineer
Microsoft and CompTIA Certified
www.MagicKits.com
X-cart 5.0.12
Reply With Quote
  #6  
Old 03-12-2014, 01:03 PM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: X-Cart 5 Remove Categories from Homepae body

OK, let's start with one simple thing. Create the module according to the article above, but with your own Developer and Module IDs.

Once you are done, please let me know your Developer and Module IDs and I will suggest you about next step.
Reply With Quote
  #7  
Old 03-12-2014, 01:51 PM
  Luisv's Avatar 
Luisv Luisv is offline
 

Member
  
Join Date: Oct 2005
Location: Nebraska
Posts: 20
 

Default Re: X-Cart 5 Remove Categories from Homepae body

Ok, I've created a Mod and enable it on my site (to test) and it works (no errors anyway). I'm not sure that it does anything. The identifiers are "Lou" and "Catsub"


This is the code I used and named "Main.php". Thanks you.


<?php
// vim: set ts=4 sw=4 sts=4 et:
namespace XLite\Module\Lou\Catsub;
/**
* Module description
*
* @package XLite
*/
abstract class Main extends \XLite\Module\AModule
{
/**
* Author name
*
* @return string
*/
public static function getAuthorName()
{
return 'Lou';
}

/**
* Module name
*
* @return string
*/
public static function getModuleName()
{
return 'Catsub';
}

/**
* Get module major version
*
* @return string
*/
public static function getMajorVersion()
{
return '5.0';
}

/**
* Module version
*
* @return string
*/
public static function getMinorVersion()
{
return 0;
}

/**
* Module description
*
* @return string
*/
public static function getDescription()
{
return 'This Mod will show Categories on pages but not front';
}
}
__________________
Luis Villamonte
Computer Systems Engineer
Microsoft and CompTIA Certified
www.MagicKits.com
X-cart 5.0.12
Reply With Quote
  #8  
Old 03-19-2014, 05:03 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: X-Cart 5 Remove Categories from Homepae body

That is good that you created the module. Indeed, it does not do anything at this point.

Next thing to do is to create the XLite/Module/Lou/Catsub/View/Subcategories.php file with the following content:

PHP Code:
<?php

namespace XLite\Module\Lou\Catsub\View;

class 
Subcategories extends \XLite\View\Subcategories implements \XLite\Base\IDecorator
{
    public static function 
getAllowedTargets()
    {
        
$targets parent::getAllowedTargets();
        
$return = array();
        
        foreach (
$targets as $target) {
            if (
$target != 'main') {
                
$return[] = $target
            }
        }

        return 
$return;
    }
}

and it should do the trick.

I will explain what this code does: you are taking default viewer XLite\View\Subcategories and decorate (change) it that it should be displayed only upon calling cart.php?target=category , so it would not work upon calling cart.php?target=main as it works by default.

Please, try this code and let me know whether it works for you.

Tony.
Reply With Quote

The following 2 users thank tony_sologubov for this useful post:
BRDgirl (04-29-2014), qualiteam (03-19-2014)
  #9  
Old 03-19-2014, 09:34 AM
  Luisv's Avatar 
Luisv Luisv is offline
 

Member
  
Join Date: Oct 2005
Location: Nebraska
Posts: 20
 

Default Re: X-Cart 5 Remove Categories from Homepae body

Works perfectly! Thanks for your help.
__________________
Luis Villamonte
Computer Systems Engineer
Microsoft and CompTIA Certified
www.MagicKits.com
X-cart 5.0.12
Reply With Quote

The following 2 users thank Luisv for this useful post:
qualiteam (03-19-2014), tony_sologubov (03-20-2014)
  #10  
Old 03-20-2014, 04:01 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: X-Cart 5 Remove Categories from Homepae body

Happy to hear that!
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:46 PM.

   

 
X-Cart forums © 2001-2020