Thursday, September 29, 2011

Open cart --> Custom page integration for old version

http://forum.opencart.com/viewtopic.php?t=6253

Google Map integration using javascript

http://www.achari.in/google-map-integration-using-javascript-php

http://code.google.com/apis/maps/documentation/staticmaps/#quick_example

http://code.google.com/apis/ajax/playground/?exp=maps#markers

http://code.google.com/apis/maps/documentation/javascript/v2/introduction.html

http://www.mayzes.org/googlemaps.jquery.html

Wednesday, September 28, 2011

Opencart --> Removing Estimate Shipping & Taxes V 1.5.1

Here's a quick fix, but there's probably a better way.

open: catalog/view/theme/default/template/checkout/cart.tpl

Find

<div class="cart-module">
<?php foreach ($modules as $module) { ?>
<?php echo $module; ?>
<?php } ?>
</div>

Replace

<div class="cart-module">
<?php $mods = 1; foreach ($modules as $module) { ?>
<?php if($mods>2){ echo $module; } $mods++; ?>
<?php } ?>
</div>


http://forum.opencart.com/viewtopic.php?t=37419&p=180239

Friday, September 16, 2011

Javascript --> Local time conversion for UTC conversion without Timezone

<script>
function date_convert(date){
sdate=date;
var tarr=sdate.split(' ');
var tarr1=tarr[1].split(':');
if(tarr1[0]!='00'){
while(tarr1[0].charAt(0) == '0')
tarr1[0]= tarr1[0].substr(1);
var t_hr1=parseInt(tarr1[0]);
var hour_min=(t_hr1*60)+parseInt(tarr1[1]);
}
else{
var hour_min=parseInt(tarr1[1]);
}
var tz=new Date().getTimezoneOffset();
var tdiff=hour_min+parseInt(tz);
if(tdiff<0){
var t_hr=24*60;
tdiff=t_hr+tdiff;
var d_arr=tarr[0].split('-');
dt=d_arr[2];
mt=d_arr[1]-1;
yt=d_arr[0];
var o=new Date(yt,mt,dt);
var p_date=new Date(o.getFullYear(), o.getMonth(), o.getDate() - 1);
var py=p_date.getFullYear();
var pm=p_date.getMonth()+1;
var pd=p_date.getDate();
if(parseInt(pm)<10)
pm='0'+pm;
if(parseInt(pd)<10)
pd='0'+pd;
//var d_date=parseInt(d_arr[2])-1;
}
else{
var d_arr=tarr[0].split('-');
var py=d_arr[0];
var pm=d_arr[1];
var pd=d_arr[2];
}
var time_hr=Math.floor(tdiff/60);
var time_min=tdiff%60;
if(parseInt(time_hr)<10)
time_hr='0'+time_hr;
if(parseInt(time_min)<10)
time_min='0'+time_min;
var date_time=py+'-'+pm+'-'+pd+' '+time_hr+':'+time_min+':'+tarr1[2];
return date_time;
}

var localtime_for_equal_utc_without_add_time_zone=date_convert('2011-09-16 05:40:00');
</script>

Tuesday, September 13, 2011

Create zip format using php

<?php
// increase script timeout value
ini_set("max_execution_time", 300);
// create object
$zip = new ZipArchive();
// open archive
if ($zip->open("my-archive.zip", ZIPARCHIVE::CREATE) !== TRUE) {
die ("Could not open archive");
}
// initialize an iterator
// pass it the directory to be processed
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("mallcart/"));
// iterate over the directory
// add each file found to the archive
foreach ($iterator as $key=>$value) {
$zip->addFile(realpath($key), $key) or die ("ERROR: Could not add file: $key");
}
// close and save archive
$zip->close();
echo "Archive created successfully.";
?>