Reduce Cart Image Size

  • Posts: 118
  • Thank you received: 3
11 years 7 months ago #127503

-- HikaShop version -- : Business 2.2.2

Hello, is there a way to change the image size in the cart? All other image sizes are good so I don't want to alter those, just in the cart we don't need them that large. Possible? if so, how please :)

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
11 years 7 months ago #127519

Hi,

You'll probably be able to do it with some CSS code customization like :

.hikashop_cart_module_product_image.hikashop_cart_value img {
width: 42px;
}

Please Log in or Create an account to join the conversation.

  • Posts: 118
  • Thank you received: 3
11 years 7 months ago #127589

Thanks Mohamed, I'll give that a shot.

Please Log in or Create an account to join the conversation.

  • Posts: 118
  • Thank you received: 3
11 years 7 months ago #127590

ok, just tried it into the front end CSS (in HS configuration/display/css) and it didn't change anything... any other ideas?

Please Log in or Create an account to join the conversation.

  • Posts: 83832
  • Thank you received: 13572
  • MODERATOR
11 years 7 months ago #127607

Hi,

You should use that CSS instead:
.hikashop_cart_product_image_value img{
width: 42px !important;
}

Please Log in or Create an account to join the conversation.

  • Posts: 118
  • Thank you received: 3
11 years 7 months ago #127624

Thanks Nicolas, although it still didn't work, everything stays the same.

Please Log in or Create an account to join the conversation.

  • Posts: 118
  • Thank you received: 3
11 years 7 months ago #127627

ok, I have just tried something which kind of worked:

Configuration/Main/Images - I changed the thumbnail size to 80 wide, this is perfect for what I want in the checkout. Although, this changed the size of the images in the product pages which should be 200 wide. How can I specify just the cart images to be one size, and the product images to be another size?

Please Log in or Create an account to join the conversation.

  • Posts: 26235
  • Thank you received: 4036
  • MODERATOR
11 years 7 months ago #127638

Hi,

Well.. There is another kind of solution if the CSS does not work : the view override.
So in the view "checkout | cart" (because I suppose that you want to change the image size in the checkout cart) there is this code:

	<td class="hikashop_cart_product_image_value">
		<?php if(!empty($row->images)){
			$image = reset($row->images);
			$width = $this->config->get('thumbnail_x');
			$height = $this->config->get('thumbnail_y');
			$this->image->checkSize($width,$height,$image);
			if(!$this->config->get('thumbnail')){
				echo '<img src="'.$this->image->uploadFolder_url.$image->file_path.'" alt="'.$image->file_name.'" id="hikashop_main_image" style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle" />';
			}else{ ?>
				<div class="hikashop_cart_product_image_thumb" >
				<?php echo $this->image->display($image->file_path,true,$image->file_name,'style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle"', '', $width, $height); ?>
				</div>
		<?php }
		} ?>
	</td>
By changing the values of $widht and $height you will change the width and the height of the thumbnail images.
So
			$width = $this->config->get('thumbnail_x');
			$height = $this->config->get('thumbnail_y');
will become:
			$width = 80;
			$height = 80;
For example...

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 118
  • Thank you received: 3
11 years 7 months ago #127689

Perfect Jerome! Thanks heaps, I went in to the cart views and looked at all that code and tried various alterations, didn't go to "checkout/cart" though. Thanks again.

Please Log in or Create an account to join the conversation.

  • Posts: 59
  • Thank you received: 1
10 years 2 months ago #193144

Hi, I followed the exact same steps but everything stayed the same?

Am I missing something here?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 2 months ago #193150

Hi,

Are you sure to have edited the view "checkout / cart" in the correct template ?

Please Log in or Create an account to join the conversation.

  • Posts: 59
  • Thank you received: 1
10 years 2 months ago #193219

I really only have one template for front-end listed in my Display > Views section...

Please Log in or Create an account to join the conversation.

  • Posts: 83832
  • Thank you received: 13572
  • MODERATOR
10 years 2 months ago #193345

If you followed the steps described here, it should have worked. You must have missed something.
For example, the checkout/cart.php view file is for the cart display on the checkout while the product/cart.php file is for the cart module display. So maybe you wanted to edit the cart module display and you should have edited the product/cart.php view file, or you actually wanted to edit the checkout cart display but you actually edited the other view.
Or maybe you have some caching on your website which prevented you from seeing the change ?

Please Log in or Create an account to join the conversation.

  • Posts: 59
  • Thank you received: 1
10 years 2 months ago #193412

So this is getting really sick now. Why must this always happen to me.

I actually have 2 different installations of hikashop. "Hikashop Starter" and "Hikashop Business".

When I do this edit in starter edition, everything works fine.

But when I do this in business edition, noting happens. And by the way, when I upgraded my starter to business, all my css got resetted. Could this be related?

Best Regards

Please Log in or Create an account to join the conversation.

  • Posts: 83832
  • Thank you received: 13572
  • MODERATOR
10 years 2 months ago #193423

The modification is the same for the Starter and the Business edition, and it will work the same.
So the problem is either a simple thing you overlooked when doing the change or some cache preventing you from seeing the change.
It has nothing to do with the upgrade or the CSS.

HikaShop indeed update its core CSS files on each update. That's actually Joomla doing that.
That's why, when you edit the CSS of HikaShop via the Display tab of the HikaShop configuration an override file is created so that you don't loose your changes when you update. So if you lose them, it means that you must have edited the CSS file directly instead of via the interface, which we don't recommend:
www.hikashop.com/support/support/documen...ize-the-display.html

Please Log in or Create an account to join the conversation.

  • Posts: 59
  • Thank you received: 1
10 years 2 months ago #193506

Ok Like I said earlier.... I have 2 editions. One starter and one business.

On the starter, voila this works like magic... however on the business (2.4.0) nada.

Can you please do this change in any business 2.4.0 edition that you have and confirm that it actually works?? Or else I can upload my entire site and please have a look at it.

And no. I have checked cache, and even tried on different computers... nothing changes, still same thumbnail size.

Please Log in or Create an account to join the conversation.

  • Posts: 59
  • Thank you received: 1
10 years 2 months ago #193556

Btw, this is how my code looks like:

<tr class="row<?php echo $k; ?>">
	<?php if($this->params->get('show_cart_image')){ ?>
		<td data-title="<?php echo JText::_('CART_PRODUCT_IMAGE'); ?>" class="hikashop_cart_product_image_value">
				<?php
					$width = 60;
					$height = 60;
					if(!empty($row->images)){
					$image = reset($row->images);
					$this->image->checkSize($width,$height,$image);
				}else{
					$image = null;
					}
					if($image && !$this->config->get('thumbnail')){
						echo '<img src="'.$this->image->uploadFolder_url.$image->file_path.'" alt="'.$image->file_name.'" id="hikashop_main_image" style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle" />';
										}else{ ?>

I can do a echo "hello world" and it shows up jsut under the cart no problem under checkout. Really, its just the image size i cant change... And I don't have a clue about php...

Last edit: 10 years 2 months ago by madjedo.

Please Log in or Create an account to join the conversation.

  • Posts: 83832
  • Thank you received: 13572
  • MODERATOR
10 years 2 months ago #193570

Hi,

I can do the change and confirm that it works.
I suppose that your issue doesn't come from the Business edition but the fact that you're using the 2.4 on that website and not on the others and that you have that bug:
www.hikashop.com/forum/install-update/87...images-shrunken.html

Please Log in or Create an account to join the conversation.

  • Posts: 59
  • Thank you received: 1
10 years 2 months ago #193625

updated it and it works now... almost drove me crazy lol. thanks

Please Log in or Create an account to join the conversation.

Time to create page: 0.140 seconds
Powered by Kunena Forum