Remove light box and adaptive template issue

  • Posts: 12
  • Thank you received: 0
10 years 11 months ago #107344

Hi,

I have been using hikashop for a while now and realy like it. But I have 2 questions :

1** how can I remove the ligntbox to show image in real size on the product page?

2** how can I remove the width and height set to the main image on the product page?
I explain : I want to set a max-width and max-height on the main image so I need to remove the height and width set in the html, I have already searched the view file show_block_img.php but can't figure out how to get rid of them. My php skills aren't good enough.
could you tell me if I am looking through the right file or even better what code to edit/remove pls?

Thx in advance.
Dan

Last edit: 10 years 11 months ago by Danydan. Reason: precisions

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

  • Posts: 2334
  • Thank you received: 403
10 years 11 months ago #107438

Hi Dan,

For your first question, you can simply edit the view addimage/product and remove the onclick code inside (this one):

onclick="SqueezeBox.fromElement(this,{parse: 'rel'});return false;"
.
Lightbox won't appear anymore.

About your second question, I think the different image options available in the main configuration (system>configuration>main>images) can help you do what you want.

I hope this will help you.

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

  • Posts: 12
  • Thank you received: 0
10 years 11 months ago #107669

Hi,

I am wondering if I am missing something important :

first :
I have no file called "addimage" in the product views or in any other folder in the views.
I searched for the string

onclick="SqueezeBox.fromElement(this,{parse: 'rel'});return false;"
in all the on server hikashop files but can't find it, what am I doing wrong?

secondly :

I have tried all combinations in system>configuration>main>images but the images on product page still have a with and height specified in html code, to be clear this is what I want to change :
the code I have on my website for main images on product page is :
<img id="hikashop_main_image_9" width="570" height="737" "="" alt="" src="/media/com_hikashop/upload/image.jpg">

I want to remove height and width atribute like this :
<img id="hikashop_main_image_9" "="" alt="" src="/media/com_hikashop/upload/image.jpg">

I can't figure out how to do that in the administration. Isn't there a view file to modify to guet this goal?

Sorry to insist but this is important for me and would realy like to get it working.
Regards,
Dan

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

  • Posts: 13201
  • Thank you received: 2322
10 years 11 months ago #107726

Hi,

1. The view is in the backend template ;)

2. You can probably edit the view "product / show_block_img" and remove $width and $height of the line:

echo $this->image->display(@$image->file_path,true,@$image->file_name,'id="hikashop_main_image'.$variant_name.'" style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle"','id="hikashop_main_image_link"', $width,  $height);

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

  • Posts: 12
  • Thank you received: 0
10 years 11 months ago #107870

Hi,
I found the view! Didn't think the backend templates could change the front end.
I deleted the code as you said but it didn't change anything... exept that I have the barcode instead of the clicked image in the lightbox... :S

For the width and height I had already deleted the with and height as you said but it still is atributed in the html...

If you have a bit of time maybe you could have a look at the product page I uploaded on my server here :
www.dm-webmaster.com/bijoux-femme/i-love...n-argent-925-blanchi

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

  • Posts: 2334
  • Thank you received: 403
10 years 11 months ago #107910

Hi,

According to your two problems you are perhaps editing the wrong view.
Are yous sure the views you customize are related to your template?

PS: I checked your website and the width/height attribute doesn't appear (and the images are really big)

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

  • Posts: 12
  • Thank you received: 0
10 years 11 months ago #108005

thx for visiting the website, I'll have to check out the views I edited seriously, I don't have much time right now, I'll do it as soon as possible, thx for helping me.

I'll post here if I manage to get it to work.

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

  • Posts: 12
  • Thank you received: 0
10 years 11 months ago #109242

Hi,

I finaly found the file I had to edit to remove the lightbox of main image and thumbnail, this one :

administrator\components\com_hikashop\helpers\image.php

To prevent loading lightbox from thumbnails, I replaced this line :

$html = '<a title="'.$alt.'" class="hikashop_image_small_link" rel="{handler: \'image\'}" href="'.$this->uploadFolder_url.$path.'" onclick="SqueezeBox.fromElement(this,{parse: \'rel\'});return false;" target="_blank" onmouseover="return hikashopChangeImage(\''.$addpopup.'\',\''.$this->uploadFolder_url_thumb.'\',\''.$this->thumbnail_x.'\',\''.$this->thumbnail_y.'\',this,\''.$alt.'\');" '.$optionslink.'>'.$html.'</a>';

by this :
$html = '<div class="hikashop_image_small_link"  onmouseover="return hikashopChangeImage(\''.$addpopup.'\',\''.$this->uploadFolder_url_thumb.'\',\''.$this->thumbnail_x.'\',\''.$this->thumbnail_y.'\',this,\''.$alt.'\');">'.$html.'</div>';

and to prevent lightbox loading from the main image I replaced this line :
$html = '<a title="'.$alt.'" rel="{handler: \'image\'}" target="_blank" href="'.$this->uploadFolder_url.$path.'" onclick="SqueezeBox.fromElement(this,{parse: \'rel\'});return false;" '.$optionslink.'>'.$html.'</a>';

by this :
$html = '<div>'.$html.'</div>';

The problem is that I can't make these modifications through the view manager in backend so I guess it will be overidden when I update hikashop... I'll have to keep track of these modifications to redo them in that case.
Or is there a way to properly overide this file?

I'm still looking for the height and width atribute on main images, I'll edit tis message when I manage.

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

  • Posts: 2334
  • Thank you received: 403
10 years 11 months ago #109257

Glad to see you found a solution.
If you want to keep your modification for future updates, there is a solution.
First you have to create a folder in templates\YOUR_TEMPLATE\html\com_hikashop\administrator\helpers\
Then just create a file named image.override.php and include this inside:

<?php

include $originalFile;

class hikashopImageHelperOverride extends hikashopImageHelper {
}

You can now redefine the function you edited inside the tags, including your modification.
Thus, in case of update, this function will still be used. But you have to be aware that if we modify this function, then your code could became unappropriated.
If for example we add a new variable to the fuction or anything else, the function you edited will still be use and could cause errors in a new feature. So you better keep an eye on this file and think about it if you encounter an error message one day ;)

I hope it helped you!

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

  • Posts: 12
  • Thank you received: 0
10 years 11 months ago #109294

Managed to remove the height and width atribute on main image, this is what I did, (always in the same file : administrator\components\com_hikashop\helpers\image.php )

deleted :

if(!$reduceSize && !$module ){
    $options.=' height="'.$this->thumbnail_y.'" width="'.$this->thumbnail_x.'" ';
}

and also deleted :
if(x) image.width=x;
if(y) image.height=y;

I am now getting comfused with the tip you told me about the override technique, I can't get it to work... My php skills are pretty bad...
this is my final file :

File Attachment:

File Name: image.txt
File Size:26 KB

what would the file image.override.php look like?

Attachments:

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

  • Posts: 2334
  • Thank you received: 403
10 years 11 months ago #109303

It depends of where you did your customizations.
Let's say you did it in the function imageLoad (it's an example), it will looks like

<?php
 
include $originalFile;
 
class hikashopImageHelperOverride extends hikashopImageHelper {
  
  function imageLoad($variables){
   //the fuction you edited
  }

}

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

  • Posts: 12
  • Thank you received: 0
10 years 11 months ago #109310

Managed!
I'll keep in mind these modifications may bug on updates.

Thx for helping me!

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

  • Posts: 846
  • Thank you received: 92
10 years 11 months ago #109358

When you say override it mean implemented the same php file name in other location( target file) .
if we implement only one function, only this function ll be override ? exact ?
so override file mean re implemented the same function name define in the source file ? exact ?

thank's

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

  • Posts: 26034
  • Thank you received: 4006
  • MODERATOR
10 years 11 months ago #109417

Hi,

This class override is a HikaShop specific system which allow you to extends and override any function in any HikaShop class.
It requires some development/php skills.

As you can see in the override file, the classname is different and it extends from the original HikaShop class.
At this moment, by creating a function in the override class, it will override the original function.
So you can rewrite an HikaShop function.

We uses this technique because you do not require to copy/paste the complete original file.
If we make some improvements in a class/helper, the override class will not remove new function.
It could generates some errors (if we add a parameter in a function that you have overridden and this function is uses by a view) but for most cases, it will work good.

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: 846
  • Thank you received: 92
10 years 11 months ago #109440

Thank's

1)i was not aware that we can do this with hikashop .
In joomla php override like for layout view we need to inform the a php file that there is other layout file ...
Is it the same for override php hikashop file ? ( implement a API and use/call an API is not he same )

2) since joomla is all about PHP file , could you confirm we can't do that with joomla ( core & extension)

3) i know java language but not php
in java => class OverrideClassName extends ParentClassName
strange ....PHP5 introduce abstraction class ....
Could you confirm that hikashop don't use abstract class ?

4) does hikashop use an internal framework other than joomla ?
in a way joomla is a framework with GUI for backend and frontEnd !!
( Drupal ll have a wellknow framework symfony )


Regard's


thank's

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

  • Posts: 26034
  • Thank you received: 4006
  • MODERATOR
10 years 11 months ago #109444

Hi,

PHP extends
www.php.net/manual/en/language.oop5.basi...e.oop5.basic.extends
In PHP "extends" is different than "implements". Class abstraction is possible but we don't use it.

HikaShop overrides
It is just something we put in the HikaShop helper because we want to have a huge flexibility.
We do not talk about it because it requires some good development skills.
Creating a good function override is a high level of customization and without the knowledge, it can break HikaShop.

View overrides could solve most of customization needs.
That's why we include the view editing interface in the HikaShop backend. It allow you to override every HikaShop views (front-end and backend).
For these view overrides, we use the Joomla structure/system.
For class/helpers overrides, we made our little structure/system.

Framework
We use the Joomla framework, but we have some internal functions like "hikashop_get" which allow to load a class.
This function have a little bit of code which will check if an override exists or not.
But HikaShop is a Joomla component based on the Joomla framework.

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.

Time to create page: 0.114 seconds
Powered by Kunena Forum