1.) put this code at the end of the theme/defult/template/module/cart.tpl
Code: Select all
<?php if ($ajax) { ?>
<script type="text/javascript"><!--
$(document).ready(function () {
$('.addtocart').replaceWith('<a onclick="" class="button addtocart">' + $('.addtocart').html() + '</a>');
$('.addtocart').click(function () {
var pid = this.parentNode.id;
$.ajax({
type: 'post',
url: 'index.php?route=module/cart/callback',
dataType: 'html',
data: $('#'+this.parentNode.id+' :input'),
success: function (html) {
$('#module_cart .middle').html(html);
},
complete: function () {
var image = $('#img_'+pid).offset();
var cart = $('#module_cart').offset();
$('#img_'+pid).before('<img src="' + $('#img_'+pid).attr('src') + '" id="temp" style="position: absolute; top: ' + image.top + 'px; left: ' + image.left + 'px;" />');
params = {
top : cart.top + 'px',
left : cart.left + 'px',
opacity : 0.0,
width : $('#module_cart').width(),
heigth : $('#module_cart').height()
};
$('#temp').animate(params, 'slow', false, function () {
$('#temp').remove();
});
}
});
});
});
//--></script>
<?php } ?>
theme/defult/template/common/home.tpl
theme/defult/template/product/category.tpl
theme/defult/template/product/special.tpl
theme/defult/template/product/search.tpl
search a little, about line 38:
Code: Select all
<div class="heading"><?php echo $text_latest; ?></div>
<table class="list">
<?php for ($i = 0; $i < sizeof($products); $i = $i + 4) { ?>
<tr>
<?php for ($j = $i; $j < ($i + 4); $j++) { ?>
<td style="width: 25%;"><?php if (isset($products[$j])) { ?>
<?//to adding AddToCart Buttons MO.?>
<a href="<?php echo str_replace('&', '&', $products[$j]['href']); ?>"><img id="img_product_<?php echo $products[$j]['id']; ?>" src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" /></a><br />
<?//End adding AddToCart Buttons MO.?>
Code: Select all
<? // adding buttons add to cart MO. ?>
<form action="index.php?route=checkout/cart" method="post" enctype="multipart/form-data" id="product_<?php echo $products[$j]['id']; ?>">
<input type="hidden" name="quantity" value="1" />
<a onclick="$('#product_<?php echo $products[$j]['id']; ?>').submit();" class="button addtocart"><span><?php echo $button_add_to_cart; ?></span></a>
<input type="hidden" name="product_id" value="<?php echo $products[$j]['id']; ?>" />
</form>
<? // adding buttons add to cart MO. ?>
<?php if ($products[$j]['rating']) { ?>
(the same for catgory, serach etc.)
about line 5
Code: Select all
$this->language->load('common/home');
$this->language->load('product/category'); // Mo add 10.5.2010
$this->document->title = $this->config->get('config_title');
Code: Select all
$this->data['text_latest'] = $this->language->get('text_latest');
// Mo adding 10.5.2010
$this->data['button_add_to_cart'] = $this->language->get('button_add_to_cart');
$this->data['ajax'] = $this->config->get('cart_ajax');
// Mo END
Code: Select all
$this->data['products'][] = array(
'id' => $result['product_id'], // Mo add 10.5.2010
'name' => $result['name'],
'model' => $result['model'],
'rating' => $rating,
'stars' => sprintf($this->language->get('text_stars'), $rating),
'thumb' => $this->model_tool_image->resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
'price' => $price,
'special' => $special,
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $result['product_id'])
);
Mo