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
  #31  
Old 08-08-2014, 12:27 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

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

I can't update because this is a temporary site I'm setting up in preparation of migrating the existing xcart to 5.X. I don't have a license to use with this site because of that.

Go here for the package https://www.dropbox.com/s/msjclt2vhoc5qku/FasterThanYours-ProductsOnHomePage-v5_1_3.tar
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #32  
Old 08-11-2014, 11:50 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

Hi!

Thank you for sending the module.

In order to fix the problem you should edit the classes/XLite/Module/FasterThanYours/ProductsOnHomePage/View/Custom/ProductsOnHomePage.php file and replace the following line
PHP Code:
class ProductsOnHome extends \XLite\View\ItemsList\Product\Customer\Category\ACategory 

with the next one:
PHP Code:
class ProductsOnHomePage extends \XLite\View\ItemsList\Product\Customer\Category\ACategory 

Then, you should regenerate the cache and the problem will be fixed.
__________________
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
  #33  
Old 08-12-2014, 08:42 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

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

Ok finally it's working! Thanks.

Now onto my next problems. I wanted the "New", "Coming Soon" tags on the dogs. The only way to get that is to turn on the Product Advisor Module.

Now that I've done that, I'm seeing several issues. It's now listing separately below all the products, "New Arrivals" and "Coming Soon"

Additionally, see in the attached picture, when I go to the All Products Category, it's listing all products in duplicate and then again below that "New Arrivals" and "Coming Soon". All of the categories are the same way, but I only have a few test products, so the All Products shows the problem better.

And as a side note, I'd like to also color each Products listing Pink or Blue depending upon membership to the Female or Males category.
Attached Thumbnails
Click image for larger version

Name:	Category look.jpg
Views:	58
Size:	162.4 KB
ID:	3867  
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #34  
Old 08-13-2014, 11:10 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

1) You can disable showing New Arrivals and Coming soon products in the Product Advisor settings. Tick on the following settings:
- Display "New arrivals" block on sidebar (otherwise in center area)
- Display "Coming soon" block on sidebar (otherwise in center area)

2) In order to hide All products from category pages, you should edit the ProductsOnHomePage viewer class and add the following method there:

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

        return 
$return
    } 

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
  #35  
Old 08-13-2014, 05:04 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,

1. Fixed.

2. I don't understand where in the code I should do that?
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #36  
Old 08-14-2014, 02: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

Ok I think I figure out where to put the code, because that fixed the duplication problem. But I'm having trouble with the Home page showing a product "ghosted" that has no inventory and is disabled. See Home Page 2014_0814.jpg I've also attached my Product Advisor Settings.jpg file

Just in case you want the current Package https://www.dropbox.com/s/z41ummw6ip033qb/FasterThanYours-ProductsOnHomePage-v5_1_3.tar

Here's the current ProductsOnHomePage.php file:
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';
    }

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')->findAll();
        }

        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_GRID_COLUMNS]->setValue(3);

        unset(
$this->widgetParams[self::PARAM_SHOW_DISPLAY_MODE_SELECTOR]);
        unset(
$this->widgetParams[self::PARAM_SHOW_SORT_BY_SELECTOR]);
    }
}
Attached Thumbnails
Click image for larger version

Name:	Home Page 2014_0814.jpg
Views:	56
Size:	64.9 KB
ID:	3875  Click image for larger version

Name:	Product Advisor Settings.jpg
Views:	54
Size:	59.1 KB
ID:	3876  
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #37  
Old 08-15-2014, 04:50 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!

I just wrote an article that describes the task you need to achieve:
http://kb.x-cart.com/display/XDD/Searching+entities+in+repositories#Searchingentiti esinrepositories-Pull...mplexcondition

Please, let me know if it helps.

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
  #38  
Old 08-17-2014, 08:37 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,

I'm sorry I don't get this. What you wrote on that page, to me, doesn't even vaguely come close to what I've already gotten. I don't understand what needs to go where.

I'm at the end of my rope because none of the old developers I worked with don't even want to to touch XC5 because of well, many reasons.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #39  
Old 08-18-2014, 03:29 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

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

Quote:
Originally Posted by minfinger
I'm at the end of my rope because none of the old developers I worked with don't even want to to touch XC5 because of well, many reasons.
I'll touch it. Drop me a line!
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following user thanks totaltec for this useful post:
tony_sologubov (08-18-2014)
  #40  
Old 08-18-2014, 05:50 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

Sorry for too technical explanation.

Let me try to explain it in simpler way.
1) In your module you need to create Model/Repo/Product.php with the content as provided here:
http://kb.x-cart.com/display/XDD/Searching+entities+in+repositories#Searchingentiti esinrepositories-Pull...mplexcondition

Make sure that you specify right namespace though!

2) In the View/Custom/ProductsOnHomePage.php file you should replace the following line:

PHP Code:
$this->allProducts = \XLite\Core\Database::getRepo('XLite\Model\Product')->findAll(); 

with the next one:

PHP Code:
$this->allProducts = \XLite\Core\Database::getRepo('XLite\Model\Product')->findAllActive(); 

3) Rebuild the cache.

It should do the trick.

Tony.

Quote:
Originally Posted by minfinger
Tony,

I'm sorry I don't get this. What you wrote on that page, to me, doesn't even vaguely come close to what I've already gotten. I don't understand what needs to go where.

I'm at the end of my rope because none of the old developers I worked with don't even want to to touch XC5 because of well, many reasons.
__________________
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
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 10:23 PM.

   

 
X-Cart forums © 2001-2020