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

Related Products - List View?

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 04-11-2014, 06:46 AM
 
Mark N Mark N is offline
 

Senior Member
  
Join Date: Sep 2011
Posts: 121
 

Default Related Products - List View?

Using the example given by Tony on the webinar yesterday (thanks for that Tony!), trying to change the default view for related products from grid to list view. Here's what I have done:

Created in my own theme XLite\Module\Alinc\AlincTheme\View\ItemsList\Upsel lingProducts\UpsellingProducts.php with the following code:

PHP Code:
<?php

namespace XLite\Module\Alinc\AlincTheme\View\ItemsList\UpsellingProducts;

/**
 * Abstract widget
 */

abstract class UpsellingProducts extends XLite\Module\XC\Upselling\View\ItemsList\UpsellingProducts implements \XLite\Base\IDecorator
{
    protected function 
defineWidgetParams()
    {
        
parent::defineWidgetParams();

        
$this->widgetParams[static::PARAM_DISPLAY_MODE] = new \XLite\Model\WidgetParam\Set('Display mode', static::DISPLAY_MODE_TABLEtrue, array());
    }
}

That said, it doesn't seem to be working. Am I going about this all wrong?

-Mark
__________________
X-Cart Gold Plus 4.6.5
Mods - WebsiteCM Dynamic Product Tabs, Smack Digital CDSEO Pro, AlteredCart Smart Search, AlteredCart One Page Checkout, Cart Works Power Filter, Firetank Software Feed Manager
Reply With Quote
  #2  
Old 04-11-2014, 08:00 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

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

Default Re: Related Products - List View?

Mark, I am going to try and do the same thing, see what happens.
__________________
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
  #3  
Old 04-11-2014, 08:04 AM
 
Mark N Mark N is offline
 

Senior Member
  
Join Date: Sep 2011
Posts: 121
 

Default Re: Related Products - List View?

Thanks Mike - my guess is I have the file in the wrong place and/or wrong file name and/or the class I am extending wrong. I am only now beginning to understand how the MVC architecture works...
__________________
X-Cart Gold Plus 4.6.5
Mods - WebsiteCM Dynamic Product Tabs, Smack Digital CDSEO Pro, AlteredCart Smart Search, AlteredCart One Page Checkout, Cart Works Power Filter, Firetank Software Feed Manager
Reply With Quote

The following user thanks Mark N for this useful post:
totaltec (04-11-2014)
  #4  
Old 04-11-2014, 08:06 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

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

Default Re: Related Products - List View?

Well in this case it is the blind helping the blind, I am getting there, but my understanding is still newb level with XC5. The transition to OOP, MVC, and Doctrine2 logic all at once is splitting my head.
__________________
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
  #5  
Old 04-11-2014, 08:23 AM
 
Mark N Mark N is offline
 

Senior Member
  
Join Date: Sep 2011
Posts: 121
 

Default Re: Related Products - List View?

I think you're very much in the majority there. The constant need to rebuild the cache is also a real development-killer - having to wait 30-60 seconds for a rebuild with every minor PHP tweak really limits the ability to plug at things until it starts working...
__________________
X-Cart Gold Plus 4.6.5
Mods - WebsiteCM Dynamic Product Tabs, Smack Digital CDSEO Pro, AlteredCart Smart Search, AlteredCart One Page Checkout, Cart Works Power Filter, Firetank Software Feed Manager
Reply With Quote
  #6  
Old 04-12-2014, 01:56 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

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

Default Re: Related Products - List View?

Mark,
Edit: I posted some comments that were utterly wrong, removed.

Well I have attempted to duplicate your change. At first I thought I was on to something, but it proved worthless.

I did notice one thing, your namespace is wrong I believe.

namespace XLite\Module\Alinc\AlincTheme\View\ItemsList\Upsel lingProducts;

Should just be:

namespace XLite\Module\Alinc\AlincTheme\View\ItemsList;

Still doesn't work though. I notice after rebuilding cache, that the new file we are creating is not copied into the var/run folder. Also since we are decorating the other class, I thought it would create a copy in the XC/Upselling/View/ItemsList directory, something like UpsellingProductsAbstract.php

Is it the same for you? No copied file in var\run\Module\Alinc\AlincTheme\View\ItemsList ?

It seems XC is ignoring our new file.
__________________
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
  #7  
Old 04-12-2014, 08:04 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

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

Default Re: Related Products - List View?

Just discovered something that may be key to what we are doing. Searching for "extends XLite\Module" in the files produces 0 results.

So there is not a working example of a module extending another module.
__________________
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
  #8  
Old 04-14-2014, 06:17 AM
 
Mark N Mark N is offline
 

Senior Member
  
Join Date: Sep 2011
Posts: 121
 

Default Re: Related Products - List View?

Mike,

Ok, so I can say that in my tests at least the module is being copied properly, but not to where you are looking - it is in var/run/classes/Xline/Module/Alinc/AlincTheme/View/ItemsList/UpsellingProducts/UpsellingProducts.php

that said, it's not running it, at least as far as I can tell. The copy as it appears in the var/run shows up as:

PHP Code:
<?php

namespace XLite\Module\Alinc\AlincTheme\View\ItemsList\UpsellingProducts;

/**
 * Abstract widget
 */
abstract class UpsellingProducts extends \XLite\Module\XC\Upselling\View\ItemsList\UpsellingProductsAbstract implements \XLite\Base\IDecorator
{
    protected function 
defineWidgetParams()
    {
        
parent::defineWidgetParams();

        
$this->widgetParams[static::PARAM_DISPLAY_MODE] = new \XLite\Model\WidgetParam\Set('Display mode', static::DISPLAY_MODE_TABLEtrue, array());
    }
}

And it is in fact turning it into UpsellingProductsAbstract when it compiles.

Not sure why your code isn't making it at least that far,maybe an error in your Main.php? Attaching mine here.

And like yourself I couldn't find anyone who has made a module that extends another module, although obviously there will be cases where people want to do exactly that.
Attached Files
File Type: php Main.php (2.4 KB, 45 views)
__________________
X-Cart Gold Plus 4.6.5
Mods - WebsiteCM Dynamic Product Tabs, Smack Digital CDSEO Pro, AlteredCart Smart Search, AlteredCart One Page Checkout, Cart Works Power Filter, Firetank Software Feed Manager
Reply With Quote
  #9  
Old 04-14-2014, 06:33 AM
 
Mark N Mark N is offline
 

Senior Member
  
Join Date: Sep 2011
Posts: 121
 

Default Re: Related Products - List View?

Ok, onto something here. Looks like people have extended other modules, for example the Social module (and others) extend SimpleCMS, the bit of code you need is:


PHP Code:
namespace XLite\Module\CDev\GoSocial\View;

/**
 * Main page page
 *
 * @LC_Dependencies ("CDev\SimpleCMS")
 */
abstract class Page extends \XLite\Module\CDev\SimpleCMS\View\CustomerPage implements \XLite\Base\IDecorator


The Key is the @LC_Dependencies bit.

So in our case we will be dependent on XC\Upselling.

Trying this out...
__________________
X-Cart Gold Plus 4.6.5
Mods - WebsiteCM Dynamic Product Tabs, Smack Digital CDSEO Pro, AlteredCart Smart Search, AlteredCart One Page Checkout, Cart Works Power Filter, Firetank Software Feed Manager
Reply With Quote

The following user thanks Mark N for this useful post:
totaltec (04-14-2014)
  #10  
Old 04-14-2014, 06:43 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

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

Default Re: Related Products - List View?

Very cool! Thanks Mark, this help me tremendously in some of my other projects. Waiting to hear back from you on how your tests go. I may be able to attempt this again myself later today...
__________________
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
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 05:32 AM.

   

 
X-Cart forums © 2001-2020