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,621 @@
<?php
/**
* SOTESHOP/stBasket
*
* Ten plik należy do aplikacji stBasket 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 stBasket
* @subpackage actions
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: actions.class.php 17428 2012-03-14 14:17:02Z marcin $
*/
/**
* Akcje dla koszyka
*
* @author Marcin Butlak <marcin.butlak@sote.pl>
*
* @package stBasket
* @subpackage actions
*/
class stBasketActions extends stActions {
public function preExecute()
{
$ret = parent::preExecute();
if ($this->hasSessionExpired() && !$this->getRequest()->isXmlHttpRequest() && $this->getRequest()->getMethod() == sfRequest::POST && !in_array($this->getActionName(), array('addReferer')))
{
return $this->redirect('@stBasket?action=index&session_expired=true');
}
/**
* @var stUser
*/
$user = $this->getUser();
$user->setVatEx(stTax::hasEx($user->isAuthenticated() && $user->getUserDataDefaultBilling() ? $user->getUserDataDefaultBilling()->getCountries()->getId() : null));
if (stTax::getIsCustomerEuTaxEnabled(true))
{
$isCompany = $user->isAuthenticated() && $user->getUserDataDefaultBilling() && $user->getUserDataDefaultBilling()->isCompany() || (!$user->isAuthenticated() || null === $user->getUserDataDefaultBilling()) && stConfig::getInstance('stUser')->get('change_default_user');
if (!$this->getRequest()->isXmlHttpRequest() && !$user->hasVatEu() && !$user->hasVatEx())
{
$userBilling = $this->getRequestParameter('user_data_billing');
if ($userBilling)
{
$isCompany = $userBilling['customer_type'] == UserData::COMPANY_TYPE;
}
}
if (stTax::getIsCustomerEuTaxEnabled() && $isCompany)
{
stTax::setIsCustomerEuTaxEnabled(false);
$basket = $user->getBasket();
$basket->refresh();
$basket->save();
}
elseif (!stTax::getIsCustomerEuTaxEnabled() && !$isCompany)
{
stTax::setIsCustomerEuTaxEnabled(true);
$basket = $user->getBasket();
$basket->refresh();
$basket->save();
}
}
elseif (!stTax::getIsCustomerEuTaxEnabled(true) && $user->getAttribute('is_customer_eu_tax_enabled', false, stTax::SESSION_NAMESPACE))
{
stTax::setIsCustomerEuTaxEnabled(false);
$basket = $user->getBasket();
$basket->refresh();
$basket->save();
}
return $ret;
}
/**
* Zwraca obiekt obsługi zdarzeń
*
* @return stEventDispatcher
*/
public function getDispatcher() {
return stEventDispatcher::getInstance();
}
/**
* Zapamietuje poprzednią stronę i przekazuje żądanie do stBasket/index
*/
public function executeIndexReferer() {
$this->remmemberRerefer();
return $this->redirect('@stBasket');
}
/**
* Zapamiętuje poprzednią stronę i przekazuje żądanie do stBasket/add
*/
public function executeAddReferer() {
$request = $this->getRequest();
stFastCacheController::disable();
if (stConfig::getInstance('stBasket')->get('ajax') && $request->isXmlHttpRequest()) {
$this->remmemberRerefer();
$this->responseUpdateElement('basket_show', array('module' => 'stBasket', 'component' => 'show', 'params' => array('cache_id' => stBasket::cacheId())));
$this->responseUpdateElement('login_status_container', array('module' => 'stUser', 'component' => 'loginStatus'));
$result = $this->getRenderComponent('stBasket', 'ajaxAddedProductPreview');
return $this->renderText($result);
} else {
$this->remmemberRerefer();
return $this->redirect('@stBasket');
}
}
/**
* Indeks koszyka
*/
public function executeIndex()
{
$this->getUser()->setAttribute('is_blocked', false, stBasket::SESSION_NAMESPACE);
$this->smarty = new stSmarty($this->getModuleName());
$this->basket = stBasket::getInstance($this->getUser());
$this->delivery = stDeliveryFrontend::getInstance($this->basket);
if ($this->getRequest()->getMethod() == sfRequest::POST)
{
$user_data_delivery = $this->getRequestParameter('user_data_delivery');
if (null !== $user_data_delivery)
{
$this->delivery->setDefaultDeliveryCountry($user_data_delivery['country']);
}
$this->basket->refresh();
$this->basket->save();
}
if ($this->hasRequestParameter('submit_save'))
{
$user = $this->getUser();
$user->setVatEx(stTax::hasEx($user->isAuthenticated() && $user->getUserDataDefaultBilling() ? $user->getUserDataDefaultBilling()->getCountries()->getId() : null));
}
$this->basket_config = stConfig::getInstance('stBasket');
$this->config_points = stConfig::getInstance('stPointsBackend');
$this->referer = $this->getReferer();
}
public function executeSetProduct() {
return $this->redirect('@stBasket');
}
/**
* Dodawanie koszyka
*/
public function executeAddBasket() {
$basket = stBasket::getInstance($this->getUser());
$basket->addBasket(true);
return $this->redirect('@stBasket');
}
/**
* Ustawia domyślny koszyk
*/
public function executeSetBasket() {
$basket = stBasket::getInstance($this->getUser());
$this->forward404Unless(stBasket::validateBasket($this->getRequestParameter('id'), $this->getUser()));
$basket->set($this->getRequestParameter('id'));
return $this->redirect('@stBasket');
}
/**
* Usuwa koszyk
*/
public function executeDeleteBasket() {
$basket = stBasket::getInstance($this->getUser());
$this->forward404Unless(stBasket::validateBasket($this->getRequestParameter('id'), $this->getUser()));
$basket->deleteBasket($this->getRequestParameter('id'));
return $this->redirect('@stBasket');
}
/**
* Zdejmuje produkt z koszyka
*/
public function executeRemove() {
$basket = stBasket::getInstance($this->getUser());
$basket->removeItem($this->getRequestParameter('product_id'));
$basket->save();
return $this->redirect($this->getRequest()->getReferer());
}
public function validateAjaxAddProduct() {
return $this->validateAddReferer();
}
/**
* Weryfikuje poprawność wprowadzanych danych dla akcji SetProduct
*
* @return bool
*/
public function validateSetProduct() {
$i18n = $this->getContext()->getI18N();
$isBlocked = false;
if ($this->hasRequestParameter('product_id')) {
sfLoader::loadHelpers(array('Helper', 'stProduct'), 'stProduct');
$id = $this->getRequestParameter('product_id');
$quantity = $this->getRequestParameter('quantity', 1);
$basket = stBasket::getInstance($this->getUser());
$item = $basket->getItem($id);
$request = $this->getRequest();
if (!$this->validateQuantity($quantity, $error, $item->getProductStockInDecimals())) {
$this->getRequest()->setError('basket{products}{' . $id . '}', $error);
$this->getRequest()->setParameter('basket[products][' . $id . ']', $quantity);
$isBlocked = true;
} else {
$item = $basket->updateItem($id, $quantity, $error);
if ($item->getQuantity() > 0) {
stPoints::refreshLoginStatusPoints();
$basket->save();
}
if ($error)
{
$request->setError('basket{products}{' . $item->getItemId() . '}', stBasket::getErrorMessage($item, $error, $i18n));
$isBlocked = true;
}
}
}
$this->getUser()->setAttribute('is_blocked', $isBlocked, stBasket::SESSION_NAMESPACE);
return $request->hasErrors();
}
/**
* Weryfikuje poprawność wprowadzanych danych dla akcji addReferer
*
* @return bool
*/
public function validateAddReferer() {
$request = $this->getRequest();
$isBlocked = false;
if ($request->hasParameter('product_id') && ($request->getMethod() == sfRequest::GET || $request->getMethod() == sfRequest::POST)) {
$product_id = $this->getRequestParameter('product_id');
$quantity = $this->getRequestParameter('quantity', 1);
$product = ProductPeer::retrieveByPK($product_id);
$basket = stBasket::getInstance($this->getUser());
$error = null;
$i18n = $this->getContext()->getI18N();
sfLoader::loadHelpers(array('Helper', 'stProduct'), 'stProduct');
if (!$this->validateQuantity($quantity, $error, $product ? $product->getStockInDecimals() : false)) {
$item = $basket->addItem($product_id, 0);
$item->setItemId($product_id);
$request->setError('basket{products}{' . $product_id . '}', $error);
$request->setParameter('basket[products][' . $product_id . ']', $quantity);
$isBlocked = true;
} else {
$item = $basket->addItem($product_id, $quantity, $error, $request->isXmlHttpRequest());
if (!$request->isXmlHttpRequest() && $error == stBasket::ERR_NO_OPTIONS_SELECTED)
{
sfLoader::loadHelpers(['Helper', 'stUrl']);
$url = st_url_for('stProduct/show?url='.$item->getProduct()->getUrl()) . '?error=no-options-selected';
return $this->redirect($url);
}
if ($error)
{
$request->setError('basket{products}{' . $item->getItemId() . '}', stBasket::getErrorMessage($item, $error, $i18n));
$isBlocked = true;
}
}
stPoints::refreshLoginStatusPoints();
if (!(stConfig::getInstance('stBasket')->get('ajax') && $request->isXmlHttpRequest()) || $item->getQuantity() > 0)
{
$basket->save();
}
}
$this->getUser()->setAttribute('is_blocked', $isBlocked, stBasket::SESSION_NAMESPACE);
return !$request->hasErrors();
}
/**
* Weryfikuje poprawność wprowadzanych danych dla akcji index
*
* @return bool
*/
public function validateIndex() {
$themeVersion = sfContext::getInstance()->getController()->getTheme()->getVersion();
$basket = stBasket::getInstance($this->getUser());
$isBlocked = false;
if ($this->getRequestParameter('submit_save'))
{
$basket->refresh();
$basket->save();
}
$request = $this->getRequest();
$i18n = $this->getContext()->getI18N();
$product_config = stConfig::getInstance('stProduct');
$this->config_points = stConfig::getInstance(sfContext::getInstance(), 'stPointsBackend');
$this->config_points->setCulture(sfContext::getInstance()->getUser()->getCulture());
stPoints::refreshLoginStatusPoints();
sfLoader::loadHelpers(array('Helper', 'stProduct'), 'stProduct');
if ($request->getMethod() == sfRequest::POST && !$request->getParameter('submit_save')) {
$products = $this->getRequestParameter('basket[products]', array());
$vat_eu = $this->getRequestParameter('basket[vat_eu]');
$this->getUser()->setVatEu($vat_eu);
foreach ($products as $id => $value) {
$item = $basket->getItem($id);
$item->updateVatEu();
if ($item && (!$item->productValidate() || $product_config->get('show_without_price') && !$item->getIsGift() && $item->getPrice() == 0 && (($item->getProduct()->getPointsOnly()!=1) && ($themeVersion < 7)))) {
$request->setParameter('basket[products][' . $id . ']', $value);
$request->setError('basket{products}{' . $id . '}', $i18n->__('Product wycofany z oferty'));
$isBlocked = true;
} elseif (!$this->validateQuantity($value, $error, $item->getProductStockInDecimals())) {
$basket->addItem($id, 0);
$request->setError('basket{products}{' . $id . '}', $error);
$request->setParameter('basket[products][' . $id . ']', $value);
$isBlocked = true;
} else {
$item = $basket->updateItem($id, $value, $error);
if (!$item) {
$item = $basket->addItem($id, $value, $error);
}
if ($error)
{
$request->setError('basket{products}{' . $item->getItemId() . '}', stBasket::getErrorMessage($item, $error, $i18n));
$isBlocked = true;
}
}
}
if (!$request->hasErrors()) {
$basket->save();
}
} else {
foreach ($basket->getItems() as $item) {
if (!$item->productValidate() || $product_config->get('show_without_price') && !$item->getIsGift() && $item->getPrice() == 0 && (($item->getProduct()->getPointsOnly()!=1) && ($themeVersion < 7))) {
$request->setParameter('basket[products][' . $item->getItemId() . ']', $item->getQuantity());
$request->setError('basket{products}{' . $item->getItemId() . '}', $i18n->__('Produkt wycofany z oferty'));
}
else
{
$error = $basket->validateQuantity($item);
if ($error)
{
$request->setError('basket{products}{' . $item->getItemId() . '}', stBasket::getErrorMessage($item, $error, $i18n));
$isBlocked = true;
}
}
}
}
foreach (stGiftCardPlugin::get() as $giftCard)
{
if (!stGiftCardPlugin::hasValidBasketProducts($giftCard, $invalidItemIds))
{
foreach ($invalidItemIds as $id)
{
$this->getRequest()->setError('basket{products}{' . $id . '}', $this->getContext()->getI18N()->__('Usuń produkt z koszyka, aby zrealizować zamówienie z aktualnym bonem zakupowym', null, 'stGiftCardFrontend'));
}
$isBlocked = true;
}
elseif (!$giftCard->isValidOrderAmount($this->getUser()->getBasket()->getTotalAmount(true, true)))
{
$isBlocked = true;
}
}
$this->getUser()->setAttribute('is_blocked', $isBlocked, stBasket::SESSION_NAMESPACE);
return !$request->hasErrors();
}
/**
* Czysci koszyk
*/
public function executeClear() {
stBasket::getInstance($this->getUser())->clearItems();
return $this->redirect('@stBasket');
}
public function handleErrorSetProduct() {
$this->smarty = new stSmarty($this->getModuleName());
$this->basket = stBasket::getInstance($this->getUser());
$this->delivery = stDeliveryFrontend::getInstance($this->basket);
$this->referer = $this->getReferer();
$this->basket_config = stConfig::getInstance('stBasket');
$this->config_points = stConfig::getInstance('stPointsBackend');
$this->setTemplate('index');
return sfView::SUCCESS;
}
/**
* Obsługa błędu w akcji index
*
* @return sfView
*/
public function handleErrorIndex() {
$this->smarty = new stSmarty($this->getModuleName());
$this->basket = stBasket::getInstance($this->getUser());
$this->delivery = stDeliveryFrontend::getInstance($this->basket);
$this->referer = $this->getReferer();
$this->basket_config = stConfig::getInstance('stBasket');
$this->config_points = stConfig::getInstance('stPointsBackend');
return sfView::SUCCESS;
}
/**
* Obsługa błędu w akcji addReferer
*/
public function handleErrorAddReferer() {
$request = $this->getRequest();
stFastCacheController::disable();
if (stConfig::getInstance('stBasket')->get('ajax') && $request->isXmlHttpRequest()) {
$result = $this->getRenderComponent('stBasket', 'ajaxAddedProductPreview');
return $this->renderText($result);
} else {
$this->remmemberRerefer();
$this->smarty = new stSmarty($this->getModuleName());
$this->basket = stBasket::getInstance($this->getUser());
$this->delivery = stDeliveryFrontend::getInstance($this->basket);
$this->referer = $this->getReferer();
$this->basket_config = stConfig::getInstance('stBasket');
$this->config_points = stConfig::getInstance('stPointsBackend');
$this->setTemplate('index');
return sfView::SUCCESS;
}
}
/**
* Zapamiętuje poprzednia strone
*/
protected function remmemberRerefer() {
$referer = $this->getRequest()->getReferer();
// chcemy zapamiętywać wyłącznie strony z produktami lub wywołano akcje 'addReferer'
if (strpos($referer, '/basket') === false && (strpos($referer, '/product/') !== false || $this->getActionName() == 'addReferer' || $referer == '/')) {
$this->getUser()->setAttribute('referer', $referer, stBasket::SESSION_NAMESPACE);
}
}
/**
* Zwraca poprzednia stronevalidateQuantity
*
* @return string
*/
protected function getReferer() {
$referer = $this->getUser()->getAttribute('referer', null, stBasket::SESSION_NAMESPACE);
return $referer ? $referer : $this->getController()->genUrl('@homepage');
}
protected function validateQuantity($quantity, &$error, $allow_decimals = false) {
$validator = new sfNumberValidator();
$i18n = $this->getContext()->getI18n();
$nan_error = $allow_decimals ? $i18n->__('Podana wartość musi być liczbą...') : $i18n->__('Podana wartość musi być liczbą całkowitą...');
$validator->initialize($this->getContext(), array('nan_error' => $nan_error, 'type_error' => $nan_error, 'min' => $allow_decimals ? 0.01 : 1, 'min_error' => $i18n->__('Podana wartość musi być większa od 0.'), 'type' => $allow_decimals ? 'any' : 'integer'));
$ret = $validator->execute($quantity, $error);
if (!$error)
{
$error = false;
}
return $ret;
}
protected function checkMinOrderAmount()
{
$user_data_billing = $this->getRequestParameter('user_data_billing');
$user_data_delivery = $this->getRequestParameter('user_data_delivery');
/**
* @var stBasket
*/
$basket = $this->getUser()->getBasket();
$isCustomerAccount = isset($user_data_billing['different_delivery']) ? $user_data_delivery['customer_type'] == 1 : $user_data_billing['customer_type'] == 1;
$country = $isCustomerAccount ? stDeliveryFrontend::getInstance($basket)->getDefaultDeliveryCountry() : null;
$validator = new stOrderMinAmountValidator();
$validator->initialize($this->getContext(), array('country' => $country));
$totalAmount = $basket->getTotalAmount(true);
if (!$basket->isEmpty() && !$validator->execute($totalAmount, $error))
{
$this->setFlash('warning', $error, false);
}
}
/**
* Indeks koszyka
*/
public function executePayByPoints() {
$basket = $this->getUser()->getBasket();
$item = $basket->getItem($this->getRequestParameter('item_id'));
if ($item) {
if (!$this->hasRequestParameter('clear')) {
if(!$item->getProductForPoints()){
if ($item->getProduct()->getPointsValue() > 0){
stPoints::addItemByPoints($item->getItemId());
$item->setProductForPoints(true);
$basket->save();
}
}
} else {
if($item->getProductForPoints()){
stPoints::removeItemByPoints($item->getItemId());
$basket->refresh($item->getItemId());
$item->setProductForPoints(false);
$basket->save();
}
}
$basket->clearProductTotals();
}
return $this->redirect('@stBasket');
}
}

View File

@@ -0,0 +1,170 @@
<?php
/**
* SOTESHOP/stBasket
*
* Ten plik należy do aplikacji stBasket 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 stBasket
* @subpackage actions
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: components.class.php 15818 2011-10-27 11:10:12Z marcin $
*/
/**
* Akcje komponentu basket
*
* @author Marcin Butlak <marcin.butlak@sote.pl>, Krzysztof Bebło <krzysztof.beblo@sote.pl>
*
* @package stBasket
* @subpackage actions
*/
class stBasketComponents extends sfComponents
{
protected static
$productConfig = null,
$basketConfig = null;
public static $ajaxIncludeOnce = false;
public function initialize($context)
{
$ret = parent::initialize($context);
if (null === self::$productConfig)
{
self::$basketConfig = stConfig::getInstance($context, 'stBasket');
}
if (null === self::$productConfig)
{
self::$productConfig = stConfig::getInstance($context, 'stProduct');
}
return $ret;
}
/**
* Lista produktów w koszyku
*/
public function executeShow()
{
if (self::$productConfig->get('hide_basket') != true)
{
$this->smarty = new stSmarty('stBasket');
$this->basket = stBasket::getInstance($this->getUser());
$this->config_points = stConfig::getInstance(sfContext::getInstance(), 'stPointsBackend');
}
else
{
return sfView::NONE;
}
}
/**
* Dodawanie do koszyka
*/
public function executeAdd()
{
if (self::$productConfig->get('hide_basket') != true)
{
$this->basket_config = self::$basketConfig;
$this->product_config = self::$productConfig;
$this->smarty = new stSmarty('stBasket'); // basket - moduleName
if (!isset($this->simple))
{
$this->simple = false;
}
if (!isset($this->info))
{
$this->info = false;
}
if ($this->product->getIsStockValidated())
{
$this->enabled = null === $this->product->getStock() || $this->product->getStock() >= $this->product->getMinQty();
}
else
{
$this->enabled = true;
}
$this->show_basket = $this->product->getOptHasOptions() <= 1;
}
else
{
return sfView::NONE;
}
}
public function executeAjaxAddedProductPreview()
{
$basket = $this->getUser()->getBasket();
$items = $basket->getLastAddedItems();
$products = array();
sfLoader::loadHelpers(array('Helper', 'stProduct', 'stProductImage', 'stUrl', 'stProductOptions'), 'stProduct');
$errors = array(
stBasket::ERR_OUT_OF_STOCK => 'Ilość została zmniejszona z powodu niskiego stanu magazynowego',
stBasket::ERR_MAX_QTY => 'Ilość została zmniejszona. Maksymalna ilość jaką możesz zamówić w ramach jednego zamówienia to %max_quantity% %uom%',
stBasket::ERR_MIN_QTY => 'Ilość została zwiększona. Minimalna ilość jaką możesz zamówic to %quantity% %uom%',
stBasket::ERR_POINTS => 'Brak wymaganej ilości punktów'
);
$i18n = $this->getContext()->getI18N();
$config_points = stConfig::getInstance(sfContext::getInstance(), 'stPointsBackend');
$config_product = stConfig::getInstance(sfContext::getInstance(), 'stProduct');
foreach ($items as $data)
{
$item = $data['item'];
$error_code = $data['error_code'];
$product = $item->getProduct();
$uom = st_product_uom($product);
$products[] = array(
'instance' => $item,
'name' => $item->getName(),
'image' => st_product_image_path($product, 'thumb'),
'url' => $this->getController()->genUrl('stProduct/show?url='.$product->getUrl()),
'price' => $item->getPriceBrutto(true),
'points_value' =>$item->getProduct()->getPointsValue(),
'points_product' =>$item->getProductForPoints(),
'points_shortcut' => $config_points->get('points_shortcut', null, true),
'quantity' => $data['quantity'],
'uom' => $uom,
'options' => st_product_options_get_view($item),
'error' => $error_code < 0 ? $i18n->__($errors[$error_code], array('%quantity%' => $product->getMinQty(), '%max_quantity%' => $product->getMaxQty(), '%uom%' => $uom)) : false
);
}
$this->smarty = new stSmarty('stBasket');
$this->smarty->assign('basket_url', st_secure_url_for('@stBasket'));
if ($config_product->get('price_view') == "net_gross" || $config_product->get('price_view') == "only_net" )
{
$this->smarty->assign('show_netto', 1);
}
$this->smarty->assign('products', $products);
}
}

View File

@@ -0,0 +1,4 @@
_show:
enabled: off
view:
stylesheets: [stBasket.css]

View File

@@ -0,0 +1,40 @@
<?php
/**
* SOTESHOP/stBasket
*
* Ten plik należy do aplikacji stBasket 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 stBasket
* @subpackage configs
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: config.php 17068 2012-02-09 13:16:30Z marcin $
*/
/**
* SOTESHOP/stBasket
* Ten plik należy do aplikacji stBasket 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 stBasket
* @subpackage libs
*/
stPluginHelper::addRouting('stBasket', '/basket/:action/*', 'stBasket', 'index', 'frontend', [], ['action' => '[a-zA-Z0-9_]+']);
stPluginHelper::addRouting('stBasketAdd', '/basket/add/:product_id/:quantity', 'stBasket', 'addReferer', 'frontend', [], ['product_id' => '\d+', 'quantity' => '[0-9.]+']);
stPluginHelper::addRouting('stBasketAddLang', '/basket/:lang/add/:product_id/:quantity', 'stBasket', 'addReferer', 'frontend', [], ['lang' => '[a-z]{2,2}', 'product_id' => '\d+', 'quantity' => '[0-9.]+']);
$dispatcher->connect('stActions.preExecute', array('stBasketListener', 'preExecuteAction'));
$dispatcher->connect('stActions.postExecute', array('stBasketListener', 'postExecuteAction'));
$dispatcher->connect('stUser.postValidateLoginUser', array('stBasketListener', 'refreshBasketProducts'));
$dispatcher->connect('stPartialCache.generateId', array('stBasketListener', 'stPartialCacheGenerateId'));
?>

View File

@@ -0,0 +1,3 @@
all:
.layout:
name: layout3

View File

@@ -0,0 +1,3 @@
all:
.layout:
name: layout3

View File

@@ -0,0 +1,132 @@
<?php
sfLoader::loadHelpers(array('stProduct', 'stBasket'), 'stProduct');
st_theme_use_stylesheet('stBasket.css');
use_javascript('stPrice.js');
if ($product->getOptHasOptions() > 1)
{
echo content_tag('div', st_get_component('stProductOptionsFrontend', 'modifyBasketView', array('smarty' => $smarty, 'product' => $product, 'simple' => $simple, 'info' => $info, 'basket_config' => $basket_config, 'enabled' => $enabled)), array('id' => 'st_product_options-modify-basket', 'style' => 'display: inline'));
}
if ($show_basket)
{
$smarty->assign('product_id', $product->getId());
if ($simple)
{
if ($enabled)
{
if ($sf_context->getController()->getTheme()->getVersion() >= 2)
{
$smarty->assign('basket_add_simple_enabled', st_secure_link_to(st_theme_image_tag('buttons/basket.png', array('alt' => __('Dodaj do koszyka'))), '@stBasketAdd?product_id='.$product->getId().'&quantity='.$product->getMinQty(), array('class' => 'add_to_basket')));
}
else
{
$smarty->assign('basket_add_simple_enabled', st_secure_link_to(st_theme_image_tag('add_basket.gif', array('alt' => __('Dodaj do koszyka'))), '@stBasketAdd?product_id='.$product->getId().'&quantity='.$product->getMinQty()));
}
$smarty->display('basket_add_simple_enabled.html');
}
else
{
if ($sf_context->getController()->getTheme()->getVersion() >= 2)
{
$smarty->assign('basket_add_simple_disabled', st_theme_image_tag('buttons/basket.png', array('alt' => __('Dodaj do koszyka'))));
}
else
{
$smarty->assign('basket_add_simple_disabled', st_theme_image_tag('add_basket.gif', array('alt' => __('Dodaj do koszyka'))));
}
$smarty->display('basket_add_simple_disabled.html');
}
}
elseif ($info)
{
$smarty->assign('product_id', $product->getId());
if ($product_config->get('show_basket_quantity'))
{
$smarty->assign('form_action', st_secure_url_for('stBasket/addReferer?product_id='.$product->getId()));
if ($product->getStepQty())
{
$smarty->assign('quantity_field', st_product_quantity_list('quantity', $product, null, array('disabled' => !$enabled)).' '.st_product_uom($product));
}
else
{
$smarty->assign('quantity_field', input_tag('quantity', $product->getMinQty(), array(
'size' => 3,
'maxlength' => 11,
'style' => 'text-align:right',
'disabled' => !$enabled,
'onchange' => 'this.value = stPrice.fixNumberFormat(this.value, '.($product->getStockInDecimals() ? 2 : 0).');'
)).' '.st_product_uom($product));
}
}
else
{
$smarty->assign('form_action', st_secure_url_for('stBasket/addReferer?product_id='.$product->getId().'&quantity='.$product->getMinQty()));
}
$smarty->assign('submit_button', submit_tag(__('Dodaj do koszyka'), array('class' => 'st_button-basket-submit-enabled', 'disabled' => !$enabled)));
$smarty->assign('enabled', $enabled);
$smarty->display('basket_add_quantity_enabled.html');
}
else
{
if ($enabled)
{
$smarty->assign('basket_add_enable', st_secure_link_to(__('Dodaj do koszyka'), '@stBasketAdd?product_id='.$product->getId().'&quantity='.$product->getMinQty(), array('class' => 'add_to_basket')));
$smarty->display('basket_add_enabled.html');
}
else
{
$smarty->display('basket_add_disabled.html');
}
}
}
if ($basket_config->get('ajax') && $show_basket && $info)
{
init_ajax_basket('#st_basket-add-to-basket-form', 'submit');
}
elseif ($show_basket && $basket_config->get('ajax') && !stBasketComponents::$ajaxIncludeOnce)
{
stBasketComponents::$ajaxIncludeOnce = true;
init_ajax_basket('.add_to_basket');
}
?>
<?php if ($show_basket && $info): ?>
<script type="text/javascript">
jQuery(function($) {
var link = $("#st_basket-add-button a");
link.click(function(event) {
if (link.hasClass('disabled')) {
return false;
}
$("#st_basket-add-to-basket-form").submit();
return false;
});
<?php if (!$enabled): ?>
link.addClass('disabled');
<?php endif ?>
$("#quantity").click(function(event) {
event.stopPropagation();
});
});
</script>
<?php endif; ?>

View File

@@ -0,0 +1,48 @@
<?php
$version = stTheme::getInstance($sf_context)->getVersion();
if ($version >= 7)
{
$smarty->assign('basket_show_component', esc_js_no_entities(st_get_component("stBasket", "show")));
}
$smarty->display('basket_ajax_added_product_preview.html');
?>
<?php if (stTheme::getInstance($sf_context)->getVersion() < 7): ?>
<script type="text/javascript">
jQuery(function($) {
$('#basket_show').html('<?php echo esc_js_no_entities(st_get_component("stBasket", "show")) ?>');
$('#login_status_container').html('<?php echo esc_js_no_entities(st_get_component("stUser", "loginStatus")) ?>');
$('#added_product_preview').overlay({
load: true,
left: 'center',
top: '30%',
closeOnClick: true,
mask: {
color: '#ebecff',
loadSpeed: 200,
opacity: 0.6
},
onLoad: function() {
var error = this.getOverlay().find('.error');
if (error.length) {
error.tooltip({
position: 'center left',
effect: 'slide',
direction: 'left',
relative: true
}).data('tooltip').show();
}
},
onClose: function() {
this.getOverlay().remove();
}
});
});
</script>
<?php endif ?>
<?php
$content = "";
echo $sf_context->getController()->getDispatcher()->filter(new sfEvent(null, 'stBasket.renderAjaxAddedProductPreview'), $content)->getReturnValue();
?>

View File

@@ -0,0 +1,323 @@
<?php
use_helper('stCurrency', 'Javascript', 'Validation', 'stProductImage', 'stBasket', 'stUrl', 'stProductOptions');
sfLoader::loadHelpers('stProduct', 'stProduct');
use_javascript('stPrice.js');
if (!isset($smarty))
{
$smarty = new stSmarty('stBasket');
}
if ($sf_request->hasErrors() && $sf_request->hasParameter('option_list'))
{
$hidden = input_hidden_tag('option_list', $sf_request->getParameter('option_list'));
$hidden .= input_hidden_tag('product_id', $sf_request->getParameter('product_id'));
$smarty->assign("form_start", form_tag('stBasket/index', 'id=st_basket-form class=st_form').$hidden);
}
else
{
$smarty->assign("form_start", form_tag('stBasket/index', 'id=st_basket-form class=st_form'));
}
$results = array();
$version = stTheme::getInstance($sf_context)->getVersion();
$smarty->assign('products', $basket->getItems());
foreach ($basket->getItems() as $index => $product)
{
if ($product->isDeleted())
{
continue;
}
$is_valid = $product->productValidate();
$url = $is_valid && !$product->getIsGift() ? st_url_for('stProduct/show?url='.$product->getProduct()->getFriendlyUrl()) : null;
$results[$index]['id'] = $product->getItemId();
$results[$index]['if_form_error'] = $sf_request->hasError('basket{products}{'.$product->getItemId().'}');
$results[$index]['error_show'] = $sf_request->getError('basket{products}{'.$product->getItemId().'}');
if ($version < 7)
{
$results[$index]['product_url'] = $url;
if ($is_valid)
{
if ($url)
{
$results[$index]['photo'] = st_product_image_tag($product->getProduct(), 'icon');
}
else
{
$results[$index]['photo'] = '<a href="'.$url.'">'.st_product_image_tag($product->getProduct(), 'icon').'</a>';
}
}
else
{
$results[$index]['photo'] = st_product_image_tag(null, 'icon');
}
$results[$index]['preview'] = st_product_image_tag($product->getProduct(), 'small');
}
else
{
$results[$index]['url'] = $url;
if ($is_valid)
{
$results[$index]['photo'] = st_product_image_path($product->getProduct(), 'small');
}
else
{
$results[$index]['photo'] = st_product_image_path(null, 'small');
}
}
$results[$index]['instance'] = $product;
if ($version < 7)
{
if ($url)
{
$results[$index]['name'] = '<a href="'.$url.'">'.$product->getName().'</a>';
}
else
{
$results[$index]['name'] = $product->getName();
}
if ($product->hasPriceModifiers())
{
$results[$index]['name'] = content_tag('div', $results[$index]['name'], array('class' => 'st_product_name_with_options')).st_product_options_get_view($product);
}
}
else
{
$results[$index]['name'] = $product->getName();
}
$results[$index]['code'] = $product->getCode();
$results[$index]['price_netto'] = st_currency_format($product->getPriceNetto(true));
$results[$index]['tax'] = $product->getVat();
$results[$index]['price_brutto'] = st_currency_format($product->getPriceBrutto(true));
if(null === $product->getProduct() || $product->getProduct()->getPointsValue() * $product->getQuantity() == 0){
$results[$index]['points_value'] = "";
$results[$index]['points_sum_value'] = "";
}else{
$results[$index]['points_value'] = $product->getProduct()->getPointsValue();
$results[$index]['points_sum_value'] = $product->getProduct()->getPointsValue() * $product->getQuantity();
}
$results[$index]['points_only']= $product->getProduct() ? $product->getProduct()->getPointsOnly() : 0;
$results[$index]['points_earn'] = $product->getPointsEarn() * $product->getQuantity();
if(null !== $product->getProduct() && $product->getProduct()->getPointsValue() * $product->getQuantity() <= stPoints::getLoginStatusPoints() && $product->getProduct()->getPointsValue()>0){
$results[$index]['show_pay_by_points'] = true;
}else{
$results[$index]['show_pay_by_points'] = false;
}
if(stPoints::isItemByPoints($product->getItemId())){
$results[$index]['show_pay_by_money'] = true;
}else{
$results[$index]['show_pay_by_money'] = false;
}
$results[$index]['is_item_by_points'] = stPoints::isItemByPoints($product->getItemId());
$results[$index]['is_set_discount'] = $product->getProductSetDiscount();
$results[$index]['url_by_money'] = st_url_for("stBasket/payByPoints?item_id=".$product->getItemId()."&clear=1");
$results[$index]['url_by_points'] = st_url_for("stBasket/payByPoints?item_id=".$product->getItemId());
$results[$index]['num_onmouseover'] = st_basket_js_num_buttons_show($product);
$results[$index]['num_onmouseout'] = st_basket_js_num_buttons_hide($product);
if ($version < 7)
{
if ($product->getIsGift())
{
$results[$index]['num'] = input_tag('basket[products]['.$product->getItemId().']', $product->getQuantity(), array('readonly' => true, 'size' => 3, 'class' => 'form-control'));
}
else
{
if ($sf_request->hasError('basket{products}{'.$product->getItemId().'}'))
{
if ($product->getProductStepQty())
{
$results[$index]['num'] = st_product_quantity_list('basket[products]['.$product->getItemId().']', $product->getProduct(), $sf_request->getParameter('basket[products]['.$product->getItemId().']'), array('class' => 'st_form-error'));
}
else
{
$results[$index]['num'] = input_tag('basket[products]['.$product->getItemId().']', $sf_request->getParameter('basket[products]['.$product->getItemId().']'), array(
'class' => 'st_form-error',
'size' => 3,
'maxlength' => 11,
'onchange' => 'this.value = stPrice.fixNumberFormat(this.value, '.$product->getProductStockInDecimals().');'
));
}
}
else
{
if ($product->getProductStepQty())
{
$results[$index]['num'] = st_product_quantity_list('basket[products]['.$product->getItemId().']', $product->getProduct(), $product->getQuantity());
}
else
{
$results[$index]['num'] = input_tag('basket[products]['.$product->getItemId().']', stPrice::round($product->getQuantity(), $product->getProductStockInDecimals()), array(
'size' => 3,
'maxlength' => 11,
'onchange' => 'this.value = stPrice.fixNumberFormat(this.value, '.$product->getProductStockInDecimals().');'
));
}
}
if (!$product->getProductStepQty())
{
if ($product->getQuantity() > $product->getProductMinQty() && !$sf_request->hasErrors())
{
$results[$index]['minus'] = link_to(st_theme_image_tag('minus.gif', array('alt' => '')), 'stBasket/setProduct?product_id='.$product->getItemId().'&quantity='.($product->getQuantity() - 1));
}
else
{
$results[$index]['minus'] = st_theme_image_tag('minus.gif', array('alt' => ''));
}
if (null === $product->getMaxQuantity() || $product->getQuantity() < $product->getMaxQuantity() && !$sf_request->hasErrors())
{
if($product->getProduct()->getPointsOnly()==1 && $product->getProduct()->getPointsValue() > stPoints::getUnusedUserPoints()){
$results[$index]['plus'] = st_theme_image_tag('plus.gif', array('alt' => ''));
}else{
$results[$index]['plus'] = link_to(st_theme_image_tag('plus.gif', array('alt' => '')), 'stBasket/setProduct?product_id='.$product->getItemId().'&quantity='.($product->getQuantity() + 1));
}
}
else
{
$results[$index]['plus'] = st_theme_image_tag('plus.gif', array('alt' => ''));
}
}
}
}
else
{
if ($product->getIsGift())
{
$results[$index]['num'] = input_tag('basket[products]['.$product->getItemId().']', $product->getQuantity(), array('readonly' => true, 'size' => 3, 'class' => 'form-control'));
}
else
{
$has_error = $sf_request->hasError('basket{products}{'.$product->getItemId().'}');
$quantity = $has_error ? $sf_request->getParameter('basket[products]['.$product->getItemId().']') : $product->getQuantity();
if ($product->getProductStepQty())
{
$results[$index]['num'] = st_product_quantity_list('basket[products]['.$product->getItemId().']', $product->getProduct(), $product->getQuantity(), array('class' => 'form-control'));
}
else
{
$results[$index]['num'] = input_tag('basket[products]['.$product->getItemId().']', stPrice::round($product->getQuantity(), $product->getProductStockInDecimals()), array(
'class' => 'form-control',
'size' => 3,
'maxlength' => 11,
'onchange' => 'this.value = stPrice.fixNumberFormat(this.value, '.$product->getProductStockInDecimals().');',
));
}
if ($has_error)
{
$results[$index]['num'] = '<span class="has-error">'.$results[$index]['num'].'</span>';
}
}
}
$results[$index]['discount'] = $product->getDiscountInPercent();
$results[$index]['uom'] = st_product_uom($product->getProduct());
$results[$index]['total_amount'] = st_currency_format($product->getTotalAmount(true, true), array('with_exchange' => false));
if ($version < 7)
{
$results[$index]['delete'] = link_to(st_theme_image_tag('delete.png', array('alt' => '')), 'stBasket/remove?product_id='.$product->getItemId());
}
else
{
$results[$index]['delete_url'] = st_url_for('stBasket/remove?product_id='.$product->getItemId());
}
}
if ($version < 7)
{
$smarty->assign("delete_img", st_theme_image_tag('delete.png', array('alt' => '', 'style'=>'margin:0px 0px -2px 2px;')));
$smarty->assign("button_update", submit_tag(__('Uaktualnij koszyk')));
}
$clear_url = st_url_for('stBasket/clear');
$smarty->assign("button_clear", link_to(__("Opróżnij koszyk"), $clear_url, array('onclick' => "javascript: return window.confirm('".__('Czy na pewno opróżnić koszyk?')."')")));
//points system
$smarty->assign('points_system_is_active', stPoints::isPointsSystemActive());
$smarty->assign('display_type', $config_points->get('product_full_list_display_type'));
$smarty->assign('points_shortcut', $config_points->get('points_shortcut', null, true));
$smarty->assign('user_points', stPoints::getUserPoints());
$smarty->assign('user_points_status', stPoints::getLoginStatusPoints());
$smarty->assign('currency', stCurrency::getInstance(sfContext::getInstance())->get());
$smarty->assign('is_authenticated', sfContext::getInstance() -> getUser() -> isAuthenticated());
$smarty->assign('is_release', stPoints::isReleasePointsSystemForUser());
//default2
$smarty->assign('clear_url', $clear_url);
$smarty->assign('results', $results);
/**
* @deprecated Proszę używać $smaty->assign('show', [...])
*/
$smarty->assign('show_points', $config_points->get('product_full_list_show_points'));
$smarty->assign("show_code_in_basket", $basket_config->get('show_code_in_basket'));
$smarty->assign("show_photo_in_basket", $basket_config->get('show_photo_in_basket'));
$smarty->assign("show_netto_in_basket", $basket_config->get('show_netto_in_basket'));
$smarty->assign("show_tax_in_basket", $basket_config->get('show_tax_in_basket'));
$smarty->assign("show_uom_in_basket", $basket_config->get('show_uom_in_basket'));
$smarty->assign("show_discount_in_basket", $basket_config->get('show_discount_in_basket'));
$smarty->assign('show', [
'code' => $basket_config->get('show_code_in_basket'),
'photo' => $basket_config->get('show_photo_in_basket'),
'netto' => $basket_config->get('show_netto_in_basket'),
'tax' => $basket_config->get('show_tax_in_basket'),
'uom' => $basket_config->get('show_uom_in_basket'),
'discount' => $basket_config->get('show_discount_in_basket'),
'points' => $config_points->get('product_full_list_show_points'),
]);
if (stConfig::getInstance('stTaxBackend')->get('is_eu_tax_enabled'))
{
$smarty->assign("vat_eu", label_for('basket[vat_eu]', __('Posiadam VAT UE')).checkbox_tag('basket[vat_eu]', true, $sf_user->hasVatEu(), array('onclick' => 'this.form.submit(); jQuery(\'#st_basket_vat_eu,#basket_index\').css({ cursor: \'wait\' })')));
}
$smarty->display('basket_products_list.html');
?>

View File

@@ -0,0 +1,115 @@
<?php
use_helper('stBasket', 'stUrl', 'stCurrency');
/**
* @var stBasket $basket
*/
$theme = stTheme::getInstance($sf_context);
$totalAmount = st_basket_total_amount($basket, true);
if ($theme->getVersion() < 7)
{
st_theme_use_stylesheet('stBasket.css');
if (!$basket->isEmpty())
{
$basket_array = array();
$basket_summary = 0;
foreach($basket->getItems() as $basket_item)
{
$validate = $basket_item->productValidate();
$url_for = $validate ? st_url_for('stProduct/show?url='.$basket_item->getProduct()->getFriendlyUrl()) : null;
$basket_array[] = array(
'name' => $url_for ? content_tag('a', $basket_item->getName(), array('href' => $url_for)) : $basket_item->getName(),
'price' => st_currency_format($basket_item->getPriceBrutto(true, true), array('with_exchange' => false)),
'product_for_points' => $validate ? $basket_item->getProductForPoints() : 0,
'points_value' => $validate ? $basket_item->getProduct()->getPointsValue()." ".$config_points->get('points_shortcut', null, true) : 0,
'quantity' => $basket_item->getQuantity(),
'image' => $url_for ? content_tag('a', st_product_image_tag($basket_item, 'icon'), array('href' => $url_for)) : st_product_image_tag($basket_item, 'icon'),
);
}
}
else
{
$basket_array = null;
}
if(stPoints::isPointsSystemActive()){
$smarty->assign("basket_icon", st_secure_link_to(st_basket_total_amount($basket, true)." / ".stPoints::getBasketPointsValue()." ".$config_points->get('points_shortcut', null, true), 'stBasket/index' . ($sf_context->getModuleName() == 'stBasket' ? '' : 'Referer')));
}else{
$smarty->assign("basket_icon", st_secure_link_to(st_basket_total_amount($basket, true), 'stBasket/index' . ($sf_context->getModuleName() == 'stBasket' ? '' : 'Referer')));
}
$smarty->assign("amount_icon", st_secure_link_to(st_theme_image_tag('basket/basket_selected.png'), 'stBasket/index' . ($sf_context->getModuleName() == 'stBasket' ? '' : 'Referer'), 'class=st_basket-list-link'));
$smarty->assign('basket_array', $basket_array);
}
else
{
$item = array();
$basket_summary = 0;
foreach($basket->getItems() as $basketItem)
{
$validate = $basketItem->productValidate();
$url_for = $validate ? st_url_for('stProduct/show?url='.$basketItem->getProduct()->getFriendlyUrl()) : null;
$items[] = array(
'instance' => $basketItem,
'url' => $url_for,
'delete_url' => st_url_for('@stBasket?action=remove&product_id='.$basketItem->getItemId()),
'name' => $basketItem->getName(),
'price' => st_currency_format($basketItem->getPriceBrutto(true, true), array('with_exchange' => false)),
'product_for_points' => $validate ? $basketItem->getProductForPoints() : 0,
'points_value' => $validate ? $basketItem->getProduct()->getPointsValue()." ".$config_points->get('points_shortcut', null, true) : 0,
'quantity' => $basketItem->getQuantity(),
'price_modifiers' => $basketItem->getPriceModifiers(),
'image' => st_product_image_path($basketItem, 'small'),
);
}
$smarty->assign('url', st_secure_url_for('stBasket/index' . ($sf_context->getModuleName() == 'stBasket' ? '' : 'Referer')));
$smarty->assign('items', $items);
$smarty->assign("total_quantity", count($items));
$smarty->assign('basket_summary', $totalAmount);
}
//points system
$smarty->assign('points_system_is_active', stPoints::isPointsSystemActive());
$smarty->assign('points_shortcut', $config_points->get('points_shortcut', null, true));
$smarty->assign("basket_points_amount", stPoints::getBasketPointsValue());
$smarty->assign("basket_amount", $totalAmount);
$smarty->display("basket_show.html");
?>
<?php if ($theme->getVersion() < 7): ?>
<script type="text/javascript" language="javascript">
jQuery(function ($) {
$(document).ready(function () {
$("#basket_show, .st_basket-list-link").tooltip({
tip: '#basket_tooltip',
effect: 'slide',
opacity: 1,
position: 'bottom left',
offset: [10,92]
});
});
});
</script>
<?php endif ?>

View File

@@ -0,0 +1,15 @@
<?php
use_helper('stCurrency');
st_theme_use_stylesheet('stBasket.css');
$value = st_get_component('stDeliveryFrontend', 'basketSummary', array('basket' => $basket));
if ($value)
{
$smarty->assign("value", $value);
}
else
{
$smarty->assign("total_amount", st_front_symbol().$basket->getTotalAmount(true, true).st_back_symbol());
}
$smarty->display("basket_summary.html");
?>

View File

@@ -0,0 +1,49 @@
<?php
st_theme_use_stylesheet('stBasket.css');
$smarty->assign("button_back", link_to(__('Wróć do zakupów'), $referer));
$smarty->assign("if_warning", $sf_flash->has('warning'));
$smarty->assign("if_notice", $sf_flash->has('notice'));
$smarty->assign("show_warning", $sf_flash->get('warning'));
$sf_flash->set('warning', null);
$smarty->assign("products", $basket->getItems());
$smarty->assign("has_deliveries", $delivery->hasDeliveries());
$smarty->assign("show_products", $basket_config->get('show_products'));
$smarty->assign("return_url", $referer);
$smarty->assign('description', $sf_request->getParameter('user_data_billing[description]'));
if ($basket->getItems())
{
$smarty->assign("product_list", st_get_partial('product_list', array('basket' => $basket, 'basket_config' => $basket_config, 'config_points' => $config_points, 'smarty' => $smarty, 'referer' => $referer)));
$smarty->assign("delivery", st_get_component('stDeliveryFrontend', 'basketDeliveryList', array('basket' => $basket)));
$smarty->assign("payment", st_get_component('stDeliveryFrontend', 'basketPaymentList', array('basket' => $basket)));
$smarty->assign("total", st_get_component('stDeliveryFrontend', 'basketSummary', array('basket' => $basket)));
$smarty->assign("products_promote", st_get_component('stPromoteProductsInBasket', 'showProducts'));
$smarty->assign("user_form", st_get_partial('stUserData/user_form', array('basket' => $basket)));
$smarty->assign("discount_coupon_code", st_get_component('stDiscountFrontend', 'couponCode', array('return_url' => 'stBasket/index')));
$smarty->assign("gift_card", st_get_component('stGiftCardFrontend', 'show', array('return_url' => 'stBasket/index')));
$smarty->assign('basket_discount', stDiscount::getBasketMessage());
$smarty->assign("trusted_shops", st_get_component('stTrustedShopsFrontend', 'showExcellenceBuyerProtection'));
$smarty->assign("socket_above_user_form", stSocketView::openComponents('stBasketAboveUserForm'));
$smarty->assignComponent('gift_group', 'stGiftGroup', 'show', array('limit' => 10, 'overlay' => true));
}
else
{
$smarty->assign("product_basket", st_get_component('stProduct', 'productInBasketGroup', array('basket' => $basket)));
}
$smarty->display("_basket_index.html");
?>

View File

@@ -0,0 +1,43 @@
<div id="st_application-st_basket-index" class="st_application">
<h1 class="st_title">{__ text="Twój koszyk"}</h1>
<div class="st_content_basket">
<div class="st_button st_align-left" id="st_basket-back_button">
<div class="st_button-left">{$button_back}</div>
</div>
<br class="st_clear_all" />
{if $if_warning || $if_notice}
<div id="st_message-warning"><h2>{$show_warning}</h2></div>
{/if}
{if $products}
<div id="st_basket-product_list">{$product_list}</div>
<form action="#" id="st_basket-delivery-form">
<div id="st_basket-delivery">{$delivery}</div>
{if $has_deliveries}
<div id="st_basket-payment">{$payment}</div>
{/if}
<div id="st_basket-summary">
{$total}
</div>
</form>
<div id="st_basket-discount-coupon-code">
{$discount_coupon_code}
</div>
{$gift_card}
<br class="st_clear_all"/>
<div id="st-trusted_shops">{$trusted_shops}</div>
{if $show_products == 1}
<div>{$products_promote}</div>
{/if}
<div id="st_basket-user">{$user_form}</div>
{else}
{if $show_products == 1}
<div id="st-basket-product_group">{$product_basket}</div>
{/if}
{/if}
<br class="st_clear_all" />
</div>
</div>

View File

@@ -0,0 +1,4 @@
{$attributes}
<div id="st_button-basket-{$product_id}" class="st_button-basket-disabled">
<span>{__ text="Dodaj do koszyka"}</span>
</div>

View File

@@ -0,0 +1,3 @@
<div id="st_button-basket-{$product_id}" class="st_button-basket-enabled">
{$basket_add_enable}
</div>

View File

@@ -0,0 +1,15 @@
<div id="st_component-st_basket-add_enable">
<form action="{$form_action}" method="post" id="st_basket-add-to-basket-form">
{$attributes}
<div id="st_basket-add-button">
<div class="st_button-left">
<div class="st_button-right">
<div id="st_basket-add-submit-container">{$submit_button}</div>
<div id="st_basket-add-quantity_container">{$quantity_field}</div>
<br class="st_clear_all" />
</div>
</div>
</div>
<br class="st_clear_all" />
</form>
</div>

View File

@@ -0,0 +1,3 @@
<span id="st_icon-basket-{$product_id}" class="st_icon-basket-disabled">
{$basket_add_simple_disabled}
</span>

View File

@@ -0,0 +1,3 @@
<span id="st_icon-basket-{$product_id}" class="st_icon-basket-enabled">
{$basket_add_simple_enabled}
</span>

View File

@@ -0,0 +1,6 @@
<div class="st_button-basket-enabled" id="st_component-st_basket-add_info_enable">
{$start_form}
{$basket_info_enabled2}
{__ text="Ilość"}: {$basket_info_enabled} {__ text="szt"}.
</form>
</div>

View File

@@ -0,0 +1,19 @@
<div id="st_component-st_basket-basket_preview">
<div id="st_component-basket-content" class="st_content">
<ul>
<li id="st_icon_basket" {$get_tooltip}>
{$icon_basket}
</li>
<li id="st_sum">
{$num}
</li>
<li {$get_tooltip}>
{$amount_product}
</li>
<li>
{$currency}
</li>
</ul>
{$basket_add}
</div>
</div>

View File

@@ -0,0 +1,63 @@
{$form_start}
<table class="st_tabular-list" cellspacing="0">
<colgroup>
<col width="80" />
<col />
<col width="80" />
<col width="50" />
<col width="80" />
<col width="80" />
<col width="80" />
<col width="60" />
</colgroup>
<thead>
<tr>
<th class="st_basket-product-photo"><span>{__ text="zdjęcie"}</span></th>
<th class="st_basket-product-name"><span>{__ text="nazwa"}</span></th>
<th class="st_basket-product-netto"><span>{__ text="cena netto"}</span></th>
<th class="st_basket-product-tax"><span>{__ text="vat"}</span></th>
<th class="st_basket-product-brutto"><span>{__ text="cena brutto"}</span></th>
<th class="st_basket-product-num"><span>{__ text="ilość"}</span></th>
<th class="st_basket-product-sum"><span>{__ text="suma}</span></th>
<th class="st_basket-product-remove">{__ text="usuń"}</th>
</tr>
</thead>
<tbody>
<div id="st_basket_product_value"></div>
{foreach key=row item=product from=$results}
{if $product.if_form_error}
<tr>
<td colspan="8"><span class="st_error">{$product.error_show}</span></td>
</tr>
{/if}
<tr id="tr_product_id_{$product.id}" >
<td class="st_basket-product-photo">{$product.photo}</td>
<td class="st_basket-product-name">{$product.name}</td>
<td class="st_basket-product-netto">{$product.price_netto}</td>
<td class="st_basket-product-tax">{$product.tax} %</td>
<td class="st_basket-product-brutto">{$product.price_brutto}</td>
<td class="st_basket-product-num" onmouseover="{$product.num_onmouseover}" onmouseout="{$product.num_onmouseout}">
<ul>
<li id="st_basket-product-num-button-minus-{$product.id}" style="visibility: hidden">{$product.minus}</li>
<li class="st_basket-product-num-value" id="st_basket_product_value{$product.id}">{$product.num}</li>
<li id="st_basket-product-num-button-plus-{$product.id}" style="visibility: hidden">{$product.plus}</li>
</ul>
</td>
<td class="st_basket-product-sum">{$product.total_amount}</td>
<td class="st_basket-product-remove">{$product.delete}</td>
</tr>
{/foreach}
<tr>
<td colspan="8" class="st_basket-all-empty" style="border-bottom: none;">
<div class="st_button st_align-right" id="st_basket-update_button">
<div class="st_button-left">{$button_update}</div>
</div>
<div class="st_button st_align-right" id="st_basket-clear_button">
<div class="st_button-left">{$button_clear}</div>
</div>
</td>
</tr>
</tbody>
</table>
</form>

View File

@@ -0,0 +1,19 @@
<ul id="st_component-st_basket-list">
<li class="st_basket-list-last">{$basket_icon}</li>
<li>{$amount_icon}
{if isset($basket_array)}
<div class="tooltip roundies">
<table style="border:none;">
{foreach from=$basket_array item=basket_item}
<tr>
<td style="border:none;">{$basket_item.image}</td>
<td style="border:none;">{$basket_item.name}</td>
<td style="border:none;">{$basket_item.quantity} x {$basket_item.price}</td>
</tr>
{/foreach}
<tr><td colspan="3" style="border:none; text-align: right">{__ text="razem"}: <b>{$basket_amount}</b></td></tr>
</table>
</div>
{/if}
</li>
</ul>

View File

@@ -0,0 +1,8 @@
<div id="st_component-st_basket-sumary_info">
{if $value}
{$value}
{else}
{__ text="Razem do zapłaty"}: <strong>{$total_amount}</strong>
{/if}
</div>

View File

@@ -0,0 +1,100 @@
{literal}
<script type="text/javascript">
jQuery(function ($)
{
function equalHeight(group)
{
tallest = 0;
group.each(function() {
$(this).css("height","auto");
thisHeight = $(this).height();
if(thisHeight > tallest) {
tallest = thisHeight;
}
});
group.height(tallest);
}
$(document).ready(function() {
equalHeight($(".frame"));
});
});
</script>
{/literal}
{set layout="one_column_layout"}
<div id="basket_index" class="box roundies">
{if $products}
<div class="title">
<h2>{__ text="Koszyk"}</h2>
<p>{__ text="Sprawdź zawartość koszyka"}</p>
</div>
{/if}
<div class="content">
<div class="clear"></div>
{if $if_warning || $if_notice}
<div id="warning"><h2>{$show_warning}</h2></div>
{/if}
{if $products}
<div id="basket_products_table">{$product_list}</div>
<form action="#" id="st_basket-delivery-form">
<div id="st_basket-delivery" class="roundies frame box_form">{$delivery}</div>
{if $has_deliveries}
<div id="st_basket-payment" class="roundies frame box_form">{$payment}</div>
{/if}
<div id="st_basket-summary" class="roundies frame box_form">{$total}</div>
</form>
{if $gift_card || $discount_coupon_code}
<div class="frame" style="margin-bottom:20px;">
{/if}
<div id="st_basket-discount-coupon-code" {if $gift_card && $discount_coupon_code} style="margin-bottom:15px;" {/if}>
{$discount_coupon_code}
</div>
{$gift_card}
<div class="clear"></div>
{if $gift_card || $discount_coupon_code}
</div>
{/if}
<div id="st-trusted_shops">{$trusted_shops}</div>
{if $show_products == 1}
<div>{$products_promote}</div>
{/if}
{if $gift_group}
<div id="gift_group" class="box_form">
<h3>{__ text="Wybierz prezent"}</h3>
<div>{$gift_group}</div>
</div>
{/if}
{$socket_above_user_form}
<div id="st_basket-user">{$user_form}</div>
{else}
<div class="empty_basket_img"><img src="{image_path image='/basket/empty_basket.jpg'}" alt="" /></div>
<h2 style="text-align: center; ">{__ text="Twój koszyk jest pusty"}</h2>
<div id="button-empty-basket-return" class="buttons">
<a href="{$return_url}" class="roundies">
<span class="arrow_right">{__ text="Kontynuuj zakupy"}</span>
</a>
</div>
{/if}
<div class="clear"></div>
</div>
</div>

View File

@@ -0,0 +1,4 @@
{$attributes}
<div id="st_button-basket-{$product_id}" class="buttons">
<span>{__ text="Dodaj do koszyka"}</span>
</div>

View File

@@ -0,0 +1,3 @@
<div id="st_button-basket-{$product_id}" >
{$basket_add_enable}
</div>

View File

@@ -0,0 +1,15 @@
<div id="st_component-st_basket-add_enable">
<form action="{$form_action}" method="post" id="st_basket-add-to-basket-form">
{$attributes}
<div id="st_basket-add-button" class="buttons">
<div id="st_basket-add-button-content" class="roundies">
{$submit_button}
{if $quantity_field}
<div id="st_basket-add-quantity_container">{$quantity_field}
</div>
{/if}
<img src="{image_path image='/buttons/basket.png'}" alt=""/>
</div>
</div>
</form>
</div>

View File

@@ -0,0 +1,3 @@
<span id="st_icon-basket-{$product_id}" class="st_icon-basket-disabled">
{$basket_add_simple_disabled}
</span>

View File

@@ -0,0 +1,3 @@
<span id="st_icon-basket-{$product_id}" class="st_icon-basket-enabled">
{$basket_add_simple_enabled}
</span>

View File

@@ -0,0 +1,43 @@
<div id="added_product_preview" style="display: none" class="box roundies">
<h3 class="head">{__ text="Produkt został dodany do koszyka"}</h3>
<div class="content">
{foreach item=product from=$products}
<div class="item">
<div class="image">
<a class="full" href="{$product.url}"><img src="{$product.image}" alt="" /></a>
</div>
<div class="info">
<a href="{$product.url}">{$product.name}</a>
<span>{$product.options}</span>
<div class="quantity">
{if $product.error}
{if $product.points_product == 1}
<span class="error">{$product.quantity} {$product.uom} x {$product.points_value} {$product.points_shortcut}</span>
{else}
<span class="error">{$product.quantity} {$product.uom} x {$product.price|st_currency_format}</span>
{/if}
<div class="tooltip tooltip_warning roundies">{$product.error}</div>
{else}
{if $product.points_product == 1}
{$product.quantity} {$product.uom} x {$product.points_value} {$product.points_shortcut}
{else}
{$product.quantity} {$product.uom} x {$product.price|st_currency_format}
{/if}
{/if}
</div>
</div>
</div>
{/foreach}
<div class="buttons right">
<a class="roundies important" href="{$basket_url}">
<span class="arrow_right">{__ text="Koszyk"}</span>
</a>
</div>
<div class="buttons">
<a class="roundies" href="#" onclick="jQuery('#added_product_preview').data('overlay').close(); return false">
<span class="arrow_left icon_left">{__ text="Kontynuuj zakupy"}</span>
</a>
</div>
<div class="clear"></div>
</div>
</div>

View File

@@ -0,0 +1,6 @@
<div class="st_button-basket-enabled" id="st_component-st_basket-add_info_enable">
{$start_form}
{$basket_info_enabled2}
{__ text="Ilość"}: {$basket_info_enabled} {__ text="szt"}.
</form>
</div>

View File

@@ -0,0 +1,19 @@
<div id="st_component-st_basket-basket_preview">
<div id="st_component-basket-content" class="st_content">
<ul>
<li id="st_icon_basket" {$get_tooltip}>
{$icon_basket}
</li>
<li id="st_sum">
{$num}
</li>
<li {$get_tooltip}>
{$amount_product}
</li>
<li>
{$currency}
</li>
</ul>
{$basket_add}
</div>
</div>

View File

@@ -0,0 +1,152 @@
{$form_start}
<div id="button-basket-continue" class="buttons right">
<a href="{$return_url}" class="regular roundies">
<span class="arrow_right">{__ text="Kontynuuj zakupy"}</span>
</a>
</div>
<table id="st-basket-product" class="st_tabular-list roundies" cellspacing="0" width="100%">
<colgroup>
{if $show_photo_in_basket}<col width="60" />{/if}
{if $show_code_in_basket}<col width="60" />{/if}
<col />
{if $show_netto_in_basket}<col width="80" />{/if}
{if $show_tax_in_basket}<col width="50" />{/if}
<col width="80" />
<col width="50" />
{if $points_system_is_active}
<col width="50" />
{/if}
{if $show_uom_in_basket}<col width="50" />{/if}
<col width="80" />
<col width="80" />
</colgroup>
<thead>
<tr>
{if $show_photo_in_basket}<th class="st_basket-product-photo roundies_lt"><span>{__ text="zdjęcie"}</span></th>{/if}
{if $show_code_in_basket}<th class="st_basket-product-code"><span>{__ text="kod"}</span></th>{/if}
<th class="st_basket-product-name"><span>{__ text="nazwa"}</span></th>
{if $show_netto_in_basket}<th class="st_basket-product-netto"><span>{__ text="netto"}</span></th>{/if}
{if $show_tax_in_basket}<th class="st_basket-product-tax"><span>{__ text="vat"}</span></th>{/if}
<th class="st_basket-product-brutto"><span>{__ text="brutto"}</span></th>
{if $points_system_is_active}
<th class="st_basket-product-brutto"><span>{$points_shortcut}</span></th>
{/if}
<th class="st_basket-product-num"><span>{__ text="ilość"}</span></th>
{if $show_uom_in_basket}<th class="st_basket-product-uom"><span>{__ text="j.m."}</span></th>{/if}
<th class="st_basket-product-sum"><span>{__ text="suma}</span></th>
<th class="st_basket-product-remove roundies_rt">{__ text="usuń"}</th>
</tr>
</thead>
<tbody>
<div id="st_basket_product_value"></div>
{foreach key=row item=product from=$results}
{if $product.if_form_error}
<tr>
<td colspan="11"><span class="st_error">{$product.error_show}</span></td>
</tr>
{/if}
<tr id="tr_product_id_{$product.id}" >
{if $show_photo_in_basket}
<td class="st_basket-product-photo">
{if $product.preview}
<div class="st_basket_product_preview">
{$product.photo}
<div>{$product.preview}</div>
</div>
{else}
{$product.photo}
{/if}
</td>
{/if}
{if $show_code_in_basket}<td class="st_basket-product-code">{$product.code}</td>{/if}
<td class="st_basket-product-name">{$product.name}</td>
{if $show_netto_in_basket}<td class="st_basket-product-netto" nowrap>{if $product.points_only!=1}{$product.price_netto}{else} - {/if}</td>{/if}
{if $show_tax_in_basket}<td class="st_basket-product-tax">{if $product.points_only!=1}{$product.tax} %{else} - {/if}</td>{/if}
<td class="st_basket-product-brutto" nowrap>{if $product.points_only!=1}{$product.price_brutto}{else} - {/if}</td>
{if $points_system_is_active}<td class="st_basket-product-brutto" >{if $product.is_set_discount==""}{$product.points_value}{else} - {/if}</td>{/if}
<td class="st_basket-product-num" onmouseover="{$product.num_onmouseover}" onmouseout="{$product.num_onmouseout}">
<ul>
<li id="st_basket-product-num-button-minus-{$product.id}" style="visibility: hidden">{$product.minus}</li>
<li class="st_basket-product-num-value" id="st_basket_product_value{$product.id}">{$product.num}</li>
<li id="st_basket-product-num-button-plus-{$product.id}" style="visibility: hidden">{$product.plus}</li>
</ul>
</td>
{if $show_uom_in_basket}<td class="st_basket-product-uom">{$product.uom}</td>{/if}
<td class="st_basket-product-sum" nowrap>
{if $points_system_is_active && $is_authenticated==1 && $is_release!="release_off" && $is_release!="release_on" && $product.show_pay_by_money!="false"}
<a href="/points/list" style="text-decoration: none;"><span class="basket_tooltip" title='{__ text="Nie osiągnięto progu punktów."}<br/>{__ text="Do osiągnięcia progu brakuje"}: <b>{$is_release} {$points_shortcut}</b>' style="color:red;">{$product.points_sum_value} {$points_shortcut}</span></a>
{elseif $points_system_is_active && $product.show_pay_by_points=="true" && $product.show_pay_by_money!="false" && $product.is_set_discount==""}
<a href="{$product.url_by_points}" style="text-decoration: none;"><span style="color:green;">{__ text="kup za "} <b>{$product.points_sum_value}</b> {$points_shortcut}</span></a>
{elseif $points_system_is_active && $product.points_sum_value > $user_points_status && $is_authenticated==1 && $product.show_pay_by_money!="false" && $product.is_set_discount==""}
<span class="basket_tooltip" title='{__ text="Brak wystarczającej ilości punków."}' style="color:red;">{$product.points_sum_value} {$points_shortcut}</span>
{/if}
{if $points_system_is_active && $is_authenticated!=1 && $product.points_sum_value!=0 && $product.is_set_discount==""}
<a href="/user/loginUser" style="text-decoration: none;"><span class="basket_tooltip" title='{__ text="Zaloguj się aby kupić produkt."}' style="color:green;">{__ text="kup za "} <b>{$product.points_sum_value}</b> {$points_shortcut}</span></a>
{/if}
{if $product.show_pay_by_money!="false" || $product.points_sum_value > $user_points}{if $product.points_only!=1}{if $points_system_is_active && $product.points_sum_value != 0 && $product.is_set_discount==""} / {/if}{$product.total_amount}{/if}{/if}
{if $product.show_pay_by_money=="true"}
{$product.points_sum_value} {$points_shortcut}
{if $product.points_only!=1}
<a class="roundies" href="{$product.url_by_money}" style="margin:0px 0px -2px 2px;">
{$delete_img}
</a>
{/if}
{/if}
</td>
<td class="st_basket-product-remove">{$product.delete}</td>
</tr>
{/foreach}
<tr>
<td colspan="11" class="st_basket-all-empty roundies_b">
<div class="buttons right basket_action">
<a href="{$clear_url}" class="roundies">
<img src="/images/frontend/theme/default2/basket/trash.gif" alt="" />
</a>
</div>
<div class="buttons right basket_action">
<button type="submit" class="roundies">
<img src="/images/frontend/theme/default2/basket/refresh.png" alt="" />
</button>
</div>
<div id="st_basket_vat_eu" class="right">
{$vat_eu}
</div>
</td>
</tr>
</tbody>
</table>
</form>
{literal}
<script type="text/javascript" language="javascript">
jQuery(function ($) {
$(document).ready(function () {
$(".basket_tooltip").tooltip({
effect: 'slide',
opacity: 1,
delay: 0,
position: 'bottom center',
offset: [20,0],
tipClass: "my_tooltip tooltip roundies"
});
});
});
</script>
{/literal}

View File

@@ -0,0 +1,28 @@
<div id="basket_icon" class="right">
{$basket_icon}
</div>
<div class="right">
{$amount_icon}
{if isset($basket_array)}
<div id="basket_tooltip" class="tooltip roundies">
<table style="border:none;">
{foreach from=$basket_array item=basket_item}
<tr>
<td style="border:none;">{$basket_item.image}</td>
<td style="border:none;">{$basket_item.name}</td>
{if $basket_item.product_for_points && $points_system_is_active}
<td class="sum_right">{$basket_item.quantity} x {$basket_item.points_value}</td>
{else}
<td class="sum_right">{$basket_item.quantity} x {$basket_item.price}</td>
{/if}
</tr>
{/foreach}
<tr><td colspan="3" class="sum_right">{__ text="razem"}: <b>{$basket_amount}{if $basket_points_amount!=0 && $points_system_is_active} / {$basket_points_amount} {$points_shortcut}{/if}</b></td></tr>
</table>
</div>
{else}
<div id="basket_tooltip" class="tooltip roundies">
{__ text="Koszyk jest pusty"}
</div>
{/if}
</div>

View File

@@ -0,0 +1,8 @@
<div id="st_component-st_basket-sumary_info">
{if $value}
{$value}
{else}
{__ text="Razem do zapłaty"}: <strong>{$total_amount}</strong>
{/if}
</div>

View File

@@ -0,0 +1,82 @@
{assign var=update value=false}
<div id="shopping-cart-product-preview" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">{__ text="Produkt został dodany do koszyka"}</h4>
</div>
<div class="modal-body">
<div class="shopping-cart">
{foreach item=product from=$products}
{if $product.quantity > 0}
{assign var=update value=true}
{/if}
<div class="item clearfix">
<div class="col-xs-2">
<a href="{$product.url}" class="image pull-left">
<img class="img-rounded" src="{$product.image}" alt="{$product.name}" />
</a>
</div>
<div class="col-xs-10">
<div class="name">
<a href="{$product.url}">{$product.name}</a>
</div>
{if $product.instance->hasPriceModifiers()}
{foreach item=modifier from=$product.instance->getPriceModifiers()}
{if $modifier.custom.field}
<span class="label label-default">{$modifier.custom.field}: {$modifier.label}</span>
{else}
<span class="label label-default">{$modifier.label}</span>
{/if}
{/foreach}
{/if}
<div class="price">
{if $product.error}
<span class="has-error glyphicon glyphicon-exclamation-sign" data-toggle="tooltip" data-placement="top" title="{$product.error}"></span>
{/if}
{$product.quantity} x {$product.price|st_currency_format}
{if $show_netto == 1}
({$product.instance->getPriceNetto(true)|st_currency_format} {__ text="netto"})
{/if}
</div>
</div>
</div>
{/foreach}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">{__ text="Kontynuuj zakupy"}</button>
<a class="btn btn-primary" href="{$basket_url}">{__ text="Koszyk"}</a>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
{slot name="basket-ajax-added-product-preview" hidden="true"}{/slot}
{literal}
<script type="text/javascript">
//<![CDATA[
jQuery(function() {
var shoppingCartProductPreview = $('#shopping-cart-product-preview');
shoppingCartProductPreview .modal().on('hidden.bs.modal', function() {
$(this).remove();
});
shoppingCartProductPreview.find('[data-toggle=tooltip]').tooltip();
});
//]]>
</script>
{/literal}
{if $update}
{literal}
<script type="text/javascript">
//<![CDATA[
jQuery(function() {
$('#nav-shopping-cart').html('{/literal}{$basket_show_component}{literal}');
});
//]]>
</script>
{/literal}
{/if}

View File

@@ -0,0 +1,200 @@
{set layout="one_column"}
<div id="shopping-cart" class="order-control">
<div class="title">
<h1>{__ text="Koszyk"}</h1>
</div>
<a href="{$return_url}" id="basket-back-button" class="btn btn-default hidden-xs">
<span class="arrow_right">{__ text="Kontynuuj zakupy"}</span>
</a>
{if $if_warning || $if_notice}
<div class="alert alert-danger" role="alert">{$show_warning}</div>
{/if}
{if $products}
{slot name="basket-before-items" hidden="true"}{/slot}
<div class="items">
{$product_list}
</div>
{slot name="basket-after-items" hidden="true"}{/slot}
<div id="basket-box" class="row" data-equalizer>
<div id="shopping-cart-delivery" class="col-sm-4">{$delivery}</div>
<div id="shopping-cart-payment" class="col-sm-4">{$payment}</div>
<div id="shopping-cart-summary" class="col-sm-4">{$total}</div>
</div>
<div id="gift-group-container">
{st_get_component module="stGiftGroup" component="show" limit="4" overlay=true}
</div>
<div class="row" data-equalizer >
<div class="col-sm-8">
<div class="panel panel-default" >
<div class="panel-body">
<textarea id="order_description_text" placeholder='{__ text="Uwagi do zamówienia"}' class="form-control" rows="1" >{$description}</textarea>
</div>
</div>
</div>
</div>
{$trusted_shops}
{$socket_above_user_form}
{$user_form}
{else}
<div class="empty-basket text-center">
<img class="hidden-xs" src="{image_path image='basket/empty_basket.png'}" alt="" />
<h3>{__ text="Twój koszyk jest pusty"}</h3>
<a href="{$return_url}" class="btn btn-primary" >
{__ text="Kontynuuj zakupy"}
</a>
</div>
{/if}
</div>
<div class="modal fade modal-vertical-centered" id="basket-update-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<h3 class="text-center">{__ text="Koszyk"}</h3>
<p class="text-center">{__ text="Twój koszyk jest aktualizowany. Proszę czekać."}</p>
<div class="preloader"></div>
</div>
</div>
</div>
</div>
<div id="delivery-modal" class="modal fade" tabindex="-1" role="dialog" data-action="{urlfor internal='@stDeliveryFrontend?action=choosePickupPoint'}">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content relative">
<div class="preloader absolute"></div>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body">
<div class="modal-body-content"></div>
</div>
</div>
</div>
</div>
<div id="delivery-message-modal" class="modal fade" tabindex="-1" role="dialog" data-show-error="{$sf_request->getError('delivery_error')}">
<div class="modal-dialog dialog-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body text-center"></div>
<div class="modal-footer">
<div class="text-center">
<button type="button" class="btn btn-default" data-dismiss="modal">{__ text="Zamknij"}</button>
</div>
</div>
</div>
</div>
</div>
{if $sf_request->hasParameter('session_expired')}
<div class="modal fade modal-vertical-centered" id="basket-session-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false" data-show="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<h3 class="text-center">{__ text="Twoja sesja wygasła"}</h3>
<p class="text-center">{__ text="Przykro nam, ale Twoja sesja wygasła.<br>Powtórz operacje, aby dokończyć proces zamówienia."}</p>
<button class="btn btn-default" data-dismiss="modal">{__ text="OK"}</button>
</div>
</div>
</div>
</div>
{/if}
{literal}
<script type="text/javascript">
//<![CDATA[
jQuery(function($) {
var forms = $('#shopping-cart-delivery, #shopping-cart-payment');
$('#basket-session-modal').modal();
function updateDelivery(event, includeDeliveryCountry) {
const form = $(this);
const fieldset = forms.find('fieldset');
fieldset.attr('disabled', true);
$(document).trigger('delivery.update.started');
let billing = $('#user_data_billing_country, #billing-country').val();
let clientType = $('input[name="user_data_billing[customer_type]"]:checked').val();
let payload = form.serialize()+'&billing_country='+billing+'&client_type='+clientType;
if (includeDeliveryCountry) {
let delivery = $('#user_data_delivery_country, #delivery-country').val();
payload += '&delivery[country]=' + delivery;
}
$.get(form.attr('action'), payload, function() {
fieldset.removeAttr('disabled');
$(document).trigger('delivery.update.finished');
});
return false;
}
forms.on('change', 'select,input[type="radio"],input[type="checkbox"]', function() {
const el = $(this);
if (el.is('#delivery-country') && !el.data('ignore-billing-update') && !$('#different_delivery').prop('checked')) {
$('#user_data_billing_country, #billing-country').val(el.val());
}
el.data('ignore-billing-update', false);
if (el.is('.payment-radio')) {
$('#payment_channel').val(el.data('channel') ? JSON.stringify(el.data('channel')) : '');
}
$(this.form).submit();
});
forms.on('submit', 'form', updateDelivery);
$("#order_description_text").click(function() {
$(this).css('height', '147px');
});
$(document).ready(function() {
$('#order_form_billing').on('change', 'input[name="user_data_billing[customer_type]"], #user_data_billing_country, #billing-country', function() {
updateDelivery.call(forms.filter('#shopping-cart-delivery').find('form'));
});
$('#toTop, #phone-call').remove();
}).on("delivery.update.started", function() {
$('#basket-update-modal').modal('show');
}).on("delivery.update.finished", function() {
setTimeout(function() {
$('#basket-update-modal').modal('hide');
}, 500);
}).on('delivery.update', function(e, includeDeliveryCountry) {
updateDelivery.call(forms.filter('#shopping-cart-delivery').find('form'), includeDeliveryCountry);
});
$('#shopping-cart [data-toggle=tooltip]').tooltip().on('show.bs.tooltip', function(e) {
var target = $(e.target);
if (target.hasClass('product-option-label')) {
var maxWidth = target.css('max-width');
target.css({ 'max-width': 'none' });
var width = target.width();
target.css({ 'max-width': maxWidth });
return width > target.width();
}
return true;
});
});
//]]>
</script>
{/literal}

View File

@@ -0,0 +1,4 @@
{$attributes}
<div id="st_button-basket-{$product_id}" class="buttons">
<span>{__ text="Dodaj do koszyka"}</span>
</div>

View File

@@ -0,0 +1,3 @@
<div id="st_button-basket-{$product_id}" >
{$basket_add_enable}
</div>

View File

@@ -0,0 +1,15 @@
<div id="st_component-st_basket-add_enable">
<form action="{$form_action}" method="post" id="st_basket-add-to-basket-form">
{$attributes}
<div id="st_basket-add-button" class="buttons">
<div id="st_basket-add-button-content" class="roundies">
{$submit_button}
{if $quantity_field}
<div id="st_basket-add-quantity_container">{$quantity_field}
</div>
{/if}
<img src="{image_path image='/buttons/basket.png'}" alt=""/>
</div>
</div>
</form>
</div>

View File

@@ -0,0 +1,3 @@
<span id="st_icon-basket-{$product_id}" class="st_icon-basket-disabled">
{$basket_add_simple_disabled}
</span>

View File

@@ -0,0 +1,3 @@
<span id="st_icon-basket-{$product_id}" class="st_icon-basket-enabled">
{$basket_add_simple_enabled}
</span>

View File

@@ -0,0 +1,94 @@
{assign var=update value=false}
<div id="shopping-cart-product-preview" class="modal fade" role="dialog" aria-labelledby="{__ text='Produkt został dodany do koszyka'}" tabindex="-1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">{__ text="Produkt został dodany do koszyka"}</h4>
</div>
<div class="modal-body">
<div class="shopping-cart">
{foreach item=product from=$products}
{if $product.quantity > 0}
{assign var=update value=true}
{/if}
<div class="item clearfix">
<div class="col-xs-2">
<a href="{$product.url}" class="image pull-left">
<img class="img-rounded" src="{$product.image}" alt="{$product.name}" />
</a>
</div>
<div class="col-xs-10">
<div class="name">
<a href="{$product.url}">{$product.name}</a>
</div>
{if $product.instance->hasPriceModifiers()}
{foreach item=modifier from=$product.instance->getPriceModifiers()}
{if $modifier.custom.field}
<span class="label label-default product-option-label" title="{$modifier.custom.field|escape:'html'}: {$modifier.label|escape:'html'}" data-toggle="tooltip">{$modifier.custom.field}: {$modifier.label}</span>
{else}
<span class="label label-default product-option-label" title="{$modifier.custom.field|escape:'html'}: {$modifier.label|escape:'html'}" data-toggle="tooltip">{$modifier.label}</span>
{/if}
{/foreach}
{/if}
<div class="price">
{if $product.error}
<span class="has-error glyphicon glyphicon-exclamation-sign" data-toggle="tooltip" data-placement="top" title="{$product.error}"></span>
{/if}
{$product.quantity} x {$product.price|st_currency_format}
{if $show_netto == 1}
({$product.instance->getPriceNetto(true)|st_currency_format} {__ text="netto"})
{/if}
</div>
</div>
</div>
{/foreach}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">{__ text="Kontynuuj zakupy"}</button>
<a class="btn btn-primary" href="{$basket_url}">{__ text="Zamów"}</a>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
{slot name="basket-ajax-added-product-preview" hidden="true"}{/slot}
{literal}
<script type="text/javascript">
//<![CDATA[
jQuery(function() {
var shoppingCartProductPreview = $('#shopping-cart-product-preview');
shoppingCartProductPreview .modal().on('hidden.bs.modal', function() {
$(this).remove();
});
shoppingCartProductPreview.find('[data-toggle=tooltip]').tooltip().on('show.bs.tooltip', function(e) {
var target = $(e.target);
if (target.hasClass('product-option-label')) {
var maxWidth = target.css('max-width');
target.css({ 'max-width': 'none' });
var width = target.width();
target.css({ 'max-width': maxWidth });
return width > target.width();
}
return true;
});
});
//]]>
</script>
{/literal}
{if $update}
{literal}
<script type="text/javascript">
//<![CDATA[
jQuery(function() {
$('#nav-shopping-cart').html('{/literal}{$basket_show_component}{literal}');
});
//]]>
</script>
{/literal}
{/if}

View File

@@ -0,0 +1,6 @@
<div class="st_button-basket-enabled" id="st_component-st_basket-add_info_enable">
{$start_form}
{$basket_info_enabled2}
{__ text="Ilość"}: {$basket_info_enabled} {__ text="szt"}.
</form>
</div>

View File

@@ -0,0 +1,19 @@
<div id="st_component-st_basket-basket_preview">
<div id="st_component-basket-content" class="st_content">
<ul>
<li id="st_icon_basket" {$get_tooltip}>
{$icon_basket}
</li>
<li id="st_sum">
{$num}
</li>
<li {$get_tooltip}>
{$amount_product}
</li>
<li>
{$currency}
</li>
</ul>
{$basket_add}
</div>
</div>

View File

@@ -0,0 +1,121 @@
<form action="{url_for internal=@stBasket}" method="post">
<table class="table">
<thead>
<tr>
{if $show_photo_in_basket}
<th class="product-image">&nbsp;</th>
{/if}
{if $show_code_in_basket}
<th class="product-code ">{__ text="kod"}</th>
{/if}
<th class="product-name">{__ text="nazwa"}</th>
{if $show_discount_in_basket}
<th class="product-discount">{__ text="rabat"}</th>
{/if}
{if $show_netto_in_basket}
<th class="product-net text-right">{__ text="netto"}</th>
{/if}
{if $show_tax_in_basket}
<th class="product-tax text-right">{__ text="vat"}</th>
{/if}
<th class="product-gross text-right">{__ text="brutto"}</th>
<th class="product-quantity text-center">{__ text="ilość"}</th>
{if $show_uom_in_basket}
<th class="product-uom text-right">{__ text="j.m."}</th>
{/if}
<th class="product-total text-right">{__ text="suma"}</th>
<th class="product-action-new">
<a href="{$clear_url}" class="pull-right hidden-xs" aria-label="{__ text='Wyczyść zawartość koszyka'}">
<span class="glyphicon glyphicon-trash"></span>
</a>
</th>
</tr>
</thead>
<tbody>
{foreach key=row item=product from=$results}
{if $product.if_form_error}
<tr>
<td colspan="11" style="padding: 0; margin: 0"><div class="bg-danger">{$product.error_show}</div></td>
</tr>
{/if}
{slot name="basket-before-item-row" hidden="true" product=$product.instance}{/slot}
<tr>
{if $show.photo}
<td class="product-image" data-th="{__ text='zdjęcie'}">
{if $product.url}
<a href="{$product.url}">
<img class="img-responsive" src="{$product.photo}" alt="{$product.name}" />
</a>
{else}
<img class="img-responsive" src="{$product.photo}" alt="{$product.name}" />
{/if}
<a class="visible-xs primary btn-delete" href="{$product.delete_url}" aria-label="{__ text='Usuń produkt z koszyka'}">{__ text="usuń"}</a>
</td>
{/if}
{if $show.code}
<td class="mobile product-code" data-th="{__ text='kod'}"> {$product.code}</td>
{/if}
<td class="product-name" data-th="{__ text='nazwa'}">
{if $product.url}
<a href="{$product.url}">
{$product.name}
</a>
{else}
{$product.name}
{/if}
{if $product.instance->hasPriceModifiers()}
<div class="options">
{foreach item=modifier from=$product.instance->getPriceModifiers()}
{if $modifier.custom.field}
<span class="label label-default product-option-label" title="{$modifier.custom.field|escape:'html'}: {$modifier.label|escape:'html'}" data-toggle="tooltip" data-placement="top">{$modifier.custom.field}: {$modifier.label}</span>
{else}
<span class="label label-default product-option-label" title="{$modifier.custom.field|escape:'html'}: {$modifier.label|escape:'html'}" data-toggle="tooltip" data-placement="top">{$modifier.label}</span>
{/if}
{/foreach}
</div>
{/if}
</td>
{if $show.discount}
<td class="product-discount text-nowrap mobile" data-th="{__ text='rabat'}"> {$product.discount}%</td>
{/if}
{if $show.netto}
<td class="product-net text-nowrap price mobile" data-th="{__ text='netto'}"> {$product.price_netto}</td>
{/if}
{if $show.tax}
<td class="mobile product-tax text-nowrap mobile" data-th="{__ text='vat'}"> {$product.tax}</td>
{/if}
<td class="product-gross text-nowrap price mobile" data-th="{__ text='brutto'}"> {$product.price_brutto}</td>
<td class="product-quantity text-center" data-th="{__ text='ilość'}">
{$product.num}
{if $show.uom}
<div class="product-uom visible-xs" data-th="{__ text='j.m.'}"> {$product.uom}</div>
{/if}
<button type="submit" class="btn btn-default btn-xs" aria-label="{__ text='Aktualizuj ilość'}">
<span class="glyphicon glyphicon-refresh"></span>
</button>
</td>
{if $show.uom}
<td class="product-uom hidden-xs" data-th="{__ text='j.m.'}"> {$product.uom}</td>
{/if}
<td class="product-total text-nowrap hidden-xs" data-th="{__ text='suma'}"> {$product.total_amount}</td>
<td class="product-action-new hidden-xs">
<a class="primary btn-delete" href="{$product.delete_url}" aria-label="{__ text='Usuń produkt z koszyka'}">
<span><img src="{image_path image='delete.png'}" height="14" width="14" alt="delete" /></span>
</a>
</td>
</tr>
{slot name="basket-after-item-row" hidden="true" parameters="product, show"}{/slot}
{/foreach}
{if $vat_eu}
<tr class="bottom-tab">
<td class="clearfix" colspan="11">
<div id="st_basket_vat_eu" class="pull-right">
{$vat_eu}
</div>
</td>
</tr>
{/if}
</tbody>
</table>
</form>

View File

@@ -0,0 +1,75 @@
<div class="shopping-cart clearfix">
{if $items}
<div class="clearfix">
{assign var='i' value=0}
{foreach item=item from=$items}
{assign var='i' value=$i+1}
{if $i < 5}
<div class="item clearfix">
<div class="col-xs-2 item-image-col">
<a href="{$item.url}" class="image">
<img class="img-rounded" src="{$item.image}" alt="{$item.name}" />
</a>
</div>
<div class="col-xs-10 item-content-col">
<div class="name">
<a href="{$item.url}">{$item.name}</a>
</div>
{if $item.price_modifiers}
<div class="options">
{foreach item=modifier from=$item.price_modifiers}
{if $modifier.custom.field}
<span class="label label-default product-option-label" title="{$modifier.custom.field|escape:'html'}: {$modifier.label|escape:'html'}" data-toggle="tooltip" data-placement="bottom">{$modifier.custom.field}: {$modifier.label}</span>
{else}
<span class="label label-default product-option-label" title="{$modifier.custom.field|escape:'html'}: {$modifier.label|escape:'html'}" data-toggle="tooltip" data-placement="bottom">{$modifier.label}</span>
{/if}
{/foreach}
</div>
{/if}
<div class="price">{$item.quantity} x {$item.price}</div>
<a class="close-icon" href="{$item.delete_url}" aria-label="{__ text='usuń'}"></a>
</div>
</div>
{slot name="basket-widget-after-item-row" hidden="true" parameters="item"}{/slot}
{elseif $i == 5}
<a href="{$url}" class="btn btn-default">{__ text="Zobacz wszystkie" langCatalogue="stOrder"}</a>
{/if}
{/foreach}
</div>
<div class="clearfix basket-show-summary">
<div class="basket-show-total">
{__ text="Razem do zapłaty"}: <b>{$basket_summary}</b>
</div>
<a class="btn btn-primary" href="{$url}">{__ text="Zamów"}</a>
</div>
{else}
<div class="text-right">{__ text="Twój koszyk jest pusty"}</div>
{/if}
</div>
{literal}
<script type="text/javascript">
//<![CDATA[
jQuery(function($) {
var quantity = {/literal}{$total_quantity}{literal};
$("#nav-button-shopping-cart .quantity").html(quantity ? quantity : "");
$('#nav-shopping-cart [data-toggle=tooltip]').tooltip().on('show.bs.tooltip', function(e) {
var target = $(e.target);
if (target.hasClass('product-option-label')) {
var maxWidth = target.css('max-width');
target.css({ 'max-width': 'none' });
var width = target.width();
target.css({ 'max-width': maxWidth });
return width > target.width();
}
return true;
});
if (quantity > 0) {
$("#nav-button-shopping-cart.empty").removeClass('empty');
};
});
//]]>
</script>
{/literal}

View File

@@ -0,0 +1,8 @@
<div id="st_component-st_basket-sumary_info">
{if $value}
{$value}
{else}
{__ text="Razem do zapłaty"}: <strong>{$total_amount}</strong>
{/if}
</div>