ТЗ:
1. okaycms 2.1 lite шаблон stok.
2. Нужно организовать на странице товара форму "Купить в 1 клик".
Файлы отсюда.
Инструкция здесь.
1. установил папку buyme в корень сайта.
2. в buyme/lib/send.php указал свою почту.
Код: Выделить всё
$to = "yourMail";
3. Подключил библиотеку здесь: design\stok_1\html\scripts.tpl
Код: Выделить всё
<script type="text/javascript" charset="utf-8" src="/buyme/js/buyme.js"></script>
4. Добавил класс b1c-good к <body> тут design\stok_1\html\index.tpl :
Код: Выделить всё
<body class="page {$module} boxed b1c-good">
и класс b1c-name к названию товара:
\design\stok_1\html\breadcrumb_headers.tpl
Код: Выделить всё
{* Карточка товара *}
{elseif $smarty.get.module == "ProductView"}
<span class="b1c-name" data-product="{$product->id}" itemprop="name">{$product->name|escape} {if $product->variants|count == 1 && !empty($product->variant->name)}({$product->variant->name|escape}){/if}</span>
5. Добавил ссылку "Купить в 1 клик" на страницу товара \design\stok_1\html\product.tpl
Код: Выделить всё
{* Сравнение *}
{if !in_array($product->id,$comparison->ids)} <a class="ico-btn_compare fn-comparison okaycms" href="#" title="В сравнение" data-result-text="Из сравнения" data-id="{$product->id}"></a>
{else} <a class="ico-btn_compare fn-comparison okaycms selected" href="#" title="Из сравнения" data-result-text="В сравнение" data-id="{$product->id}"></a>{/if}
{* Избранное *}
{if $product->id|in_array:$wished_products} <a href="#" class="ico-btn_wishlist fn-wishlist okaycms selected" data-id="{$product->id}" title="Из закладок" data-result-text="В закладки"></a>
{else} <a href="#" class="ico-btn_wishlist fn-wishlist okaycms" data-id="{$product->id}" title="В закладки" data-result-text="Из закладок"></a>{/if}
<br><br><a href="#" class="b1c"><b>Купить в 1 клик</b></a>
6. Стиль добавил здесь \design\stok_1\css\main.css
Код: Выделить всё
.b1c{padding:1em;border:1px solid;}
7. Проверил - все работает - данные из формы пришли на почту.