Jump to content

[solved] Changing Product Image Size On Category Pages.


Recommended Posts

My image is 1290 x 846. I go to the back office and click preferences>Images then change my category image preference to a smaller size and for some reason it stays only one size and doesn't fit in the boarder (See image) How do i edit the image size?

 

Thank you

-Ray

post-461376-0-23332000-1375592537_thumb.png

Edited by vekia (see edit history)
Link to comment
Share on other sites

I did that though :/ 1290 x 846 is the pictures size, i divided it by 3 for the category pictures and it did not move. I even set it to the original size and nothing happens. Right now the Category preference is 645 x 432 which is 1290 x 846 / 2. Still no luck :/

Link to comment
Share on other sites

I mean that each image in your store has got own "type", each image types used in your store are defined in the preferences > images tab. Thumbnail that i pasted above also.

 

I suppose that you wondering how to check image type?

just right click on it and copy its url, in the picture name you will see something from this list:

X9x8Twa.png

 

 

just paste the name here

Link to comment
Share on other sites

Oh see that's what im not sure of. that picture is from my "Category" page. like i make a category for my products ex. "Women" then i click there and see all the products in that category. So when i go to the Category_Alysum and change the size it doesnt work :/

Link to comment
Share on other sites

but the thumbnail looks like product picture, so it is picture for product, not for "category"

from pictures list only circled "image types" are related to the products

oCKbrow.png

 

i just wondering which one is on thumbnail, so please share the image name (right click on product thumbnail > get picture url)

Link to comment
Share on other sites

thanks, so your thumb for product "cover" category items list is "home_alysum"

 

the size of it is 645x845

and it isn't proportional for 1290 x 846 ;)

 

setup the size, save changes and regenerate thumbnails for "home_alysum"

Link to comment
Share on other sites

Now im in a pickle because the Carousel for products is messed up. The person who made it says it uses home_Alysum and large_Alysum so that is a little bit of an issue because i fixed the one i really needed to fix now the carousel is messy so i need to figure its best settings. here is a picture

 

 

post-461376-0-27371200-1375638117_thumb.png

Link to comment
Share on other sites

just create new image type in the preferences > images

  1. click on add new
  2. define new picture name, for example carousel_alysum
  3. define correct width and height (the same as original home_alysum)
  4. check only "products"

save changes and regenerate thumbnails for this image type.

 

then edit the carousel module to use this new image type

Link to comment
Share on other sites

alright i can do all that no problem but the editing the carousel module to use the new image type is where it gets scary for me I have no idea how to do that, i'd assume it's in manage hooks? sorry im a web dev noob.

Link to comment
Share on other sites

in the php file this is what i get (this is the default one from my themes file but not on my ftp)

 

 

<?php

class productsCarousel extends Module

{

private $_html = '';

private $_postErrors = array();

 

function __construct()

{

$this->name = 'productsCarousel';

$this->tab = 'others';

$this->version = '1.1';

$this->author = 'Promokit Co.';

$this->need_instance = 0;

 

parent::__construct();

 

$this->page = basename(__FILE__, '.php');

$this->displayName = $this->l('Products Carousel on the homepage');

$this->description = $this->l('Displays Products Carousel in Your Homepage');

}

 

function install()

{

if (!Configuration::updateValue('CAROUSEL_PRODUCTS_NUMBER', 8) OR

!Configuration::updateValue('PRODUCTS_TYPE', 0) OR

!Configuration::updateValue('PRODUCTS_VISIBLE', 5) OR

!Configuration::updateValue('PRODUCTS_TO_SCROLL', 1) OR

!Configuration::updateValue('CELL_WIDTH', 164) OR

!parent::install() OR

!$this->registerHook('header') OR

!$this->registerHook('displayHome')

) return false;

return true;

}

 

 

public function uninstall()

{

return (parent::uninstall());

}

 

public function getContent()

{

$output = '<div style="width:800px; margin:0 auto"><h2>'.$this->displayName.'</h2>';

if (Tools::isSubmit('submitHomeFeatured'))

{

Configuration::updateValue('PRODUCTS_TYPE', intval(Tools::getValue('products_type')));

$nbr = intval(Tools::getValue('nbr'));

$products_visible = intval(Tools::getValue('products_visible'));

$products_to_scroll = intval(Tools::getValue('products_to_scroll'));

$cell_width = intval(Tools::getValue('cell_width'));

if (!$nbr OR $nbr <= 0 OR !Validate::isInt($nbr))

$errors[] = $this->l('Invalid number of products');

else

Configuration::updateValue('CAROUSEL_PRODUCTS_NUMBER', $nbr); /*---------------------*/

if (!$products_visible OR $products_visible <= 0 OR !Validate::isInt($products_visible))

$errors[] = $this->l('Invalid number of products number');

else

Configuration::updateValue('PRODUCTS_VISIBLE', $products_visible); /*---------------------*/

if (!$products_to_scroll OR $products_to_scroll <= 0 OR !Validate::isInt($products_to_scroll))

$errors[] = $this->l('Invalid number of visible products');

else

Configuration::updateValue('PRODUCTS_TO_SCROLL', $products_to_scroll);/*---------------------*/

if (!$products_to_scroll OR $products_to_scroll <= 0 OR !Validate::isInt($products_to_scroll))

$errors[] = $this->l('Invalid number of products to scroll');

else

Configuration::updateValue('CELL_WIDTH', $cell_width);

if (isset($errors) AND sizeof($errors))

$output .= $this->displayError(implode('<br />', $errors));

else

$output .= $this->displayConfirmation($this->l('Settings updated'));

}

$output .= "</div>";

return $output.$this->displayForm();

}

 

public function displayForm()

{

 

$output = '

<form action="'.$_SERVER['REQUEST_URI'].'" method="post" style="width:800px; margin:0 auto">

<fieldset><legend><img src="'.$this->_path.'logo.png" width="16" height="16" alt="" title="" />'.$this->l('Carousel settings').'</legend>

<h4>Products type</h4>

<div style="overflow:hidden">

<label style="text-align:right; width:200px;">'.$this->l('Featured products').'</label><input type="radio" name="products_type" value="1" '.((Configuration::get('PRODUCTS_TYPE') == 1) ? 'checked="checked" ' : '').'/>

</div>

<div style="overflow:hidden">

<label style="text-align:right; width:200px;">'.$this->l('New products').'</label>

<input type="radio" name="products_type" value="0" '.((Configuration::get('PRODUCTS_TYPE') == 0) ? 'checked="checked" ' : '').'/>

</div>

<div style="overflow:hidden">

<label style="text-align:right; width:200px;">'.$this->l('Special products').'</label>

<input type="radio" name="products_type" value="2" '.((Configuration::get('PRODUCTS_TYPE') == 2) ? 'checked="checked" ' : '').'/>

</div>

<h4>Quantity Products</h4>

<div style="overflow:hidden">

<label style="text-align:right; width:200px;">'.$this->l('The number of all products').'</label>

<input type="text" size="1" name="nbr" value="'.(Configuration::get('CAROUSEL_PRODUCTS_NUMBER')).'" />

</div>

<br/>

<div style="overflow:hidden">

<label style="text-align:right; width:200px;">'.$this->l('The number of visible products').'</label>

<input type="text" size="1" name="products_visible" value="'.(Configuration::get('PRODUCTS_VISIBLE')).'" />

</div>

<br/>

<div style="overflow:hidden">

<label style="text-align:right; width:200px;">'.$this->l('The number of items to scroll').'</label>

<input type="text" size="1" name="products_to_scroll" value="'.(Configuration::get('PRODUCTS_TO_SCROLL')).'" />

</div>

 

<br/><br/>

<input type="submit" name="submitHomeFeatured" value="'.$this->l('Save').'" class="button" />

</fieldset>

</form>';

return $output;

}

 

public function getImages($products, $params) {

 

foreach ($products as $key => $product) {

 

$imgholder = Image::getImages((int)($params['cookie']->id_lang), $product["id_product"]);

foreach ($imgholder as $k => $img) {

if ($k < 2) {

if ($k == 0) {

$productData[$key]["prodCover"] = Image::getCover($product["id_product"]); // get product cover image

 

} else {

$productData[$key]["image"] = $img["id_image"];

}

$productData[$key]["data"] = $product;

}

}

}

 

return $productData;

}

 

public function hookDisplayHome($params)

{

$idLang = (int)($params['cookie']->id_lang);

$category = new Category(Context::getContext()->shop->getCategory(), Configuration::get('PS_LANG_DEFAULT'));

$nb = (int)(Configuration::get('CAROUSEL_PRODUCTS_NUMBER'));

 

$orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby'));

$orderWay = Tools::getProductsOrder('way', Tools::getValue('orderway'));

 

$new = Product::getNewProducts($idLang, 0, (int)(Configuration::get('CAROUSEL_PRODUCTS_NUMBER'))); /*get new products*/

$featured = $category->getProducts($idLang, 1, ($nb ? $nb : 10)); /* get featured products */

$specials = Product::getPricesDrop($idLang, 0, (Configuration::get('CAROUSEL_PRODUCTS_NUMBER')), false, $orderBy, $orderWay); /* get special products */

 

switch (Configuration::get('PRODUCTS_TYPE')) {

case 0:

$products = $this->getImages($new, $params);

break;

case 1:

$products = $this->getImages($featured, $params);

break;

case 2:

$products = $this->getImages($specials, $params);

break;

default:

$products = $this->getImages($featured, $params);

}

 

$this->smarty->assign(array(

'pth' => $this->_path,

'carouselProducts' => $products,

'products_type' => Configuration::get('PRODUCTS_TYPE'),

'visible_products' => Configuration::get('PRODUCTS_VISIBLE'),

'products_to_scroll' => Configuration::get('PRODUCTS_TO_SCROLL')

));

 

return $this->display(__FILE__, 'productsCarousel.tpl');

}

 

public function hookHeader($params)

{

$this->context->controller->addCSS($this->_path.'css/productsCarousel.css', 'all');

$this->context->controller->addJS($this->_path.'js/jquery.hoverdir.js');

$this->context->controller->addJS($this->_path.'js/modernizr.custom.97074.js'); // for hover effect

}

 

public function hookTop($params)

{

return $this->hookDisplayHome($params);

}

 

}

Link to comment
Share on other sites

in the .tpl i get (also this is from the default theme not from my ftp)

 

 

{if $page_name == "index"}

<div class="clear"></div>

<!-- jCarousel library -->

<div class="preloadImg"><div></div></div>

<div id="productsCarousel" class="main">

<div class="container_border">

{if $products_type == 0}

<h4>{l s='New products' mod='productsCarousel'}</h4>

{elseif $products_type == 1}

<h4>{l s='Featured products' mod='productsCarousel'}</h4>

{elseif $products_type == 2}

<h4>{l s='Special products' mod='productsCarousel'}</h4>

{/if}

<button class="nav_prev"></button>

<button class="nav_next"></button>

<div class="viewport_container">

<div class="viewport">

<div class="jCarouselLite">

{if $carouselProducts}

<ul id="da-thumbs" class="da-thumbs carouFredSel">

{foreach from=$carouselProducts item=product name=products}

{assign var='productLink' value=$link->getProductLink($product.data.id_product, $product.data.link_rewrite)}

<li class="block_product ajax_block_product slide">

<div class="carouselContainer">

<a href="{$productLink}" title="{$product.data.legend}" class="slide-animate product_image_crs">

<img src="{$link->getImageLink($product.data.link_rewrite, "{$product.prodCover.id_product}-{$product.prodCover.id_image}", $img_name.home)}" alt="{$product.data.name|escape:html:'UTF-8'}" class="add_to_cart_image" />

{if isset($product.image)}

<div>

<img src="{$link->getImageLink($product.data.link_rewrite, "{$product.data.id_product}-{$product.image}", $img_name.large)}" alt="{$product.data.name|escape:html:'UTF-8'}" />

</div>

{/if}

</a>

<a class="f_title" href="{$productLink}" title="{$product.data.legend}">{$product.data.name|escape:htmlall:'UTF-8'|truncate:35}</a>

{if $product.data.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}

<div class="price">

 

<span>{convertPrice price=$product.data.price_without_reduction}</span>

{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}

<a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.data.id_product}" href="{$link->getPageLink('cart.php')}?qty=1&id_product={$product.data.id_product}&token={$static_token}&add" title="{l s='Add to cart' mod='productsCarousel'}">{l s='Add to cart' mod='productsCarousel'}</a>

{else}

<a href="{$productLink}" class="button exclusive">{l s='View' mod='productsCarousel'}</a>

{/if}

</div>

{/if}

</div>

</li>

{/foreach}

</ul>

{else}<b>{l s='No products' mod='productsCarousel'}</b>{/if}

</div>

</div>

</div>

</div>

</div>

<script type="text/javascript">

$(function() {

$('#da-thumbs > li > div.carouselContainer a').each( function() { $(this).hoverdir(); } );

});

</script>

{/if}

Link to comment
Share on other sites

it's really hard to help without sources. Image definition you've got here:

 

<img src="{$link->getImageLink($product.data.link_rewrite, "{$product.prodCover.id_product}-{$product.prodCover.id_image}", $img_name.home)}" alt="{$product.data.name|escape:html:'UTF-8'}" class="add_to_cart_image" />

 

<img src="{$link->getImageLink($product.data.link_rewrite, "{$product.data.id_product}-{$product.image}", $img_name.large)}" alt="{$product.data.name|escape:html:'UTF-8'}" />

Link to comment
Share on other sites

  • 1 month later...
  • 2 years later...
  • 6 months later...
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...