Just a quick one.
Google Maps is great for embedding a quick map on a Contact Us page - but often the pop-up ballon that appears giving more info about the address can look out of place - especially if the frame you are displaying it in is smaller than the balloon.
Its tough to find official documentaion on how to easily customise these embedded maps, but here is a nice post with details of some of the extra variables that appear in the querystring for the url of the iframe:
http://mapki.com/wiki/Google_Map_Parameters
So, if you have the one address that you just want to display the red "pushpin" for, and NOT the balloon, do the following:
1) In the embedded code you have copied from Google, locate the parameter in the iframe src url (not the href for the text View Larger Map) that says "iwoc=A"
2) Change it to "iwoc=B"
According to mapwiki (see link above) it changes the balloon's position to be over the pushpin for B - and as that doesn't exist in this case, it doesn't appear - woo hoo!
There is probably a neater, less voodoo, way to do this - but this works for me for now!
Monday, 12 July 2010
Wednesday, 7 July 2010
Make selecting size attribute compulsory in ZenCart
I love Zencart most of the time - but its implementation of size/colours attributes always causes me headaches.
A common request is for the size to be compulory when adding a product to the basket.
But the official Zen cart way of doing it involves a complex process of adding a dummy option to the top and forcing that to be default. Not a great way - especially as you can still end up with an item in the basket that has a size of "Please select..."
So I've written a quick n dirty javascript/jQuery function to check if the option has been chosen:
In the tpl_product_info_display.php template add the following javascript above the line that says
Note: You will have to repeat the $("input[name*='id[1]']").click() function for as many possible attributes you have. (Calls for some sort of loop surely?!)
Then change the following line:
to
So that it forces the checkOptions() function to run each time you try to add something to the cart
I admit this is very quick-and-dirty - and it only caters for 1 option at a time on the page.
And I know purists among you will bemoan the fact that this is just client side validation, and what if the visitor doesn't use Javascript etc etc.
Well it works for me for for now.
Who knows maybe I'll post an update with all these issues addressed? For now, enjoy!
A common request is for the size to be compulory when adding a product to the basket.
But the official Zen cart way of doing it involves a complex process of adding a dummy option to the top and forcing that to be default. Not a great way - especially as you can still end up with an item in the basket that has a size of "Please select..."
So I've written a quick n dirty javascript/jQuery function to check if the option has been chosen:
In the tpl_product_info_display.php template add the following javascript above the line that says
<?php echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . "\n"; ?>
<script type="javascript">
var clickedOption = false;
$(document).ready(function() {
$("input[name*='id[1]']").click(function() {
clickedOption = true;
});
});
function checkOptions(){
if(clickedOption){
return true;
}else{
alert("Please select a size");
return false;
}
}
</script>
Note: You will have to repeat the $("input[name*='id[1]']").click() function for as many possible attributes you have. (Calls for some sort of loop surely?!)
Then change the following line:
<?php echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . "\n"; ?>
to
<?php echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data" onSubmit="return checkOptions();"') . "\n"; ?>
So that it forces the checkOptions() function to run each time you try to add something to the cart
I admit this is very quick-and-dirty - and it only caters for 1 option at a time on the page.
And I know purists among you will bemoan the fact that this is just client side validation, and what if the visitor doesn't use Javascript etc etc.
Well it works for me for for now.
Who knows maybe I'll post an update with all these issues addressed? For now, enjoy!
Monday, 28 June 2010
10 ZenCart Plugins you really need to install
I'm working on this post to list my favourite plugins that I almost always use on my Zen Cart sites - I'm up to nine at the moment - I'm just working out wihich others are worthy enough to make it into my top ten. Any suggestions? I'd be interested....
Monday, 14 June 2010
Add slideshow to Squarespace using Jquery
I was asked by a client to add a simple fading slideshow animation to their Squarespace website:
This works best for images that are all the same size that just need to fade into one another. Make sure the images are not too hi res as there is no prelaoding code in here - so users may experience a delay as each picture loads
Take a look at the site so you can see the slideshow in action
http://abbeyfurnitureonline.squarespace.com/
This works best for images that are all the same size that just need to fade into one another. Make sure the images are not too hi res as there is no prelaoding code in here - so users may experience a delay as each picture loads
Take a look at the site so you can see the slideshow in action
http://abbeyfurnitureonline.squarespace.com/
Friday, 21 May 2010
Beware the one-click install for Wordpress
I love Wordpress most of the time. It simple, has an extremely customisable front end, a lovely intuitive admin interface that almost all clients can get to grips with easily - oh and its free!
So I have built many a site with it - some simple, some complicated - always to great effect and general client satisfaction. Go me!
I had been recommended a new hosting provider that a client of mine had been using and their rates seemed very reasonable for just a small Wordpress blogging site. So I took the plunge and signed up with them. Plus they had Fantastico one-click installs available for most of major packages - Wordpress included.
So I have built many a site with it - some simple, some complicated - always to great effect and general client satisfaction. Go me!
I had been recommended a new hosting provider that a client of mine had been using and their rates seemed very reasonable for just a small Wordpress blogging site. So I took the plunge and signed up with them. Plus they had Fantastico one-click installs available for most of major packages - Wordpress included.
Wednesday, 14 April 2010
$_POST Variables for Image input buttons
I've just run up against something weird.
My PHP code which was detecting which of two buttons a user had clicked on a form had suddenly stopped working. Or to be exact, had stopped working in Internet Explorer.
I was using the $_POST variable of the button name to detect if it had been clicked.
For example the two buttons were called "Register" and "Subscribe" - so if I wanted to see if the Subscribe button had been clicked I would perform the following check in the submit process:
My PHP code which was detecting which of two buttons a user had clicked on a form had suddenly stopped working. Or to be exact, had stopped working in Internet Explorer.
I was using the $_POST variable of the button name to detect if it had been clicked.
For example the two buttons were called "Register" and "Subscribe" - so if I wanted to see if the Subscribe button had been clicked I would perform the following check in the submit process:
Remove all products and categories from a Zen Cart
Don't you just hate it when you realise you need to clear out all your old products and categories froma ZenCart install and start again? Particularly if you have done an import using EasyPopulate and the client(ahem) has given you a spreadsheet of duff data?!
Simply login to phpMyAdmin and run these statements on your database.
WARNING: This will delete ALL your product data!
Simply login to phpMyAdmin and run these statements on your database.
WARNING: This will delete ALL your product data!
DELETE FROM zen_customers; DELETE FROM zen_customers_info; DELETE FROM categories; DELETE FROM categories_description; DELETE FROM group_pricing; DELETE FROM manufacturers; DELETE FROM manufacturers_info; DELETE FROM products; DELETE FROM products_attributes; DELETE FROM products_attributes_download; DELETE FROM products_description; DELETE FROM products_discount_quantity; DELETE FROM products_options; DELETE FROM products_options_values; DELETE FROM products_options_values_to_products_options; DELETE FROM products_to_categories;
Subscribe to:
Posts (Atom)