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
  #71  
Old 02-16-2015, 12:35 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

For that, add the following methods to the AllProducts class:

PHP Code:
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_DISPLAY_MODE]->setValue(static::DISPLAY_MODE_LIST);
    } 

Please, let me know if it does the trick for you.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!

Last edited by tony_sologubov : 03-10-2015 at 03:53 AM.
Reply With Quote
  #72  
Old 02-16-2015, 04:50 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

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

Which location do I make that file? I tried adding it to any of the other AllProducts.php files and none of them worked.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #73  
Old 02-18-2015, 04:51 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 should add these lines to the <X-Cart>/classes/XLite/Module/Tony/ProductsDemo/View/ItemsList/Product/Customer/AllProducts.php file. If lines do not do the trick, please send me the final version of the module with lines there and I will check what might be wrong.

Tony.
__________________
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
  #74  
Old 02-18-2015, 05:22 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

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

From the php log: <?php die(1); ?>
[18-Feb-2015 08:00:17 America/Chicago] PHP Fatal error: Access level to XLite\Module\Tony\ProductsDemo\View\ItemsList\Prod uct\Customer\AllProducts::setWidgetParams() must be public (as in class XLite\View\ItemsList\Product\Customer\ACustomerAbs tract) in /home/myyamaha/public_html/lpo/var/run/classes/XLite/Module/Tony/ProductsDemo/View/ItemsList/Product/Customer/AllProducts.php on line 57

When I changed that to public the front page didn't load and just made a giant xlite error log that kept building.

Here's the file
https://www.dropbox.com/s/2dgpii0040lzzin/Tony-ProductsDemo-v5_1_2%20-%202015_0218.tar?dl=0
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #75  
Old 02-18-2015, 06:11 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

Hi Michael!

Sorry, that was my bad. The correct version of setWidgetParams() must be as follows:
PHP Code:
public function setWidgetParams(array $params)
    {
        
parent::setWidgetParams($params);
 
        
$this->widgetParams[static::PARAM_DISPLAY_MODE]->setValue(static::DISPLAY_MODE_LIST);
    } 

Please, let me know if it works for you.

Tony.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!

Last edited by tony_sologubov : 03-10-2015 at 03:53 AM.
Reply With Quote
  #76  
Old 02-18-2015, 08:44 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

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

That got the front page to show the products, but only in Grid Mode.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #77  
Old 02-19-2015, 04:31 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

Quote:
Originally Posted by minfinger
That got the front page to show the products, but only in Grid Mode.

I see. Please replace this line
PHP Code:
$this->widgetParams[static::PARAM_GRID_COLUMNS]->setValue(static::DISPLAY_MODE_LIST); 
with the next one:
PHP Code:
$this->widgetParams[static::PARAM_DISPLAY_MODE]->setValue(static::DISPLAY_MODE_LIST); 
and it should do the trick.
__________________
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
  #78  
Old 02-19-2015, 07:08 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

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

Oh that's great, thank you.

Can you tell me how to set the default display mode in that Category view to List?
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #79  
Old 02-20-2015, 02:24 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

Quote:
Originally Posted by minfinger
Can you tell me how to set the default display mode in that Category view to List?

I am not sure I am following this question.

Do you mean that you want to display products in List mode in certain category? In this case, you will need to add a corresponding if condition around this line:
PHP Code:
$this->widgetParams[static::PARAM_DISPLAY_MODE]->setValue(static::DISPLAY_MODE_LIST); 
__________________
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
  #80  
Old 02-20-2015, 02:33 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

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

Tony,

No I want it to be List mode by default on the whole site.
__________________
X-Cart 4.3
Joomla
Among other things
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 11:59 PM.

   

 
X-Cart forums © 2001-2020