first commit
This commit is contained in:
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stSklepy24Plugin
|
||||
*
|
||||
* Ten plik należy do aplikacji stSklepy24Plugin 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 stSklepy24Plugin
|
||||
* @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>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Klasa stSklepy24BackendActions
|
||||
*
|
||||
* @package stSklepy24Plugin
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stSklepy24BackendActions extends autostSklepy24BackendActions
|
||||
{
|
||||
/**
|
||||
* Przeciążenie aktualizacji config'a
|
||||
*/
|
||||
protected function updateConfigFromRequest()
|
||||
{
|
||||
$config = $this->getRequestParameter('config');
|
||||
|
||||
if (is_dir(sfConfig::get('sf_plugins_dir')."/appAdsTrackerPlugin")) {
|
||||
if ($config['ads_tracker']==1) {
|
||||
appAdsTracker::checkCompare("sklepy24",1);
|
||||
} else {
|
||||
appAdsTracker::checkCompare("sklepy24",0);
|
||||
}
|
||||
}
|
||||
|
||||
parent::updateConfigFromRequest();
|
||||
|
||||
$this->dispatcher->notify(new sfEvent($this, 'stCeneoBackendActions.updateConfigFromRequest'), array('config' => $this->config));
|
||||
}
|
||||
|
||||
public function executeProductEnable()
|
||||
{
|
||||
$ids = $this->getRequestParameter('sklepy24[selected]', array());
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$c = new Criteria();
|
||||
$c->add(Sklepy24Peer::PRODUCT_ID, $id);
|
||||
$Sklepy24 = Sklepy24Peer::doSelectOne($c);
|
||||
|
||||
if (null === $Sklepy24) {
|
||||
$Sklepy24 = new Sklepy24();
|
||||
$Sklepy24->setProductId($id);
|
||||
}
|
||||
|
||||
$Sklepy24->setActive(true);
|
||||
$Sklepy24->save();
|
||||
}
|
||||
|
||||
return $this->redirect('stSklepy24Backend/list?page=' . $this->getRequestParameter('page', 1));
|
||||
}
|
||||
|
||||
public function executeProductDisable()
|
||||
{
|
||||
$ids = $this->getRequestParameter('sklepy24[selected]', array());
|
||||
|
||||
/**
|
||||
* @var Sklepy24 $Sklepy24
|
||||
*/
|
||||
foreach (Sklepy24Peer::retrieveByPKs(array_values($ids)) as $Sklepy24) {
|
||||
$Sklepy24->delete();
|
||||
}
|
||||
|
||||
return $this->redirect('stSklepy24Backend/list?page=' . $this->getRequestParameter('page', 1));
|
||||
}
|
||||
|
||||
protected function addFiltersCriteria($c)
|
||||
{
|
||||
if (isset($this->filters['code_is_empty'])) {
|
||||
$criterion = $c->getNewCriterion(ProductPeer::CODE, '');
|
||||
$criterion->addOr($c->getNewCriterion(ProductPeer::CODE, null, Criteria::ISNULL));
|
||||
$c->add($criterion);
|
||||
} else if (isset($this->filters['code']) && $this->filters['code'] !== '') {
|
||||
if (method_exists($this, 'filterCriteriaByProductCode')) {
|
||||
$filter_anyway = !$this->filterCriteriaByProductCode($c, $this->filters['code']);
|
||||
} else {
|
||||
$filter_anyway = true;
|
||||
}
|
||||
|
||||
if ($filter_anyway) {
|
||||
$c->add(ProductPeer::CODE, '%' . $this->filters['code'] . '%', Criteria::LIKE);
|
||||
}
|
||||
}
|
||||
if (isset($this->filters['product_is_empty'])) {
|
||||
$criterion = $c->getNewCriterion(ProductPeer::OPT_NAME, '');
|
||||
$criterion->addOr($c->getNewCriterion(ProductPeer::OPT_NAME, null, Criteria::ISNULL));
|
||||
$c->add($criterion);
|
||||
} else if (isset($this->filters['product']) && $this->filters['product'] !== '') {
|
||||
if (method_exists($this, 'filterCriteriaByProductOptName')) {
|
||||
$filter_anyway = !$this->filterCriteriaByProductOptName($c, $this->filters['product']);
|
||||
} else {
|
||||
$filter_anyway = true;
|
||||
}
|
||||
|
||||
if ($filter_anyway) {
|
||||
$c->add(ProductPeer::OPT_NAME, '%' . $this->filters['product'] . '%', Criteria::LIKE);
|
||||
}
|
||||
}
|
||||
if (isset($this->filters['active_is_empty'])) {
|
||||
$criterion = $c->getNewCriterion(Sklepy24Peer::ACTIVE, '');
|
||||
$criterion->addOr($c->getNewCriterion(Sklepy24Peer::ACTIVE, null, Criteria::ISNULL));
|
||||
$c->add($criterion);
|
||||
} else if (isset($this->filters['active']) && $this->filters['active'] !== '') {
|
||||
if ($this->filters['active'] == null || $this->filters['active'] == 0) {
|
||||
$criterion = $c->getNewCriterion(Sklepy24Peer::ACTIVE, '');
|
||||
$criterion->addOr($c->getNewCriterion(Sklepy24Peer::ACTIVE, null, Criteria::ISNULL));
|
||||
$c->add($criterion);
|
||||
}
|
||||
|
||||
if ($this->filters['active'] == 1) {
|
||||
$c->add(Sklepy24Peer::ACTIVE, $this->filters['active']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($this->filters) {
|
||||
$c->add(Sklepy24Peer::PRODUCT_ID, 0, Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
$this->getDispatcher()->notify(new sfEvent($this, 'autoStSklepy24BackendActions.addFiltersCriteria', array('criteria' => $c)));
|
||||
}
|
||||
|
||||
public function executeAddAll()
|
||||
{
|
||||
Sklepy24Peer::doDeleteAll();
|
||||
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$con->executeQuery(sprintf(
|
||||
"INSERT INTO %s(%s, %s) (SELECT %s, 1 FROM %s)",
|
||||
Sklepy24Peer::TABLE_NAME,
|
||||
Sklepy24Peer::PRODUCT_ID,
|
||||
Sklepy24Peer::ACTIVE,
|
||||
ProductPeer::ID,
|
||||
ProductPeer::TABLE_NAME
|
||||
));
|
||||
|
||||
return $this->redirect('stSklepy24Backend/list?page=' . $this->getRequestParameter('page', 1));
|
||||
}
|
||||
|
||||
public function executeDeleteAll()
|
||||
{
|
||||
Sklepy24Peer::doDeleteAll();
|
||||
|
||||
return $this->redirect('stSklepy24Backend/list?page=' . $this->getRequestParameter('page', 1));
|
||||
}
|
||||
|
||||
protected function getSklepy24OrCreate($id = 'id')
|
||||
{
|
||||
$sklepy24 = Sklepy24Peer::retrieveByProduct($this->related_object);
|
||||
|
||||
if (null === $sklepy24) {
|
||||
if ($this->hasRequestParameter('id')) {
|
||||
return $this->redirect('@stSklepy24Plugin?action=create&product_id=' . $this->related_object->getId().'&view=default');
|
||||
} else {
|
||||
$sklepy24 = new Sklepy24();
|
||||
$sklepy24->setProduct($this->related_object);
|
||||
}
|
||||
}
|
||||
|
||||
return $sklepy24;
|
||||
}
|
||||
|
||||
public function executeGenerateCustom()
|
||||
{
|
||||
parent::executeGenerateCustom();
|
||||
|
||||
$i18n = $this->getContext()->getI18n();
|
||||
$this->getBreadcrumbsBuilder()->getDefaultBreadcrumbs()->add($i18n->__('Generowanie pliku'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stSklepy24Plugin
|
||||
*
|
||||
* Ten plik należy do aplikacji stSklepy24Plugin 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 stSklepy24Plugin
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: components.class.php 10 2009-08-24 09:32:18Z michal $
|
||||
* @author Michal Prochowski <michal.prochowski@sote.pl>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Klasa stSklepy24BackendComponents
|
||||
*
|
||||
* @package stSklepy24Plugin
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stSklepy24BackendComponents extends autostSklepy24BackendComponents
|
||||
{
|
||||
/**
|
||||
* Generowanie pliku xml
|
||||
*/
|
||||
public function executeGenerateXml()
|
||||
{
|
||||
$this->generate = false;
|
||||
if ($this->getRequest()->hasParameter('generate')) $this->generate = true;
|
||||
|
||||
$stSklepy24 = new stSklepy24();
|
||||
$this->steps = $stSklepy24->getStepsCount();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
generator:
|
||||
class: stAdminGenerator
|
||||
param:
|
||||
model_class: Sklepy24
|
||||
theme: simple
|
||||
|
||||
head:
|
||||
package: stSklepy24Plugin
|
||||
|
||||
documentation:
|
||||
pl: https://www.sote.pl/docs/sklepy24
|
||||
en: https://www.soteshop.com/docs/sklepy24
|
||||
|
||||
list:
|
||||
title: Lista produktów
|
||||
description: Zarządzanie porównywarką cen Sklepy24
|
||||
max_per_page: 20
|
||||
display: [_code, _product, active]
|
||||
peer_method: doSelectRightJoinProduct
|
||||
peer_count_method: doCountRightJoinProduct
|
||||
actions:
|
||||
_deletes: {name: Wypisz wszystkie, action: deleteAll, icon: delete}
|
||||
_add: {name: Przypisz wszystkie, action: addAll}
|
||||
_generate: {name: Generuj plik xml z przypisanych, action: "@stSklepy24Plugin?action=generateCustom&generate=1", icon: export}
|
||||
object_actions: -
|
||||
select_actions:
|
||||
display:
|
||||
"Ustaw przypisane:": [product_enabled, product_disabled]
|
||||
actions:
|
||||
product_enabled: {name: Tak, confirm: "Ustaw przypisane: Tak", action: productEnable, i18n: stSklepy24Backend}
|
||||
product_disabled: {name: Nie, confirm: "Ustaw przypisane: Nie", action: productDisable, i18n: stSklepy24Backend}
|
||||
filters:
|
||||
code: {filter_field: product.code}
|
||||
product: {filter_field: product.opt_name}
|
||||
fields:
|
||||
code: {name: Kod, sort_field: product.code, params: size=50}
|
||||
product: {name: Nazwa, sort_field: product.opt_name, params: size=50}
|
||||
active: {name: Przypisany}
|
||||
menu:
|
||||
display: [list, generate, config]
|
||||
fields:
|
||||
list: {name: Lista produktów, action: @stSklepy24PluginDefault}
|
||||
generate: {name: Generowanie pliku, action: stSklepy24Backend/generateCustom}
|
||||
config: {name: Konfiguracja, action: stSklepy24Backend/config}
|
||||
object_actions:
|
||||
_edit: {action: @stSklepy24Plugin?action=edit&id=%%id%%&product_id=%%product_id%%&view=default}
|
||||
|
||||
create:
|
||||
title: Edytuj
|
||||
|
||||
edit:
|
||||
menu: {use: list.menu}
|
||||
display: [active]
|
||||
fields:
|
||||
active: {name: Przypisany}
|
||||
actions:
|
||||
_list: {name: Lista}
|
||||
_save: {name: Zapisz}
|
||||
forward_parameters: [product_id, view]
|
||||
build_options:
|
||||
related_id: forward_parameters.product_id
|
||||
related_class: Product
|
||||
|
||||
|
||||
generate_model_class: Sklepy24
|
||||
|
||||
custom_actions:
|
||||
custom: [generate]
|
||||
|
||||
generate_custom:
|
||||
menu: {use: list.menu}
|
||||
title: Generowanie pliku
|
||||
description: Zarządzanie porównywarką cen Sklepy24
|
||||
|
||||
config:
|
||||
title: Konfiguracja
|
||||
description: Zarządzanie porównywarką cen Sklepy24
|
||||
display:
|
||||
"ADS Tracker": [_ads_tracker_info_befour, ads_tracker, _ads_tracker_info_after]
|
||||
fields:
|
||||
ads_tracker: {name: Aktywuj, checked: false, type: checkbox}
|
||||
ads_tracker_info_befour: {name: ""}
|
||||
ads_tracker_info_after: {name: ""}
|
||||
actions:
|
||||
_list: {name: Lista}
|
||||
_save: {name: Zapisz}
|
||||
menu: {use: list.menu}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php $config = stConfig::getInstance(sfContext::getInstance(), 'stSklepy24Backend'); ?>
|
||||
|
||||
<?php
|
||||
if ($config->get('ads_tracker')==1 && is_dir(sfConfig::get('sf_plugins_dir')."/appAdsTrackerPlugin")):?>
|
||||
|
||||
<?php
|
||||
|
||||
$c = new Criteria();
|
||||
$c->add(AdsTrackerListPeer::PLUGIN_NAME, "sklepy24");
|
||||
$AdsTrackerList = AdsTrackerListPeer::doSelectOne($c);
|
||||
|
||||
if($AdsTrackerList):
|
||||
?>
|
||||
|
||||
<?php echo __("Przejdź do ADS Trackera, aby obejrzeć raporty"); ?>:
|
||||
<a href="<?php echo st_url_for('appAdsTrackerBackend/adsTrackerInfoStats/')."?id=".$AdsTrackerList->getId(); ?>"><?php echo __("Sklepy24"); ?></a>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php if (!is_dir(sfConfig::get('sf_plugins_dir')."/appAdsTrackerPlugin")): ?>
|
||||
|
||||
<?php echo __("Aby skorzystać z tej funkcji, potrzebujesz aplikacji ADS Tracker"); ?>:
|
||||
<a target="_blank" href="https://www.sote.pl/ads-tracker.html?hash=e90a50c5a3a683e5e9dcc34a0ce1a2b3"><?php echo __("Zamów aplikację ADS Tracker"); ?></a>
|
||||
<br/>
|
||||
<style>
|
||||
.off, .row_ads_tracker{
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
$("#config_ads_tracker").attr("disabled", true);
|
||||
$("#config_ads_tracker").prop("checked", false );
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<span class="off"><?php echo __("Raportuj wejścia i rozpoznawaj zamówienia osób, które weszły na stronę z porównywarki Sklepy24."); ?></span>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
if ($sklepy24->getProductId()): ?>
|
||||
<?php echo st_link_to($sklepy24->getProduct()->getCode(), 'product/edit?id='.$sklepy24->getProductId()); ?>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
if ($sf_request->getParameter('view') == 'product')
|
||||
{
|
||||
st_include_partial('stProduct/edit_menu', array('related_object' => $related_object, 'forward_parameters' => $forward_parameters));
|
||||
}
|
||||
else
|
||||
{
|
||||
include st_admin_get_template_path(__FILE__);
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php use_helper('stProgressBar'); ?>
|
||||
|
||||
<div class="admin_form">
|
||||
<fieldset >
|
||||
|
||||
<div class="content" style="text-align: center;">
|
||||
|
||||
<?php
|
||||
if ($generate)
|
||||
: ?>
|
||||
<div id="generateXml">
|
||||
<?php echo progress_bar('stSklepy24GenerateXml', 'stSklepy24', 'generate', $steps); ?>
|
||||
</div>
|
||||
<?php else
|
||||
: ?>
|
||||
|
||||
<?php echo __('Wciśnij przycisk "Generuj plik", aby rozpocząć proces tworzenia pliku exportu danych dla Sklepy24.'); ?> <br>
|
||||
<?php echo __('Może to potrwać nawet kilka minut w zależności od ilości produktów.'); ?>
|
||||
<br><br>
|
||||
|
||||
<?php echo st_get_admin_button('file', __('Generuj plik'), 'sklepy24/generateCustom?generate=1', array ('name' => 'sample_file', 'style' => 'text-align:center;')) ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php use_helper('stAdminGenerator'); ?>
|
||||
<?php $stWebRequest = new stWebRequest(); ?>
|
||||
<br />
|
||||
<?php echo __('Plik został wygenerowany i znajduje się pod adresem:') ?>
|
||||
<br>
|
||||
|
||||
<a href="http://<?php echo $stWebRequest->getHost() ?>/uploads/sklepy24.xml" target="_blank">
|
||||
http://<?php echo $stWebRequest->getHost() ?>/uploads/sklepy24.xml
|
||||
<a>
|
||||
|
||||
<br><br>
|
||||
|
||||
<?php echo st_get_admin_button('file', 'Pobierz', '/uploads/sklepy24.xml', array('download'=>null)); ?>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
if ($sklepy24->getProductId()): ?>
|
||||
<?php echo st_link_to($sklepy24->getProduct()->getName(), 'product/edit?id='.$sklepy24->getProductId()); ?>
|
||||
<?php endif; ?>
|
||||
Reference in New Issue
Block a user