Модуль Полезные модификации Prestashop 1.7

fortuner

Хранитель порядка
Регистрация
26 Июн 2012
Сообщения
631
Реакции
1.238
Делимся полезными модификациями, хаками, допиленными модулями (или самописными) для Prestashop 1.7.
Предлагаю скопировать правила из темы модулей Prestashop, чтобы в теме было проще ориентироваться.
Правила:
1. Увидели чужую ошибку - исправьте :)
2. Запросы "а сделайте мне то-то" пожалуйста пишите в тему "Помощь с Prestashop".
3. Не спамьте, пусть раздел будет соответствовать своему названию :)
4. Не пишите "спасибо, должен навеки вечные!", просто нажмите "спасибо".
 
c лееред навигацией на всех страницах
page.number = 1
А условия фильтра оно разве не выдает?
Тогда
{if !$условия_фильтра}
...
{/if}
Найдешь - напиши здесь, мы будем признательны :)
 
какие условия фильтра и как они относятся к странице
 
Добавление превью корзины на Prestashop 1.7 как было на версии 1.6
правиться все это в файле themes/(название вашей темы)/module/ps_shoppingcart/ps_shoppingcart.tpl

Код:
<div class="body cart-hover-content">
<ul>
{foreach from=$cart.products item=product}
<li class="cart-wishlist-item">
{include 'module:ps_shoppingcart/ps_shoppingcart-product-line.tpl' product=$product}
</li>
{/foreach}
</ul>
<div class="cart-subtotals">
{foreach from=$cart.subtotals item="subtotal"}
<div class="{$subtotal.type}">
<span class="label">{$subtotal.label}</span>
<span class="value">{$subtotal.value}</span>
</div>
{/foreach}
</div>
<div class="cart-total">
<span class="label">{$cart.totals.total.label}</span>
<span class="value">{$cart.totals.total.value}</span>
</div>
<div class="cart-wishlist-action">
<a class="cart-wishlist-viewcart" href="{$cart_url}">view cart</a>
<a class="cart-wishlist-checkout" href="{$urls.pages.order}">{l s='Check Out' d='Shop.Theme.Actions'}</a>
</div>
</div>

и в файле themes/(название вашей темы)/module/ps_shoppingcart/ps_shoppingcart-product-line.tpl

Код:
{if $product.images}
<div class="shoppingcart_img">
<img src="{$product.images.0.bySize.small_default.url}" title="{$product.name}"/>
</div>
{/if}
 
Ребят, или я не пойму или лыжи не едут!

Но! Напишите по шагам, как теперь в 1.7 вносить правки в файлы чтобы они не затирались при обновлении (оверррайды).
Я сделал по аналогии с 1.6 добавил новые файлы - но при сбрасывании кэша - ни в какую не подцепляются файлы и тупо читает родной (в итоге правок нет!)
Куда смотреть, или напишите мини гайд по оверрайдам в 1.7.2.4.

Спасибо!
 
Ребят, или я не пойму или лыжи не едут!

Но! Напишите по шагам, как теперь в 1.7 вносить правки в файлы чтобы они не затирались при обновлении (оверррайды).
Я сделал по аналогии с 1.6 добавил новые файлы - но при сбрасывании кэша - ни в какую не подцепляются файлы и тупо читает родной (в итоге правок нет!)
Куда смотреть, или напишите мини гайд по оверрайдам в 1.7.2.4.

Спасибо!
просто закидываю в override (создаю соответствующие пути папок как в оригинале) и правлю. Посмотри пути и разрешения на папки и файлы
 
просто закидываю в override (создаю соответствующие пути папок как в оригинале) и правлю. Посмотри пути и разрешения на папки и файлы

Да, проблема была в разрешениях на папки! Спасибо большое за ответ! Остальным будет тоже полезно.
Я додумался до этого только спустя двое суток)))
 
Последнее редактирование:
Поставить символ рубля в Prestashop 1.7.x
Чтобы поменять символ валюты в prestashop 1.7.x – нужно зайти в папку вашего магазина через фтп, найти файл: translations/cldr/main–ru-RU—currencies. Далее открываем файл для редактирования. Находим валюту по символам “RUB“, далее находим
Код:
"symbol":"\u0440\u0443\u0431."
0_18a089_38c06c02_orig.jpg

И делаем замену
Код:
"symbol":"₽"
0_18a08a_f1040a35_orig.jpg

Сохраняем и наслаждаемся результатом :

0_18a08b_da62fd23_orig.jpg
 
Кнопка добавить в корзину у товара для Prestashop 1.7.х как было в 1.6
0_18a0cc_ec1179ad_orig.jpg


Редактируем файл шаблона


Открываем файл:
Код:
/themes/classic/templates/catalog/_partials/miniatures/product.tpl
В нем ищем
Код:
{block name='product_price_and_shipping'}
    {if $product.show_price}
        <div class="product-price-and-shipping">
            {if $product.has_discount}
                {hook h='displayProductPriceBlock' product=$product type="old_price"}
                <span class="regular-price">{$product.regular_price}</span>
                {if $product.discount_type === 'percentage'}
                    <span class="discount-percentage">{$product.discount_percentage}</span>
                {/if}
            {/if}

            {hook h='displayProductPriceBlock' product=$product type="before_price"}

            <span itemprop="price" class="price">{$product.price}</span>

            {hook h='displayProductPriceBlock' product=$product type='unit_price'}

            {hook h='displayProductPriceBlock' product=$product type='weight'}
<!-- Сюда будем вставлять код -->
        </div>
    {/if}
{/block}
Строчка в которую нужно вставлять под номером 63.
0_18a0cd_5302015c_orig.jpg

В нее нужно добавить следующий код:
Код:
<div class="clearfix atc_div">
                <input name="qty" type="text" class="form-control atc_qty" value="1" onfocus="if(this.value == '1') this.value = '';" onblur="if(this.value == '') this.value = '1';"/>
                <button class="add_to_cart btn btn-primary btn-sm" onclick="mypresta_productListCart.add({literal}$(this){/literal});">
                    <i class="material-icons">add_shopping_cart</i>{l s='Add to cart' d='Shop.Theme.Actions'}
                </button>
            </div>
В итоге получается такой код
Код:
{block name='product_price_and_shipping'}
    {if $product.show_price}
        <div class="product-price-and-shipping">
            {if $product.has_discount}
                {hook h='displayProductPriceBlock' product=$product type="old_price"}
                <span class="regular-price">{$product.regular_price}</span>
                {if $product.discount_type === 'percentage'}
                    <span class="discount-percentage">{$product.discount_percentage}</span>
                {/if}
            {/if}

            {hook h='displayProductPriceBlock' product=$product type="before_price"}

            <span itemprop="price" class="price">{$product.price}</span>

            {hook h='displayProductPriceBlock' product=$product type='unit_price'}

            {hook h='displayProductPriceBlock' product=$product type='weight'}
            <div class="clearfix atc_div">
                <input name="qty" type="text" class="form-control atc_qty" value="1" onfocus="if(this.value == '1') this.value = '';" onblur="if(this.value == '') this.value = '1';"/>
                <button class="add_to_cart btn btn-primary btn-sm" onclick="mypresta_productListCart.add({literal}$(this){/literal});">
                    <i class="material-icons">add_shopping_cart</i>{l s='Add to cart' d='Shop.Theme.Actions'}
                </button>
            </div>
        </div>
    {/if}
{/block}
Пример:
0_18a0ce_999828fd_orig.jpg


С шаблоном закончили, перейдем к стилям.

Редактируем стиль

Открываем файл:
Код:
/themes/classic/assets/css/custom.css
Он будет пустой и добавьте в него следующий код:
Код:
.atc_qty {
    display: inline-block;
    width: 40px;
    border: 1px solid #cecece;
    background: #FFF;
    padding: 10px 0px;
    text-align: center;
    top: 2px;
    margin: auto;
    position: relative;
    margin: 0px 5px 0px 0px;
}

.product-description {
    min-height:130px;
}

#products .thumbnail-container {
    min-height:368px;
}

.atc_div {
    margin-top:10px;
}


.atc_spinner {
    -webkit-animation-name: spin;
    -webkit-animation-duration: 4000ms;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-timing-function: linear;
    -moz-animation-name: spin;
    -moz-animation-duration: 4000ms;
    -moz-animation-iteration-count: infinite;
    -moz-animation-timing-function: linear;
    -ms-animation-name: spin;
    -ms-animation-duration: 4000ms;
    -ms-animation-iteration-count: infinite;
    -ms-animation-timing-function: linear;
     
    animation-name: spin;
    animation-duration: 4000ms;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}
@-ms-keyframes spin {
    from { -ms-transform: rotate(0deg); }
    to { -ms-transform: rotate(360deg); }
}
@-moz-keyframes spin {
    from { -moz-transform: rotate(0deg); }
    to { -moz-transform: rotate(360deg); }
}
@-webkit-keyframes spin {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
    from {
        transform:rotate(0deg);
    }
    to {
        transform:rotate(360deg);
    }
}


#products .thumbnail-container:hover .highlighted-informations, .featured-products .thumbnail-container:hover .highlighted-informations, .product-accessories .thumbnail-container:hover .highlighted-informations, .product-miniature .thumbnail-container:hover .highlighted-informations {
    bottom: 9.525rem;
}

#products .highlighted-informations, .featured-products .highlighted-informations, .product-accessories .highlighted-informations, .product-miniature .highlighted-informations {
    bottom: 5rem;
}
Осталось добавить Ajax обработку добавления товара в корзину.

Javascript для обработки Ajax
Открываем файл:
Код:
/themes/classic/assets/js/custom.js
Он также будет у Вас пустым и добавляем в него код:
Код:
var _0x7035=["\x61\x74\x63\x5F\x73\x70\x69\x6E\x6E\x65\x72","\x61\x64\x64\x43\x6C\x61\x73\x73","\x61\x75\x74\x6F\x72\x65\x6E\x65\x77","\x68\x74\x6D\x6C","\x69","\x66\x69\x6E\x64","\x64\x61\x74\x61\x2D\x69\x64\x2D\x70\x72\x6F\x64\x75\x63\x74\x2D\x61\x74\x74\x72\x69\x62\x75\x74\x65","\x61\x74\x74\x72","\x70\x61\x72\x65\x6E\x74","\x76\x61\x6C","\x2E\x61\x74\x63\x5F\x71\x74\x79","\x64\x61\x74\x61\x2D\x69\x64\x2D\x70\x72\x6F\x64\x75\x63\x74","\x50\x4F\x53\x54","\x6E\x6F\x2D\x63\x61\x63\x68\x65","\x63\x61\x72\x74","\x70\x61\x67\x65\x73","\x75\x72\x6C\x73","\x3F\x72\x61\x6E\x64\x3D","\x67\x65\x74\x54\x69\x6D\x65","\x6A\x73\x6F\x6E","\x61\x63\x74\x69\x6F\x6E\x3D\x75\x70\x64\x61\x74\x65\x26\x61\x64\x64\x3D\x31\x26\x61\x6A\x61\x78\x3D\x74\x72\x75\x65\x26\x71\x74\x79\x3D","\x31","\x26\x69\x64\x5F\x70\x72\x6F\x64\x75\x63\x74\x3D","\x26\x74\x6F\x6B\x65\x6E\x3D","\x73\x74\x61\x74\x69\x63\x5F\x74\x6F\x6B\x65\x6E","\x26\x69\x70\x61\x3D","","\x26\x69\x64\x5F\x63\x75\x73\x74\x6F\x6D\x69\x7A\x61\x74\x69\x6F\x6E\x3D","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x72\x65\x6D\x6F\x76\x65\x43\x6C\x61\x73\x73","\x61\x64\x64\x5F\x73\x68\x6F\x70\x70\x69\x6E\x67\x5F\x63\x61\x72\x74","\x75\x70\x64\x61\x74\x65\x43\x61\x72\x74","\x61\x64\x64\x2D\x74\x6F\x2D\x63\x61\x72\x74","\x65\x6D\x69\x74","\x61\x6A\x61\x78"];var mypresta_productListCart={add:function(_0x4bd3x2){_0x4bd3x2[_0x7035[5]](_0x7035[4])[_0x7035[3]](_0x7035[2])[_0x7035[1]](_0x7035[0]);idCombination= _0x4bd3x2[_0x7035[8]]()[_0x7035[8]]()[_0x7035[8]]()[_0x7035[8]]()[_0x7035[8]]()[_0x7035[7]](_0x7035[6]);quantity= _0x4bd3x2[_0x7035[8]]()[_0x7035[5]](_0x7035[10])[_0x7035[9]]();idProduct= _0x4bd3x2[_0x7035[8]]()[_0x7035[8]]()[_0x7035[8]]()[_0x7035[8]]()[_0x7035[8]]()[_0x7035[7]](_0x7035[11]);$[_0x7035[34]]({type:_0x7035[12],headers:{"\x63\x61\x63\x68\x65\x2D\x63\x6F\x6E\x74\x72\x6F\x6C":_0x7035[13]},url:prestashop[_0x7035[16]][_0x7035[15]][_0x7035[14]]+ _0x7035[17]+  new Date()[_0x7035[18]](),async:true,cache:false,dataType:_0x7035[19],data:_0x7035[20]+ ((quantity&& quantity!= null)?quantity:_0x7035[21])+ _0x7035[22]+ idProduct+ _0x7035[23]+ prestashop[_0x7035[24]]+ ((parseInt(idCombination)&& idCombination!= null)?_0x7035[25]+ parseInt(idCombination):_0x7035[26]+ _0x7035[27]+ (( typeof customizationId!== _0x7035[28])?customizationId:0)),success:function(_0x4bd3x3,_0x4bd3x4,_0x4bd3x5){_0x4bd3x2[_0x7035[5]](_0x7035[4])[_0x7035[3]](_0x7035[30])[_0x7035[29]](_0x7035[0]);prestashop[_0x7035[33]](_0x7035[31],{reason:{idProduct:idProduct,idProductAttribute:idCombination,linkAction:_0x7035[32]}})}})}}
 
Кнопка добавить в корзину у товара для Prestashop 1.7.х как было в
Скрытое содержимое доступно для зарегистрированных пользователей!
Скрытое содержимое доступно для зарегистрированных пользователей!

Не работает. Как и большинства людей здесь Для просмотра ссылки Войди или Зарегистрируйся.
 
Dodanie podgląd koszu na Prestashop 1.7, jak to było w wersji 1.6
aby skorygować to wszystko w tematach / (twoja nazwa motywu) / module / ps_shoppingcart/ps_shoppingcart.tpl

Код:
 <div class = "body-hover-content">
<ul>
{foreach from = $ cart.products item = product}
<li class = "cart-wishlist-item">
{include 'moduł: ps_shoppingcart / ps_shoppingcart-product-line.tpl' product = $ product}
</ li>
{/ foreach}
</ ul>
<div class = "cart-subtotals">
{foreach from = $ cart.subtotals item = "subtotal"}
<div class = "{$ subtotal.type}">
<span class = "label"> {$ subtotal.label} </ span>
<span class = "value"> {$ subtotal.value} </ span>
</ div>
{/ foreach}
</ div>
<div class = "cart-total">
<span class = "label"> {$ cart.totals.total.label} </ span>
<span class = "value"> {$ cart.totals.total.value} </ span>
</ div>
<div class = "cart-wishlist-action">
<a class="cart-wishlist-viewcart" href="{$cart_url}"> wyświetl koszyk </a>
<a class="cart-wishlist-checkout" href="{$urls.pages.order}"> {ls = "Wymeldowanie" d = "Shop.Theme.Actions"} </a>
</ div>
</ div>
[/ CODE]

oraz w tematach / (twoja nazwa motywu) / module / ps_shoppingcart / ps_shoppingcart-product-line.tpl

[CODE] {if $ product.images}
<div class = "shoppingcart_img">
<img src = "{$ product.images.0.bySize.small_default.url}" title = "{$ product.name}" />
</ div>
{/ if} [/ CODE] [/QUOTE]


Thanks a lot, it works! I was looking for a few days for this!
 
Назад
Сверху