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,140 @@
<?php
/*
* @author Krzysztof Bebło <krzysztof.beblo@sote.pl>
*/
class smMyTabsFrontendActions extends stActions
{
public function executeTab1()
{
if (!$_SERVER['HTTP_REFERER']){
$this->getResponse()->setStatusCode(404);
$this->getResponse()->setHttpHeader('Status', '404 Not Found');
return sfView::NONE;
}
$this->setLayout(false);
$this->smarty = new stSmarty($this->getModuleName());
$this->config = stConfig::getInstance(sfContext::getInstance(), 'stProduct');
$product_id = $this->getRequestParameter('product_id');
$c = new Criteria();
$c->addJoin(ProductPeer::ID, ProductHasTab1Peer::TAB1_ID);
$c->add(ProductHasTab1Peer::PRODUCT_ID, $product_id);
$c->add(ProductPeer::ACTIVE, 1);
$c->addAscendingOrderByColumn(ProductHasTab1Peer::ID);
$this->products = ProductPeer::doSelectForPager($c);
}
public function executeTab2()
{
if (!$_SERVER['HTTP_REFERER']){
$this->getResponse()->setStatusCode(404);
$this->getResponse()->setHttpHeader('Status', '404 Not Found');
return sfView::NONE;
}
$this->setLayout(false);
$this->smarty = new stSmarty($this->getModuleName());
$this->config = stConfig::getInstance(sfContext::getInstance(), 'stProduct');
$product_id = $this->getRequestParameter('product_id');
$c = new Criteria();
$c->addJoin(ProductPeer::ID, ProductHasTab2Peer::TAB2_ID);
$c->add(ProductHasTab2Peer::PRODUCT_ID, $product_id);
$c->add(ProductPeer::ACTIVE, 1);
$c->addAscendingOrderByColumn(ProductHasTab2Peer::ID);
$this->products = ProductPeer::doSelectForPager($c);
}
public function executeTab3()
{
if (!$_SERVER['HTTP_REFERER']){
$this->getResponse()->setStatusCode(404);
$this->getResponse()->setHttpHeader('Status', '404 Not Found');
return sfView::NONE;
}
$this->setLayout(false);
$this->smarty = new stSmarty($this->getModuleName());
$this->config = stConfig::getInstance(sfContext::getInstance(), 'stProduct');
$product_id = $this->getRequestParameter('product_id');
$c = new Criteria();
$c->addJoin(ProductPeer::ID, ProductHasTab3Peer::TAB3_ID);
$c->add(ProductHasTab3Peer::PRODUCT_ID, $product_id);
$c->add(ProductPeer::ACTIVE, 1);
$c->addAscendingOrderByColumn(ProductHasTab3Peer::ID);
$this->products = ProductPeer::doSelectForPager($c);
}
public function executeTab4()
{
if (!$_SERVER['HTTP_REFERER']){
$this->getResponse()->setStatusCode(404);
$this->getResponse()->setHttpHeader('Status', '404 Not Found');
return sfView::NONE;
}
$this->setLayout(false);
$this->smarty = new stSmarty($this->getModuleName());
$this->config = stConfig::getInstance(sfContext::getInstance(), 'stProduct');
$product_id = $this->getRequestParameter('product_id');
$c = new Criteria();
$c->addJoin(ProductPeer::ID, ProductHasTab4Peer::TAB4_ID);
$c->add(ProductHasTab4Peer::PRODUCT_ID, $product_id);
$c->add(ProductPeer::ACTIVE, 1);
$c->addAscendingOrderByColumn(ProductHasTab4Peer::ID);
$this->products= ProductPeer::doSelectForPager($c);
}
}

View File

@@ -0,0 +1,102 @@
<?php
class smMyTabsFrontendComponents extends sfComponents
{
public function executeShow()
{
$product = sfContext::getInstance()->getActionStack()->getLastEntry()->getActionInstance()->product;
$product_id = $product->getId();
$this->smarty = new stSmarty('smMyTabsFrontend');
$this->tabs = stTabNavigator::getInstance($this->getContext(), "my_tabs", null);
if($product->getMyTab1()){
$name_tab_1 = $product->getMyTab1();
}else{
$name_tab_1 = "---- 1 ----";
}
if($product->getMyTab2()){
$name_tab_2 = $product->getMyTab2();
}else{
$name_tab_2 = "---- 2 ----";
}
if($product->getMyTab3()){
$name_tab_3 = $product->getMyTab3();
}else{
$name_tab_3 = "---- 3 ----";
}
if($product->getMyTab4()){
$name_tab_4 = $product->getMyTab4();
}else{
$name_tab_4 = "---- 4 ----";
}
$c = new Criteria();
$c->addJoin(ProductPeer::ID, ProductHasTab1Peer::TAB1_ID);
$c->add(ProductHasTab1Peer::PRODUCT_ID, $product_id);
$c->add(ProductPeer::ACTIVE, 1);
$c->addAscendingOrderByColumn(ProductHasTab1Peer::ID);
$products_tab1 = ProductPeer::doSelectForPager($c);
$c = new Criteria();
$c->addJoin(ProductPeer::ID, ProductHasTab2Peer::TAB2_ID);
$c->add(ProductHasTab2Peer::PRODUCT_ID, $product_id);
$c->add(ProductPeer::ACTIVE, 1);
$c->addAscendingOrderByColumn(ProductHasTab2Peer::ID);
$products_tab2 = ProductPeer::doSelectForPager($c);
$c = new Criteria();
$c->addJoin(ProductPeer::ID, ProductHasTab3Peer::TAB3_ID);
$c->add(ProductHasTab3Peer::PRODUCT_ID, $product_id);
$c->add(ProductPeer::ACTIVE, 1);
$c->addAscendingOrderByColumn(ProductHasTab3Peer::ID);
$products_tab3 = ProductPeer::doSelectForPager($c);
$c = new Criteria();
$c->addJoin(ProductPeer::ID, ProductHasTab4Peer::TAB4_ID);
$c->add(ProductHasTab4Peer::PRODUCT_ID, $product_id);
$c->add(ProductPeer::ACTIVE, 1);
$c->addAscendingOrderByColumn(ProductHasTab4Peer::ID);
$products_tab4 = ProductPeer::doSelectForPager($c);
if ($products_tab1){
$this->tabs->addTab($name_tab_1,'smMyTabsFrontend', 'tab1', array("product_id"=>$product->getId()));
}
if ($products_tab2){
$this->tabs->addTab($name_tab_2,'smMyTabsFrontend', 'tab2', array("product_id"=>$product->getId()));
}
if ($products_tab3){
$this->tabs->addTab($name_tab_3,'smMyTabsFrontend', 'tab3', array("product_id"=>$product->getId()));
}
if ($products_tab4){
$this->tabs->addTab($name_tab_4,'smMyTabsFrontend', 'tab4', array("product_id"=>$product->getId()));
}
}
}

View File

@@ -0,0 +1,106 @@
<?php
use_helper('stCurrency', 'stProductImage', 'stText', 'stUrl');
st_theme_use_stylesheet('stProduct.css');
if ($products)
{
$smarty->assign('name', $name);
$smarty->assign("show_name", $config->get('show_name_other'));
$smarty->assign("show_image", $config->get('show_image_other'));
$smarty->assign("show_price", $config->get('show_price_other'));
$smarty->assign("show_description", $config->get('show_description_other'));
$smarty->assign("show_old_price", $config->get('show_old_price_other'));
$smarty->assign("show_discount", $config->get('show_discount_other'));
$smarty->assign("price_view", $config->get('price_view_other'));
$photo_max_height = st_asset_thumbnail_setting('height', 'thumb');
$cut_name = $config->get('cut_name_other');
$max_name_length = $config->get('cut_name_num_other');
$results = array();
foreach ($products as $index => $product)
{
$product_url = st_url_for('stProduct/show?url='.$product->getFriendlyUrl());
$product_name = $product->getName();
$results[$index]['instance'] = $product ;
$results[$index]['id'] = $product->getId();
$results[$index]['photo'] = content_tag('a', st_product_image_tag($product, 'thumb'), array('href' => $product_url));
$results[$index]['photo_small'] = content_tag('a', st_product_image_tag($product, 'small'), array('href' => $product_url));
$results[$index]['photo_max_height'] = $photo_max_height;
if ($cut_name && st_check_strlen($product_name) > $max_name_length)
{
$results[$index]['name'] = "<span title=\"". $product_name ."\">" . content_tag('a', st_truncate_text($product_name, $max_name_length, '...'), array('href' => $product_url, 'class' => 'product_name')) . "</span>";
}
else
{
$results[$index]['name'] = content_tag('a', $product_name, array('href' => $product_url, 'class' => 'product_name'));
}
if ($product->isPriceVisible())
{
$results[$index]['price'] = st_currency_format($product->getPriceBrutto(true));
$results[$index]['price_net'] = st_currency_format($product->getPriceNetto(true));
$old_price_brutto = $product->getOldPriceBrutto(true);
$results[$index]['check_old_price'] = $old_price_brutto != 0;
$results[$index]['old_price'] = st_currency_format($old_price_brutto);
$results[$index]['old_price_net'] = st_currency_format($product->getOldPriceNetto(true));
$results[$index]['discount'] = $product->getDiscountInPercent();
$results[$index]['check_price'] = false;
$results[$index]['basket'] = st_get_component('stBasket', 'add', array('product' => $product));
if ($config->get('show_basic_price_long') && $product->hasBasicPrice() && $product->getBasicPriceBrutto()!=0)
{
$results[$index]['basic_price'] = array(
'netto' => st_currency_format($product->getBasicPriceNetto(true)),
'brutto' => st_currency_format($product->getBasicPriceBrutto(true)),
'quantity' => st_product_basic_price_quantity($product),
'for_quantity' => st_product_basic_price_for_quantity($product),
);
}
}
else
{
$results[$index]['check_price'] = true;
}
$results[$index]['description'] = $product->getShortDescription() ? $product->getShortDescription() : st_truncate_text($product->getDescription(), 140, '...');
$results[$index]['name_without_link'] = $product->getName();
$results[$index]['link'] = $product_url;
$results[$index]['code'] = $product->getCode();
}
$smarty->assign("results", $results);
$smarty->display('products.html');
}

View File

@@ -0,0 +1,5 @@
<?php
use_helper('stTabNavigator');
$smarty->assign('tabs', $tabs);
$smarty->display('tabs.html');
?>

View File

@@ -0,0 +1 @@
<?php echo st_get_partial('products',array('products'=>$products, 'smarty'=>$smarty, 'config'=>$config, 'name'=>'my_tab1'));?>

View File

@@ -0,0 +1 @@
<?php echo st_get_partial('products',array('products'=>$products, 'smarty'=>$smarty, 'config'=>$config, 'name'=>'my_tab2'));?>

View File

@@ -0,0 +1 @@
<?php echo st_get_partial('products',array('products'=>$products, 'smarty'=>$smarty, 'config'=>$config, 'name'=>'my_tab3'));?>

View File

@@ -0,0 +1 @@
<?php echo st_get_partial('products',array('products'=>$products, 'smarty'=>$smarty, 'config'=>$config, 'name'=>'my_tab4'));?>

View File

@@ -0,0 +1,65 @@
<section id="{$name}" class="full-list product-list" style="margin-top: 10px;">
<div class="row" data-equalizer>
{foreach key=row item=product from=$results}
<div class="product col-xs-4 col-sm-4 col-md-3 col-lg-3">
<div class="thumbnail clearfix view-img">
{if $show_image==1}<div data-equalizer-watch="image"><div class="image">{$product.photo_small}</div></div>{/if}
<div class="text-center caption clearfix">
<p class="name" data-equalizer-watch="name">{if $show_name==1}{$product.name}{/if}</p>
<div data-equalizer-watch="info">
{if $show_price==1 && $product.check_price!=1 && $product.points_only!=1}
{if $price_view=='net_gross'}
<div class="double_price price">
{$product.price_net}
<div class="minor_price">({$product.price})</div>
</div>
{elseif $price_view=='only_gross'}
<div class="price">{$product.price}</div>
{elseif $price_view=='only_net'}
<div class="price">{$product.price_net}</div>
{elseif $price_view=='gross_net'}
<div class="double_price price">
{$product.price}
<div class="minor_price">({$product.price_net})</div>
</div>
{/if}
{if $product.basic_price}
<div class="text-muted basic_price text-center"><i>{$product.basic_price.quantity} ( {$product.basic_price.brutto} {__ text="za"} {$product.basic_price.for_quantity} )</i></div>
{/if}
{/if}
<div class="discount-old_price">
{if $show_discount==1 && $product.discount!=0 && $product.check_price!=1 && $product.points_only!=1}
<div class="discount">{__ text="Rabat"}: {$product.discount} %</div>
{elseif ($show_old_price==1 && $product.check_price!=1)}
{if $product.check_old_price==1}
<div class="old_price price">
{if ($price_view=='net_gross' || $price_view=='only_net')}
{$product.old_price_net}
{else}
{$product.old_price}
{/if}
</div>
{/if}
{/if}
</div>
</div>
{basket_add_link product=$product.instance namespace="product_list"}
<div class="text-center" data-equalizer-watch="basket">
<a class="product-details" href="{$product.link}">{__ text="szczegóły" langCatalogue="stProduct"}</a>
</div>
</div>
</div>
</div>
{/foreach}
</div>
</section>
{literal}
<script type="text/javascript">
jQuery(function($) {
$(document).ready(function() {
$('#{/literal}{$name}{literal} [data-equalizer]').equalizer({ use_tallest: true });
});
});
</script>
{/literal}

View File

@@ -0,0 +1,59 @@
<section id="{$name}" class="full-list product-list" style="margin-top: 10px;">
<div class="row" data-equalizer>
{foreach key=row item=product from=$results}
<div class="product col-xs-4 col-sm-4 col-md-3 col-lg-3">
<div class="thumbnail clearfix view-img">
{if $show_image==1}<div data-equalizer-watch="image"><div class="image">{$product.photo_small}</div></div>{/if}
<div class="text-center caption clearfix" data-equalizer-watch="info">
<p class="name">{if $show_name==1}{$product.name}{/if}</p>
{if $show_price==1 && $product.check_price!=1}
{if $price_view=='net_gross'}
<div class="double_price price">
<span class="nowrap">{$product.price_net}</span>
<div class="minor_price nowrap">({$product.price})</div>
</div>
{elseif $price_view=='only_gross'}
<div class="price nowrap">{$product.price}</div>
{elseif $price_view=='only_net'}
<div class="price nowrap">{$product.price_net}</div>
{elseif $price_view=='gross_net'}
<div class="double_price price">
<span class="nowrap">{$product.price}</span>
<div class="minor_price nowrap">({$product.price_net})</div>
</div>
{/if}
{if $product.basic_price}
<div class="text-muted basic_price text-center"><i>{$product.basic_price.quantity} ( {$product.basic_price.brutto} {__ text="za"} {$product.basic_price.for_quantity} )</i></div>
{/if}
{/if}
<div class="discount-old_price">
{if $show_discount==1 && $product.discount!=0 && $product.check_price!=1}
<div class="discount">{__ text="Rabat"}: <span class="nowrap">{$product.discount} %</span></div>
{elseif ($show_old_price==1 && $product.check_price!=1)}
{if $product.check_old_price==1}
<div class="old_price price nowrap">
{if ($price_view=='net_gross' || $price_view=='only_net')}
{$product.old_price_net}
{else}
{$product.old_price}
{/if}
</div>
{/if}
{/if}
</div>
</div>
</div>
</div>
{/foreach}
</div>
</section>
{literal}
<script type="text/javascript">
jQuery(function($) {
$(document).ready(function() {
$('#{/literal}{$name}{literal} [data-equalizer]').equalizer({ use_tallest: true });
});
});
</script>
{/literal}

View File

@@ -0,0 +1,47 @@
{if $tabs->getTabs()}
<ul id="tabs" class="nav nav-tabs">
{foreach item=tab from=$tabs->getTabs()}
<li>
<a href="#tabs-{$tab->getIndex()}" data-url="{url_for internal=$tab->getParamsForUrl()}" rel="nofollow">{__ text=$tab->getLabel()}</a>
</li>
{/foreach}
</ul>
<div class="tab-content">
{foreach item=tab from=$tabs->getTabs()}
<div class="tab-pane" id="tabs-{$tab->getIndex()}"></div>
{/foreach}
</div>
{/if}
{literal}
<script type="text/javascript">
//<![CDATA[
jQuery(function($) {
var preloader = $('#product-preloader');
$('#tabs').on('click', 'a', function() {
var tab = $(this);
tab.tab('show');
var pane = $(tab.attr('href'));
if (pane.is(':empty')) {
pane.html('<div class="preloader"></div>');
$.get(tab.data('url'), function(html) {
pane.html(html);
});
}
return false;
});
$('#tabs a[href=#tabs-1]').click();
});
//]]>
</script>
{/literal}