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,21 @@
<?php
/**
* SOTESHOP/stCrossellingPlugin
*
* Ten plik należy do aplikacji stCrossellingPlugin opartej na licencji (Professional License SOTE).
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
*
* @package stCrossellingPlugin
* @subpackage configs
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: config.php 8574 2010-10-01 12:11:46Z michal $
* @author Michal Prochowski <michal.prochowski@sote.pl>
*/
/**
* Włączanie modułów
*/
stPluginHelper::addEnableModule('stCrossellingFrontend', 'frontend');

View File

@@ -0,0 +1,34 @@
---
propel:
_attributes:
defaultIdMethod: native
package: plugins.stCrossellingPlugin.lib.model
st_crosselling:
_attributes:
phpName: Crosselling
created_at:
type: timestamp
updated_at:
type: timestamp
id:
type: INTEGER
primaryKey: true
required: true
autoIncrement: true
first_product_id:
type: INTEGER
required: true
foreignTable: st_product
foreignReference: id
onDelete: cascade
secound_product_id:
type: INTEGER
required: true
foreignTable: st_product
foreignReference: id
onDelete: cascade
sum:
type: INTEGER
_indexes:
crosselling_sum:
- sum

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for representing a row from the 'st_crosselling' table.
*
*
*
* @package plugins.stCrossellingPlugin.lib.model
*/
class Crosselling extends BaseCrosselling
{
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* Subclass for performing query and update operations on the 'st_crosselling' table.
*
*
*
* @package plugins.stCrossellingPlugin.lib.model
*/
class CrossellingPeer extends BaseCrossellingPeer
{
}

View File

@@ -0,0 +1,78 @@
<?php
/**
* This class adds structure of 'st_crosselling' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package plugins.stCrossellingPlugin.lib.model.map
*/
class CrossellingMapBuilder {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'plugins.stCrossellingPlugin.lib.model.map.CrossellingMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('st_crosselling');
$tMap->setPhpName('Crosselling');
$tMap->setUseIdGenerator(true);
$tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addForeignKey('FIRST_PRODUCT_ID', 'FirstProductId', 'int', CreoleTypes::INTEGER, 'st_product', 'ID', true, null);
$tMap->addForeignKey('SECOUND_PRODUCT_ID', 'SecoundProductId', 'int', CreoleTypes::INTEGER, 'st_product', 'ID', true, null);
$tMap->addColumn('SUM', 'Sum', 'int', CreoleTypes::INTEGER, false, null);
} // doBuild()
} // CrossellingMapBuilder

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,153 @@
<?php
/**
* SOTESHOP/stCrossellingPlugin
*
* Ten plik należy do aplikacji stCrossellingPlugin opartej na licencji (Professional License SOTE).
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
*
* @package stCrossellingPlugin
* @subpackage libs
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: stCrosselling.class.php 799 2009-09-28 13:26:35Z michal $
* @author Michal Prochowski <michal.prochowski@sote.pl>
*/
/**
* Klasa stCrosselling
*
* @package stCrossellingPlugin
* @subpackage libs
*/
class stCrosselling
{
/**
* Zapisywanie produktów z zamówienia
*
* @param array $products tablica z numerami id produktów
*/
static public function saveProducts($products = array())
{
}
/**
* Pobieranie pojedyńczego produktu, który pasuje do wybranej grupy produktów
*
* @param array $products - tablica z numerami id produktów
* @return object obiekt z danymi produktu
*/
public function getProduct( $products = array() )
{
$c = new Criteria();
$c->add(CrossellingPeer::FIRST_PRODUCT_ID, $products, Criteria::IN);
$c->add(CrossellingPeer::SECOUND_PRODUCT_ID, $products, Criteria::NOT_IN);
$c->addGroupByColumn(CrossellingPeer::SECOUND_PRODUCT_ID);
$c->addAsColumn("MAX","MAX(".CrossellingPeer::SUM.")");
$c->addDescendingOrderByColumn('MAX');
$product = CrossellingPeer::doSelect($c);
if (!is_array($product) || count($product) == 0)
{
return false;
}
$c = new Criteria();
$c->add(ProductPeer::ID, $product[rand(0, count($product)-1)]->getSecoundProductId());
$c->add(ProductPeer::ACTIVE, 1);
return ProductPeer::doSelectOne($c);
}
/**
* Pobieranie kilku produktów, które pasują do wybranej grupy produktów
*
* @param array $products - tablica z numerami id produktów
* @param integer $limit liczba produków, które mają zostać zwrócone
* @return object obiekt z danymi produktów
*/
static public function getProducts($products = array(), $limit = 6)
{
$c = new Criteria();
$c->add(CrossellingPeer::FIRST_PRODUCT_ID, $products, Criteria::IN);
$c->add(CrossellingPeer::SECOUND_PRODUCT_ID, $products, Criteria::NOT_IN);
$c->addGroupByColumn(CrossellingPeer::SECOUND_PRODUCT_ID);
$c->addAsColumn("MAX","MAX(".CrossellingPeer::SUM.")");
$c->addDescendingOrderByColumn('MAX');
$c->setLimit($limit);
$products = CrossellingPeer::doSelect($c);
if (!is_array($products) || count($products) == 0)
{
return array();
}
$c = new Criteria();
foreach ($products as $product)
{
$c->addOr(ProductPeer::ID, $product->getSecoundProductId());
}
$c->addAnd(ProductPeer::ACTIVE, 1);
return ProductPeer::doSelect($c);
}
/**
* Pobieranie numerów id produktów, które pasują do wybranej grupy produktów
*
* @param array $products - tablica z numerami id produktów
* @param integer $limit liczba produków, które mają zostać zwrócone
* @return object obiekt z danymi produktów
*/
public function getProductsId($products = array(), $limit = 6)
{
$c = new Criteria();
$c->add(CrossellingPeer::FIRST_PRODUCT_ID, $products, Criteria::IN);
$c->add(CrossellingPeer::SECOUND_PRODUCT_ID, $products, Criteria::NOT_IN);
$c->addGroupByColumn(CrossellingPeer::SECOUND_PRODUCT_ID);
$c->addAsColumn("MAX","MAX(".CrossellingPeer::SUM.")");
$c->addDescendingOrderByColumn('MAX');
$c->setLimit($limit);
$products = CrossellingPeer::doSelect($c);
if (!is_array($products) || count($products) == 0) return array();
$productsId = array();
foreach ($products as $product) $productsId[] = $product->getSecoundProductId();
return $productsId;
}
/**
* Pobieranie informacji o istnieniu produktów
*
* @return bool
*/
static public function hasProductsInBasket()
{
$context = sfContext::getInstance();
$stBasket = stBasket::getInstance($context->getUser());
if (count($stBasket->getItems()) > 0)
{
$products = $stBasket->getItems();
$productsIdArray = array();
foreach ($products as $productId => $product) {
$productsIdArray[] = $product->getProductId();
}
$stCrosselling = new stCrosselling();
if (count($stCrosselling->getProducts($productsIdArray,1))>0)
{
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,43 @@
<?php
/**
* SOTESHOP/stCrossellingPlugin
*
* Ten plik należy do aplikacji stCrossellingPlugin opartej na licencji (Professional License SOTE).
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
*
* @package stCrossellingPlugin
* @subpackage libs
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: stCrossellingListener.class.php 10 2009-08-24 09:32:18Z michal $
* @author Michal Prochowski <michal.prochowski@sote.pl>
*/
/**
* Klasa stCrossellingListener
*
* @package stCrossellingPlugin
* @subpackage libs
*/
class stCrossellingListener
{
/**
* Dodanie zakładki do karty produktu
*
* @param sfEvent $event
*/
public static function addTabProduct(sfEvent $event)
{
$action = $event->getSubject();
$stCrosselling = new stCrosselling();
$products = $stCrosselling->getProducts(array($action->getRequestParameter('product_id')));
if ($products)
{
$action->productList->addTab('Klienci, którzy kupili ten produkt, kupili również', 'stCrossellingFrontend', 'showInProductTab', array('product_id' => $action->product->getId()));
}
}
}

View File

@@ -0,0 +1,40 @@
<?php
/**
* SOTESHOP/stCrossellingPlugin
*
* Ten plik należy do aplikacji stCrossellingPlugin opartej na licencji (Professional License SOTE).
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
*
* @package stCrossellingPlugin
* @subpackage actions
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: actions.class.php 10 2009-08-24 09:32:18Z michal $
* @author Michal Prochowski <michal.prochowski@sote.pl>
*/
/**
* Komponent stCrossellingFrontendComponents
*
* @package stCrossellingPlugin
* @subpackage actions
*/
class stCrossellingFrontendActions extends stActions {
public function executeShowInProductTab() {
$this->setLayout(false);
$this->smarty = new stSmarty($this->getModuleName());
if ($this->hasRequestParameter('id'))
$this->products = stCrosselling::getProducts(array($this->getRequestParameter('id')));
else
return sfView::NONE;
$this->config = stConfig::getInstance('stProduct');
$this->config_points = stConfig::getInstance('stPointsBackend');
$this->config_points->setCulture($this->getUser()->getCulture());
}
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* SOTESHOP/stCrossellingPlugin
*
* Ten plik należy do aplikacji stCrossellingPlugin opartej na licencji (Professional License SOTE).
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
*
* @package stCrossellingPlugin
* @subpackage actions
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: components.class.php 2904 2010-01-07 13:40:03Z bartek $
* @author Michal Prochowski <michal.prochowski@sote.pl>
*/
/**
* Komponent stCrossellingFrontendComponents
*
* @package stCrossellingPlugin
* @subpackage actions
*/
class stCrossellingFrontendComponents extends sfComponents
{
/**
* Wyświetlanie produktów w koszyku
*/
public function executeShowProductsInBasket()
{
$this->smarty = new stSmarty('stCrossellingFrontend');
$this->productSmarty = new stSmarty('stProduct');
$context = sfContext::getInstance();
$products = stBasket::getInstance($context->getUser())->getItems();
$stCrosselling = new stCrosselling();
$this->productConfig = stConfig::getInstance($context, 'stProduct');
$productsIdArray = array();
foreach ($products as $product) $productsIdArray[] = $product->getProductId();
$c = new Criteria();
$c->add(ProductGroupPeer::PRODUCT_GROUP, 'BASKET');
$basketGroup = ProductGroupPeer::doSelectOneCached($c);
if (is_object($basketGroup) && ($basketGroup->getProductLimit())) $limit = $basketGroup->getProductLimit();
else $limit = 6;
$c = new Criteria();
$c->add(ProductPeer::ID, $stCrosselling->getProductsId($productsIdArray), Criteria::IN);
$c->addAscendingOrderByColumn('RAND()');
$this->pager = new sfPropelPager('Product', $limit);
$this->pager->setCriteria($c);
$this->pager->init();
$this->productSmarty->register_function('st_product_image_tag', 'st_product_smarty_image_tag');
}
}

View File

@@ -0,0 +1,5 @@
<?php
st_theme_use_stylesheet('stPromoteProductsInBasket.css');
$smarty->assign('products', get_partial("stProduct/listOther", array('product_pager' => $pager, 'smarty' => $productSmarty, 'config' => $productConfig)));
$smarty->display('crosselling_show_products_in_basket.html');
?>

View File

@@ -0,0 +1,87 @@
<?php
use_helper('stCurrency', 'stText', 'stProductImage', 'stUrl');
st_theme_use_stylesheet('stProduct.css');
$results = array();
$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_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');
$photo_max_width = st_asset_thumbnail_setting('width', 'small');
$cut_name = $config->get('cut_name_other');
$max_name_length = $config->get('cut_name_num_other');
foreach ($products as $index => $product) {
$product_url = st_url_for('stProduct/show?url=' . $product->getFriendlyUrl());
$product_name = $product->getName();
$results[$index]['instance'] = $product;
if ($cut_name && st_check_strlen($product_name) > $max_name_length)
$results[$index]['name'] = '<span title="'.$product_name.'" class="hint">' . 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'));
$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 ($product->isPriceVisible()) {
if ($config->get('show_uom_other') && $product->getUom())
$uom = " / ".$product->getUom();
else
$uom = "";
$results[$index]['price'] = st_currency_format($product->getPriceBrutto(true)).$uom;
$results[$index]['price_net'] = st_currency_format($product->getPriceNetto(true)).$uom;
$results[$index]['price_brutto_pure'] = $product->getPriceBrutto(true).$uom;
$results[$index]['price_netto_pure'] = $product->getPriceNetto(true).$uom;
$currency = stCurrency::getInstance(sfContext::getInstance());
if ($currency->getFrontSymbol())
$results[$index]['currency'] = $currency->getFrontSymbol();
else
$results[$index]['currency'] = $currency->getBackSymbol();
$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]['basket'] = st_get_component('stBasket', 'add', array('product' => $product));
$results[$index]['check_price'] = false;
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]['points_value'] = $product->getPointsValue();
$results[$index]['points_earn'] = $product->getPointsEarn();
$results[$index]['points_only'] = $product->getPointsOnly();
$results[$index]['name_without_link'] = $product_name;
$results[$index]['link'] = st_url_for('stProduct/show?url=' . $product->getFriendlyUrl());
}
$smarty->assign('points_system_is_active', stPoints::isPointsSystemActive());
$smarty->assign('show_points', $config_points->get('product_group_show_points'));
$smarty->assign('display_type', $config_points->get('product_group_display_type'));
$smarty->assign('points_shortcut', $config_points->get('points_shortcut', null, true));
$smarty->assign('config_points',$config_points);
$smarty->assign('results', $results);
$smarty->display('crosselling_show_in_product_tab.html');

View File

@@ -0,0 +1,16 @@
<div id="st_promote_products_in_basket_frame_images">
{foreach key=row item=product from=$results}
<div class="st_promote_products_in_basket_box_image">
<div class="st_promote_products_in_basket_name">
{$product.name}
</div>
<div class="st_promote_products_in_basket_image">
{$product.image}
</div>
<div class="st_promote_products_in_basket_price">
{$product.brutto}
</div>
</div>
{/foreach}
<br class="clear_all" />
</div>

View File

@@ -0,0 +1,8 @@
<h5 class="st_title">
{__ text="Klienci, którzy kupili te produkty, kupili również"}
</h5>
<div class="st_promote-products">
<div id="st_promote_products_in_basket_frame_images">
{$products}
</div>
</div>

View File

@@ -0,0 +1,4 @@
<h3>{__ text="Klienci, którzy kupili te produkty, kupili również"}</h3>
<div id="content_product_basket">
{$products}
</div>

View File

@@ -0,0 +1,66 @@
<section id="product-crosselling" class="full-list product-list">
<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">
<div class="image" data-equalizer-watch="image">{if $show_image==1}{$product.photo_small}{/if}</div>
<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 && $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>
</div>
</div>
{/foreach}
</div>
</section>
{literal}
<script type="text/javascript">
jQuery(function($) {
$(document).ready(function() {
$('#product-crosselling [data-equalizer]').equalizer({ use_tallest: true });
if($('#price-star-info').length ){
$('#product-crosselling .price').each(function() {
var price = $(this);
price.html(price.html() + ' *');
});
}
});
});
</script>
{/literal}

View File

@@ -0,0 +1,4 @@
<h3>{__ text="Klienci, którzy kupili te produkty, kupili również"}</h3>
<div id="content_product_basket">
{$products}
</div>