How To Disable Enlarge Image View In Magento

We had a client that wanted to disable the double click feature of the main product image in Magento, but still be able to click on the thumbnail images to expand them. We think this is a great little feature and will be implementing on more sites of ours.

Here’s how to do it:

Go to js/varien/product.js

Find this code:

this.scale(0);

Event.observe(this.imageEl, ‘dblclick’, this.toggleFull.bind(this));

Event.observe($(zoomInEl), ‘mousedown’, this.startZoomIn.bind(this));

Event.observe($(zoomInEl), ‘mouseup’, this.stopZooming.bind(this));

Event.observe($(zoomInEl), ‘mouseout’, this.stopZooming.bind(this));

Event.observe($(zoomOutEl), ‘mousedown’, this.startZoomOut.bind(this));

Event.observe($(zoomOutEl), ‘mouseup’, this.stopZooming.bind(this));

Event.observe($(zoomOutEl), ‘mouseout’, this.stopZooming.bind(this));

},

and comment out the second line of code, like this:

this.scale(0);

//Event.observe(this.imageEl, ‘dblclick’, this.toggleFull.bind(this));

Event.observe($(zoomInEl), ‘mousedown’, this.startZoomIn.bind(this));

Event.observe($(zoomInEl), ‘mouseup’, this.stopZooming.bind(this));

Event.observe($(zoomInEl), ‘mouseout’, this.stopZooming.bind(this));

Event.observe($(zoomOutEl), ‘mousedown’, this.startZoomOut.bind(this));

Event.observe($(zoomOutEl), ‘mouseup’, this.stopZooming.bind(this));

Event.observe($(zoomOutEl), ‘mouseout’, this.stopZooming.bind(this));

},

Save the file. Now, when you look at your products in Magento, the main image still shows up, you can still zoom in and out with the slider, but double clicking has no effect. We also moved the code that said “Double click on above image to view full picture” that is in your theme/template/catalog/product/view/media.phtml file to the end of the file and changed wording to “Click above image for larger view”.

That’s kind of the summary of how we disabled the double click to zoom feature in Magento.

Can’t Login to Magento Admin

We’ve been working on a new Magento Commerce site for another client. We’re doing this all on our server then will transfer it to their server when completed. We’re trying to keep most of the settings we’ll be using after the transfer, so of course we have selected admin as being secure using https. Problem is, we’re not going to buy a SSL cert just for the setup. We’ve been working on this site for weeks now and all of a sudden, we can’t login to admin in Magento! We did a little research and found the answer, so here it is.

Open file app/code/core/Mage/Core/Model/Session/Abstract/Varien.php. Find the line that reads:

// set session cookie params

session_set_cookie_params(

$this->getCookie()->getLifetime(),

$this->getCookie()->getPath(),

$this->getCookie()->getDomain(),

$this->getCookie()->isSecure(),

$this->getCookie()->getHttponly()

);

Change it to read:

// set session cookie params

session_set_cookie_params(

$this->getCookie()->getLifetime(),

$this->getCookie()->getPath()

//$this->getCookie()->getDomain(),

//$this->getCookie()->isSecure(),

// $this->getCookie()->getHttponly()

);

Save the file. Empty your browser cache and reload the page.

That should take care of the problem cant log in to Magento admin.

What File Has The Config Settings For Magento

If you’re looking for the database config settings for your Magento store, they are in the /app/etc/local.xml file.

How To Copy Magento Site To Different Site

If you’re into saving time and work like we are, you’ll appreciate this article. As you may have figured out from this website, we’ve done tons of tweaks and improvements to Magento commerce sites over the last year plus. We’re fairly happy with what we have on our main websites, but to think of creating a new Magento site from scratch? No thanks. So here’s what we did with our newest magento site.

Followed the directions on our other posts on this website to copy and tar all the files on the current site. Backup the database, as outlined on this website in another article.

Then you do a wget and bring all the files to your new website. Untar the files and import the database on the new website.

Next, you need to go into the database on the new website and change the entries in core_config_data to the new web url settings. Next, go to the files on the new server and modify /app/etc/local.xml to the new sites database info.

One more step. You have to go to var/cache on the server and empty the cache directory.

Now, you should have a duplicate of your Magento site on the new website. Make certain that it’s reading the right database before you start making changes though!

That’s our shortcut to creating a completely new Magento site from an existing Magento install.