Add Text Before Price In Magento Cart

Here was another toughy. We wanted to add the text “Regular Price:” in front of the priceĀ on one of our sites running Magento, and after a bit of searching, found the correct file and line to add it to.

Go to /app/design/frontend/default/yourtheme/template/catalog/product/price.phtml and find this line:

<span class=”regular-price” id=”product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>”><?php echo Mage::helper(’core’)->currency($_price,true,true) ?></span>

And change it to read:

<span class=”regular-price” id=”product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>”><?php echo $this->__(’Regular Price: ‘), Mage::helper(’core’)->currency($_price,true,true) ?></span>

Save your file and have a look at your results.

You should now have “Regular Price: in front of your price in Magento

How To Add A Close Button To Magento Product Image Pop-ups

We wanted to add a “Close Window” button to a Magento store for one of our clients. Turns out, it’s one of the easiest things to do with Magento!

Open /app/design/frontend/default/yourtheme/template/catalog/product/gallery.phtml.

Just under the first line of code: <?php $_width=$this->getImageWidth() ?>

Add this line of code and save the file.

<div-left”><a href=”javascript:window.close()”><img border=”0″ src=”/images/btn-close.png”></a></div>

Make sure you create an image for the close button, name it btn-close.png and put it in your images directory.

If you wanted to just do a link instead, use this code: <a href=”javascript:window.close()”>Close Window</a>

You should be done. That’s how we added a “Close Button” to our Magento product images.

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.