<div style="text-align: right;"><?php echo $text_subtotal; ?> <?php echo $subtotal; ?></div>
<a onclick="clearCart();" class="button"><span><?php echo $this->language->get('text_clear'); ?></span></a>
});
//--></script>
<script type="text/javascript"><!--
function clearCart() {
$.ajax({
type: 'post',
url: 'index.php?route=module/cart/clear',
dataType: 'html',
data: '&clearcart=true',
success: function (html) {
$('#module_cart .middle').html(html);
},
});
}
//--></script>
$output .= '<div style="text-align: right;">' . $this->language->get('text_subtotal') . ' ' . $this->currency->format($this->cart->getTotal()) . '</div>';
$output .= '<a onclick="clearCart();" class="button"><span>' . $this->language->get('text_clear') . '</span></a>';
}
?>
public function clear() {
$this->language->load('module/cart');
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
if (isset($this->request->post['clearcart'])) {
$this->cart->clear();
$output = '<div style="text-align: center;">' . $this->language->get('text_empty') . '</div>';
$this->response->setOutput($output, $this->config->get('config_compression'));
}
}
}
$_['text_empty'] = '0 ürün var.';
$_['text_clear'] = 'Sepeti Boşalt';
<div id="module_cart" class="box">
<div class="top"><img src="catalog/view/theme/default/image/basket.png" alt="" /><?php echo $heading_title; ?></div>
<div class="middle">
<?php if ($products) { ?>
<table cellpadding="2" cellspacing="0" style="width: 100%;">
<?php foreach ($products as $product) { ?>
<tr>
<td valign="top" align="right" width="1"><?php echo $product['quantity']; ?> x </td>
<td align="left" valign="top"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
<div>
<?php foreach ($product['option'] as $option) { ?>
- <small style="color: #999;"><?php echo $option['name']; ?> <?php echo $option['value']; ?></small><br />
<?php } ?>
</div></td>
</tr>
<?php } ?>
</table>
<br />
<div style="text-align: right;"><?php echo $text_subtotal; ?> <?php echo $subtotal; ?></div>
<a onclick="clearCart();" class="button"><span><?php echo $this->language->get('text_clear'); ?></span></a>
<div style="text-align: center; margin-top: 10px;"><a href="<?php echo $cart; ?>" class="button" style="text-decoration: none;"><span><?php echo $text_cart; ?></span></a></div>
<?php } else { ?>
<div style="text-align: center;"><?php echo $text_empty; ?></div>
<?php } ?>
</div>
<div class="bottom"> </div>
</div>
<?php if ($ajax) { ?>
<script type="text/javascript"><!--
$(document).ready(function () {
$('#add_to_cart').replaceWith('<a onclick="" id="add_to_cart" class="button">' + $('#add_to_cart').html() + '</a>');
$('#add_to_cart').click(function () {
var submitted = $("#product").serialize();
$.ajax({
type: 'post',
url: 'index.php?route=module/cart/callback',
dataType: 'html',
data: submitted,
success: function (html) {
$('#module_cart .middle').html(html);
},
complete: function () {
var image = $('#image').offset();
var cart = $('#module_cart').offset();
$('#image').before('<img src="' + $('#image').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>
<script type="text/javascript"><!--
function clearCart() {
$.ajax({
type: 'post',
url: 'index.php?route=module/cart/clear',
dataType: 'html',
data: '&clearcart=true',
success: function (html) {
$('#module_cart .middle').html(html);
},
});
}
//--></script>
<?php } ?>
<?php
class ControllerModuleCart extends Controller {
protected function index() {
$this->language->load('common/header');
$this->language->load('module/cart');
$this->load->model('tool/seo_url');
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_subtotal'] = $this->language->get('text_subtotal');
$this->data['text_cart'] = $this->language->get('text_cart');
$this->data['cart'] = (HTTP_SERVER . 'index.php?route=checkout/cart');
$this->data['text_empty'] = $this->language->get('text_empty');
$this->data['products'] = array();
foreach ($this->cart->getProducts() as $result) {
$option_data = array();
foreach ($result['option'] as $option) {
$option_data[] = array(
'name' => $option['name'],
'value' => $option['value']
);
}
$this->data['products'][] = array(
'name' => $result['name'],
'option' => $option_data,
'quantity' => $result['quantity'],
'stock' => $result['stock'],
'price' => $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))),
'href' => $this->model_tool_seo_url->rewrite((HTTP_SERVER . 'index.php?route=product/product&product_id=' . $result['product_id'])),
);
}
$this->data['subtotal'] = $this->currency->format($this->cart->getTotal());
$this->data['ajax'] = $this->config->get('cart_ajax');
$this->id = 'cart';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/cart.tpl')) {
$this->template = $this->config->get('config_template') . '/template/module/cart.tpl';
} else {
$this->template = 'default/template/module/cart.tpl';
}
$this->render();
}
public function callback() {
$this->language->load('common/header');
$this->language->load('module/cart');
$this->load->model('tool/seo_url');
$text_cart = $this->language->get('text_cart');
$cart = (HTTP_SERVER . 'index.php?route=checkout/cart');
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
if (isset($this->request->post['option'])) {
$option = $this->request->post['option'];
} else {
$option = array();
}
$this->cart->add($this->request->post['product_id'], $this->request->post['quantity'], $option);
unset($this->session->data['shipping_methods']);
unset($this->session->data['shipping_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['payment_method']);
}
$output = '<table cellpadding="2" cellspacing="0" style="width: 100%;">';
foreach ($this->cart->getProducts() as $product) {
$output .= '<tr>';
$output .= '<td width="1" valign="top" align="right">' . $product['quantity'] . ' x </td>';
$output .= '<td align="left" valign="top"><a href="' . $this->model_tool_seo_url->rewrite((HTTP_SERVER . 'index.php?route=product/product&product_id=' . $product['product_id'])) . '">' . $product['name'] . '</a>';
$output .= '<div>';
foreach ($product['option'] as $option) {
$output .= ' - <small style="color: #999;">' . $option['name'] . ' ' . $option['value'] . '</small><br />';
}
$output .= '</div></td>';
$output .= '</tr>';
}
$output .= '</table>';
$output .= '<br />';
$output .= '<div style="text-align: right;">' . $this->language->get('text_subtotal') . ' ' . $this->currency->format($this->cart->getTotal()) . '</div>';
$output .= '<a onclick="clearCart();" class="button"><span>' . $this->language->get('text_clear') . '</span></a>';
$output .= '<div style="text-align: center; margin-top: 10px;"><a href="' . $cart . '" class="button" style="text-decoration: none;"><span>' . $text_cart . '</span></a></div>';
$this->response->setOutput($output, $this->config->get('config_compression'));
}
public function clear() {
$this->language->load('module/cart');
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
if (isset($this->request->post['clearcart'])) {
$this->cart->clear();
$output = '<div style="text-align: center;">' . $this->language->get('text_empty') . '</div>';
$this->response->setOutput($output, $this->config->get('config_compression'));
}
}
}
}
?>
<?php
/* OpenCart 1.4.7 Turkish Ceviren eka7a - http://www.opencart-tr.com */
// Heading
$_['heading_title'] = 'Alışveriş Sepeti';
// Text
$_['text_subtotal'] = 'Ara Toplam:';
$_['text_empty'] = '0 ürün var.';
$_['text_clear'] = 'Sepeti Boşalt';
?>
$this->data['text_empty'] = $this->language->get('text_empty');
$this->data['text_remove'] = $this->language->get('text_remove');
$this->data['text_confirm'] = $this->language->get('text_confirm');
$this->data['text_view'] = $this->language->get('text_view');
$this->data['text_checkout'] = $this->language->get('text_checkout');
public function callback() {
$this->language->load('module/cart');
$this->load->model('tool/seo_url');
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
if (isset($this->request->post['option'])) {
$option = $this->request->post['option'];
} else {
$option = array();
}
$this->cart->add($this->request->post['product_id'], $this->request->post['quantity'], $option);
unset($this->session->data['shipping_methods']);
unset($this->session->data['shipping_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['payment_method']);
}
public function callback() {
$this->language->load('module/cart');
$this->load->model('tool/seo_url');
unset($this->session->data['shipping_methods']);
unset($this->session->data['shipping_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['payment_method']);
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
if (isset($this->request->post['remove'])) {
$result = explode('_', $this->request->post['remove']);
$this->cart->remove(trim($result[1]));
} else {
if (isset($this->request->post['option'])) {
$option = $this->request->post['option'];
} else {
$option = array();
}
$this->cart->add($this->request->post['product_id'], $this->request->post['quantity'], $option);
}
}
foreach ($this->cart->getProducts() as $product) {
$output .= '<tr>';
$output .= '<td width="1" valign="top" align="right">' . $product['quantity'] . ' x </td>';
$output .= '<td align="left" valign="top"><a href="' . $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $product['product_id']) . '">' . $product['name'] . '</a>';
$output .= '<div>';
foreach ($this->cart->getProducts() as $product) {
$output .= '<tr>';
$output .= '<td width="1" valign="top" align="left"><span class="cart_remove" id="remove_ ' . $product['key'] . '" /> </span></td><td width="1" valign="top" align="right">' . $product['quantity'] . ' x </td>';
$output .= '<td align="left" valign="top"><a href="' . $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $product['product_id']) . '">' . $product['name'] . '</a>';
$output .= '<div>';
.cart_remove {
margin-top: 3px;
background: url('../image/list_remove_btn.gif') no-repeat left center transparent;
padding-right:10px;
cursor:pointer;
}
.cart_remove_loading {
margin-top: 3px;
background: url('../image/ajax_load.gif') no-repeat transparent;
padding-right:10px;
}
<td valign="top" align="right" width="1"><?php echo $product['quantity']; ?> x </td>
<td align="left" valign="top" width="1"><span class="cart_remove" id="remove_<?php echo $product['key']; ?>"> </span><td valign="top" align="right" width="1"><?php echo $product['quantity']; ?> x </td>
<div class="bottom"> </div>
</div>
<?php if ($ajax) { ?>
<script type="text/javascript"><!--
$(document).ready(function () {
$('#add_to_cart').replaceWith('<a onclick="" id="add_to_cart" class="button">' + $('#add_to_cart').html() + '</a>');
$('#add_to_cart').click(function () {
$.ajax({
type: 'post',
url: 'index.php?route=module/cart/callback',
dataType: 'html',
data: $('#product :input'),
success: function (html) {
$('#module_cart .middle').html(html);
},
complete: function () {
var image = $('#image').offset();
var cart = $('#module_cart').offset();
$('#image').before('<img src="' + $('#image').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 } ?>
<div class="bottom"> </div>
</div>
<?php if ($ajax) { ?>
<script type="text/javascript" src="catalog/view/javascript/jquery/ajax_add.js"></script>
<?php } ?>
<script type="text/javascript"><!--
function getUrlParam(name) {
var name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if (results == null)
return "";
else
return results[1];
}
$(document).ready(function () {
$('.cart_remove').live('click', function () {
if (!confirm('<?php echo $text_confirm; ?>')) {
return false;
}
$(this).removeClass('cart_remove').addClass('cart_remove_loading');
$.ajax({
type: 'post',
url: 'index.php?route=module/cart/callback',
dataType: 'html',
data: 'remove=' + this.id,
success: function (html) {
$('#module_cart .middle').html(html);
if (getUrlParam('route').indexOf('checkout') != -1) {
window.location.reload();
}
}
});
});
});
//--></script>
$_['text_empty'] = '0 ürün var.';
$_['text_confirm'] = 'Onaylıyor Musunuz?';
<div style="text-align: right;"><?php echo $text_subtotal; ?> <?php echo $subtotal; ?></div>
<div style="text-align:center;clear:both;"><a href="index.php?route=checkout/cart">Sepetim</a> | <a href="index.php?route=checkout/shipping">Kasaya Git</a></div>