X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Thumbnail size in xc5 (https://forum.x-cart.com/showthread.php?t=69263)

DTS 12-02-2014 03:10 PM

Re: Thumbnail size in xc5
 
Is there a way to disable the resizing of the icons so we can control our layout without software intervention?

totaltec 12-02-2014 03:39 PM

Re: Thumbnail size in xc5
 
Quote:

Originally Posted by DTS
Is there a way to disable the resizing of the icons so we can control our layout without software intervention?

I think it may be more trouble than it is worth. Looks like the resize function is triggered in XLite\Model\Base\Image. The method I'm looking at is resizeIcon

That would be a starting point, but I see so much code that depends upon this that I think it would be a massive undertaking to disable it completely. Much easier to simply embrace it and twist it to your own advantage.

tony_sologubov 12-03-2014 02:46 AM

Re: Thumbnail size in xc5
 
Guys, I just wrote an article about disabling resizing routine here:
http://kb.x-cart.com/display/XDD/Working+with+image+resizing+routine

Check it out!

totaltec 12-03-2014 03:30 AM

Re: Thumbnail size in xc5
 
Very cool Tony! Your mod is an elegant way to handle this.

flipp2k 02-23-2015 09:21 AM

Re: Thumbnail size in xc5
 
Hi Tony,

I'm also having trouble with resizing thumbnail images. I tried the solution you suggested but it also isn't working for me. Any Ideas?

tony_sologubov 02-24-2015 04:47 AM

Re: Thumbnail size in xc5
 
Hello @flipp2k and welcome to X-Cart community.

Could you please give me more details about what you were trying to achieve, what you did and what actually happened instead of what you expected to see?

ant99 03-05-2015 10:46 AM

Re: Thumbnail size in xc5
 
Everything here seems really useful and exactly fitting for what I need. I am wanting to change the category thumbnail size to 300x300. I'm also wanting to change the product thumbnail size to 300x300. As of now, the categories are showing 160x160. Also the products in the grid view are showing 160x160.

However, I tried integrating this into my theme and it doesn't seem to be working at all? What am I missing? Attached are the files that I've added to my module. Any insight is appreciated!

/XLite/Module/DevID/ModuleID/View/ProductBox.php
PHP Code:

<?php
namespace XLite\Module\DevID\ModuleID\View;

abstract class 
ProductBox extends \XLite\View\ProductBox implements \XLite\Base\IDecorator

{   

    protected function 
defineWidgetParams() 
        { 
            
parent::defineWidgetParams(); 

            
$this->widgetParams += array( 
                
self::PARAM_PRODUCT_ID => new \XLite\Model\WidgetParam\ObjectId\Product('Product Id'0true), 
                
self::PARAM_ICON_MAX_WIDTH => new \XLite\Model\WidgetParam\Int
                    
'Maximal icon width'300true 
                
), 
                
self::PARAM_ICON_MAX_HEIGHT => new \XLite\Model\WidgetParam\Int
                    
'Maximal icon height'300true 
                
), 
            ); 
        }

}
?>


/XLite/Module/DevID/ModuleID/View/Subcategories.php
PHP Code:

<?php
namespace XLite\Module\DevID\ModuleID\View;

class 
Subcategories extends \XLite\View\Subcategories implements \XLite\Base\IDecorator
{
   
    protected function 
defineWidgetParams()
    {
        
parent::defineWidgetParams();

        
$this->widgetParams += array(
            
self::PARAM_DISPLAY_MODE => new \XLite\Model\WidgetParam\Set(
                
'Display mode'$this->getDisplayMode(), true$this->displayModes
            
),
            
self::PARAM_ICON_MAX_WIDTH => new \XLite\Model\WidgetParam\Int(
                
'Maximal icon width'300true
            
),
            
self::PARAM_ICON_MAX_HEIGHT => new \XLite\Model\WidgetParam\Int(
                
'Maximal icon height'300true
            
),
        );
    }

}
?>


tony_sologubov 03-10-2015 12:08 PM

Re: Thumbnail size in xc5
 
@ant99 it should have worked out. Could you please send me your module, so I could check out what is wrong exactly?

Tony.

tony_sologubov 03-17-2015 11:42 AM

Re: Thumbnail size in xc5
 
Thanks for sending me the module.

The correct implementation of the \XLite\Module\Dev-ID\Module-ID\View\Subcategories class should be as follows:

PHP Code:

<?php

namespace XLite\Module\Dev-ID\Module-ID\View;

abstract class 
Subcategories extends \XLite\View\Subcategories implements \XLite\Base\IDecorator
{
    public function 
setWidgetParams(array $params)
    {
        
parent::setWidgetParams($params);

        
$this->widgetParams[static::PARAM_ICON_MAX_WIDTH]->setValue(300);
        
$this->widgetParams[static::PARAM_ICON_MAX_HEIGHT]->setValue(300);
    }
}


In other words, you should decorate the setWidgetParams() method instead of defineWidgetParams() one.

ant99 03-26-2015 10:27 PM

Re: Thumbnail size in xc5
 
Quote:

Originally Posted by tony_sologubov
In other words, you should decorate the setWidgetParams() method instead of defineWidgetParams() one.


Thank you, that works perfectly for the Category images. However, I tried to apply the fix for Product thumbnail images also and had no success. Here is what I have.

PHP Code:

<?php
namespace XLite\Module\Dev-ID\Module-ID\View;

abstract class 
ProductBox extends \XLite\View\ProductBox implements \XLite\Base\IDecorator

{   

    public function 
setWidgetParams(array $params)
        { 
            
parent::setWidgetParams($params); 

            
$this->widgetParams[static::PARAM_ICON_MAX_WIDTH]->setValue(300);
            
$this->widgetParams[static::PARAM_ICON_MAX_HEIGHT]->setValue(300);
        }

}

?>


Any suggestions? Thanks for your help.


All times are GMT -8. The time now is 09:03 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.