Thursday, January 26, 2012

Change prestashop stores google maps zoom


Good day visitor.

In prestashop there is "Stores" section.

To change zoom of the default map which loads up after navigating there, go to:


  • /js/ folder
  • open stores.js
Go to line 196.

You will see code like this:

map = new google.maps.Map(document.getElementById('map'), {
center: new google.maps.LatLng(defaultLat, defaultLong),
zoom: 15,
mapTypeId: 'roadmap',
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}
});

Change Zoom to whatever you like.

Good luck!

Wednesday, January 18, 2012

Days in months of year


Are you lazy to count how many there are days in months of certain year?

I have created small php counter for my self.

Its pretty useful so i want to share it.

http://www.drunksick.com/index.php?p=daysinmonth

Main part of code:

for($year_s;$year_s<$year_f;$year_s++)
{
  for($month=1;$month<=12;$month++)
  {
    echo $month."'th month of ".$year_s." has: ".cal_days_in_month(CAL_GREGORIAN, $month, $year_s)." days
";
  }
}

Sunday, January 15, 2012

Bitch please 9gag T-Shirt




By request of many people tshirt design was made for mass production:

http://www.streetshirts.co.uk/igloro

Original: http://9gag.com/gag/1786826

Thursday, January 5, 2012

JQuery email check

To check if user typed his email right you can use jquery.

Atribute of reg:
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;


And IF code:

if(!emailReg.test(email))
{
     error = true;
 }


Full code will could look like

$(document).ready(function()
{
  $("input.button[name=komentuoti]").click(function()
  {
    var email = $("input[name=email]").val();
    var error;
    var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
 
    if(!emailReg.test(comment_email))
    {
      error = true;
      return false;
    }
 
    if(error == true)
    {
      alert("Bad email!");
    }    
  }
});


IE image spacing issue [Solved]



Today / yesterday i faced with IE image spacing issue, which was like pain in my ass.

In Chrome, Firefox and other good browsers everything was perfect, but in IE navigation bar with background images and just images which can be clicked was not perfect. 

Solution for this is just to add CSS for the images with attribute display block.

Example:

.tablewithbadimages img
{
    display:block;
}

Update ( 2012.01.30 ):

Another solution for this is check if user's browser is IE and do something for all other browsers and other values for IE.

Example:

.footer{
  height: 40px;
}               

 
 

Tuesday, January 3, 2012

Google web preview bot check PHP

I was faced with problem of google web preview "bot".
Its really not a bot, but a chrome tool which makes preview of site which you hover in google search.

The problem was that google web preview "bot" sees page without cookies in users PC. that means google bot will see all advertises which should popup for new coming user.

So solution for this is to check who is looks at page and don't show anything if its an google bot preview.

PHP code:

$bot_v = false;  
$uAgent=$_SERVER['HTTP_USER_AGENT']; 
if(strpos($uAgent,"Google Web Preview") > 0) 
{ $bot_v=true; }