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

All Products on front page, similar to featured products

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #51  
Old 11-14-2014, 06:24 AM
 
DBK Web Builder DBK Web Builder is offline
 

Advanced Member
  
Join Date: Apr 2014
Location: NJ
Posts: 67
 

Default Re: All Products on front page, similar to featured products

I want to show a page of all top level categories ... with an image on a page

but not the home page ?

Just a top level store page ?

There must be a way - I must be missing something.

thanks

Donna

(XC4.something not sure)
__________________
4.6.2 and 4.6.3
http://www.DBKWebBuilder.com
Reply With Quote
  #52  
Old 11-14-2014, 07:38 AM
 
DBK Web Builder DBK Web Builder is offline
 

Advanced Member
  
Join Date: Apr 2014
Location: NJ
Posts: 67
 

Default Re: All Products on front page, similar to featured products

Duh - never mind - Mike already showed me how to do this here - and I did it - I just cuoldn't find it since it's been like 6mo since I worked on this

http://forum.x-cart.com/showthread.php?t=69144

thanks

DonnaNJ
__________________
4.6.2 and 4.6.3
http://www.DBKWebBuilder.com
Reply With Quote

The following user thanks DBK Web Builder for this useful post:
tony_sologubov (11-17-2014)
  #53  
Old 12-11-2014, 04:29 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: All Products on front page, similar to featured products

Tony,

Any thought's on how to place all Products on the front page similar to how we've done this, but instead of the Grid, we do it as the List format?
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #54  
Old 12-16-2014, 04:48 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

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

Default Re: All Products on front page, similar to featured products

You need to decorate your viewer class (I believe, you decorated \XLite\View\ItemsList\Product\Customer\Category\AC ategory one) and add following line into setWidgetParams() function:

PHP Code:
$this->widgetParams[static::PARAM_DISPLAY_MODE]->setValue(static::DISPLAY_MODE_LIST); 

Please, let me know if it works out for you.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #55  
Old 12-16-2014, 02:30 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: All Products on front page, similar to featured products

Tony,

At the very end of the php file is this:

PHP Code:
// disabling ability to sort products and switch between display modes
    
protected function defineWidgetParams()
    {
        
parent::defineWidgetParams();

        
$this->widgetParams[self::PARAM_GRID_COLUMNS]->setValue(3);

        unset(
$this->widgetParams[self::PARAM_SHOW_DISPLAY_MODE_SELECTOR]);
        unset(
$this->widgetParams[self::PARAM_SHOW_SORT_BY_SELECTOR]);
    }


Are you saying all I need to do is change:

PHP Code:
$this->widgetParams[self::PARAM_GRID_COLUMNS]->setValue(3); 

to:

PHP Code:
$this->widgetParams[static::PARAM_DISPLAY_MODE]->setValue(static::DISPLAY_MODE_LIST); 


I tried that and it didn't do anything.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #56  
Old 12-16-2014, 08:15 PM
 
juancho juancho is offline
 

Advanced Member
  
Join Date: Mar 2014
Posts: 47
 

Default Re: All Products on front page, similar to featured products

I have an issue when doing this:

PHP Code:
// disabling ability to sort products and switch between display modes
    
protected function defineWidgetParams()
    {
        
parent::defineWidgetParams();

        
$this->widgetParams[self::PARAM_GRID_COLUMNS]->setValue(3);

         unset(
$this->widgetParams[self::PARAM_SHOW_DISPLAY_MODE_SELECTOR]);
    }


The display options are gone (that's what I wanted). The Sort menu is displayed but does not work, When I try to sort, let say by newest, it does not display any product at all. Any idea what it is happening?
I have also tried:
PHP Code:
$this->widgetParams[self::PARAM_SHOW_SORT_BY_SELECTOR]->setValue(true); 

but no change
Thanks
__________________
X-Cart Business 5.0.12
Reply With Quote
  #57  
Old 12-17-2014, 01:42 PM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

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

Default Re: All Products on front page, similar to featured products

Quote:
Originally Posted by minfinger
Tony,

At the very end of the php file is this:

PHP Code:
// disabling ability to sort products and switch between display modes
    
protected function defineWidgetParams()
    {
        
parent::defineWidgetParams();

        
$this->widgetParams[self::PARAM_GRID_COLUMNS]->setValue(3);

        unset(
$this->widgetParams[self::PARAM_SHOW_DISPLAY_MODE_SELECTOR]);
        unset(
$this->widgetParams[self::PARAM_SHOW_SORT_BY_SELECTOR]);
    }


Are you saying all I need to do is change:

PHP Code:
$this->widgetParams[self::PARAM_GRID_COLUMNS]->setValue(3); 

to:

PHP Code:
$this->widgetParams[static::PARAM_DISPLAY_MODE]->setValue(static::DISPLAY_MODE_LIST); 


I tried that and it didn't do anything.

This code should be placed into setWidgetParams() method, not into defineWidgetParams() one.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #58  
Old 12-17-2014, 01:49 PM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

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

Default Re: All Products on front page, similar to featured products

@juancho and @minfinger, you should not use construction like this:

PHP Code:
unset($this->widgetParams[self::PARAM_SHOW_DISPLAY_MODE_SELECTOR]); 

instead you have to use it like this:
PHP Code:
$this->widgetParams[self::PARAM_SHOW_SORT_BY_SELECTOR]->setValue(false); 

Again, setting your own values for widget parameters must be done in the setWidgetParams() method, not in the defineWidgetParams() one.

@juancho, if you have more questions about your task, let us discuss it in this thread:
http://forum.x-cart.com/showthread.php?t=70749

I would prefer this thread to be dedicated to @minfinger's task.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote

The following user thanks tony_sologubov for this useful post:
juancho (12-17-2014)
  #59  
Old 01-25-2015, 05:35 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: All Products on front page, similar to featured products

Tony,

I finally have time to get back to where I can work on this site again. I've had a heck of a couple of months. I've been trying to get this List View Mode to work and I'm not having any success. Right now this is the code I'm working with and all it does is screw up the front page.

PHP Code:
<?php

namespace XLite\Module\FasterThanYours\ProductsOnHomePage\View\Custom;

/**
 *
 * @ListChild (list="center.bottom", zone="customer", weight="300")
 */

class ProductsOnHomePage extends \XLite\View\ItemsList\Product\Customer\Category\ACategory
{
    protected 
$allProducts null;

    protected function 
getHead()
    {
        
'My products';
    }

//  This hides All products from category pages and stops duplication

    
public static function getAllowedTargets() 
    { 
        
$return = array('main');

        return 
$return
    }  

// this method defines that you do not need pagination
    
protected function getPagerClass()
    {
        return 
'\XLite\View\Pager\Infinity';
    }

// this method defines that all products must be displayed in this section
    
protected function getData(\XLite\Core\CommonCell $cnd$countOnly false)
    {
        if (!isset(
$this->allProducts)) {
            
$this->allProducts = \XLite\Core\Database::getRepo('XLite\Model\Product')->findAllActive();
        }

        return 
true == $countOnly
            
count($this->allProducts)
            : 
$this->allProducts;
    }

// disabling ability to sort products and switch between display modes
    
protected function defineWidgetParams()
    {
        
parent::defineWidgetParams();

        
$this->widgetParams[self::PARAM_SHOW_DISPLAY_MODE_SELECTOR]->setValue(false); 
        
$this->widgetParams[self::PARAM_SHOW_SORT_BY_SELECTOR]->setValue(false); 
    }

    Protected function 
setWidgetParams()
    {
        
parent::setWidgetParams();
 
        
$this->widgetParams[static::PARAM_GRID_COLUMNS]->setValue(static::DISPLAY_MODE_LIST);
    }
}
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #60  
Old 01-25-2015, 09:39 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: All Products on front page, similar to featured products

PHP Code:
class ProductsOnHomePage extends \XLite\View\ItemsList\Product\Customer\Category\ACategory 

Do you want to create a new widget, or modify the existing one? To hack into the existing widget you should declare your class as follows:

PHP Code:
class ProductsOnHomePage extends \XLite\View\ItemsList\Product\Customer\Category\ACategory implements \XLite\Base\IDecorator 
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



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 02:20 PM.

   

 
X-Cart forums © 2001-2020