Так же показываем пользователю, сколько обойдется доставка.
Добавим запрос
Код: Выделить всё
ALTER TABLE `ok_products` ADD `free_delivery` TINYINT( 0 ) NOT NULL AFTER `featured`;
UPDATE `ok_products` SET `free_delivery` = 0;
Дальше идем в /backend/core/ProductAdmin.php ищем строку 21
Код: Выделить всё
$product->visible = $this->request->post('visible', 'boolean');
и ниже вставим
Код: Выделить всё
$product->free_delivery = $this->request->post('free_delivery', 'boolean');
Теперь добавим галочку в шаблоне backend/design/html/product.tpl после строк (129) ищем
Код: Выделить всё
<div class="activity_of_switch_item"> {* row block *}
<div class="okay_switch clearfix">
<label class="switch_label">{$btr->general_bestseller|escape}</label>
<label class="switch switch-default">
<input class="switch-input" name="featured" value="1" type="checkbox" id="featured_checkbox" {if $product->featured}checked=""{/if}/>
<span class="switch-label"></span>
<span class="switch-handle"></span>
</label>
</div>
</div>
и ниже вставим:
Код: Выделить всё
<div class="activity_of_switch_item"> {* row block *}
<div class="okay_switch clearfix">
<label class="switch_label">Беспл. доставка</label>
<label class="switch switch-default">
<input class="switch-input" name="free_delivery" value="1" type="checkbox" id="free_delivery_checkbox" {if $product->free_delivery}checked=""{/if}/>
<span class="switch-label"></span>
<span class="switch-handle"></span>
</label>
</div>
</div>
в файле backend/design/html/products.tpl ищем (212строка)
Код: Выделить всё
{*featured*}
<button data-hint="{$btr->general_bestseller|escape}" type="button" class="setting_icon setting_icon_featured fn_ajax_action {if $product->featured}fn_active_class{/if} hint-bottom-middle-t-info-s-small-mobile hint-anim" data-module="product" data-action="featured" data-id="{$product->id}" >
дост.
</button>
Ниже добавим
Код: Выделить всё
{*free_delivery*}
<button data-hint="Бесплатная доставка" type="button" class="setting_icon setting_icon_free_delivery fn_ajax_action {if $product->free_delivery}fn_active_class{/if} hint-bottom-middle-t-info-s-small-mobile hint-anim" data-module="product" data-action="free_delivery" data-id="{$product->id}" >
Я
</button>
Далее идем backend/design/css/okay.css ищем там строку 2523
Код: Выделить всё
.okay_list_setting .setting_icon_featured.fn_active_class,
.okay_list_setting .setting_icon_featured:hover{
background: #F8D053;
border-color: #F8D053;
color: #fff
}
вставим ниже:
Код: Выделить всё
.okay_list_setting .setting_icon_free_delivery.fn_active_class, .okay_list_setting .setting_icon_free_delivery:hover {
background: #a953f8;
border-color: #a953f8;
color: #fff;
}
далее в api/products.php ищем в двух местах (183,388строки)
Код: Выделить всё
p.visible,
и ниже вставим в 2-х местах
Код: Выделить всё
p.free_delivery,
далее идем в feed.php
ищем
Код: Выделить всё
v.compare_price,
ниже вставим
Код: Выделить всё
p.free_delivery AS product_free_delivery,
далее ниже ищем
Код: Выделить всё
$old_price = ($old_price > 0 ? "<oldprice>$old_price</oldprice>" : '');
и после этой строки вставим
Код: Выделить всё
$delivery = $okay->delivery->get_delivery(1);
if ($p->product_free_delivery == 1 || $p->price >= $delivery->free_from) {
$local_delivery_cost = '0';
}
else {
$local_delivery_cost = '600';}
далее ищем
Код: Выделить всё
print "</offer>";
и выше вставим
Код: Выделить всё
print "<local_delivery_cost>".$local_delivery_cost."</local_delivery_cost>";
где 600 - это стоимость доставки в рублях для товаров без чекбокса.
Выводим в шаблоне например так:
Код: Выделить всё
{* Доставка *}
<div>
Доставка этого товара по Москве
{if ($product->free_delivery == 1) || ({$product->variant->price}>=50000)}Бесплатна
{else}
600р{/if}.
</div>