first commit
This commit is contained in:
65
themes/ayon__/modules/ps_shoppingcart/modal.tpl
Normal file
65
themes/ayon__/modules/ps_shoppingcart/modal.tpl
Normal file
@@ -0,0 +1,65 @@
|
||||
{**
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* 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.txt.
|
||||
* 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 http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<div id="blockcart-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-3 divide-right">
|
||||
<img class="product-image" src="{$product.cover.medium.url}" alt="{$product.cover.legend}" title="{$product.cover.legend}" itemprop="image">
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="cart-content">
|
||||
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></span>
|
||||
</button>
|
||||
<h4 class="modal-title h5" id="myModalLabel"><i class="material-icons rtl-no-flip"></i>{l s='Product successfully added to your shopping cart' d='Shop.Theme.Checkout'}</h4>
|
||||
|
||||
<h6 class="h6 product-name">{$product.name}</h6>
|
||||
<p>{$product.price}</p>
|
||||
{hook h='displayProductPriceBlock' product=$product type="unit_price"}
|
||||
{foreach from=$product.attributes item="property_value" key="property"}
|
||||
<span><strong>{$property}</strong>: {$property_value}</span><br>
|
||||
{/foreach}
|
||||
<p><strong>{l s='Quantity:' d='Shop.Theme.Checkout'}</strong> {$product.cart_quantity}</p>
|
||||
|
||||
{if $cart.products_count > 1}
|
||||
<p class="cart-products-count">{l s='There are %products_count% items in your cart.' sprintf=['%products_count%' => $cart.products_count] d='Shop.Theme.Checkout'}</p>
|
||||
{else}
|
||||
<p class="cart-products-count">{l s='There is %product_count% item in your cart.' sprintf=['%product_count%' =>$cart.products_count] d='Shop.Theme.Checkout'}</p>
|
||||
{/if}
|
||||
<p><strong>{l s='Subtotal:' d='Shop.Theme.Checkout'}</strong> {$cart.subtotals.products.value}</p>
|
||||
<div class="cart-content-btn">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">{l s='Continue shopping' d='Shop.Theme.Actions'}</button>
|
||||
<a href="{$cart_url}" class="btn btn-primary"><i class="material-icons rtl-no-flip"></i>{l s='Proceed to checkout' d='Shop.Theme.Actions'}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,26 @@
|
||||
<div class="product-img">
|
||||
<span class="image-cont">
|
||||
<img class="product-image" src="{$product.cover.small.url}" alt="{$product.cover.legend}" title="{$product.cover.legend}">
|
||||
</span>
|
||||
{if $product.quantity > 1}
|
||||
<span class="product-quantity">{$product.quantity}</span>
|
||||
{/if}
|
||||
<a class="remove-from-cart tip_inside"
|
||||
rel="nofollow"
|
||||
href="{$product.remove_from_cart_url}"
|
||||
data-link-action="remove-from-cart"
|
||||
title=""
|
||||
>
|
||||
<i>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
|
||||
</i>
|
||||
<span class="tip">{l s='remove from cart' d='Shop.Theme.Actions'}</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="product-atts">
|
||||
<p class="product-name">{$product.name}
|
||||
{foreach from=$product.attributes item="property_value" key="property"}
|
||||
<span>{$property}: {$property_value}</span>
|
||||
{/foreach}</p>
|
||||
<span class="product-price">{$product.price}</span>
|
||||
</div>
|
||||
138
themes/ayon__/modules/ps_shoppingcart/ps_shoppingcart.js
Normal file
138
themes/ayon__/modules/ps_shoppingcart/ps_shoppingcart.js
Normal file
@@ -0,0 +1,138 @@
|
||||
/* global $, prestashop */
|
||||
|
||||
/**
|
||||
* This module exposes an extension point in the form of the `showModal` function.
|
||||
*
|
||||
* If you want to override the way the modal window is displayed, simply define:
|
||||
*
|
||||
* prestashop.blockcart = prestashop.blockcart || {};
|
||||
* prestashop.blockcart.showModal = function myOwnShowModal (modalHTML) {
|
||||
* // your own code
|
||||
* // please not that it is your responsibility to handle closing the modal too
|
||||
* };
|
||||
*
|
||||
* Attention: your "override" JS needs to be included **before** this file.
|
||||
* The safest way to do so is to place your "override" inside the theme's main JS file.
|
||||
*
|
||||
*/
|
||||
|
||||
$(document).ready(function () {
|
||||
prestashop.blockcart = prestashop.blockcart || {};
|
||||
|
||||
var showModal = prestashop.blockcart.showModal || function (modal) {
|
||||
var $body = $('body');
|
||||
$body.append(modal);
|
||||
$body.one('click', '#blockcart-modal', function (event) {
|
||||
if (event.target.id === 'blockcart-modal') {
|
||||
$(event.target).remove();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
prestashop.on(
|
||||
'updateCart',
|
||||
function (event) {
|
||||
|
||||
if($('body:not(#cart)').hasClass('add1')) {
|
||||
var cart_click = function (e) {
|
||||
$('body').addClass('side_open side_content')
|
||||
$('.side_menu .side_menu_rel > div').removeClass('show');
|
||||
$('#side_cart_wrap').addClass('show');
|
||||
$('.side_close').removeClass('search_close menu_close mail_close').addClass('cart_close');
|
||||
$('.side_menu').find('.cart-prods').addClass('loading');
|
||||
}
|
||||
cart_click();
|
||||
}
|
||||
|
||||
var refreshURL = $('.blockcart').data('refresh-url');
|
||||
var requestData = {};
|
||||
|
||||
if (event && event.reason) {
|
||||
requestData = {
|
||||
id_product_attribute: event.reason.idProductAttribute,
|
||||
id_product: event.reason.idProduct,
|
||||
action: event.reason.linkAction
|
||||
};
|
||||
}
|
||||
|
||||
$.post(refreshURL, requestData).then(function (resp) {
|
||||
$('.blockcart').replaceWith($(resp.preview).find('.blockcart'));
|
||||
var count_new = $(resp.preview).find('.cart-products-count').text()
|
||||
$('.box-cart.cart-products-count').html(count_new);
|
||||
|
||||
if($('body').hasClass('add1')) {
|
||||
$('.side_menu').find('.cart-prods').addClass('loading');
|
||||
|
||||
setTimeout(function(){
|
||||
$('.side_menu').find('.cart-prods').removeClass('loading');
|
||||
$('.side_menu').find('.cart-prods > li:not(.show)').each(function(i){
|
||||
var row = $(this);
|
||||
setTimeout(function(){
|
||||
row.addClass('show');
|
||||
}, 300 + i * 160);
|
||||
});
|
||||
}, 400);
|
||||
} else {
|
||||
if (resp.modal) {
|
||||
showModal(resp.modal);
|
||||
}
|
||||
}
|
||||
|
||||
$('.side_close, .close_cross, .return').click(function () {
|
||||
$('body').removeClass('side_open side_content');
|
||||
$('.side_menu').find('.cart-prods > li').each(function(i){
|
||||
$(this).removeClass('show');
|
||||
});
|
||||
setTimeout(function(){
|
||||
$('body').removeClass('was_open');
|
||||
}, 440);
|
||||
});
|
||||
var reopen = function() {
|
||||
if($('body').hasClass('side_open')) {
|
||||
|
||||
$('body').removeClass('side_content');
|
||||
$('.side_menu').removeClass('reopen_go').addClass('reopen_hide');
|
||||
setTimeout(function(){
|
||||
$('body').addClass('side_content');
|
||||
}, 320);
|
||||
setTimeout(function(){
|
||||
$('.side_menu').removeClass('reopen_hide').addClass('reopen_go');
|
||||
}, 600);
|
||||
|
||||
} else {
|
||||
$('body').addClass('side_open side_content was_open')
|
||||
}
|
||||
}
|
||||
var cartprodsshow = function () {
|
||||
$('.side_menu').find('.cart-prods > li').each(function(i){
|
||||
var row = $(this);
|
||||
setTimeout(function(){
|
||||
row.addClass('show');
|
||||
}, 300 + i * 220);
|
||||
});
|
||||
}
|
||||
var cart_click = function (e) {
|
||||
e.preventDefault();
|
||||
reopen();
|
||||
$('.side_menu .side_menu_rel > div').removeClass('show');
|
||||
$('#side_cart_wrap').addClass('show');
|
||||
$('.side_close').removeClass('search_close menu_close acc_close').addClass('cart_close');
|
||||
$('.side_close i').toggleClass('rotateit');
|
||||
if($('.side_menu').hasClass('reopen_hide')) {
|
||||
setTimeout(function(){
|
||||
cartprodsshow();
|
||||
}, 320);
|
||||
} else {
|
||||
cartprodsshow();
|
||||
}
|
||||
}
|
||||
$('#header .row.action .blockcart a.cart_nogo').off("click", cart_click).on("click", cart_click);
|
||||
|
||||
}).fail(function (resp) {
|
||||
prestashop.emit('handleError', {eventType: 'updateShoppingCart', resp: resp});
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
66
themes/ayon__/modules/ps_shoppingcart/ps_shoppingcart.tpl
Normal file
66
themes/ayon__/modules/ps_shoppingcart/ps_shoppingcart.tpl
Normal file
@@ -0,0 +1,66 @@
|
||||
<div id="_desktop_cart" class="cart_widget">
|
||||
<div class="blockcart cart-preview {if $cart.products_count > 0}active{else}inactive{/if}" data-refresh-url="{$refresh_url}">
|
||||
<div class="cart_header tip_inside">
|
||||
<a rel="nofollow" href="{$cart_url}" class="{if isset($roythemes.click_lay_c) && ($roythemes.click_lay_c !== "3")}cart_nogo{/if}">
|
||||
<i class="shopping-cart"></i>
|
||||
<span class="text hidden-sm-down">{l s='Cart' d='Shop.Theme.Checkout'}</span>
|
||||
<span class="cart-products-count{if $cart.products_count < 1} hidden{/if}">{$cart.products_count}</span>
|
||||
{if $cart.products_count > 0}
|
||||
<span class="tip">{l s='Open Shopping cart' d='Modules.Shoppingcart.Shop'}</span>
|
||||
{else}
|
||||
<span class="tip">{l s='Cart is empty.' d='Modules.Shoppingcart.Shop'}</span>
|
||||
{/if}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="cart_inside">
|
||||
<h4 class="side_title">{l s='Shopping Cart' d='Modules.Shoppingcart.Shop'}</h4>
|
||||
<span class="metahide">{l s='Back to shop' d='Modules.Shoppingcart.Shop'}</span>
|
||||
<span class="close_cross"><i><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></i></span>
|
||||
{if $cart.products_count > 0}
|
||||
<ul class="cart-prods">
|
||||
<div class="loader">
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
{foreach from=$cart.products item=product}
|
||||
<li>{include 'module:ps_shoppingcart/ps_shoppingcart-product-line.tpl' product=$product}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<div class="cart-prices">
|
||||
<div class="cart-subtotals">
|
||||
{foreach from=$cart.subtotals item="subtotal"}
|
||||
<div class="cart-summary-line">
|
||||
<span class="label">{$subtotal.label}</span>
|
||||
<span class="value">{$subtotal.value}</span>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
<div class="cart-bottom">
|
||||
<div class="cart-total">
|
||||
{foreach from=$cart.subtotals item="subtotal"}
|
||||
<div class="cart-summary-line">
|
||||
<span class="label">{$subtotal.label}</span>
|
||||
<span class="value">{$subtotal.value}</span>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
<div class="cart-checkout">
|
||||
<a href="{$cart_url}" class="btn btn-primary btn-high">{l s='Shopping Cart' d='Modules.Shoppingcart.Shop'}</a>
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<div class="shopping-cart empty">
|
||||
<p class="text-center">{l s='Cart is empty.' d='Modules.Shoppingcart.Shop'}</p>
|
||||
<i></i>
|
||||
</div>
|
||||
<div class="cart-checkout">
|
||||
<button class="btn btn-primary btn-high return">{l s='Back to shop' d='Modules.Shoppingcart.Shop'}</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user