first commit

This commit is contained in:
2025-03-12 17:06:23 +01:00
commit 2241f7131f
13185 changed files with 1692479 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
<?php
class stNewSearchFrontendActions extends stActions {
public function executeNewSearch() {
$this->smarty = new stSmarty($this->getModuleName());
$query = $this->getRequestParameter('query',$this->getRequestParameter('st_search[search]',''));
$this->search = new stNewSearch($query);
ProductPeer::addSearchSortCriteria($query, $this->search->getCriteria(), $this->getUser()->getCulture());
$this->search->setPage($this->getRequestParameter('page',0));
if (empty($query)) $this->results = array();
else $this->results = $this->search->getResults();
$this->isAjax = $this->getRequest()->isXmlHttpRequest();
}
public function executeNewSearchAjax() {
$this->smarty = new stSmarty($this->getModuleName());
$query = $this->getRequestParameter('query',$this->getRequestParameter('st_search[search]',''));
$this->search = new stNewSearch($query);
ProductPeer::addSearchSortCriteria($query, $this->search->getCriteria(), $this->getUser()->getCulture());
$this->results = $this->search->getResults();
sfLoader::loadHelpers(array('Helper', 'stCurrency', 'stProductImage'));
foreach ($this->results as $product) {
$results[] = content_tag('li',stNewSearch::str_highlight(mb_strtolower($product->getName(),'UTF-8'),mb_strtolower(implode(' ',$this->search->getQueryKeywords()),'UTF-8')));
}
return $this->renderText('<ul>'.implode("\n",$results)."</ul>");
}
public function executeAjaxSearchProduct() {
sfLoader::loadHelpers(array('Helper', 'stCurrency', 'stProductImage'));
$this->smarty = new stSmarty($this->getModuleName());
$query = $this->getRequestParameter('query',$this->getRequestParameter('st_search[search]',''));
$search = new stNewSearch($query);
ProductPeer::addSearchSortCriteria($query, $search->getCriteria(), $this->getUser()->getCulture());
$products = $search->getResults();
stEventDispatcher::getInstance()->notify(new sfEvent($this, 'stSearchFrontendActions.myExecuteAjaxSearchProduct'));
foreach ($products as $product) {
if ($product->isPriceVisible()) {
$pn = st_currency_format($product->getPriceNetto(true));
$pb = st_currency_format($product->getPriceBrutto(true));
} else {
$pn = "";
$pb = "";
}
$results[] = array(
'image' => st_product_image_path($product, 'icon'),
'name' => $product->getName(),
'pn' => $pn,
'pb' => $pb,
'url' => $product->getUrl(),
'id' => $product->getId());
$suggestions[] = $product->getName();
}
$json = json_encode(array('query' => $query, 'data' => $results, 'suggestions' => $suggestions));
return $this->renderText($json);
}
}

View File

@@ -0,0 +1,11 @@
<?php
class stNewSearchFrontendComponents extends sfComponents {
public function executeList() {
$this->smarty = new stSmarty($this->getModuleName());
$this->config_points = stConfig::getInstance(sfContext::getInstance(), 'stPointsBackend');
$this->config_points->setCulture(sfContext::getInstance()->getUser()->getCulture());
}
}

View File

@@ -0,0 +1,54 @@
<?php
use_helper('stCurrency', 'stText', 'stProductImage', 'stUrl');
$row = array();
foreach ($results as $result) {
$result_url = st_url_for('stProduct/show?url=' . $result->getFriendlyUrl());
//desc
$desc = $result->getShortDescription();
if (empty($desc)) $desc = $result->getDescription();
$desc = strip_tags($desc);
if (preg_match('/^.{1,250}\b/s', $desc, $match)) { $desc=trim($match[0])."..."; }
$desc = stNewSearch::str_highlight($desc,implode(' ',$search->getQueryKeywords()));
$image = $result->getOptImage();
if (!empty($image)) $image = content_tag('a', st_product_image_tag($result, 'thumb'), array('href' => $result_url));
if ($result->isPriceVisible())
{
$check_price = false;
}else{
$check_price = true;
}
// manufacturer
$manufacturer = '';
if (is_object($result->getProducer())) $manufacturer = $result->getProducer()->getName();
$row[] = array(
'name'=> content_tag('a',$result->getName(), array('href' => $result_url)),
'description' => $desc,
'image' => $image,
'manufacturer' => $manufacturer,
'check_price' => $check_price,
'price_net' => st_currency_format($result->getPriceNetto(true)),
'price_gross'=> st_currency_format($result->getPriceBrutto(true)),
'basket' => st_get_component('stBasket', 'add', array('product' => $result)),
'more' => content_tag('a',__('Więcej',null,'stSearchFrontend'), array('href' => $result_url)),
'instance' => $result,
'points_value' => $result->getPointsValue(),
'points_earn' => $result->getPointsEarn(),
'points_only' => $result->getPointsOnly(),
);
}
//points system
$smarty->assign('points_system_is_active', stPoints::isPointsSystemActive());
$smarty->assign('show_points', $config_points->get('product_alternative_list_show_points'));
$smarty->assign('display_type', $config_points->get('product_alternative_list_display_type'));
$smarty->assign('points_shortcut', $config_points->get('points_shortcut', null, true));
$smarty->assign('points_login_status', stPoints::getLoginStatusPoints());
$smarty->assign('is_authenticated', sfContext::getInstance() -> getUser() -> isAuthenticated());
$smarty->assign('is_release', stPoints::isReleasePointsSystemForUser());
$smarty->assign('results',$row );
$smarty->display('search_list.html');

View File

@@ -0,0 +1,12 @@
<?php
st_theme_use_stylesheet('stNewSearch.css');
use_helper('XssSafe', 'stJQueryTools', 'stUrl', 'stAsset');
use_javascript('/jQueryTools/jquery/effects.core.js');
use_javascript('/js/stSearch.js');
$smarty->assign('search_input', input_auto_complete_tag('query', $search->getQuery(), 'stNewSearchFrontend/newSearchAjax',array('autocomplete'=>'off'),array('use_style'=> true)));
$smarty->assign('form_start', form_tag('stSearchFrontend/search', array('method' => 'get')));
if ($search->getQuery() != '' && count($results)==0 && !$isAjax) $smarty->assign('no_results',1);
if (count($results)==$search->getPageLimit()) $smarty->assign('more',content_tag('button',__('Więcej wyników',null,'stSearchFrontend'),array('id'=>'st_search_more_button')));
$smarty->assign('list',st_get_component('stNewSearchFrontend','list',array('results'=>$results, 'search'=>$search)));
if ($isAjax) $smarty->display('search_ajax.html'); else $smarty->display('search.html');

View File

@@ -0,0 +1,21 @@
<div class="new_search-box">
<h2>{__ text="Wyszukiwanie" langCatalogue="stSearchFrontend"}</h2>
<div class="content">
{$form_start}
{$search_input}
<div class="buttons right">
<button class="roundies regular" type="submit"/>{__ text="Szukaj" langCatalogue="stSearchFrontend"}</button>
</div>
</form>
{$filters}
<div id="product_other">
{$list}
</div>
{if $more}
<div id="more_button" class="buttons right">{$more}</div>
{/if}
{if $no_results eq 1}
{__ text="Niestety żaden produkt nie spełnia kryteriów wyszukiwania które wpisałeś. Spróbuj użyć innego słowa lub wyszukaj produkt według kategorii." langCatalogue="stSearchFrontend}
{/if}
</div>
</div>

View File

@@ -0,0 +1,80 @@
{literal}
<script type="text/javascript">
jQuery(function($) {
$(".product_tooltip").tooltip({
effect : 'slide',
opacity : 1,
delay : 0,
position : 'bottom center',
offset : [10, 0],
tipClass : "my_tooltip tooltip roundies"
});
});
</script>
{/literal}
{foreach from=$results item=result}
<div class="search-result-row box roundies" >
{if $result.check_price!=1 && $result.points_only!=1}
<div class="price">
{$result.price_gross}
</div>
{/if}
{if $points_system_is_active==1 && $show_points==1}
<div class="price">
{if $display_type=='only_value' || $result.points_only==1}
{if $result.points_value > 0}<span style="color:#ED1B24;">{$result.points_value} {$points_shortcut}</span>{/if}
{elseif $display_type=='only_earn' && $result.points_only!=1}
{if $result.points_earn > 0}<span style="color:green;">{$result.points_earn} {$points_shortcut}</span>{/if}
{elseif $display_type=='value_earn_alternative' && $result.points_only!=1}
{if $result.points_value > 0}<span style="color:#ED1B24;">{$result.points_value} {$points_shortcut}</span>{/if}{if $result.points_value > 0 && $result.points_earn > 0} / {/if}{if $result.points_earn > 0}<span style="color:green;">{$result.points_earn} {$points_shortcut}</span>{/if}
{elseif $display_type=='earn_value_alternative' && $product.points_only!=1}
{if $result.points_earn > 0}<span style="color:green;">{$result.points_earn} {$points_shortcut}</span>{/if}{if $result.points_value > 0 && $result.points_earn > 0} / {/if}{if $result.points_value > 0}<span style="color:#ED1B24;">{$result.points_value} {$points_shortcut}</span>{/if}
{/if}
</div>
{/if}
<h4 class="product_link">{$result.name}</h4>
<div class="image">
{$result.image}
</div>
<div class="content">
{$result.description}
</div>
<div class="search_links">
<ul>
<li>
{$result.more}
</li>
{if $points_system_is_active==1 && $result.points_only==1}
{if $is_authenticated!=1}
<li class="product_tooltip" title='{__ text="Zaloguj się aby kupić produkt."}'>
<a href="/user/loginUser">{__ text="tylko za punkty"}</a>
</li>
{elseif $is_release!="release_off" && $is_release!="release_on"}
<li style="opacity:0.5" class="basket product_tooltip" title='{__ text="Nie osiągnięto progu punktów."} <br/> {__ text="Do osiągnięcia progu brakuje"}: <b>{$is_release} {$points_shortcut}</b>'>
<a style="opacity:0.5" href="/points/list" >{__ text="dodaj do koszyka"}</a>
</li>
{elseif $result.points_value < $points_login_status}
<li>
{$result.basket}
</li>
{elseif $result.points_value > $points_login_status}
<li style="opacity:0.5" class=" product_tooltip" title='{__ text="Brak wystarczającej ilości punktów."}'>
<a style="opacity:0.5" href="#" >{__ text="dodaj do koszyka"}</a>
</li>
{/if}
{elseif $result.check_price!=1}
<li>
{$result.basket}
</li>
{/if}
</ul>
</div>
<div class="clear"></div>
</div>
{/foreach}

View File

@@ -0,0 +1,21 @@
<div class="new_search-box">
<h2>{__ text="Wyszukiwaniec" langCatalogue="stSearchFrontend"}</h2>
<div class="content">
{$form_start}
{$search_input}
<div class="buttons right">
<button class="roundies regular" type="submit"/>{__ text="Szukaj" langCatalogue="stSearchFrontend"}</button>
</div>
</form>
{$filters}
<div id="product_other">
{$list}
</div>
{if $more}
<div id="more_button" class="buttons right">{$more}</div>
{/if}
{if $no_results eq 1}
{__ text="Niestety żaden produkt nie spełnia kryteriów wyszukiwania które wpisałeś. Spróbuj użyć innego słowa lub wyszukaj produkt według kategorii." langCatalogue="stSearchFrontend}
{/if}
</div>
</div>

View File

@@ -0,0 +1,80 @@
{literal}
<script type="text/javascript">
jQuery(function($) {
$(".product_tooltip").tooltip({
effect : 'slide',
opacity : 1,
delay : 0,
position : 'bottom center',
offset : [10, 0],
tipClass : "my_tooltip tooltip roundies"
});
});
</script>
{/literal}
{foreach from=$results item=result}
<div class="search-result-row box roundies" >
{if $result.check_price!=1 && $result.points_only!=1}
<div class="price">
{$result.price_gross}
</div>
{/if}
{if $points_system_is_active==1 && $show_points==1}
<div class="price">
{if $display_type=='only_value' || $result.points_only==1}
{if $result.points_value > 0}<span style="color:#ED1B24;">{$result.points_value} {$points_shortcut}</span>{/if}
{elseif $display_type=='only_earn' && $result.points_only!=1}
{if $result.points_earn > 0}<span style="color:green;">{$result.points_earn} {$points_shortcut}</span>{/if}
{elseif $display_type=='value_earn_alternative' && $result.points_only!=1}
{if $result.points_value > 0}<span style="color:#ED1B24;">{$result.points_value} {$points_shortcut}</span>{/if}{if $result.points_value > 0 && $result.points_earn > 0} / {/if}{if $result.points_earn > 0}<span style="color:green;">{$result.points_earn} {$points_shortcut}</span>{/if}
{elseif $display_type=='earn_value_alternative' && $product.points_only!=1}
{if $result.points_earn > 0}<span style="color:green;">{$result.points_earn} {$points_shortcut}</span>{/if}{if $result.points_value > 0 && $result.points_earn > 0} / {/if}{if $result.points_value > 0}<span style="color:#ED1B24;">{$result.points_value} {$points_shortcut}</span>{/if}
{/if}
</div>
{/if}
<h4 class="product_link">{$result.name}</h4>
<div class="image">
{$result.image}
</div>
<div class="content">
{$result.description}
</div>
<div class="search_links">
<ul>
<li>
{$result.more}
</li>
{if $points_system_is_active==1 && $result.points_only==1}
{if $is_authenticated!=1}
<li class="product_tooltip" title='{__ text="Zaloguj się aby kupić produkt."}'>
<a href="/user/loginUser">{__ text="tylko za punkty"}</a>
</li>
{elseif $is_release!="release_off" && $is_release!="release_on"}
<li style="opacity:0.5" class="basket product_tooltip" title='{__ text="Nie osiągnięto progu punktów."} <br/> {__ text="Do osiągnięcia progu brakuje"}: <b>{$is_release} {$points_shortcut}</b>'>
<a style="opacity:0.5" href="/points/list" >{__ text="dodaj do koszyka"}</a>
</li>
{elseif $result.points_value < $points_login_status}
<li>
{$result.basket}
</li>
{elseif $result.points_value > $points_login_status}
<li style="opacity:0.5" class=" product_tooltip" title='{__ text="Brak wystarczającej ilości punktów."}'>
<a style="opacity:0.5" href="#" >{__ text="dodaj do koszyka"}</a>
</li>
{/if}
{elseif $result.check_price!=1}
<li>
{$result.basket}
</li>
{/if}
</ul>
</div>
<div class="clear"></div>
</div>
{/foreach}