PHP
Replacement zoomer for Magento
by Huy Dinh on Aug.31, 2008, under PHP, Random
One of Magento's little annoyances is the main image preview method - like everything else about Magento, it comes with bells and whistles. Is that a bad thing? Well, yes.
Before I complain, look at the original zoomer.
I'd argue whether the average user needs to zoom into an image using the a slider, because imo, they wither want to see the whole image or as much detail as possible (maximum zoom). Luckily the front end is much easier to change than the back end, so I've made my own zoomer tool which is infinitely easier to use (because you can't actually control anything) you just roll the mouse pointer over the image, a little box will appear that shows a portion of the actual image with maximum zoom. Move the mouse pointer and the zoomed image will be updated accordingly.
Easy, peasy, nifty.
It was written specificly for Magento 1.1 so uses Prototype 1.4 instead of the latest.
To use it, follow similar instructions to installing lightbox:
Put the .js in the main js folder: /js/huy/.
Put the .css in your theme's css folder: /skin/frontend/default/default/css/huy/
In /app/design/frontend/default/default/template/catalog/product/view/ delete the following lines:
-
<p class="a-center" id="track_hint"><?php echo $this->__('Double click on above image to view full picture') ?></p>
-
<div class="image-zoom" id="track_outer">
-
<img id="zoom_out" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_out.gif') ?>" alt="<?php echo $this->__('Zoom Out') ?>" class="btn-zoom-out" />
-
<div id="track">
-
<div id="handle"></div>
-
</div>
-
<img id="zoom_in" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_in.gif') ?>" alt="<?php echo $this->__('Zoom In') ?>" class="btn-zoom-in" />
-
</div>
-
<script type="text/javascript">
-
Event.observe(window, 'load', function() {
-
product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out');
-
});
-
</script>
You may want to change the styling of zoomer.css to taste.
Remember to minify it!
Minify Magento’s JS and CSS
by Huy Dinh on Aug.31, 2008, under PHP
I don't want to sound like a broken record but Magento is slow. So why then aren't the JS and CSS minified by default?
My love for optimisation knows no boundaries, as such, I've taken it on myself to provide an automated solution - here it is:
It's a simple script that scans through each theme's layout/page.xml and minifies each JS and CSS it finds.
To use the script, you need to have the Java runtime environment installed, php must have shell execution abilities and your webserver must have write permissions inĀ each theme's page.xml (/app/design/frontend/default/default/layout/page.xml), css folder (/skin/frontend/default/default/css) and the main js folder (/js). You also need to have YUI Compressor's build jar file on your server (download it here).
One last thing is to edit the script with your Magento's root folder and location of YUI Compressor's jar file.
It is recommended that you put the script into a password protected folder!
Oh, one last thing: I haven't tested the script in a Windows environment so it may not work.
Crooked Tongues Store – refreshed
by Huy Dinh on Jul.22, 2008, under PHP
Crooked Tongues, the famous online sneakers store has been updated with a new ecommerce system - one built from scratch, based on the CMS I built for Freeview... well, not quite "based on" but there are similar features and functionality - especially the recursive navigation/categorisation structure whereby each category can have child categories... there's a name for that design pattern but I don't remember what it is.
Built using the Code Igniter framework by Ca Phun Ung and I, it's very fast and robust and was completed in record time of aproximately 2 months. Most of the backend logic was done by me, templates and javascript by Ca Phun.
I'm pretty proud of this shopping cart system... it has a little bit of data redundancy but it makes the system faster so even though I'm an optimisation evangelist, I think having the redundancy is a good call.
The system is quite flexible - you can sell shoes with multiple size/quantities, apparel with up to 20 different sizes, accessories without a size, homogeneous products with 1 difference... such as a choice of colour.
Anyway, hop over to http://www.crookedtongues.com for some street culture.
Slots Logic – a slot machine search engine
by Huy Dinh on Feb.06, 2008, under PHP, Random
Previously known as Slots Boffin, Slots Logic is a website with information and reviews about slot machines. I don't know when it was launched but is live now, and it's pretty good.
The site is nice and colourful with good icons and graphics. My part in the site was the PHP engine that searches for specific slot machines.
So, if you want to know more about slot machines, go to http://www.slotslogic.com!





