first commit
This commit is contained in:
@@ -0,0 +1,261 @@
|
||||
{**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* 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 https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*}
|
||||
|
||||
{if isset($dimension_data)}
|
||||
{foreach from=$dimension_data item="ddata"}
|
||||
{foreach from=$customization_added_to_cart item="cdata"}
|
||||
{if $cdata.0.id_customization == $product.id_customization}
|
||||
{if $ddata.0.displayquantity == 'decimalok'}
|
||||
{$dimension_text = $cdata.0.value}
|
||||
{$dimension_quantity = $cdata.0.total_dimension}
|
||||
{$dimension_unit = $cdata.0.unittype_module}
|
||||
{$product_price = $product.price|regex_replace:'/[^0-9,.]+/':''}
|
||||
{$currency = $product.price|regex_replace:'/[A-Za-z0-9.,]+/':''}
|
||||
{$unit_price = $product_price|floatval / $dimension_quantity|floatval}
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
<div class="product-line-grid">
|
||||
<!-- product line left content: image-->
|
||||
<div class="product-line-grid-left col-md-3 col-xs-4">
|
||||
<span class="product-image media-middle">
|
||||
{if $product.cover}
|
||||
<img src="{$product.cover.bySize.cart_default.url|escape:'quotes':'UTF-8'}" alt="{$product.name|escape:'quotes':'UTF-8'}">
|
||||
{else}
|
||||
<img src="{$urls.no_picture_image.bySize.cart_default.url}" />
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- product line body: label, discounts, price, attributes, customizations -->
|
||||
<div class="product-line-grid-body col-md-4 col-xs-8">
|
||||
<div class="product-line-info">
|
||||
<a class="label" href="{$product.url}" data-id_customization="{$product.id_customization|intval}">{$product.name}</a>
|
||||
</div>
|
||||
|
||||
<div class="product-line-info product-price h5 {if $product.has_discount}has-discount{/if}">
|
||||
{if $product.has_discount}
|
||||
<div class="product-discount">
|
||||
<span class="regular-price">{$product.regular_price}</span>
|
||||
{if $product.discount_type === 'percentage'}
|
||||
<span class="discount discount-percentage">
|
||||
-{$product.discount_percentage_absolute}
|
||||
</span>
|
||||
{else}
|
||||
<span class="discount discount-amount">
|
||||
-{$product.discount_to_display}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="current-price">
|
||||
<span class="price">{$product.price}</span>
|
||||
{if $product.unit_price_full}
|
||||
{if $dimension_text}
|
||||
<div class="unit-price-cart">{$currency}{$unit_price|string_format:"%.2f"} per {$dimension_unit|escape:'htmlall':'UTF-8'}</div>
|
||||
{else}
|
||||
<div class="unit-price-cart">{$product.unit_price_full}</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
{foreach from=$product.attributes key="attribute" item="value"}
|
||||
<div class="product-line-info {$attribute|lower}">
|
||||
<span class="label">{$attribute}:</span>
|
||||
<span class="value">{$value}</span>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
<!-- product line right content: actions (quantity, delete), price -->
|
||||
<div class="product-line-grid-right product-line-actions col-md-5 col-xs-12">
|
||||
<div class="row">
|
||||
<div class="col-xs-4 hidden-md-up"></div>
|
||||
<div class="col-md-10 col-xs-6">
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-xs-6 qty">
|
||||
{if isset($product.is_gift) && $product.is_gift}
|
||||
<span class="gift-quantity">{$product.quantity}</span>
|
||||
{else}
|
||||
<input
|
||||
class="js-cart-line-product-quantity"
|
||||
style="font-size: 14px;"
|
||||
data-down-url="{$product.down_quantity_url}"
|
||||
data-up-url="{$product.up_quantity_url}"
|
||||
data-update-url="{$product.update_quantity_url}"
|
||||
data-product-id="{$product.id_product|intval}"
|
||||
unique-product-id="{$product.id_product|escape:'javascript':'UTF-8'}-{$product.id_product_attribute|escape:'javascript':'UTF-8'}-{$product.id_customization|escape:'javascript':'UTF-8'}"
|
||||
type="number"
|
||||
value="{if isset($dimension_text)}{$dimension_quantity|escape:'htmlall':'UTF-8'}{else}{$product.quantity}{/if}"
|
||||
name="product-quantity-spin"
|
||||
/>
|
||||
{if isset($dimension_text)}
|
||||
<div class="input-group-append" style="height: 40px;line-height: 40px;">
|
||||
<span class="input-group-text small-text text-muted">{$dimension_unit|escape:'htmlall':'UTF-8'}</span>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="col-md-6 col-xs-2 price">
|
||||
<span class="product-price">
|
||||
<strong>
|
||||
{if isset($product.is_gift) && $product.is_gift}
|
||||
<span class="gift">{l s='Gift' d='Shop.Theme.Checkout'}</span>
|
||||
{else}
|
||||
{$product.total}
|
||||
{/if}
|
||||
</strong>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 col-xs-2 text-xs-right">
|
||||
<div class="cart-line-product-actions">
|
||||
<a
|
||||
class = "remove-from-cart"
|
||||
rel = "nofollow"
|
||||
href = "{$product.remove_from_cart_url}"
|
||||
data-link-action = "delete-from-cart"
|
||||
data-id-product = "{$product.id_product|escape:'javascript':'UTF-8'}"
|
||||
data-id-product-attribute = "{$product.id_product_attribute|escape:'javascript':'UTF-8'}"
|
||||
data-id-customization = "{$product.id_customization|escape:'javascript':'UTF-8'}"
|
||||
>
|
||||
{if !isset($product.is_gift) || !$product.is_gift}
|
||||
<i class="material-icons float-xs-left">delete</i>
|
||||
{/if}
|
||||
</a>
|
||||
|
||||
{block name='hook_cart_extra_product_actions'}
|
||||
{hook h='displayCartExtraProductActions' product=$product}
|
||||
{/block}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
{if is_array($product.customizations) && $product.customizations|count}
|
||||
<br>
|
||||
{block name='cart_detailed_product_line_customization'}
|
||||
{foreach from=$product.customizations item="customization"}
|
||||
{foreach from=$customization.fields item="field"}
|
||||
{assign var="dimension_text" value=" "|explode:$field.text}
|
||||
<div class="alert medium-alert alert-info">
|
||||
<p style="float:left;">{$field.label} </p>
|
||||
<div class="value">
|
||||
{if $field.type == 'text'}
|
||||
{if (int)$field.id_module}
|
||||
{$field.text nofilter}
|
||||
{else}
|
||||
{$field.text}
|
||||
{/if}
|
||||
{elseif $field.type == 'image'}
|
||||
<img src="{$field.image.small.url}">
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{/block}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{if isset($dimension_text)}
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var id_product = {$product.id_product|intval};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
id_product:id_product
|
||||
},
|
||||
url: "index.php?fc=module&module=squaremeter&controller=getdimensiondata",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(data) {
|
||||
results = data;
|
||||
id_product=id_product;
|
||||
//console.table(results);
|
||||
},
|
||||
error: function (jqXHR, exception) {
|
||||
console.log(jqXHR);
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof results !== 'undefined' && results.length > 0) {
|
||||
var displayquantity = results[0]['displayquantity'];
|
||||
|
||||
if ((results[0]) && (displayquantity == 'decimalok')) {
|
||||
if (results[0]['step_width'])
|
||||
stepvalue = results[0]['step_width'];
|
||||
else
|
||||
stepvalue = results[0]['step'];
|
||||
|
||||
if(!stepvalue)
|
||||
stepvalue = 1;
|
||||
|
||||
switch(results[0]['calculationtype']) {
|
||||
case "weight":
|
||||
if (results[0]['minweight'])
|
||||
minvalue = results[0]['minweight'];
|
||||
else
|
||||
minvalue = '';
|
||||
if (results[0]['maxweight'])
|
||||
maxvalue = results[0]['maxweight'];
|
||||
else
|
||||
maxvalue = '';
|
||||
break;
|
||||
default:
|
||||
if (results[0]['minwidth'])
|
||||
minvalue = results[0]['minwidth'];
|
||||
else
|
||||
minvalue = '';
|
||||
if (results[0]['maxwidth'])
|
||||
maxvalue = results[0]['maxwidth'];
|
||||
else
|
||||
maxvalue = '';
|
||||
break;
|
||||
}
|
||||
|
||||
$("[unique-product-id={$product.id_product|intval}-{$product.id_product_attribute|intval}-{$product.id_customization|intval}]").attr('min', parseFloat(minvalue));
|
||||
$("[unique-product-id={$product.id_product|intval}-{$product.id_product_attribute|intval}-{$product.id_customization|intval}]").attr('max', parseFloat(maxvalue));
|
||||
$("[unique-product-id={$product.id_product|intval}-{$product.id_product_attribute|intval}-{$product.id_customization|intval}]").attr('step', parseFloat(stepvalue));
|
||||
}
|
||||
}
|
||||
|
||||
if (displayquantity == "decimalok") {
|
||||
window["q" + "{$product.id_product|intval}-" + "{$product.id_product_attribute|intval}-" + "{$product.id_customization|intval}"] = $("[unique-product-id={$product.id_product|intval}-{$product.id_product_attribute|intval}-{$product.id_customization|intval}]").val();
|
||||
setInterval(function(){
|
||||
$("[unique-product-id={$product.id_product|intval}-{$product.id_product_attribute|intval}-{$product.id_customization|intval}]").val(parseFloat(window["q" + "{$product.id_product|intval}-" + "{$product.id_product_attribute|intval}-" + "{$product.id_customization|intval}"]).toFixed(2));
|
||||
}, 100);
|
||||
}
|
||||
</script>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user