first commit
This commit is contained in:
@@ -0,0 +1,160 @@
|
||||
{*
|
||||
* Module Name: Perimeter / Length / Surface (Area) / Volume / Weight Calculator for Prestashop
|
||||
* Module URI: Please contact with info@megventure.com
|
||||
* Description: A utility to calculate quantity in perimeter, length, area, volume or weight units
|
||||
* Version: 5.5.0
|
||||
* Author: MEG Venture
|
||||
*
|
||||
* Copyright 2013, MEG Venture (info@megventure.com)
|
||||
*
|
||||
* This program is not a free software: you can't redistribute it and/or modify
|
||||
* it. All rights reserved.
|
||||
*
|
||||
*
|
||||
* This copyright notice and licence should be retained in all modules based on this framework.
|
||||
* This does not affect your rights to assert copyright over your own original work.
|
||||
*}
|
||||
|
||||
{if (($allow_ordering_from_listing) AND ($availability == 'available'))}
|
||||
<form action="{$urls.pages.cart}" method="post" class="squaremeterProductListing" id="sqform_{$id_product}">
|
||||
<input type="hidden" name="cartsource" value="listingpage">
|
||||
<input type="hidden" name="token" value="{$token}">
|
||||
<input type="hidden" name="id_product" value="{$id_product}" class="product_page_product_id">
|
||||
<input type="hidden" name="id_product_attribute_{$id_product}" value="{$id_product_attribute}" class="product_page_product_attribute_id">
|
||||
<input type="hidden" name="id_customization" value="0" class="product_customization_id">
|
||||
<input type='hidden' id='dim_{$id_product}' name='dim_{$id_product}' value='' />
|
||||
<input type='hidden' id='discretion' name='discretion' value='on' />
|
||||
<input type='hidden' id='converted_ea_{$id_product}' name='converted_ea_{$id_product}' value='' />
|
||||
<input type='hidden' id='calculated_total_{$id_product}' name='calculated_total_{$id_product}' value='' />
|
||||
<input type='hidden' id='grand_calculated_total_{$id_product}' name='grand_calculated_total_{$id_product}' value='' />
|
||||
<input type='hidden' id='product_total_price_calc_{$id_product}' name='product_total_price_calc_{$id_product}' value=''/>
|
||||
<input type='hidden' id='qty_alt_{$id_product}' name='qty_alt_{$id_product}' value='' />
|
||||
<input type='hidden' id='quantity_wanted_{$id_product}' name='qty_{$id_product}' value='{$minimal_qty}' min='{$minimal_qty}'>
|
||||
{if ($admintab_dispquan != "decimalok")} {* If direct input is allowed, step value should be one unless decimal quantity is not allowed *}
|
||||
{$step = 1}
|
||||
{/if}
|
||||
<div class="quantity_calculated product-quantity">
|
||||
<div class="value-button decrease" onclick="decreaseValue('directinput_{$id_product}', {$step});price_calculation_{$id_product}({$id_product});check_directinput({$id_product}, {$min}, {$max});" value="Decrease Value">-</div>
|
||||
<input type="text" class="directinput" id="directinput_{$id_product}" name="directinput_{$id_product}" onchange="check_directinput({$id_product}, {$min}, {$max})" value="0"/>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">{$admintab_conversion_unit|escape:'html':'UTF-8'}</span>
|
||||
</div>
|
||||
<div class="value-button increase" onclick="increaseValue('directinput_{$id_product}', {$step});price_calculation_{$id_product}({$id_product});check_directinput({$id_product}, {$min}, {$max});" value="Increase Value">+</div>
|
||||
</div>
|
||||
<button
|
||||
id="button_{$id_product}"
|
||||
class="btn btn-primary add-to-cart"
|
||||
data-button-action="add-to-cart"
|
||||
type="submit"
|
||||
>
|
||||
{l s='Add' mod='squaremeter'}
|
||||
</button>
|
||||
</form>
|
||||
<span id="totalpriceinfo_{$id_product}" class="totalpriceinfo"></span>
|
||||
<link rel="stylesheet" href="{$module_dir|escape:'html':'UTF-8'}views/css/jquery-ui.css">
|
||||
<script src="{$module_dir|escape:'html':'UTF-8'}views/js/jquery-1.12.4.js"></script>
|
||||
<script src="{$module_dir|escape:'html':'UTF-8'}views/js/jquery-ui.js"></script>
|
||||
<script type="text/javascript">
|
||||
{if ($psversion >= '1.7.8.0')}
|
||||
$('#sqform_{$id_product}').prev().prev().find('span').after($('#totalpriceinfo_{$id_product}'));
|
||||
{else}
|
||||
$('#sqform_{$id_product}').prev().find('span').after($('#totalpriceinfo_{$id_product}'));
|
||||
{/if}
|
||||
price_calculation_{$id_product}({$id_product});
|
||||
$(document).on('change', 'input#directinput_{$id_product}', function (event) {
|
||||
price_calculation_{$id_product}({$id_product});
|
||||
});
|
||||
$(document).ready(function () {
|
||||
check_directinput({$id_product}, {$min}, {$max});
|
||||
if ($('button[data-id-product="{$id_product}"]')) //jms_yanka theme adaptation
|
||||
$('button[data-id-product="{$id_product}"]').hide();
|
||||
});
|
||||
function price_calculation_{$id_product}(idProduct) {
|
||||
var multiplication = $('#directinput_{$id_product}').val();
|
||||
if (multiplication < 0)
|
||||
multiplication = 0;
|
||||
if (multiplication < {$min})
|
||||
multiplication = {$min};
|
||||
if (multiplication > {$max})
|
||||
multiplication = {$max};
|
||||
$('#qty_alt_{$id_product}').val(multiplication);
|
||||
var qty_prod = document.getElementById('quantity_wanted_{$id_product}');
|
||||
var qty_production = Number(qty_prod.value);
|
||||
var selecteddimension = {$admintab_conversion|escape:'htmlall':'UTF-8'};
|
||||
{if $admintab_secconversionselect}
|
||||
selecteddimension = selecteddimension * {$admintab_secconversion|escape:'htmlall':'UTF-8'};
|
||||
{/if}
|
||||
fulldimension = multiplication;
|
||||
extra = Math.ceil(multiplication / selecteddimension) * selecteddimension - fulldimension;
|
||||
if (("{$admintab_dispquan|escape:'html':'UTF-8'}" == "onevisible")
|
||||
|| ("{$admintab_dispquan|escape:'html':'UTF-8'}" == "oneinvisible")
|
||||
|| ("{$admintab_dispquan|escape:'html':'UTF-8'}" == "onewithcalcvisible")
|
||||
|| ("{$admintab_dispquan|escape:'html':'UTF-8'}" == "onewithcalcinvisible")
|
||||
|| ("{$admintab_dispquan|escape:'html':'UTF-8'}" == "decimalok"))
|
||||
{
|
||||
qty_prod.value = 1;
|
||||
qty_prod2 = Math.ceil(multiplication/selecteddimension);
|
||||
qty_prod3 = parseFloat(Math.round((multiplication/selecteddimension) * 100) / 100).toFixed(2);
|
||||
{if ($admintab_dispquan != "decimalok")}
|
||||
if (qty_prod3 < 1)
|
||||
qty_prod3 = 1;
|
||||
{/if}
|
||||
}
|
||||
else
|
||||
qty_prod.value = Math.ceil(multiplication/selecteddimension);
|
||||
|
||||
if (qty_prod.value == 0)
|
||||
qty_prod.value = 1;
|
||||
|
||||
if ("{$admintab_dispquan|escape:'html':'UTF-8'}" == "decimalok")
|
||||
product_calc_quantity = parseFloat(Math.round((multiplication/selecteddimension) * 100) / 100).toFixed(2);
|
||||
else
|
||||
product_calc_quantity = Math.ceil(multiplication/selecteddimension);
|
||||
|
||||
var dimen = document.getElementById("dim_{$id_product}");
|
||||
var unit = "{$admintab_conversion_unit|escape:'html':'UTF-8'}";
|
||||
dimen.value = "({l s='Total ' mod='squaremeter'}" + parseFloat(multiplication).toFixed(2) + " " + unit + ") ";
|
||||
if (typeof fulldimension !== 'undefined') {
|
||||
$('#calculated_total_{$id_product}').val(parseFloat(fulldimension).toFixed(2));
|
||||
if ((typeof extra !== 'undefined') && ("{$admintab_dispquan|escape:'html':'UTF-8'}" != "decimalok")) {
|
||||
$('#grand_calculated_total_{$id_product}').val((fulldimension).toFixed(2) + extra);
|
||||
}
|
||||
}
|
||||
var qty_prod = document.getElementById('quantity_wanted_{$id_product}');
|
||||
|
||||
if(("{$admintab_dispquan|escape:'html':'UTF-8'}" == "onewithcalcinvisible")
|
||||
|| ("{$admintab_dispquan|escape:'html':'UTF-8'}" == "onewithcalcvisible"))
|
||||
var qty_production = qty_prod2;
|
||||
else if ("{$admintab_dispquan|escape:'html':'UTF-8'}" == "decimalok")
|
||||
var qty_production = qty_prod3;
|
||||
else
|
||||
var qty_production = Number(qty_prod.value);
|
||||
$('#converted_ea_{$id_product}').val(qty_production);
|
||||
var pricecurrencyval = "{$currency.sign}";
|
||||
var pricenumberval = {$price};
|
||||
$('#quantity_wanted_{$id_product}').change();
|
||||
var product_total_price = Number({$admintab_startingprice|escape:'htmlall':'UTF-8'}) + pricenumberval * qty_production;
|
||||
if ("{$admintab_dispquan|escape:'html':'UTF-8'}" == "onevisible"
|
||||
|| "{$admintab_dispquan|escape:'html':'UTF-8'}" == "oneinvisible") {
|
||||
product_total_price = pricenumberval;
|
||||
}
|
||||
{if $admintab_unit_baseprice}
|
||||
if(pricenumberval > product_total_price)
|
||||
product_total_price = pricenumberval;
|
||||
{/if}
|
||||
|
||||
{if $admintab_reserve}
|
||||
if(Number("{$admintab_reserve|escape:'htmlall':'UTF-8'}")>product_total_price)
|
||||
product_total_price = Number({$admintab_reserve|escape:'htmlall':'UTF-8'});
|
||||
{/if}
|
||||
if ((product_total_price == 0) || (multiplication == 0))
|
||||
$('#button_{$id_product}').prop( "disabled", true );
|
||||
else
|
||||
$('#button_{$id_product}').prop( "disabled", false );
|
||||
$('#product_total_price_calc_{$id_product}').val(product_total_price.toFixed(2));
|
||||
var totalpriceinfo = $('#totalpriceinfo_{$id_product}');
|
||||
totalpriceinfo.html(" {l s='(Total' mod='squaremeter'} : <span>" + pricecurrencyval + parseFloat(product_total_price).toFixed(2) + ")</span>");
|
||||
}
|
||||
</script>
|
||||
{/if}
|
||||
|
||||
29
modules/squaremeter_bckp/views/templates/hook/index.php
Normal file
29
modules/squaremeter_bckp/views/templates/hook/index.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2021 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This module is not a free module and all rights are reserved. It is prohibited to sell or redistribute this module for any purpose. Each license can be used only in one website. For multishop environment, a new license is required for each e-shop managed.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author MEG Venture <info@megventure.com>
|
||||
* @copyright 2007-2021 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
Reference in New Issue
Block a user