Commit 40d6e726 authored by Artem Malichev's avatar Artem Malichev

Merge branch 'master' of projects.intelliants.com:intelliants/commerce

parents f965be13 f3374a21
<?php
//##copyright##
/******************************************************************************
*
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
*
* This copyright notice may not be removed from the software source without
* the permission of Subrion respective owners.
*
*
******************************************************************************/
class iaBackendController extends iaAbstractControllerModuleBackend
{
......
<?php
//##copyright##
/******************************************************************************
*
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
*
* This copyright notice may not be removed from the software source without
* the permission of Subrion respective owners.
*
*
******************************************************************************/
class iaBackendController extends iaAbstractControllerModuleBackend
{
......
<?php
//##copyright##
/******************************************************************************
*
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
*
* This copyright notice may not be removed from the software source without
* the permission of Subrion respective owners.
*
*
******************************************************************************/
class iaBackendController extends iaAbstractControllerModuleBackend
{
......
<?php
//##copyright##
/******************************************************************************
*
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
*
* This copyright notice may not be removed from the software source without
* the permission of Subrion respective owners.
*
*
******************************************************************************/
$iaCart = $iaCore->factoryModule('cart', IA_CURRENT_MODULE);
$iaProduct = $iaCore->factoryModule('product', IA_CURRENT_MODULE);
......
<?php
//##copyright##
/******************************************************************************
*
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
*
* This copyright notice may not be removed from the software source without
* the permission of Subrion respective owners.
*
*
******************************************************************************/
if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
$iaView->display('checkout');
......
<?php
//##copyright##
/******************************************************************************
*
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
*
* This copyright notice may not be removed from the software source without
* the permission of Subrion respective owners.
*
*
******************************************************************************/
if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
if (1 != count($iaCore->requestPath)) {
......
<?php
/******************************************************************************
*
* Subrion Web Directory Script
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion Web Directory Script.
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
......@@ -13,8 +13,6 @@
* the permission of Subrion respective owners.
*
*
* @link https://subrion.pro/product/directory.html
*
******************************************************************************/
class iaCategory extends iaAbstractHelperCategoryFlat
......
<?php
//##copyright##
/******************************************************************************
*
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
*
* This copyright notice may not be removed from the software source without
* the permission of Subrion respective owners.
*
*
******************************************************************************/
class iaOrder extends abstractModuleAdmin
{
......
<?php
//##copyright##
/******************************************************************************
*
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
*
* This copyright notice may not be removed from the software source without
* the permission of Subrion respective owners.
*
*
******************************************************************************/
class iaProduct extends abstractModuleAdmin
{
......
<?php
//##copyright##
/******************************************************************************
*
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
*
* This copyright notice may not be removed from the software source without
* the permission of Subrion respective owners.
*
*
******************************************************************************/
class iaNotification extends abstractCore
{
......
<?php
//##copyright##
/******************************************************************************
*
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
*
* This copyright notice may not be removed from the software source without
* the permission of Subrion respective owners.
*
*
******************************************************************************/
class iaCart extends abstractModuleFront
{
......@@ -170,6 +184,26 @@ class iaCart extends abstractModuleFront
return $rows;
}
protected function _processValues(&$rows, $singleRow = false, $fieldNames = [])
{
parent::_processValues($rows, $singleRow, $fieldNames);
if ($rows) {
$singleRow && $rows = [$rows];
$iaCurrency = $this->iaCore->factory('currency');
$currency = $iaCurrency->get();
foreach ($rows as &$row) {
$row['price_formatted'] = $iaCurrency->format($row['price']);
$row['currency'] = $currency;
}
$singleRow && $rows = array_shift($rows);
}
}
protected function _summarize($cartId)
{
$items = $this->_getItems($cartId);
......
<?php
/******************************************************************************
*
* Subrion Yellow Pages & Business Directory Software
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion Yellow Pages & Business Directory Software.
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
......@@ -13,8 +13,6 @@
* the permission of Subrion respective owners.
*
*
* @link https://subrion.pro/product/yellow-pages-script.html
*
******************************************************************************/
class iaCategory extends iaAbstractFrontHelperCategoryFlat
......@@ -25,6 +23,11 @@ class iaCategory extends iaAbstractFrontHelperCategoryFlat
protected $_moduleName = 'commerce';
public $coreSearchEnabled = true;
public $coreSearchOptions = [
'regularSearchFields' => ['title', 'description']
];
public function getUrl(array $item)
{
......@@ -39,6 +42,15 @@ class iaCategory extends iaAbstractFrontHelperCategoryFlat
return $this->getUrl($data);
}
// TODO: make it work
public function coreSearch($stmt, $start, $limit, $order)
{
$rows = $this->getAll($stmt, null, $start, $limit);
$count = $this->getFoundRows();
return [$count, $rows];
}
public function getBySlug($slug)
{
$where = '`status` = :status AND `slug` = :slug';
......
<?php
//##copyright##
/******************************************************************************
*
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
*
* This copyright notice may not be removed from the software source without
* the permission of Subrion respective owners.
*
*
******************************************************************************/
class iaOrder extends abstractModuleFront
{
......
<?php
/******************************************************************************
*
* Subrion Yellow Pages & Business Directory Software
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion Yellow Pages & Business Directory Software.
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
......@@ -13,8 +13,6 @@
* the permission of Subrion respective owners.
*
*
* @link https://subrion.pro/product/yellow-pages-script.html
*
******************************************************************************/
class iaProduct extends abstractModuleFront
......@@ -30,6 +28,12 @@ class iaProduct extends abstractModuleFront
protected $_moduleName = 'commerce';
public $coreSearchEnabled = true;
public $coreSearchOptions = [
'tableAlias' => 'p',
'regularSearchFields' => ['title', 'snippet', 'description']
];
protected $_foundRows = 0;
private $_sortingOptions = [
......@@ -65,6 +69,14 @@ class iaProduct extends abstractModuleFront
return $this->getUrl($data);
}
public function coreSearch($stmt, $start, $limit, $order)
{
$rows = $this->_get($stmt, $start, $limit, $order);
$count = $this->getFoundRows();
return [$count, $rows];
}
public function getByCategory($categoryId, $start, $limit, $order)
{
$where = '';
......@@ -153,7 +165,7 @@ class iaProduct extends abstractModuleFront
if ($rows) {
$singleRow && $rows = [$rows];
$iaCurrency = $this->iaCore->factoryModule('currency', $this->getModuleName());
$iaCurrency = $this->iaCore->factory('currency');
$currency = $iaCurrency->get();
......
<?php
//##copyright##
/******************************************************************************
*
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
*
* This copyright notice may not be removed from the software source without
* the permission of Subrion respective owners.
*
*
******************************************************************************/
if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
$iaView->add_js('_IA_URL_modules/commerce/js/commerce, _IA_URL_modules/commerce/js/app');
......
<?php
//##copyright##
/******************************************************************************
*
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
*
* This copyright notice may not be removed from the software source without
* the permission of Subrion respective owners.
*
*
******************************************************************************/
if ($iaView->url && 'commerce' == $iaCore->get('default_package')) {
switch ($iaView->get('extension')) {
......
<?php
//##copyright##
/******************************************************************************
*
* Subrion E-commerce Software
* Copyright (C) 2017 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion E-commerce Software.
*
* This program is a commercial software and any kind of using it must agree
* to the license, see <https://subrion.pro/license.html>.
*
* This copyright notice may not be removed from the software source without
* the permission of Subrion respective owners.
*
*
******************************************************************************/
$iaCategory = $iaCore->factoryModule('category', IA_CURRENT_MODULE);
......
......@@ -5,7 +5,7 @@
<author>Intelliants LLC</author>
<contributor>Intelliants LLC</contributor>
<version>1.0.0</version>
<date>2017-07-02</date>
<date>2017-08-23</date>
<compatibility>4.1.5</compatibility>
<url>shop</url>
......@@ -283,6 +283,11 @@
<hooks>
<hook name="phpCoreUrlRewrite" page_type="front" filename="hook.url-rewrite"><![CDATA[]]></hook>
<hook name="phpCoreBeforePageDisplay" page_type="front" filename="hook.blocks-load"><![CDATA[]]></hook>
<hook name="phpFrontCurrencyChanged" page_type="front">
<![CDATA[
$iaCore->factoryModule('cart', 'commerce')->recount();
]]>
</hook>
<hook name="smartyAdminAfterHeadSection" type="smarty">
<![CDATA[
<style type="text/css">
......
$(function()
{
$('#js-cmd-add-cart').on('click', function(){
intelli.commerce.cart('add', $('#input-id').val(), null, {quantity: $('#input-qty').val()}, null,
function(response){
if (response.result){
$('.js-cart-placeholder-count').html(response.count)
$('.js-cart-placeholder-total').html(response.total)
$('#js-cart-contents').html(response.html)
}
$(function () {
$('#js-cmd-add-cart').on('click', function () {
intelli.commerce.cart('add', $('#input-id').val(), null, {quantity: $('#input-qty').val()}, null,
function (response) {
if (response.result) {
$('.js-cart-placeholder-count').html(response.count)
$('.js-cart-placeholder-total').html(response.total)
$('#js-cart-contents').html(response.html)
}
intelli.notifFloatBox({msg: response.message, type: response.result ? 'success' : 'error'})
}
)
})
}
)
})
})
\ No newline at end of file
<form method="post" enctype="multipart/form-data" class="sap-form form-horizontal">
{preventCsrf}
<input type="hidden" id="input-id" value="{$id}">
{preventCsrf}
<input type="hidden" id="input-id" value="{$id}">
{if iaCore::ACTION_EDIT == $pageAction}
<input id="input-id" type="hidden" value="{$id}">
......
<form method="post" enctype="multipart/form-data" class="sap-form form-horizontal">
{preventCsrf}
{preventCsrf}
<div class="wrap-list">
<div class="wrap-group">
......
......@@ -94,11 +94,9 @@
</form>
{ia_hooker name='smartyAdminSubmitItemBeforeFooter'}
{ia_add_js}
$(function()
{
$('.js-cmd-delete').on('click', function(e)
{
confirm(_t('do_you_want_to_remove_order')) || e.preventDefault();
});
$(function() {
$('.js-cmd-delete').on('click', function(e) {
confirm(_t('do_you_want_to_remove_order')) || e.preventDefault();
});
});
{/ia_add_js}
\ No newline at end of file
<div class="ia-sorting">
<div class="ia-sorting__by">
<span>{lang key='sort_by'}:</span>
<div class="btn-group">
<a class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" href="#">
{lang key="sorting_option_{$sorting.key}"}
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
{foreach $sorting.options as $option}
<li><a href="{$smarty.const.IA_SELF}?sort_by={$option}" rel="nofollow">{lang key="sorting_option_{$option}"}</a></li>
{/foreach}
</ul>
</div>
</div>
<div class="ia-sorting__layout">
</div>
<div class="ia-sorting__by">
<span>{lang key='sort_by'}:</span>
<div class="btn-group">
<a class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" href="#">
{lang key="sorting_option_{$sorting.key}"}
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
{foreach $sorting.options as $option}
<li><a href="{$smarty.const.IA_SELF}?sort_by={$option}" rel="nofollow">{lang key="sorting_option_{$option}"}</a></li>
{/foreach}
</ul>
</div>
</div>
<div class="ia-sorting__layout">
</div>
</div>
\ No newline at end of file
<div class="b-cart">
<button id="js-cart-shortcut" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" tabindex="0">
<span class="fa fa-shopping-cart"></span>
<span class="js-cart-placeholder-total">{$commerce.cart.total} {$core.config.currency}</span>
<span class="js-cart-placeholder-total">{$commerce.cart.total|currency_format}</span>
<span class="badge js-cart-placeholder-count" title="{lang key='products_count' count=$commerce.cart.count}">{$commerce.cart.count}</span>
<span class="caret"></span>
</button>
......
{if $commerce.priorityCategories}
<ul>
{foreach $commerce.priorityCategories as $entry}
<li>
<h5>{$entry.title|escape}</h5>
<a href="{$entry.link}">{lang key='browse'}</a>
</li>
{/foreach}
{foreach $commerce.priorityCategories as $entry}
<li>
<h5>{$entry.title|escape}</h5>
<a href="{$entry.link}">{lang key='browse'}</a>
</li>
{/foreach}
</ul>
{/if}
{if isset($subcategories)}
<ul>
{foreach $subcategories as $entry}
<li>
<a href="{$entry.link}">{$entry.title|escape}</a>
</li>
{/foreach}
</ul>
{if !empty($subcategories)}
<ul>
{foreach $subcategories as $entry}
<li>
<a href="{$entry.link}">{$entry.title|escape}</a>
</li>
{/foreach}
</ul>
{/if}
\ No newline at end of file
......@@ -20,7 +20,7 @@
{lang key='update_cart'}
</button>
</p>
<p class="lead">{lang key='total'}: <span class="js-cart-placeholder-total">{$total}</span> {$core.config.currency}</p>
<p class="lead">{lang key='total'}: <span class="js-cart-placeholder-total">{$total|currency_format}</span></p>
</td>
</tr>
</table>
......
......@@ -11,7 +11,7 @@
<div class="fieldset-wrapper content">
<dl class="dl-horizontal">
<dt>{lang key='total'}</dt>
<dd>{$item.total|number_format} {$core.config.currency}</dd>
<dd>{$item.total|currency_format}</dd>
</dl>
</div>
</div>
......
{if $items}
{include 'extra:commerce/_sorting-header'}
{include 'extra:commerce/_sorting-header'}
<div class="cards products">
<div class="row">
{foreach $items as $item}
<div class="col-md-4">
{include 'extra:commerce/list'}
</div>
{if $item@iteration % 3 == 0 && !$item@last}
</div>
<div class="row">
{/if}
{/foreach}
</div>
</div>
<div class="cards products">
<div class="row">
{foreach $items as $item}
<div class="col-md-4">
{include 'extra:commerce/list'}
</div>
{if $item@iteration % 3 == 0 && !$item@last}
</div>
<div class="row">
{/if}
{/foreach}
</div>
</div>
{navigation aTotal=$pagination.total aTemplate=$pagination.url aItemsPerPage=$pagination.limit}
{navigation aTotal=$pagination.total aTemplate=$pagination.url aItemsPerPage=$pagination.limit}
{else}
<div class="alert alert-info">{lang key='no_products'}</div>
<div class="alert alert-info">{lang key='no_products'}</div>
{/if}
\ No newline at end of file
......@@ -15,7 +15,7 @@
</div>
</td>
<td class="text-right">
<strong>{($item.price*$item.qty)|number_format}</strong>
<strong>{($item.price*$item.qty)|currency_format}</strong>
</td>
<td class="text-center delete-item"><a href="#" class="js-cmd-remove-item" data-id="{$item.id}" data-item_id="{$item.item_id}"><i class="fa fa-remove"></i></a></td>