View Single Post
  #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