Version Notes
Janolaw_Agb2 ist eine umfangreiche Überarbeitung der Vorgänger-Extension Janolaw_Agb. Unter anderem ist die Extension nicht mehr abhängig von Market Ready Germany. Sie kann standalone, oder aber im Zusammenspiel mit FireGento_MageSetup (bzw. deren Vorgänger FireGento_GermanSetup) oder MarketReadyGermany verwendet werden. Wenn Sie die Vorgänger-Version installiert haben, empfehlen wir, diese erst zu deinstallieren (dazu entfernen Sie einfach die Dateien "app/etc/Janolaw_All.xml", "app/code/community/Janolaw/update_agb.php" und den kompletten Ordner "app/code/community/Janolaw/Agb".). Anschließend kann die neue Version Janolaw_Agb2 installiert werden.
Nach Installation dieser Version sollten Sie den Cache leeren, sich abmelden und neu anmelden, und dann unter System -> Konfiguration -> Janolaw AGB Hosting -> Setup die Anweisungen zur Konfiguration befolgen.
Release Info
Developer | Claudio Kressibucher |
Extension | janolaw_agb2 |
Version | 0.1.6 |
Comparing to | |
See all releases |
Version 0.1.6
- app/code/community/Janolaw/Agb/Block/Adminhtml/Setup.php +38 -0
- app/code/community/Janolaw/Agb/Block/Adminhtml/Status/Config.php +114 -0
- app/code/community/Janolaw/Agb/Helper/Data.php +101 -0
- app/code/community/Janolaw/Agb/Helper/HttpStatusNotSuccessfulException.php +20 -0
- app/code/community/Janolaw/Agb/Model/CmsAssistant.php +113 -0
- app/code/community/Janolaw/Agb/Model/Downloader.php +335 -0
- app/code/community/Janolaw/Agb/Model/Email/Template.php +37 -0
- app/code/community/Janolaw/Agb/Model/MissingConfigException.php +5 -0
- app/code/community/Janolaw/Agb/Model/Observer.php +130 -0
- app/code/community/Janolaw/Agb/Model/RemoteException.php +5 -0
- app/code/community/Janolaw/Agb/Model/Resource/Downloader.php +154 -0
- app/code/community/Janolaw/Agb/Model/Setup.php +60 -0
- app/code/community/Janolaw/Agb/controllers/Adminhtml/Janolaw/SetupController.php +201 -0
- app/code/community/Janolaw/Agb/controllers/Adminhtml/Janolaw/StatusController.php +55 -0
- app/code/community/Janolaw/Agb/data/agb_setup/data-upgrade-0.1.5-0.1.6.php +67 -0
- app/code/community/Janolaw/Agb/etc/adminhtml.xml +49 -0
- app/code/community/Janolaw/Agb/etc/config.xml +150 -0
- app/code/community/Janolaw/Agb/etc/system.xml +123 -0
- app/code/community/Janolaw/Agb/sql/agb_setup/mysql4-install-0.1.4.php +14 -0
- app/design/adminhtml/default/default/layout/janolawagb/agbdownloader.xml +14 -0
- app/design/adminhtml/default/default/template/janolawagb/setup.phtml +554 -0
- app/design/adminhtml/default/default/template/janolawagb/status/config.phtml +108 -0
- app/etc/modules/Janolaw_Agb.xml +9 -0
- app/etc/modules/Janolaw_All.xml +6 -0
- app/locale/de_DE/Janolaw_Agb.csv +28 -0
- package.xml +42 -0
- shell/janolaw.php +75 -0
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Janolaw_Agb_Block_Adminhtml_Setup extends Mage_Adminhtml_Block_Abstract
|
5 |
+
{
|
6 |
+
|
7 |
+
public function getInstalledMrgModules()
|
8 |
+
{
|
9 |
+
$modulesDir = Mage::getBaseDir('etc') . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR;
|
10 |
+
|
11 |
+
$dirHandle = @opendir($modulesDir);
|
12 |
+
if (false === $dirHandle) {
|
13 |
+
Mage::log('Error opening modules dir at ' . $modulesDir, Zend_Log::ERR);
|
14 |
+
return array();
|
15 |
+
}
|
16 |
+
$modules = array();
|
17 |
+
while (false !== ($file = readdir($dirHandle))) {
|
18 |
+
if (!preg_match('/^Symmetrics_.*\.xml$/', $file)) {
|
19 |
+
continue;
|
20 |
+
}
|
21 |
+
$fullPath = rtrim($modulesDir, '/\\') . DIRECTORY_SEPARATOR . $file;
|
22 |
+
try {
|
23 |
+
$xml = new SimpleXMLElement($fullPath, 0, true);
|
24 |
+
foreach ($xml->modules->children() as $m) {
|
25 |
+
$moduleName = $m->getName();
|
26 |
+
if (Mage::helper('core')->isModuleEnabled($moduleName)) {
|
27 |
+
$modules[] = $m->getName();
|
28 |
+
}
|
29 |
+
}
|
30 |
+
} catch (Exception $e) {
|
31 |
+
Mage::logException($e);
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
return $modules;
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Janolaw_Agb_Block_Adminhtml_Status_Config extends Mage_Adminhtml_Block_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
public function getConfigData()
|
7 |
+
{
|
8 |
+
$blockConfigData = $this->_getBlockConfigData();
|
9 |
+
return $blockConfigData;
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _getBlockConfigData()
|
13 |
+
{
|
14 |
+
$blockIds = array(
|
15 |
+
Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION => Janolaw_Agb_Model_Downloader::XML_PATH_REVOCATION_ID,
|
16 |
+
Janolaw_Agb_Model_CmsAssistant::TYPE_TAC => Janolaw_Agb_Model_Downloader::XML_PATH_TAC_ID,
|
17 |
+
Janolaw_Agb_Model_CmsAssistant::TYPE_PRIVACY => Janolaw_Agb_Model_Downloader::XML_PATH_PRIVACY_ID,
|
18 |
+
Janolaw_Agb_Model_CmsAssistant::TYPE_IMPRINT => Janolaw_Agb_Model_Downloader::XML_PATH_IMPRINT_ID,
|
19 |
+
);
|
20 |
+
$data = array();
|
21 |
+
foreach ($blockIds as $type => $configPath) {
|
22 |
+
$data[$type] = Mage::getStoreConfig($configPath, 0);
|
23 |
+
}
|
24 |
+
return $data;
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
+
public function getNotConfiguredValues()
|
31 |
+
{
|
32 |
+
$missing = array();
|
33 |
+
foreach ($this->_getBlockConfigData() as $type => $value) {
|
34 |
+
if (empty($value)) {
|
35 |
+
if (!isset($missing['block_config'])) {
|
36 |
+
$missing['block_config'] = array();
|
37 |
+
}
|
38 |
+
$missing['block_config'][] = $this->_getTypeTranslated($type);
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
// check shop id / user id / base_url in default scope
|
43 |
+
$shopId = Mage::getStoreConfig(\Janolaw_Agb_Model_Downloader::XML_PATH_SHOP_ID, 0);
|
44 |
+
$userId = Mage::getStoreConfig(\Janolaw_Agb_Model_Downloader::XML_PATH_USER_ID, 0);
|
45 |
+
$baseUrl = Mage::getStoreConfig(\Janolaw_Agb_Model_Downloader::XML_PATH_API_BASE_URL, 0);
|
46 |
+
|
47 |
+
if (empty($shopId)) {
|
48 |
+
$missing['shop_id'] = 'Shop Id';
|
49 |
+
}
|
50 |
+
if (empty($userId)) {
|
51 |
+
$missing['user_id'] = 'User Id';
|
52 |
+
}
|
53 |
+
if (empty($baseUrl)) {
|
54 |
+
$missing['base_url'] = 'Base Url';
|
55 |
+
}
|
56 |
+
return $missing;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @return Mage_Core_Model_Flag
|
61 |
+
*/
|
62 |
+
public function getLastRunFlagData()
|
63 |
+
{
|
64 |
+
/* @var $flag Mage_Core_Model_Flag */
|
65 |
+
$flag = Mage::getModel(
|
66 |
+
'core/flag',
|
67 |
+
array('flag_code' => Janolaw_Agb_Model_Downloader::FLAG_CODE)
|
68 |
+
);
|
69 |
+
$flag->loadSelf();
|
70 |
+
return $flag;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* @param $utcString
|
75 |
+
* @param string $format
|
76 |
+
*
|
77 |
+
* @return string
|
78 |
+
*/
|
79 |
+
public function convertUTCToLocaleTime($utcString, $format = 'Y-m-d H:i:s')
|
80 |
+
{
|
81 |
+
$strZone = Mage::getStoreConfig('general/locale/timezone');
|
82 |
+
$localeZone = new DateTimeZone($strZone);
|
83 |
+
$utcZone = new DateTimeZone('UTC');
|
84 |
+
|
85 |
+
$dt = DateTime::createFromFormat($format, $utcString, $utcZone);
|
86 |
+
$dt->setTimezone($localeZone);
|
87 |
+
|
88 |
+
return $dt->format($format);
|
89 |
+
}
|
90 |
+
|
91 |
+
protected function _getTypeTranslated($type)
|
92 |
+
{
|
93 |
+
switch ($type) {
|
94 |
+
case \Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION:
|
95 |
+
return $this->__('Revocation');
|
96 |
+
case \Janolaw_Agb_Model_CmsAssistant::TYPE_TAC:
|
97 |
+
return $this->__('Terms and conditions');
|
98 |
+
case \Janolaw_Agb_Model_CmsAssistant::TYPE_PRIVACY:
|
99 |
+
return $this->__('Privacy statement');
|
100 |
+
case \Janolaw_Agb_Model_CmsAssistant::TYPE_IMPRINT:
|
101 |
+
return $this->__('Imprint');
|
102 |
+
}
|
103 |
+
return '';
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* @return string
|
108 |
+
*/
|
109 |
+
public function getVersion()
|
110 |
+
{
|
111 |
+
$c = Mage::getConfig()->getModuleConfig('Janolaw_Agb');
|
112 |
+
return strval($c->version);
|
113 |
+
}
|
114 |
+
}
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Janolaw_Agb_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* @var Zend_Http_Client
|
8 |
+
*/
|
9 |
+
protected $_client = null;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* TODO replace file_get_contents by correct curl request or something similar...
|
13 |
+
* Fetch content from a remote host, using GET request.
|
14 |
+
*
|
15 |
+
* @param string $url
|
16 |
+
*
|
17 |
+
* @throws Exception
|
18 |
+
* @return string The remote data
|
19 |
+
*/
|
20 |
+
public function getRemoteContent($url)
|
21 |
+
{
|
22 |
+
$response = $this->_getClient($url)->request(Zend_Http_Client::GET);
|
23 |
+
$status = $response->getStatus();
|
24 |
+
if ($status < 200 || $status >= 300) {
|
25 |
+
throw new Janolaw_Agb_Helper_HttpStatusNotSuccessfulException($response);
|
26 |
+
}
|
27 |
+
return $response->getBody();
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Print a list of error messages, depending on context (admin, command line, frontend).
|
32 |
+
* If the array is large, not all messages are printed
|
33 |
+
*
|
34 |
+
* @param array $errors
|
35 |
+
* @param int $maxCount Print maximum this number or error messages.
|
36 |
+
*/
|
37 |
+
public function printErrors(array $errors, $maxCount = 8)
|
38 |
+
{
|
39 |
+
if (empty($errors)) {
|
40 |
+
return;
|
41 |
+
}
|
42 |
+
$errorsSliced = array_slice($errors, 0, $maxCount);
|
43 |
+
if (count($errors) > count($errorsSliced)) {
|
44 |
+
$errorsSliced[] = '...';
|
45 |
+
}
|
46 |
+
if ($this->_isShellContext()) {
|
47 |
+
foreach ($errorsSliced as $e) {
|
48 |
+
echo $e;
|
49 |
+
}
|
50 |
+
} else {
|
51 |
+
if (Mage::app()->getStore()->isAdmin()) {
|
52 |
+
$session = Mage::getSingleton('adminhtml/session');
|
53 |
+
} else {
|
54 |
+
$session = Mage::getSingleton('core/session');
|
55 |
+
}
|
56 |
+
foreach ($errorsSliced as $e) {
|
57 |
+
$session->addError($e);
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
protected function _isShellContext()
|
63 |
+
{
|
64 |
+
return !isset($_SERVER['REQUEST_METHOD']);
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @param $name
|
69 |
+
* @param int $storeId
|
70 |
+
*
|
71 |
+
* @return Mage_Checkout_Model_Resource_Agreement_Collection
|
72 |
+
*/
|
73 |
+
public function getAgreements($name, $storeId = 0)
|
74 |
+
{
|
75 |
+
/* @var $collection Mage_Checkout_Model_Resource_Agreement_Collection */
|
76 |
+
$collection = Mage::getModel('checkout/agreement')->getCollection();
|
77 |
+
$collection->addStoreFilter($storeId)
|
78 |
+
->addFieldToFilter('name', $name);
|
79 |
+
return $collection;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Creates or resets client object and returns it.
|
84 |
+
*
|
85 |
+
* @param string $url
|
86 |
+
*
|
87 |
+
* @return Zend_Http_Client
|
88 |
+
*/
|
89 |
+
protected function _getClient($url)
|
90 |
+
{
|
91 |
+
if (is_null($this->_client)) {
|
92 |
+
$this->_client = new Zend_Http_Client($url, array(
|
93 |
+
'keepalive' => true,
|
94 |
+
));
|
95 |
+
} else {
|
96 |
+
$this->_client->resetParameters(true);
|
97 |
+
$this->_client->setUri($url);
|
98 |
+
}
|
99 |
+
return $this->_client;
|
100 |
+
}
|
101 |
+
}
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Janolaw_Agb_Helper_HttpStatusNotSuccessfulException extends Exception
|
5 |
+
{
|
6 |
+
|
7 |
+
/**
|
8 |
+
* @var Zend_Http_Response
|
9 |
+
*/
|
10 |
+
public $response;
|
11 |
+
|
12 |
+
public function __counstruct(Zend_Http_Response $response, $msg = null)
|
13 |
+
{
|
14 |
+
if (is_null($msg)) {
|
15 |
+
$msg = 'Unexpected Http status code: ' . $response->getStatus();
|
16 |
+
}
|
17 |
+
parent::__construct($msg);
|
18 |
+
$this->response = $response;
|
19 |
+
}
|
20 |
+
}
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Janolaw_Agb_Model_CmsAssistant extends Mage_Catalog_Model_Abstract
|
5 |
+
{
|
6 |
+
|
7 |
+
const TYPE_REVOCATION = 'revocation';
|
8 |
+
const TYPE_TAC = 'tac';
|
9 |
+
const TYPE_PRIVACY = 'privacy';
|
10 |
+
const TYPE_IMPRINT = 'imprint';
|
11 |
+
|
12 |
+
/** @var array blocks to search for... */
|
13 |
+
protected static $_blocks = array(
|
14 |
+
self::TYPE_REVOCATION => array(
|
15 |
+
'revocation', // mage setup
|
16 |
+
'gs_revocation', // german setup
|
17 |
+
'mrg_revocation', // MRG (Symmetrics_Agreement)
|
18 |
+
'sym_widerruf', // old MRG
|
19 |
+
),
|
20 |
+
self::TYPE_TAC => array(
|
21 |
+
'business_terms', // mage setup
|
22 |
+
'gs_business_terms', // german setup
|
23 |
+
'mrg_business_terms', // MRG (Symmetrics_Agreement)
|
24 |
+
'sym_agb', // old MRG
|
25 |
+
),
|
26 |
+
self::TYPE_PRIVACY => array(
|
27 |
+
'datenschutz_block', // janolaw old setup script
|
28 |
+
),
|
29 |
+
self::TYPE_IMPRINT => array(
|
30 |
+
'Impressum_block' // janolaq old setup script
|
31 |
+
)
|
32 |
+
);
|
33 |
+
|
34 |
+
public function getBlockCandidates()
|
35 |
+
{
|
36 |
+
$existingBlocksByType = array();
|
37 |
+
foreach (self::$_blocks as $type => $candidates) {
|
38 |
+
$existing = array();
|
39 |
+
/* @var $blocks Mage_Cms_Model_Resource_Block_Collection */
|
40 |
+
$blocks = Mage::getModel('cms/block')->getCollection();
|
41 |
+
$blocks->addFieldToFilter('identifier', array('in' => $candidates));
|
42 |
+
|
43 |
+
foreach ($blocks->getItems() as $block) {
|
44 |
+
/* @var $block Mage_Cms_Model_Block */
|
45 |
+
$identifier = $block->getIdentifier();
|
46 |
+
if (isset($existing[$identifier])) {
|
47 |
+
if ($block->getIsActive()) {
|
48 |
+
$existing[$identifier] = true;
|
49 |
+
} // else do not overwrite existing value
|
50 |
+
} else {
|
51 |
+
// add this identifier to existing blocks and set its active status as value
|
52 |
+
$existing[$identifier] = $block->getIsActive();
|
53 |
+
}
|
54 |
+
}
|
55 |
+
$existingBlocksByType[$type] = $existing;
|
56 |
+
}
|
57 |
+
return $existingBlocksByType;
|
58 |
+
}
|
59 |
+
|
60 |
+
public function getCmsDirectiveSnippet($blockIdentifier)
|
61 |
+
{
|
62 |
+
return '{{block type="cms/block" block_id="' . Mage::helper('core')->escapeHtml($blockIdentifier) . '"}}';
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Stores given block identifer for type (only default scope...)
|
67 |
+
*
|
68 |
+
* @param string $type (revocation|tac|privacy|imprint, see TYPE_x constants of this class)
|
69 |
+
* @param string $blockIdentifier
|
70 |
+
*
|
71 |
+
* @throws InvalidArgumentException
|
72 |
+
*/
|
73 |
+
public function setBlockConfig($type, $blockIdentifier)
|
74 |
+
{
|
75 |
+
$blockIdentifier = trim($blockIdentifier);
|
76 |
+
$this->_validateBlockIdentifier($blockIdentifier);
|
77 |
+
$config = Mage::getConfig();
|
78 |
+
switch ($type) {
|
79 |
+
case self::TYPE_REVOCATION:
|
80 |
+
$path = Janolaw_Agb_Model_Downloader::XML_PATH_REVOCATION_ID;
|
81 |
+
break;
|
82 |
+
case self::TYPE_TAC:
|
83 |
+
$path = Janolaw_Agb_Model_Downloader::XML_PATH_TAC_ID;
|
84 |
+
break;
|
85 |
+
case self::TYPE_PRIVACY:
|
86 |
+
$path = Janolaw_Agb_Model_Downloader::XML_PATH_PRIVACY_ID;
|
87 |
+
break;
|
88 |
+
case self::TYPE_IMPRINT:
|
89 |
+
$path = Janolaw_Agb_Model_Downloader::XML_PATH_IMPRINT_ID;
|
90 |
+
break;
|
91 |
+
default:
|
92 |
+
throw new InvalidArgumentException('invalid type ' . $type);
|
93 |
+
}
|
94 |
+
$config->saveConfig($path, $blockIdentifier); // save on default scope
|
95 |
+
}
|
96 |
+
|
97 |
+
protected function _validateBlockIdentifier($blockIdentifier)
|
98 |
+
{
|
99 |
+
if (!preg_match('/^[A-Z][A-Z0-9_-]*$/i', $blockIdentifier)) {
|
100 |
+
// translate message as we will use it in session errors...
|
101 |
+
$msg = Mage::helper('agbdownloader')->__(
|
102 |
+
'Given block identifer (%s) has the wrong format.', $blockIdentifier
|
103 |
+
);
|
104 |
+
throw new Exception($msg);
|
105 |
+
}
|
106 |
+
if (strlen($blockIdentifier) > 255) {
|
107 |
+
$msg = Mage::helper('agbdownloader')->__(
|
108 |
+
'Given block identifier is too large (only 255 characters allowed at maximum)'
|
109 |
+
);
|
110 |
+
throw new Exception($msg);
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
@@ -0,0 +1,335 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* To change this template, choose Tools | Templates
|
4 |
+
* and open the template in the editor.
|
5 |
+
*/
|
6 |
+
|
7 |
+
|
8 |
+
class Janolaw_Agb_Model_Downloader
|
9 |
+
{
|
10 |
+
|
11 |
+
const XML_PATH_ENABLED = 'agbdownload/janoloaw_agb_user/active';
|
12 |
+
|
13 |
+
// api settings
|
14 |
+
const XML_PATH_SHOP_ID = 'agbdownload/janoloaw_agb_user/shopid';
|
15 |
+
const XML_PATH_USER_ID = 'agbdownload/janoloaw_agb_user/userid';
|
16 |
+
const XML_PATH_API_BASE_URL = 'agbdownload/janoloaw_agb_user/api_base_url';
|
17 |
+
|
18 |
+
// cms block/page definitions
|
19 |
+
const XML_PATH_TAC_ID = 'agbdownload/janoloaw_agb_cms/agbid';
|
20 |
+
|
21 |
+
const XML_PATH_IMPRINT_ID = 'agbdownload/janoloaw_agb_cms/impressumid';
|
22 |
+
|
23 |
+
const XML_PATH_REVOCATION_ID = 'agbdownload/janoloaw_agb_cms/wiederrufid';
|
24 |
+
|
25 |
+
const XML_PATH_PRIVACY_ID = 'agbdownload/janoloaw_agb_cms/datenschutzid';
|
26 |
+
|
27 |
+
const FLAG_CODE = 'janolaw_download_state';
|
28 |
+
|
29 |
+
protected $_pdfBasePath;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @var Janolaw_Agb_Helper_Data
|
33 |
+
*/
|
34 |
+
protected $_helper = null;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var Janolaw_Agb_Model_Resource_Downloader
|
38 |
+
*/
|
39 |
+
protected $_resource = null;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* To prevent additional loading of the same texts for multiple stores...
|
43 |
+
* @var array
|
44 |
+
*/
|
45 |
+
protected $_urlCache = array();
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @var array
|
49 |
+
*/
|
50 |
+
protected $_contentItems;
|
51 |
+
|
52 |
+
public function __construct()
|
53 |
+
{
|
54 |
+
$this->_pdfBasePath = Mage::getBaseDir('media') . DIRECTORY_SEPARATOR . 'janolaw_pdf';
|
55 |
+
$this->_contentItems = array(
|
56 |
+
Janolaw_Agb_Model_CmsAssistant::TYPE_TAC => array(
|
57 |
+
'filename' => 'terms_include.html',
|
58 |
+
'config_id' => self::XML_PATH_TAC_ID,
|
59 |
+
'pdf_filename' => null, // currently we don't support pdf's, so we just set it to null
|
60 |
+
),
|
61 |
+
Janolaw_Agb_Model_CmsAssistant::TYPE_IMPRINT => array(
|
62 |
+
'filename' => 'legaldetails_include.html',
|
63 |
+
'config_id' => self::XML_PATH_IMPRINT_ID,
|
64 |
+
'pdf_filename' => null,
|
65 |
+
),
|
66 |
+
Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION => array(
|
67 |
+
'filename' => 'revocation_include.html',
|
68 |
+
'config_id' => self::XML_PATH_REVOCATION_ID,
|
69 |
+
'pdf_filename' => null,
|
70 |
+
),
|
71 |
+
Janolaw_Agb_Model_CmsAssistant::TYPE_PRIVACY => array(
|
72 |
+
'filename' => 'datasecurity_include.html',
|
73 |
+
'config_id' => self::XML_PATH_PRIVACY_ID,
|
74 |
+
'pdf_filename' => null,
|
75 |
+
)
|
76 |
+
);
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* "Downloads" the content from remote server, and updates cms blocks/pages accordingly.
|
81 |
+
*/
|
82 |
+
public function download()
|
83 |
+
{
|
84 |
+
$stores = Mage::app()->getStores();
|
85 |
+
|
86 |
+
// first fetch content for the default store
|
87 |
+
// note: this just creates blocks for all texts in default scope to
|
88 |
+
// prevent errors due to missing blocks. We therefor do not check if
|
89 |
+
// synchronization is enabled in global (default) scope in the configuration.
|
90 |
+
// (using the block is another -- independant -- topic)
|
91 |
+
$errors = $this->_updateAllContent(0);
|
92 |
+
|
93 |
+
/* @var $store Mage_Core_Model_Store */;
|
94 |
+
foreach ($stores as $store) {
|
95 |
+
$storeId = $store->getId();
|
96 |
+
if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED, $storeId)) {
|
97 |
+
continue;
|
98 |
+
}
|
99 |
+
$e = $this->_updateAllContent($storeId);
|
100 |
+
$errors = array_merge($errors, $e);
|
101 |
+
}
|
102 |
+
$this->_getHelper()->printErrors($errors);
|
103 |
+
if ($errors) {
|
104 |
+
Mage::log($errors, Zend_Log::ERR);
|
105 |
+
}
|
106 |
+
Mage::log('Done downloading (synchronizing) of contents from janolaw.');
|
107 |
+
$this->_storeLastSyncState($errors);
|
108 |
+
}
|
109 |
+
|
110 |
+
public function getPdfBasePath()
|
111 |
+
{
|
112 |
+
return $this->_pdfBasePath;
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Returns the path to a pdf document identified by store and pdf basename.
|
117 |
+
* Note that this function does not check if the file exists!
|
118 |
+
*
|
119 |
+
* @param int $storeId
|
120 |
+
* @param string $pdfName
|
121 |
+
*
|
122 |
+
* @return string Absolute path to the pdf file
|
123 |
+
*/
|
124 |
+
public function getPdfPath($storeId, $pdfName)
|
125 |
+
{
|
126 |
+
$storeCode = $store = Mage::app()->getStore($storeId)->getCode();
|
127 |
+
return $this->_pdfBasePath . DIRECTORY_SEPARATOR . $storeCode . DIRECTORY_SEPARATOR . $pdfName;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @param $storeId
|
132 |
+
* @param $type
|
133 |
+
*
|
134 |
+
* @return null|string Returns null if pdf was not found
|
135 |
+
*/
|
136 |
+
public function getPdfPathByType($storeId, $type)
|
137 |
+
{
|
138 |
+
if (!in_array($type, $this->_contentItems)) {
|
139 |
+
return null;
|
140 |
+
}
|
141 |
+
$pdfName = $this->_contentItems[$type]['pdf_filename'];
|
142 |
+
if (!$pdfName) {
|
143 |
+
return null;
|
144 |
+
}
|
145 |
+
$pdfPath = $this->getPdfPath($storeId, $pdfName);
|
146 |
+
if ($pdfPath && is_readable($pdfPath)) {
|
147 |
+
return $pdfPath;
|
148 |
+
}
|
149 |
+
return null;
|
150 |
+
}
|
151 |
+
|
152 |
+
protected function _storeLastSyncState(array $errors)
|
153 |
+
{
|
154 |
+
/* @var $flagModel Mage_Core_Model_Flag */
|
155 |
+
$flagModel = Mage::getModel(
|
156 |
+
'core/flag',
|
157 |
+
array('flag_code' => Janolaw_Agb_Model_Downloader::FLAG_CODE)
|
158 |
+
);
|
159 |
+
$flagModel->loadSelf();
|
160 |
+
|
161 |
+
$success = empty($errors);
|
162 |
+
$flagModel->setState(intval($success));
|
163 |
+
$flagModel->setFlagData($errors);
|
164 |
+
$flagModel->save();
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* @param int|string $storeId
|
169 |
+
*
|
170 |
+
* @return array
|
171 |
+
*/
|
172 |
+
protected function _updateAllContent($storeId)
|
173 |
+
{
|
174 |
+
$errors = array();
|
175 |
+
foreach ($this->_contentItems as $itemDefinition) {
|
176 |
+
// config id are independant from store... (only global / default scope)
|
177 |
+
$cmsIdent = trim(Mage::getStoreConfig($itemDefinition['config_id'], 0));
|
178 |
+
|
179 |
+
if (!$cmsIdent) {
|
180 |
+
// if no value for the block is configured, we do not create or update any blocks
|
181 |
+
continue;
|
182 |
+
}
|
183 |
+
|
184 |
+
try {
|
185 |
+
$cmsId = $this->_getResourceModel()->getCmsId($cmsIdent, $storeId);
|
186 |
+
if ($cmsId === false) {
|
187 |
+
// no block exists for the given identifier and store. Create one.
|
188 |
+
$cmsId = $this->_getResourceModel()->createCmsBlock($cmsIdent, $storeId);
|
189 |
+
}
|
190 |
+
try {
|
191 |
+
$url = $this->_buildApiUrl($itemDefinition['filename'], $storeId);
|
192 |
+
$content = $this->_getRemoteContent($url);
|
193 |
+
} catch (Janolaw_Agb_Model_MissingConfigException $missingDataException) {
|
194 |
+
if ($storeId == 0) {
|
195 |
+
// for admin (default) store, ignore missing data and instead create a block with
|
196 |
+
// no content (to prevent missing block exceptions)
|
197 |
+
$content = '';
|
198 |
+
} else {
|
199 |
+
throw $missingDataException;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
// handle pdf file...
|
204 |
+
if (isset($itemDefinition['pdf_filename'])) {
|
205 |
+
$pdfFile = $this->_downloadPdf($storeId, $itemDefinition['pdf_filename']);
|
206 |
+
if ($pdfFile) {
|
207 |
+
$pathRelToMedia = $this->_getStoreCodeById($storeId) . '/' . $itemDefinition['pdf_filename'];
|
208 |
+
$pdfIncludeMarkup = '<p class="janolaw_pdf"><a href="{{media url=\'' . $pathRelToMedia . '\'}}">'
|
209 |
+
. $pdfFile . '</a></p>';
|
210 |
+
$content .= "\n" . $pdfIncludeMarkup;
|
211 |
+
}
|
212 |
+
}
|
213 |
+
$this->_getResourceModel()->updateCmsContent($cmsId, $content);
|
214 |
+
} catch (Exception $e) {
|
215 |
+
$msg = 'Could not update data from ' . Mage::getStoreConfig(self::XML_PATH_API_BASE_URL, $storeId) . '.';
|
216 |
+
$msg .= ' Store id = ' . $storeId . '; Item definition = ' . print_r($itemDefinition, true);
|
217 |
+
$wrapperException = new Exception($msg, 0, $e);
|
218 |
+
Mage::logException($wrapperException);
|
219 |
+
$errors[] = $e->getMessage();
|
220 |
+
}
|
221 |
+
}
|
222 |
+
return $errors;
|
223 |
+
}
|
224 |
+
|
225 |
+
protected function _getStoreCodeById($storeId)
|
226 |
+
{
|
227 |
+
return Mage::app()->getStore($storeId)->getCode();
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* @param $storeId
|
232 |
+
* @param $pdfFilename
|
233 |
+
*
|
234 |
+
* @return null|string Returns the filename where the pdf was saved to or null if it is not available
|
235 |
+
* @throws Exception
|
236 |
+
* @throws Janolaw_Agb_Helper_HttpStatusNotSuccessfulException
|
237 |
+
*/
|
238 |
+
protected function _downloadPdf($storeId, $pdfFilename) {
|
239 |
+
if (empty($pdfFilename)) {
|
240 |
+
return null;
|
241 |
+
}
|
242 |
+
try {
|
243 |
+
$url = $this->_buildApiUrl($pdfFilename, $storeId);
|
244 |
+
$content = $this->_getHelper()->getRemoteContent($url);
|
245 |
+
$pdf = Zend_Pdf::parse($content);
|
246 |
+
$filename = $this->getPdfPath($storeId, $pdfFilename);
|
247 |
+
$pdf->save($filename);
|
248 |
+
return $filename;
|
249 |
+
} catch (Janolaw_Agb_Model_MissingConfigException $e) {
|
250 |
+
return null; // ignore it, as we have logged that before...
|
251 |
+
} catch (Janolaw_Agb_Helper_HttpStatusNotSuccessfulException $e) {
|
252 |
+
if ($e->response->getStatus() == 404) {
|
253 |
+
// document not available, that's ok.
|
254 |
+
return null;
|
255 |
+
} // other return codes are not expected. Redirects are handled automatically by Zend_Http_Client.
|
256 |
+
throw $e;
|
257 |
+
} // don't catch other exceptions (e.g. Zend_Pdf_Exception may occur)
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* @param string $url
|
262 |
+
*
|
263 |
+
* @return string The content
|
264 |
+
* @throws Janolaw_Agb_Helper_HttpStatusNotSuccessfulException
|
265 |
+
*/
|
266 |
+
protected function _getRemoteContent($url)
|
267 |
+
{
|
268 |
+
if (!isset($this->_urlCache[$url])) {
|
269 |
+
$this->_urlCache[$url] = $this->_getHelper()->getRemoteContent($url);
|
270 |
+
}
|
271 |
+
return $this->_urlCache[$url];
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Build url from Magento config (base url, shop id and user id) and filename.
|
276 |
+
*
|
277 |
+
* @param string $fileName
|
278 |
+
* @param int $storeId
|
279 |
+
*
|
280 |
+
* @throws Janolaw_Agb_Model_MissingConfigException
|
281 |
+
* @return string
|
282 |
+
*/
|
283 |
+
protected function _buildApiUrl($fileName, $storeId)
|
284 |
+
{
|
285 |
+
$baseUrl = Mage::getStoreConfig(self::XML_PATH_API_BASE_URL, $storeId);
|
286 |
+
$userId = Mage::getStoreConfig(self::XML_PATH_USER_ID, $storeId);
|
287 |
+
$shopId = Mage::getStoreConfig(self::XML_PATH_SHOP_ID, $storeId);
|
288 |
+
|
289 |
+
if (!$baseUrl || !$userId || !$shopId) {
|
290 |
+
throw new Janolaw_Agb_Model_MissingConfigException(
|
291 |
+
'Unsufficient configuration data. Add base url, user id and shop id configuration.'
|
292 |
+
);
|
293 |
+
}
|
294 |
+
|
295 |
+
return rtrim($baseUrl, '/\\') . '/' . urlencode($userId) . '/' . urlencode($shopId) . '/'
|
296 |
+
. urlencode($this->_getLanguageUrlPart($storeId)) . '/' . $fileName;
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Currently we use only 'de' url part.
|
301 |
+
* Ideas:
|
302 |
+
* - provide store specific config field (very flexible, but more configuration)
|
303 |
+
* - use data from locale (may be problematic if url does not exist on janolaw for given store)
|
304 |
+
*
|
305 |
+
* @param string $storeId
|
306 |
+
*
|
307 |
+
* @return string
|
308 |
+
*/
|
309 |
+
protected function _getLanguageUrlPart($storeId)
|
310 |
+
{
|
311 |
+
return 'de';
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* @return Janolaw_Agb_Helper_Data
|
316 |
+
*/
|
317 |
+
protected function _getHelper()
|
318 |
+
{
|
319 |
+
if (is_null($this->_helper)) {
|
320 |
+
$this->_helper = Mage::helper('agbdownloader');
|
321 |
+
}
|
322 |
+
return $this->_helper;
|
323 |
+
}
|
324 |
+
|
325 |
+
/**
|
326 |
+
* @return Janolaw_Agb_Model_Resource_Downloader
|
327 |
+
*/
|
328 |
+
protected function _getResourceModel()
|
329 |
+
{
|
330 |
+
if (is_null($this->_resource)) {
|
331 |
+
$this->_resource = Mage::getResourceSingleton('agbdownloader/downloader');
|
332 |
+
}
|
333 |
+
return $this->_resource;
|
334 |
+
}
|
335 |
+
}
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Janolaw_Agb_Model_Email_Template extends Mage_Core_Model_Email_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
public function sendTransactional($templateId, $sender, $email, $name, $vars=array(), $storeId=null)
|
7 |
+
{
|
8 |
+
Mage::dispatchEvent(
|
9 |
+
'janolaw_send_transactional_before',
|
10 |
+
array(
|
11 |
+
'tempalte_id' => $templateId,
|
12 |
+
'sender' => $sender,
|
13 |
+
'recipient_email' => $email,
|
14 |
+
'recipient_name' => $name,
|
15 |
+
'vars' => $vars,
|
16 |
+
'store_id' => $storeId,
|
17 |
+
'template_model' => $this,
|
18 |
+
)
|
19 |
+
);
|
20 |
+
|
21 |
+
parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
|
22 |
+
|
23 |
+
Mage::dispatchEvent(
|
24 |
+
'janolaw_send_transactional_after',
|
25 |
+
array(
|
26 |
+
'tempalte_id' => $templateId,
|
27 |
+
'sender' => $sender,
|
28 |
+
'recipient_email' => $email,
|
29 |
+
'recipient_name' => $name,
|
30 |
+
'vars' => $vars,
|
31 |
+
'store_id' => $storeId,
|
32 |
+
'template_model' => $this,
|
33 |
+
)
|
34 |
+
);
|
35 |
+
return $this;
|
36 |
+
}
|
37 |
+
}
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Janolaw_Agb_Model_MissingConfigException extends Exception
|
4 |
+
{
|
5 |
+
}
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Janolaw_Agb_Model_Observer extends Mage_Core_Model_Abstract
|
5 |
+
{
|
6 |
+
|
7 |
+
const XML_PATH_ATTACHMENT_TAC = 'sales_email/order/include_tac_pdf';
|
8 |
+
|
9 |
+
const XML_PATH_ATTACHMENT_REVOCATION = 'sales_email/order/include_revocation_pdf';
|
10 |
+
|
11 |
+
protected $_downloader;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* (From FireGento_MageSetup...)
|
15 |
+
* Filters all agreements
|
16 |
+
*
|
17 |
+
* Filters all agreements against the Magento template filter. This enables the Magento
|
18 |
+
* administrator define a cms static block as the content of the checkout agreements..
|
19 |
+
*
|
20 |
+
* Event: <core_block_abstract_to_html_before>
|
21 |
+
*
|
22 |
+
* @param Varien_Event_Observer $observer Observer
|
23 |
+
*/
|
24 |
+
public function filterAgreements(Varien_Event_Observer $observer)
|
25 |
+
{
|
26 |
+
$helper = Mage::helper('core');
|
27 |
+
if ($helper->isModuleEnabled('FireGento_GermanSetup') || $helper->isModuleEnabled('FireGento_MageSetup')) {
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
$block = $observer->getEvent()->getBlock();
|
31 |
+
if ($block->getType() == 'checkout/agreements') {
|
32 |
+
if ($agreements = $block->getAgreements()) {
|
33 |
+
$collection = new Varien_Data_Collection();
|
34 |
+
foreach ($agreements as $agreement) {
|
35 |
+
$agreement->setData('content', $this->_filterString($agreement->getData('content')));
|
36 |
+
$agreement->setData('checkbox_text', $this->_filterString($agreement->getData('checkbox_text')));
|
37 |
+
$collection->addItem($agreement);
|
38 |
+
}
|
39 |
+
$observer->getEvent()->getBlock()->setAgreements($collection);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* (From FireGento_MageSetup...)
|
46 |
+
* Calls the Magento template filter to transform {{block type="cms/block" block_id="xyz"}}
|
47 |
+
* into the specific html code
|
48 |
+
*
|
49 |
+
* @param string $string Agreement to filter
|
50 |
+
* @return string Processed String
|
51 |
+
*/
|
52 |
+
protected function _filterString($string)
|
53 |
+
{
|
54 |
+
$processor = Mage::getModel('cms/template_filter');
|
55 |
+
$string = $processor->filter($string);
|
56 |
+
|
57 |
+
return $string;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* event: janolaw_send_transactional_before
|
62 |
+
* @see \Janolaw_Agb_Model_Email_Template::sendTransactional
|
63 |
+
*
|
64 |
+
* @param Varien_Event_Observer $observer
|
65 |
+
*/
|
66 |
+
public function addAttachmentToNewOrderEmail(Varien_Event_Observer $observer)
|
67 |
+
{
|
68 |
+
$templateId = $observer->getData('template_id');
|
69 |
+
$storeId = $observer->getData('store_id');
|
70 |
+
|
71 |
+
$newOrderTemplates = array(
|
72 |
+
Mage::getStoreConfig(\Mage_Sales_Model_Order::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId),
|
73 |
+
Mage::getStoreConfig(\Mage_Sales_Model_Order::XML_PATH_EMAIL_TEMPLATE, $storeId),
|
74 |
+
);
|
75 |
+
if (in_array($templateId, $newOrderTemplates)) {
|
76 |
+
$templateModel = $observer->getData('template_model');
|
77 |
+
$this->_addAttachment($templateModel, $storeId, self::XML_PATH_ATTACHMENT_TAC);
|
78 |
+
$this->_addAttachment($templateModel, $storeId, self::XML_PATH_ATTACHMENT_REVOCATION);
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
protected function _addAttachment(Mage_Core_Model_Email_Template $template, $storeId, $includeConfigPath)
|
83 |
+
{
|
84 |
+
switch ($includeConfigPath) {
|
85 |
+
case self::XML_PATH_ATTACHMENT_TAC:
|
86 |
+
$type = Janolaw_Agb_Model_CmsAssistant::TYPE_TAC;
|
87 |
+
$attachmentFilename = $this->_getHelper()->__('Terms-and-conditions') . '.pdf';
|
88 |
+
break;
|
89 |
+
case self::XML_PATH_ATTACHMENT_REVOCATION:
|
90 |
+
$type = Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION;
|
91 |
+
$attachmentFilename = $this->_getHelper()->__('Revocation-policy') . '.pdf';
|
92 |
+
break;
|
93 |
+
default:
|
94 |
+
return;
|
95 |
+
}
|
96 |
+
if (Mage::getStoreConfigFlag($includeConfigPath, $storeId)) {
|
97 |
+
$pdfPath = $this->_getDownloader()->getPdfPathByType($storeId, $type);
|
98 |
+
if ($pdfPath) {
|
99 |
+
try {
|
100 |
+
$pdf = Zend_Pdf::load($pdfPath);
|
101 |
+
$template->getMail()->createAttachment(
|
102 |
+
$pdf->render(),
|
103 |
+
Zend_Mime::TYPE_OCTETSTREAM,
|
104 |
+
Zend_Mime::DISPOSITION_ATTACHMENT,
|
105 |
+
Zend_Mime::ENCODING_BASE64,
|
106 |
+
$attachmentFilename
|
107 |
+
);
|
108 |
+
} catch (Exception $e) {
|
109 |
+
Mage::logException($e);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* @return Janolaw_Agb_Model_Downloader
|
117 |
+
*/
|
118 |
+
protected function _getDownloader()
|
119 |
+
{
|
120 |
+
if (!$this->_downloader) {
|
121 |
+
$this->_downloader = Mage::getModel('agbdownloader/downloader');
|
122 |
+
}
|
123 |
+
return $this->_downloader;
|
124 |
+
}
|
125 |
+
|
126 |
+
protected function _getHelper()
|
127 |
+
{
|
128 |
+
return Mage::helper('agbdownloader');
|
129 |
+
}
|
130 |
+
}
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Janolaw_Agb_Model_RemoteException extends Exception {
|
5 |
+
}
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Janolaw_Agb_Model_Resource_Downloader
|
5 |
+
*
|
6 |
+
* Used for general database interaction
|
7 |
+
*/
|
8 |
+
class Janolaw_Agb_Model_Resource_Downloader extends Mage_Core_Model_Resource_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @var Varien_Db_Adapter_Interface
|
13 |
+
*/
|
14 |
+
protected $_read = null;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var Varien_Db_Adapter_Interface
|
18 |
+
*/
|
19 |
+
protected $_write = null;
|
20 |
+
|
21 |
+
protected $_coreResource = null;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Resource initialization
|
25 |
+
*/
|
26 |
+
protected function _construct()
|
27 |
+
{
|
28 |
+
// nothing to do here...
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @param string $identifier
|
33 |
+
* @param int $storeId
|
34 |
+
*
|
35 |
+
* @return int|bool False if element was not found, block or page id if found (as integer value)
|
36 |
+
*/
|
37 |
+
public function getCmsId($identifier, $storeId)
|
38 |
+
{
|
39 |
+
return $this->_getBlockCmsId($identifier, $storeId);
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Updates the block content.
|
44 |
+
* Does also set the state of the block to 'active'
|
45 |
+
*
|
46 |
+
* @param int|string $blockId If string, it must be numeric
|
47 |
+
* @param string $content
|
48 |
+
*/
|
49 |
+
public function updateCmsContent($blockId, $content)
|
50 |
+
{
|
51 |
+
$this->_getWriteAdapter()->update(
|
52 |
+
$this->_getTableName('cms/block'),
|
53 |
+
array('content' => $content, 'is_active' => 1),
|
54 |
+
array('block_id = ?' => $blockId)
|
55 |
+
);
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @param $blockIdentifier
|
60 |
+
* @param $storeId
|
61 |
+
*
|
62 |
+
* @throws Exception
|
63 |
+
* @return int the id of the newly created block
|
64 |
+
*/
|
65 |
+
public function createCmsBlock($blockIdentifier, $storeId)
|
66 |
+
{
|
67 |
+
$modelAlias = 'cms/block';
|
68 |
+
|
69 |
+
/* @var $model Mage_Cms_Model_Block */
|
70 |
+
$model = Mage::getModel($modelAlias);
|
71 |
+
$model->setIdentifier($blockIdentifier);
|
72 |
+
$model->setContent('');
|
73 |
+
$model->setTitle(str_replace('_', ' ', $blockIdentifier));
|
74 |
+
$model->setIsActive(1);
|
75 |
+
$model->setStores(array($storeId));
|
76 |
+
$model->save();
|
77 |
+
|
78 |
+
if (!$model->getId()) {
|
79 |
+
throw new Exception('Error on creation of cms block or page');
|
80 |
+
}
|
81 |
+
|
82 |
+
return (int) $model->getId();
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* @param string $identifier block code
|
87 |
+
* @param int|string $storeId (numerical string if it's a string)
|
88 |
+
*
|
89 |
+
* @return bool|int False if no matching block was found, integer if found
|
90 |
+
*/
|
91 |
+
protected function _getBlockCmsId($identifier, $storeId)
|
92 |
+
{
|
93 |
+
$blockTable = $this->_getTableName('cms/block');
|
94 |
+
$blockStores = $this->_getTableName('cms/block_store');
|
95 |
+
|
96 |
+
$select = $this->_getReadAdapter()->select();
|
97 |
+
$select->from(array('main_table' => $blockTable), 'block_id')
|
98 |
+
->joinInner(array('stores' => $blockStores), 'stores.block_id = main_table.block_id', '')
|
99 |
+
->where('stores.store_id = ?', $storeId)
|
100 |
+
->where('main_table.identifier = ?', $identifier);
|
101 |
+
|
102 |
+
$result = $this->_getReadAdapter()->fetchOne($select);
|
103 |
+
if ($result && is_numeric($result)) {
|
104 |
+
return intval($result);
|
105 |
+
}
|
106 |
+
return false;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* @return Varien_Db_Adapter_Interface
|
111 |
+
*/
|
112 |
+
protected function _getReadAdapter()
|
113 |
+
{
|
114 |
+
if (is_null($this->_read)) {
|
115 |
+
$this->_read = $this->_getCoreResource()->getConnection(Mage_Core_Model_Resource::DEFAULT_READ_RESOURCE);
|
116 |
+
}
|
117 |
+
return $this->_read;
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* @return Varien_Db_Adapter_Interface
|
122 |
+
*/
|
123 |
+
protected function _getWriteAdapter()
|
124 |
+
{
|
125 |
+
if (is_null($this->_write)) {
|
126 |
+
$this->_write = $this->_getCoreResource()->getConnection(Mage_Core_Model_Resource::DEFAULT_WRITE_RESOURCE);
|
127 |
+
}
|
128 |
+
return $this->_write;
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Wrapper method
|
133 |
+
* @see \Mage_Core_Model_Resource::getTableName
|
134 |
+
*
|
135 |
+
* @param string $mageTableAlias
|
136 |
+
*
|
137 |
+
* @return string
|
138 |
+
*/
|
139 |
+
protected function _getTableName($mageTableAlias)
|
140 |
+
{
|
141 |
+
return $this->_getCoreResource()->getTableName($mageTableAlias);
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* @return Mage_Core_Model_Resource
|
146 |
+
*/
|
147 |
+
protected function _getCoreResource()
|
148 |
+
{
|
149 |
+
if (is_null($this->_coreResource)) {
|
150 |
+
$this->_coreResource = Mage::getSingleton('core/resource');
|
151 |
+
}
|
152 |
+
return $this->_coreResource;
|
153 |
+
}
|
154 |
+
}
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Janolaw_Agb_Model_Setup extends Mage_Eav_Model_Entity_Setup
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Create a cms page with given data.
|
8 |
+
* Additionally, this method defines an layout update which sets robot tag's data to
|
9 |
+
* NOINDEX,NOFOLLOW,NOARCHIVE
|
10 |
+
*
|
11 |
+
* @param array $pageData
|
12 |
+
*/
|
13 |
+
public function createCmsPage($pageData)
|
14 |
+
{
|
15 |
+
if (is_array($pageData)) {
|
16 |
+
foreach ($pageData as $key => $value) {
|
17 |
+
$data[$key] = $value;
|
18 |
+
}
|
19 |
+
$data['stores'] = array('0');
|
20 |
+
$data['is_active'] = '1';
|
21 |
+
$data['layout_update_xml']
|
22 |
+
= '<reference name="head"><action method="setRobots"><value>NOINDEX,NOFOLLOW,NOARCHIVE</value></action></reference>';
|
23 |
+
} else {
|
24 |
+
return;
|
25 |
+
}
|
26 |
+
|
27 |
+
$model = Mage::getModel('cms/page');
|
28 |
+
$page = $model->load($pageData['identifier']);
|
29 |
+
|
30 |
+
if (!$page->getId()) {
|
31 |
+
$model->setData($data)->save();
|
32 |
+
} else {
|
33 |
+
$data['page_id'] = $page->getId();
|
34 |
+
$model->setData($data)->save();
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @param array $blockData
|
40 |
+
*/
|
41 |
+
public function createCmsBlock($blockData)
|
42 |
+
{
|
43 |
+
$blockData['stores'] = array('0');
|
44 |
+
$blockData['is_active'] = '1';
|
45 |
+
|
46 |
+
/* $model Mage_Cms_Model_Block */
|
47 |
+
$blockModel = Mage::getModel('cms/block');
|
48 |
+
$blockModel->load($blockData['identifier']);
|
49 |
+
|
50 |
+
if (!$blockModel->getId()) {
|
51 |
+
$blockModel->setData($blockData)->save();
|
52 |
+
} else {
|
53 |
+
// $data['block_id'] = $block->getId();
|
54 |
+
$blockModel->delete();
|
55 |
+
$blockModel = Mage::getModel('cms/block');
|
56 |
+
$blockModel->load($blockData['identifier']);
|
57 |
+
$blockModel->setData($blockData)->save();
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Janolaw_Agb_Adminhtml_Janolaw_SetupController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $_lastError = '';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Show setup page
|
10 |
+
*/
|
11 |
+
public function indexAction()
|
12 |
+
{
|
13 |
+
$this->loadLayout();
|
14 |
+
$this->renderLayout();
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* create / update an agreement based on type.
|
19 |
+
* Expected input data (POST):
|
20 |
+
* name
|
21 |
+
* type (one of Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION and
|
22 |
+
* Janolaw_Agb_Model_CmsAssistant::TYPE_TAC)
|
23 |
+
* overwrite Whether we should overwrite existing agreements with the same name or print an error in this case
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
public function saveAgreementAction()
|
27 |
+
{
|
28 |
+
$r = $this->getRequest();
|
29 |
+
$name = $r->getPost('name');
|
30 |
+
$type = $r->getPost('type'); // tac or revocation
|
31 |
+
$overwriteExisting = (bool) trim($r->getPost('overwrite'));
|
32 |
+
|
33 |
+
$content = $this->_getBlockIncludeSnippet($type);
|
34 |
+
$checkboxText = $this->getCheckboxText($type);
|
35 |
+
if (is_null($content) || is_null($checkboxText)) {
|
36 |
+
$this->_endRequest(false, $this->_lastError);
|
37 |
+
return;
|
38 |
+
}
|
39 |
+
|
40 |
+
$model = $this->_getAgreementModel($name, $overwriteExisting);
|
41 |
+
if (is_null($model)) {
|
42 |
+
$this->_endRequest(false, $this->_lastError);
|
43 |
+
return;
|
44 |
+
}
|
45 |
+
|
46 |
+
$model->setIsActive(true);
|
47 |
+
$model->setIsHtml(true);
|
48 |
+
$model->setCheckboxText($checkboxText);
|
49 |
+
$model->setContent($content);
|
50 |
+
$model->setName($name);
|
51 |
+
$model->setStores(array(0));
|
52 |
+
$model->save();
|
53 |
+
|
54 |
+
$successMsg = $this->_getHelper()->__('Successfully saved agreement %s', $name);
|
55 |
+
$this->_endRequest(true, $successMsg);
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Saves block identifier to janolaw configuration. Expected data (POST):
|
60 |
+
* - type
|
61 |
+
* - block_identifier
|
62 |
+
*/
|
63 |
+
public function setBlockIdentifierAction()
|
64 |
+
{
|
65 |
+
$type = $this->getRequest()->getPost('type');
|
66 |
+
$blockId = $this->getRequest()->getPost('block_identifier');
|
67 |
+
|
68 |
+
try {
|
69 |
+
$this->_getCmsAssistant()->setBlockConfig($type, $blockId);
|
70 |
+
Mage::getConfig()->cleanCache();
|
71 |
+
$successMsg = $this->_getHelper()->__('Successfully set block identifer %s', $blockId);
|
72 |
+
$this->_endRequest(true, $successMsg);
|
73 |
+
} catch (InvalidArgumentException $e) {
|
74 |
+
$this->_lastError = $this->_getHelper()->__('Could not save block identifier to configuration. Wrong type given (%s)', $type);
|
75 |
+
$this->_endRequest(false, $this->_lastError);
|
76 |
+
} catch (Exception $e) {
|
77 |
+
$this->_lastError = $this->_getHelper()->__('Could not save block identifier to configuration. Details: %s', $e->getMessage());
|
78 |
+
$this->_endRequest(false, $this->_lastError);
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* If request has a parameter 'is_ajax', then a json response is sendt.
|
84 |
+
* Otherwise, the message is added to the session (as success or error message, depending on $success)
|
85 |
+
*
|
86 |
+
* @param bool $success
|
87 |
+
* @param string $message If empty, no message is added to the session.
|
88 |
+
* @param string $redirectTarget If request is not an ajax request, a redirect to this route is done
|
89 |
+
*/
|
90 |
+
protected function _endRequest($success, $message, $redirectTarget = '*/*/index')
|
91 |
+
{
|
92 |
+
$isAjax = (bool) trim($this->getRequest()->getParam('is_ajax'));
|
93 |
+
if ($isAjax) {
|
94 |
+
$response = array(
|
95 |
+
'success' => (bool) $success,
|
96 |
+
'message' => $message,
|
97 |
+
);
|
98 |
+
$this->_sendJson($response);
|
99 |
+
} else {
|
100 |
+
if (!empty($message)) {
|
101 |
+
if ($success) {
|
102 |
+
$this->_getSession()->addSuccess($message);
|
103 |
+
} else {
|
104 |
+
$this->_getSession()->addError($message);
|
105 |
+
}
|
106 |
+
}
|
107 |
+
if ($redirectTarget) {
|
108 |
+
$this->_redirect($redirectTarget);
|
109 |
+
}
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
protected function _sendJson(array $data)
|
114 |
+
{
|
115 |
+
$jsonData = json_encode($data);
|
116 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
117 |
+
$this->getResponse()->setBody($jsonData);
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Returns null if an agreement with given name does exist already, and $overwriteExisting is false
|
122 |
+
*
|
123 |
+
* @param $name
|
124 |
+
* @param $overwriteExisting
|
125 |
+
*
|
126 |
+
* @return null|Mage_Checkout_Model_Agreement
|
127 |
+
*/
|
128 |
+
protected function _getAgreementModel($name, $overwriteExisting)
|
129 |
+
{
|
130 |
+
/* @var $model Mage_Checkout_Model_Agreement */
|
131 |
+
$existingItems = $this->_getHelper()->getAgreements($name);
|
132 |
+
if ($existingItems->count() > 0) {
|
133 |
+
if ($overwriteExisting) {
|
134 |
+
return $existingItems->getFirstItem();
|
135 |
+
} else {
|
136 |
+
$this->_lastError = $this->_getHelper()->__('Agreement with name %s does already exist in default store', $name);
|
137 |
+
return null;
|
138 |
+
}
|
139 |
+
} else {
|
140 |
+
return Mage::getModel('checkout/agreement');
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* @param string $type One of the constants defined in Janolaw_Agb_Model_CmsAssistant
|
146 |
+
*
|
147 |
+
* @return null|string Null if type is not revocation or terms of condition
|
148 |
+
* (only this two are allowed for agreements)
|
149 |
+
*/
|
150 |
+
protected function _getBlockIncludeSnippet($type)
|
151 |
+
{
|
152 |
+
switch ($type) {
|
153 |
+
case \Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION:
|
154 |
+
$blockId = Mage::getStoreConfig(\Janolaw_Agb_Model_Downloader::XML_PATH_REVOCATION_ID, 0);
|
155 |
+
break;
|
156 |
+
case \Janolaw_Agb_Model_CmsAssistant::TYPE_TAC:
|
157 |
+
$blockId = Mage::getStoreConfig(\Janolaw_Agb_Model_Downloader::XML_PATH_TAC_ID, 0);
|
158 |
+
break;
|
159 |
+
default:
|
160 |
+
$this->_lastError = $this->_getHelper()->__('Error on save agreement action. Unknown type %s given.', $type);
|
161 |
+
return null;
|
162 |
+
}
|
163 |
+
$content = $this->_getCmsAssistant()->getCmsDirectiveSnippet($blockId);
|
164 |
+
return $content ? $content : null;
|
165 |
+
}
|
166 |
+
|
167 |
+
protected function getCheckboxText($type)
|
168 |
+
{
|
169 |
+
switch ($type) {
|
170 |
+
case \Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION:
|
171 |
+
return 'Ich habe die Widerrufsbelehrung gelesen.';
|
172 |
+
case \Janolaw_Agb_Model_CmsAssistant::TYPE_TAC:
|
173 |
+
return 'Ich habe die Allgemeinen Geschäftsbedingungen gelesen und stimme diesen ausdrücklich zu.';
|
174 |
+
default:
|
175 |
+
$this->_lastError = $this->_getHelper()->__('Error on save agreement action. Unknown type %s given.', $type);
|
176 |
+
return null;
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* @param bool $singleton
|
182 |
+
*
|
183 |
+
* @return Janolaw_Agb_Model_CmsAssistant
|
184 |
+
*/
|
185 |
+
protected function _getCmsAssistant($singleton = true)
|
186 |
+
{
|
187 |
+
if ($singleton) {
|
188 |
+
return Mage::getSingleton('agbdownloader/cmsAssistant');
|
189 |
+
} else {
|
190 |
+
return Mage::getModel('agbdownloader/cmsAssistant');
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* @return Janolaw_Agb_Helper_Data
|
196 |
+
*/
|
197 |
+
protected function _getHelper()
|
198 |
+
{
|
199 |
+
return Mage::helper('agbdownloader');
|
200 |
+
}
|
201 |
+
}
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Janolaw_Agb_Adminhtml_Janolaw_StatusController extends Mage_Adminhtml_Controller_Action
|
5 |
+
{
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Print info about state of janolaw module..
|
9 |
+
*/
|
10 |
+
public function indexAction()
|
11 |
+
{
|
12 |
+
$this->loadLayout();
|
13 |
+
$this->renderLayout();
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* This is an ajax session, returning json
|
18 |
+
*/
|
19 |
+
public function runSynchronisationAction()
|
20 |
+
{
|
21 |
+
/* @var $model Janolaw_Agb_Model_Downloader */
|
22 |
+
$model = Mage::getModel('agbdownloader/downloader');
|
23 |
+
|
24 |
+
try {
|
25 |
+
$model->download();
|
26 |
+
$messages = $this->_getSession()->getMessages(true);
|
27 |
+
$errors = $messages->getErrors();
|
28 |
+
|
29 |
+
$sessionMessages = array();
|
30 |
+
foreach ($errors as $m) {
|
31 |
+
/* @var $m Mage_Core_Model_Message_Abstract */
|
32 |
+
$sessionMessages[] = $m->getText();
|
33 |
+
}
|
34 |
+
|
35 |
+
$result = array(
|
36 |
+
'success' => count($errors) <= 0,
|
37 |
+
'messages' => $sessionMessages,
|
38 |
+
);
|
39 |
+
} catch (Exception $e) {
|
40 |
+
$result = array(
|
41 |
+
'success' => false,
|
42 |
+
'messages' => array($e->getMessage())
|
43 |
+
);
|
44 |
+
Mage::logException($e);
|
45 |
+
}
|
46 |
+
$this->_sendJson($result);
|
47 |
+
}
|
48 |
+
|
49 |
+
protected function _sendJson(array $data)
|
50 |
+
{
|
51 |
+
$jsonData = json_encode($data);
|
52 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
53 |
+
$this->getResponse()->setBody($jsonData);
|
54 |
+
}
|
55 |
+
}
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// This script will clean up old config values (becase config fields have changed in this version).
|
3 |
+
// Escpecially we need to make sure that any cms *page* id is deleted from database config
|
4 |
+
// as we only use cms *blocks* to store janolaw data (and use the same config fields for that).
|
5 |
+
|
6 |
+
|
7 |
+
Mage::app()->reinitStores();
|
8 |
+
$stores = Mage::app()->getStores(true);
|
9 |
+
$config = Mage::getConfig();
|
10 |
+
|
11 |
+
$configPaths = array(
|
12 |
+
'revocation' => array(
|
13 |
+
'type' => 'agbdownload/janoloaw_agb_cms/widerruf_page',
|
14 |
+
'id' => 'agbdownload/janoloaw_agb_cms/wiederrufid',
|
15 |
+
),
|
16 |
+
'tac' => array(
|
17 |
+
'type' => 'agbdownload/janoloaw_agb_cms/agb_page',
|
18 |
+
'id' => 'agbdownload/janoloaw_agb_cms/agbid',
|
19 |
+
),
|
20 |
+
'privacy' => array(
|
21 |
+
'type' => 'agbdownload/janoloaw_agb_cms/datenschutz_page',
|
22 |
+
'id' => 'agbdownload/janoloaw_agb_cms/datenschutzid',
|
23 |
+
),
|
24 |
+
'imprint' => array(
|
25 |
+
'type' => 'agbdownload/janoloaw_agb_cms/impressum_page',
|
26 |
+
'id' => 'agbdownload/janoloaw_agb_cms/impressumid',
|
27 |
+
)
|
28 |
+
);
|
29 |
+
|
30 |
+
$websites = array();
|
31 |
+
|
32 |
+
/* @var $store Mage_Core_Model_Store */
|
33 |
+
foreach($stores as $store) {
|
34 |
+
if (!in_array($store->getWebsiteId(), $websites)) {
|
35 |
+
$websites[] = $store->getWebsiteId();
|
36 |
+
}
|
37 |
+
foreach ($configPaths as $textType => $paths) {
|
38 |
+
$type = $store->getConfig($paths['type']);
|
39 |
+
if ($type == 1) { // type page
|
40 |
+
$store->setConfig($paths['id'], ''); // reset to empty string, as we change type from page to block
|
41 |
+
$config->deleteConfig($paths['id']); // default scope
|
42 |
+
$config->deleteConfig($paths['id'], 'stores', $store->getId());
|
43 |
+
$config->deleteConfig($paths['id'], 'websites', $store->getWebsiteId());
|
44 |
+
} // else: type was block... so we can use that further...
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
foreach ($configPaths as $textType => $paths) {
|
50 |
+
$config->deleteConfig($paths['type']); // default scope
|
51 |
+
|
52 |
+
foreach ($websites as $websiteId) {
|
53 |
+
$config->deleteConfig($paths['type'], 'websites', $websiteId);
|
54 |
+
} // stores should not be defined, as it was not visible in store config before and it does no harm if
|
55 |
+
// there were some configs left in the database...
|
56 |
+
}
|
57 |
+
|
58 |
+
// =========================
|
59 |
+
// create admin notification
|
60 |
+
// =========================
|
61 |
+
|
62 |
+
/* @var $notice Mage_AdminNotification_Model_Inbox */
|
63 |
+
$notice = Mage::getModel('adminnotification/inbox');
|
64 |
+
$notice->setSeverity(Mage_AdminNotification_Model_Inbox::SEVERITY_MAJOR);
|
65 |
+
$notice->setTitle('Bitte konfigurieren Sie Janolaw AGB unter System -> Janolaw AGB Hosting -> Setup');
|
66 |
+
$notice->setDescription('Bitte konfigurieren Sie Ihr System auf der Janolaw Setup Seite (Im Menü unter System -> Janolaw AGB Hosting -> Setup)');
|
67 |
+
$notice->save();
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<system>
|
5 |
+
<children>
|
6 |
+
<janolaw translate="title">
|
7 |
+
<title>Janolaw AGB Hosting</title>
|
8 |
+
<sort_order>0</sort_order>
|
9 |
+
<children>
|
10 |
+
<setup>
|
11 |
+
<title>Setup</title>
|
12 |
+
<action>adminhtml/janolaw_setup</action>
|
13 |
+
<sort_order>10</sort_order>
|
14 |
+
</setup>
|
15 |
+
<status>
|
16 |
+
<title>Status</title>
|
17 |
+
<action>adminhtml/janolaw_status</action>
|
18 |
+
<sort_order>20</sort_order>
|
19 |
+
</status>
|
20 |
+
</children>
|
21 |
+
</janolaw>
|
22 |
+
</children>
|
23 |
+
</system>
|
24 |
+
</menu>
|
25 |
+
<acl>
|
26 |
+
<resources>
|
27 |
+
<admin>
|
28 |
+
<children>
|
29 |
+
<system>
|
30 |
+
<children>
|
31 |
+
<config>
|
32 |
+
<children>
|
33 |
+
<agbdownload>
|
34 |
+
<title>janolaw AGB-Hosting</title>
|
35 |
+
<sort_order>905</sort_order>
|
36 |
+
</agbdownload>
|
37 |
+
</children>
|
38 |
+
</config>
|
39 |
+
<janolaw translate="title">
|
40 |
+
<title>Janolaw AGB</title>
|
41 |
+
<sort_order>10</sort_order>
|
42 |
+
</janolaw>
|
43 |
+
</children>
|
44 |
+
</system>
|
45 |
+
</children>
|
46 |
+
</admin>
|
47 |
+
</resources>
|
48 |
+
</acl>
|
49 |
+
</config>
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Janolaw_Agb>
|
5 |
+
<version>0.1.6</version>
|
6 |
+
</Janolaw_Agb>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<agbdownloader>
|
11 |
+
<class>Janolaw_Agb_Model</class>
|
12 |
+
<resourceModel>agbdownloader_resource</resourceModel>
|
13 |
+
</agbdownloader>
|
14 |
+
<agbdownloader_resource>
|
15 |
+
<class>Janolaw_Agb_Model_Resource</class>
|
16 |
+
</agbdownloader_resource>
|
17 |
+
<core>
|
18 |
+
<rewrite>
|
19 |
+
<email_template>Janolaw_Agb_Model_Email_Template</email_template>
|
20 |
+
</rewrite>
|
21 |
+
</core>
|
22 |
+
</models>
|
23 |
+
<helpers>
|
24 |
+
<agbdownloader>
|
25 |
+
<class>Janolaw_Agb_Helper</class>
|
26 |
+
</agbdownloader>
|
27 |
+
</helpers>
|
28 |
+
<blocks>
|
29 |
+
<agbdownloader>
|
30 |
+
<class>Janolaw_Agb_Block</class>
|
31 |
+
</agbdownloader>
|
32 |
+
</blocks>
|
33 |
+
<resources>
|
34 |
+
<agb_setup>
|
35 |
+
<setup>
|
36 |
+
<module>Janolaw_Agb</module>
|
37 |
+
<class>Janolaw_Agb_Model_Setup</class>
|
38 |
+
</setup>
|
39 |
+
<connection>
|
40 |
+
<use>core_setup</use>
|
41 |
+
</connection>
|
42 |
+
</agb_setup>
|
43 |
+
</resources>
|
44 |
+
<events>
|
45 |
+
<!-- we do not support pdf attachments yet, but will probably do so later.. -->
|
46 |
+
<!--
|
47 |
+
<janolaw_send_transactional_before>
|
48 |
+
<observers>
|
49 |
+
<neworder_add_attachement>
|
50 |
+
<class>agbdownloader/observer</class>
|
51 |
+
<method>addAttachmentToNewOrderEmail</method>
|
52 |
+
</neworder_add_attachement>
|
53 |
+
</observers>
|
54 |
+
</janolaw_send_transactional_before>
|
55 |
+
-->
|
56 |
+
</events>
|
57 |
+
</global>
|
58 |
+
|
59 |
+
<adminhtml>
|
60 |
+
<acl>
|
61 |
+
<resources>
|
62 |
+
<admin>
|
63 |
+
<children>
|
64 |
+
<system>
|
65 |
+
<children>
|
66 |
+
<config>
|
67 |
+
<children>
|
68 |
+
<agbdownload>
|
69 |
+
<title>janolaw AGB-Hosting</title>
|
70 |
+
<sort_order>905</sort_order>
|
71 |
+
</agbdownload>
|
72 |
+
</children>
|
73 |
+
</config>
|
74 |
+
</children>
|
75 |
+
</system>
|
76 |
+
</children>
|
77 |
+
</admin>
|
78 |
+
</resources>
|
79 |
+
</acl>
|
80 |
+
<layout>
|
81 |
+
<updates>
|
82 |
+
<agbdownloader>
|
83 |
+
<file>janolawagb/agbdownloader.xml</file>
|
84 |
+
</agbdownloader>
|
85 |
+
</updates>
|
86 |
+
</layout>
|
87 |
+
<translate>
|
88 |
+
<modules>
|
89 |
+
<Janolaw_Agb>
|
90 |
+
<files>
|
91 |
+
<default>Janolaw_Agb.csv</default>
|
92 |
+
</files>
|
93 |
+
</Janolaw_Agb>
|
94 |
+
</modules>
|
95 |
+
</translate>
|
96 |
+
</adminhtml>
|
97 |
+
|
98 |
+
<admin>
|
99 |
+
<routers>
|
100 |
+
<adminhtml>
|
101 |
+
<args>
|
102 |
+
<modules>
|
103 |
+
<Janolaw_Agb before="Mage_Adminhtml">Janolaw_Agb_Adminhtml</Janolaw_Agb>
|
104 |
+
</modules>
|
105 |
+
</args>
|
106 |
+
</adminhtml>
|
107 |
+
</routers>
|
108 |
+
</admin>
|
109 |
+
|
110 |
+
<frontend>
|
111 |
+
<events>
|
112 |
+
<core_block_abstract_to_html_before>
|
113 |
+
<observers>
|
114 |
+
<germansetup_observer>
|
115 |
+
<class>agbdownloader/observer</class>
|
116 |
+
<method>filterAgreements</method>
|
117 |
+
</germansetup_observer>
|
118 |
+
</observers>
|
119 |
+
</core_block_abstract_to_html_before>
|
120 |
+
</events>
|
121 |
+
</frontend>
|
122 |
+
|
123 |
+
<default>
|
124 |
+
<agbdownload>
|
125 |
+
<janoloaw_agb_user>
|
126 |
+
<api_base_url><![CDATA[http://www.janolaw.de/agb-service/shops]]></api_base_url>
|
127 |
+
</janoloaw_agb_user>
|
128 |
+
<janoloaw_agb_cms>
|
129 |
+
<agbid></agbid> <!-- empty values prevent the system from creating or overwriting any pages/blocks, so we use that as default... -->
|
130 |
+
<impressumid></impressumid>
|
131 |
+
<wiederrufid></wiederrufid>
|
132 |
+
<datenschutzid></datenschutzid>
|
133 |
+
</janoloaw_agb_cms>
|
134 |
+
</agbdownload>
|
135 |
+
</default>
|
136 |
+
|
137 |
+
<crontab>
|
138 |
+
<jobs>
|
139 |
+
<janolaw_import_all>
|
140 |
+
<schedule>
|
141 |
+
<!-- every second hour -->
|
142 |
+
<cron_expr>* */2 * * *</cron_expr>
|
143 |
+
</schedule>
|
144 |
+
<run>
|
145 |
+
<model>agbdownloader/downloader::download</model>
|
146 |
+
</run>
|
147 |
+
</janolaw_import_all>
|
148 |
+
</jobs>
|
149 |
+
</crontab>
|
150 |
+
</config>
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<!-- currently we do not support pdf attachments... but do not delete, as we will support that later. -->
|
5 |
+
<!--
|
6 |
+
<sales_email>
|
7 |
+
<groups>
|
8 |
+
<order>
|
9 |
+
<fields>
|
10 |
+
<include_tac_pdf translate="label comment" module="agbdownloader">
|
11 |
+
<label><![CDATA[Include T&C pdf as Attachment]]></label>
|
12 |
+
<comment>Note that this only works if a pdf is available from janolaw</comment>
|
13 |
+
<frontend_type>select</frontend_type>
|
14 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
15 |
+
<sort_order>3</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
</include_tac_pdf>
|
20 |
+
<include_revocation_pdf translate="label comment" module="agbdownloader">
|
21 |
+
<label><![CDATA[Include revocation pdf as Attachment]]></label>
|
22 |
+
<comment>Note that this only works if a pdf is available from janolaw</comment>
|
23 |
+
<frontend_type>select</frontend_type>
|
24 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
25 |
+
<sort_order>3</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>1</show_in_store>
|
29 |
+
</include_revocation_pdf>
|
30 |
+
</fields>
|
31 |
+
</order>
|
32 |
+
</groups>
|
33 |
+
</sales_email>
|
34 |
+
-->
|
35 |
+
<agbdownload>
|
36 |
+
<tab>general</tab>
|
37 |
+
<label>janolaw AGB-Hosting</label>
|
38 |
+
<frontend_type>text</frontend_type>
|
39 |
+
<sort_order>905</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
<groups>
|
44 |
+
<janoloaw_agb_user translate="label" module="agbdownloader">
|
45 |
+
<label>Userdaten</label>
|
46 |
+
<sort_order>65</sort_order>
|
47 |
+
<show_in_default>1</show_in_default>
|
48 |
+
<show_in_website>1</show_in_website>
|
49 |
+
<show_in_store>1</show_in_store>
|
50 |
+
<fields>
|
51 |
+
<active translate="label">
|
52 |
+
<label>Enabled</label>
|
53 |
+
<frontend_type>select</frontend_type>
|
54 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
55 |
+
<sort_order>10</sort_order>
|
56 |
+
<show_in_default>1</show_in_default>
|
57 |
+
<show_in_website>1</show_in_website>
|
58 |
+
<show_in_store>1</show_in_store>
|
59 |
+
</active>
|
60 |
+
<userid translate="label">
|
61 |
+
<label>User-ID</label>
|
62 |
+
<frontend_type>text</frontend_type>
|
63 |
+
<sort_order>10</sort_order>
|
64 |
+
<show_in_default>1</show_in_default>
|
65 |
+
<show_in_website>1</show_in_website>
|
66 |
+
<show_in_store>1</show_in_store>
|
67 |
+
</userid>
|
68 |
+
<shopid translate="label">
|
69 |
+
<label>Shop-ID</label>
|
70 |
+
<frontend_type>text</frontend_type>
|
71 |
+
<sort_order>11</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>1</show_in_store>
|
75 |
+
</shopid>
|
76 |
+
<api_base_url translate="label">
|
77 |
+
<label>API base url</label>
|
78 |
+
<frontend_type>text</frontend_type>
|
79 |
+
<sort_order>20</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>0</show_in_website>
|
82 |
+
<show_in_store>0</show_in_store>
|
83 |
+
</api_base_url>
|
84 |
+
</fields>
|
85 |
+
</janoloaw_agb_user>
|
86 |
+
|
87 |
+
<!-- only in default scope, as store specific data is handled by cms (multiple records per identifier possible) -->
|
88 |
+
<janoloaw_agb_cms translate="label,comment" module="agbdownloader">
|
89 |
+
<label>Storage definitions</label>
|
90 |
+
<comment>Defines block identifiers where the legal texts from janolaw are stored. Note that the content inside the blocks defined here is overwritten when synchronizing with Janolaw Hosting (in all stores!).</comment>
|
91 |
+
<sort_order>75</sort_order>
|
92 |
+
<show_in_default>1</show_in_default>
|
93 |
+
<fields>
|
94 |
+
<agbid translate="label">
|
95 |
+
<label>AGB Block (string identifier)</label>
|
96 |
+
<frontend_type>text</frontend_type>
|
97 |
+
<sort_order>9</sort_order>
|
98 |
+
<show_in_default>1</show_in_default>
|
99 |
+
</agbid>
|
100 |
+
<impressumid translate="label">
|
101 |
+
<label>Impressum Block (string identifier)</label>
|
102 |
+
<frontend_type>text</frontend_type>
|
103 |
+
<sort_order>11</sort_order>
|
104 |
+
<show_in_default>1</show_in_default>
|
105 |
+
</impressumid>
|
106 |
+
<wiederrufid translate="label">
|
107 |
+
<label>Widerrufsbelehrung Block (string identifier)</label>
|
108 |
+
<frontend_type>text</frontend_type>
|
109 |
+
<sort_order>13</sort_order>
|
110 |
+
<show_in_default>1</show_in_default>
|
111 |
+
</wiederrufid>
|
112 |
+
<datenschutzid translate="label">
|
113 |
+
<label>Datenschutzerklärung Block (string identifier)</label>
|
114 |
+
<frontend_type>text</frontend_type>
|
115 |
+
<sort_order>15</sort_order>
|
116 |
+
<show_in_default>1</show_in_default>
|
117 |
+
</datenschutzid>
|
118 |
+
</fields>
|
119 |
+
</janoloaw_agb_cms>
|
120 |
+
</groups>
|
121 |
+
</agbdownload>
|
122 |
+
</sections>
|
123 |
+
</config>
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* This script was used on earlier versions to create cms blocks for
|
5 |
+
* revocation, general terms and conditions, privacy statements, and
|
6 |
+
* imprint.
|
7 |
+
*
|
8 |
+
* To maximize compatibility with other modules like Market Ready Germany
|
9 |
+
* of GermanSetup/ MageSetup, we do not create this anymore.
|
10 |
+
*
|
11 |
+
* If one of the mentioned modules is installed, there are normally already
|
12 |
+
* cms blocks for that purpose. Otherwise, the user has to create blocks manually.
|
13 |
+
* In either case he/she has to define them in the configuration.
|
14 |
+
*/
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<adminhtml_janolaw_setup_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="agbdownloader/adminhtml_setup" name="janolaw.setup" template="janolawagb/setup.phtml"/>
|
6 |
+
</reference>
|
7 |
+
</adminhtml_janolaw_setup_index>
|
8 |
+
|
9 |
+
<adminhtml_janolaw_status_index>
|
10 |
+
<reference name="content">
|
11 |
+
<block type="agbdownloader/adminhtml_status_config" name="janolaw.status.config" template="janolawagb/status/config.phtml"/>
|
12 |
+
</reference>
|
13 |
+
</adminhtml_janolaw_status_index>
|
14 |
+
</layout>
|
@@ -0,0 +1,554 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* @var $this Janolaw_Agb_Block_Adminhtml_Setup */
|
3 |
+
?>
|
4 |
+
|
5 |
+
<?php
|
6 |
+
$isInstalledGermanSetup = Mage::helper('core')->isModuleEnabled('FireGento_GermanSetup');
|
7 |
+
$isInstalledMageSetup = Mage::helper('core')->isModuleEnabled('FireGento_MageSetup');
|
8 |
+
|
9 |
+
// $mrg modules
|
10 |
+
// $installedMrgModules = $this->getInstalledMrgModules();
|
11 |
+
$isInstalledSymmetricsAgreement = Mage::helper('core')->isModuleEnabled('Symmetrics_Agreement');
|
12 |
+
|
13 |
+
/* @var $urlModel Mage_Adminhtml_Model_Url */
|
14 |
+
$urlModel = Mage::getModel('adminhtml/url');
|
15 |
+
$linkSysConfig = $urlModel->getUrl('adminhtml/system_config/edit', array('section' => 'agbdownload'));
|
16 |
+
$staticBlockUrl = $urlModel->getUrl('adminhtml/cms_block/index');
|
17 |
+
$cmsPageUrl = $urlModel->getUrl('adminhtml/cms_page/index');
|
18 |
+
$agreementsUrl = $urlModel->getUrl('adminhtml/checkout_agreement/index');
|
19 |
+
|
20 |
+
/* @var $cmsAssistant Janolaw_Agb_Model_CmsAssistant */
|
21 |
+
$cmsAssistant = Mage::getSingleton('agbdownloader/cmsAssistant');
|
22 |
+
$blockCandidates = $cmsAssistant->getBlockCandidates();
|
23 |
+
|
24 |
+
$actionSetBlockId = $urlModel->getUrl('adminhtml/janolaw_setup/setBlockIdentifier');
|
25 |
+
$actionSaveAgreement = $urlModel->getUrl('adminhtml/janolaw_setup/saveAgreement');
|
26 |
+
?>
|
27 |
+
|
28 |
+
<div class="content-header">
|
29 |
+
<h3>Janolaw AGB Hosting - Setup</h3>
|
30 |
+
|
31 |
+
<p class="form-buttons"></p>
|
32 |
+
</div>
|
33 |
+
|
34 |
+
<div class="entry-edit" style="max-width: 800px;">
|
35 |
+
<div class="entry-edit-head">
|
36 |
+
<h4>Kurzinfo</h4>
|
37 |
+
</div>
|
38 |
+
<div class="fieldset">
|
39 |
+
<p>
|
40 |
+
<b>Neuinstallation</b><br />
|
41 |
+
Falls Sie dieses Modul gerade installiert haben, lesen Sie die folgenden Informationen bitte durch.
|
42 |
+
Folgen Sie den Anweisungen, um Ihr System korrekt zu konfigurieren.
|
43 |
+
</p>
|
44 |
+
<p>
|
45 |
+
<b>Update</b><br />
|
46 |
+
Wenn Sie bereits eine ältere Version des Moduls installiert hatten, ist vermutlich das meiste bereits
|
47 |
+
korrekt konfiguriert. Insbesondere bei der CMS-Konfiguration haben wir jedoch <b>Änderungen</b>
|
48 |
+
durchgeführt, die Sie beachten sollten:
|
49 |
+
</p>
|
50 |
+
<ul style="margin-left: 1.5em; list-style-type: disc;">
|
51 |
+
<li>
|
52 |
+
Wir haben die Möglichkeit entfernt, Janolaw-Texte direkt in CMS-Seiten zu speichern. Falls Sie diese
|
53 |
+
Option genutzt haben, sollten Sie nun für den betreffenden Text einen CMS-Block definieren und das Snippet
|
54 |
+
für diesen Block in die CMS-Seite einbinden (Details: Schritte 2 und 3).
|
55 |
+
</li>
|
56 |
+
</ul>
|
57 |
+
<p>
|
58 |
+
Im Allgemeinen empfiehlt es sich, die hier beschriebenen Schritte nochmals durchzulesen und die Konfiguration
|
59 |
+
überprüfen.
|
60 |
+
</p>
|
61 |
+
</div>
|
62 |
+
</div>
|
63 |
+
|
64 |
+
<div class="entry-edit" style="max-width: 800px;">
|
65 |
+
<div class="entry-edit-head">
|
66 |
+
<h4>Schritt 1: Lokalisierungs-Modul installieren (optional)</h4>
|
67 |
+
</div>
|
68 |
+
<div class="fieldset">
|
69 |
+
<?php if ($isInstalledMageSetup): ?>
|
70 |
+
<p>
|
71 |
+
Auf Ihrem System ist bereits das Modul <b>FireGento_MageSetup</b> installiert. Diese arbeitet optimal mit
|
72 |
+
dem Janolaw Modul zusammen.
|
73 |
+
</p>
|
74 |
+
<?php elseif ($isInstalledGermanSetup): ?>
|
75 |
+
<p>
|
76 |
+
Auf Ihrem System ist bereits das Modul <b>FireGento_GermanSetup</b> installiert. Diese arbeitet optimal mit
|
77 |
+
dem Janolaw Modul zusammen.
|
78 |
+
</p>
|
79 |
+
<?php elseif ($isInstalledSymmetricsAgreement): ?>
|
80 |
+
<p>
|
81 |
+
Auf Ihrem System ist bereits das Modul <b>Symmetrics_Agreement</b> (als Teil der Modulsammlung Market
|
82 |
+
Ready Germany) installiert. Diese arbeitet optimal mit dem Janolaw Modul zusammen.
|
83 |
+
</p>
|
84 |
+
<?php else: ?>
|
85 |
+
<p>
|
86 |
+
Auf Ihrem System ist kein (bekanntes) Modul installiert, das die Einbindung von den AGB und
|
87 |
+
Widerruf-Texten in den Checkout-Prozess vornimmt. Wir empfehlen dazu das Modul
|
88 |
+
<a href="http://www.magentocommerce.com/magento-connect/firegento-magesetup.html">MageSetup von FireGento</a>.
|
89 |
+
Falls Sie dieses Modul installieren wollen, installieren <b>und initialisieren</b> Sie dieses Modul bitte
|
90 |
+
<b>bevor</b> Sie mit diesem Setup weiterfahren (beachten Sie dazu die Hinweise des Anbieters).
|
91 |
+
Sie erreichen diese Setup-Seite anschließend wieder über den Menü-Punkt System -> Janolaw AGB Hosting
|
92 |
+
-> Setup.
|
93 |
+
Alternativ können Sie das Janolaw Modul auch standalone nutzen.
|
94 |
+
</p>
|
95 |
+
<?php endif; ?>
|
96 |
+
</div>
|
97 |
+
</div>
|
98 |
+
|
99 |
+
|
100 |
+
<div class="entry-edit" style="max-width: 800px;">
|
101 |
+
<div class="entry-edit-head">
|
102 |
+
<h4>Schritt 2a: Konfiguration - Speicher-Definition (CMS-Blöcke/-Seiten)</h4>
|
103 |
+
</div>
|
104 |
+
<div class="fieldset">
|
105 |
+
<p>
|
106 |
+
Für jeden Text (AGB, Widerrufsbelehrung, Impressum und Datenschutz) wird ein CMS-Block
|
107 |
+
benötigt. Wenn Sie eines der Module <i>FireGento_GermanSetup</i>, <i>FireGento_MageSetup</i>
|
108 |
+
oder <i>Symmetrics_Agreement</i> (von
|
109 |
+
Market Ready Germany) installiert haben (vgl. Schritt 1), exisitieren dazu vermutlich bereits Blöcke.
|
110 |
+
</p>
|
111 |
+
<p>
|
112 |
+
Nachfolgend haben wir Ihr System auf von oben erwähnten Modulen angelegte Blöcke durchsucht, die Sie verwenden
|
113 |
+
können. Wurden keine gefunden, oder wollen Sie die Janolaw-Texte in anderen CMS-Blöcken speichern, dann
|
114 |
+
können Sie auch selbst einen Bezeichner eingeben. Für den Bezeichner gelten dabei folgende Regeln:
|
115 |
+
</p>
|
116 |
+
|
117 |
+
<ul style="margin-left: 1.5em; list-style-type: disc;">
|
118 |
+
<li>Nur Buchstaben (klein oder gross, keine Umlaute oder Sonderzeichen), Zahlen oder Bindestriche (-) oder Unterstriche (_) verwenden</li>
|
119 |
+
<li>Der Wert muss mit einem Buchstaben beginnen.</li>
|
120 |
+
</ul>
|
121 |
+
|
122 |
+
<p>
|
123 |
+
Die Werte können Sie jederzeit in der
|
124 |
+
<a href="<?php echo $linkSysConfig; ?>" target="_blank">Janolaw-Systemkonfiguration</a> unter <i>Storage definitions</i>
|
125 |
+
einsehen und ändern. Bedenken Sie, dass der Inhalt existierender Blöcke mit den hier definierten Bezeichnern
|
126 |
+
überschrieben werden. Sie können alle in Ihrem System existierenden Blöcke unter dem Menü-Punkt
|
127 |
+
<a href="<?php echo $staticBlockUrl; ?>" target="_blank">Statische Blöcke</a> einsehen.
|
128 |
+
</p>
|
129 |
+
|
130 |
+
<!-- AGB -->
|
131 |
+
<br />
|
132 |
+
<b>CMS-Block zur Speicherung der AGB</b>
|
133 |
+
|
134 |
+
<?php
|
135 |
+
$currentValue = Mage::getStoreConfig(Janolaw_Agb_Model_Downloader::XML_PATH_TAC_ID, 0);
|
136 |
+
?>
|
137 |
+
<?php if ($currentValue): ?>
|
138 |
+
<p>
|
139 |
+
Dieser Wert ist bereits konfiguriert. Der aktuelle Wert ist <i><?php echo $currentValue; ?></i>.
|
140 |
+
Sie können den Wert so belassen oder ihn ändern.
|
141 |
+
</p>
|
142 |
+
<?php endif; ?>
|
143 |
+
|
144 |
+
<?php $blocks = $blockCandidates[Janolaw_Agb_Model_CmsAssistant::TYPE_TAC]; ?>
|
145 |
+
<?php if (empty($blocks)): ?>
|
146 |
+
<p>Es wurden keine passenden Blöcke gefunden.</p>
|
147 |
+
<?php else: ?>
|
148 |
+
<p>Es wurden folgende Blöcke gefunden, die wahrscheinlich zur Speicherung der AGB dienen:</p>
|
149 |
+
<ul style="margin-left: 1.5em; list-style-type: disc;">
|
150 |
+
<?php foreach ($blocks as $bCandidate => $isActive): ?>
|
151 |
+
<li>
|
152 |
+
<?php
|
153 |
+
echo $bCandidate;
|
154 |
+
if (!$isActive) echo ' (aktuell nicht aktiviert)';
|
155 |
+
?>
|
156 |
+
</li>
|
157 |
+
<?php endforeach; ?>
|
158 |
+
</ul>
|
159 |
+
<?php endif; ?>
|
160 |
+
|
161 |
+
<form method="post" id="form_block_id_tac" action="<?php echo $actionSetBlockId; ?>" onsubmit="jlform.block_tac.submit()">
|
162 |
+
<label for="block_id_tac">Setzte Bezeichner für CMS-Block, in den die AGB-Texte gespeichert werden sollen (Kopieren Sie einen der oben vorgeschlagenen Blöcke oder wählen Sie einen eigenen Bezeichner):</label><br />
|
163 |
+
<input id="block_id_tac" name="block_identifier" class="validate-xml-identifier input-text" type="text" value="<?php echo $currentValue ?: ''?>"/>
|
164 |
+
<input type="hidden" name="type" value="<?php echo Janolaw_Agb_Model_CmsAssistant::TYPE_TAC; ?>"/>
|
165 |
+
<button>CMS-Block Bezeichner für AGB setzen</button>
|
166 |
+
</form>
|
167 |
+
<br />
|
168 |
+
|
169 |
+
<!-- Widerrufsbelehrung -->
|
170 |
+
|
171 |
+
<br />
|
172 |
+
<b>CMS-Block zur Speicherung der Widerrufsbelehrung</b>
|
173 |
+
<?php
|
174 |
+
$currentValue = Mage::getStoreConfig(Janolaw_Agb_Model_Downloader::XML_PATH_REVOCATION_ID, 0);
|
175 |
+
?>
|
176 |
+
<?php if ($currentValue): ?>
|
177 |
+
<p>
|
178 |
+
Dieser Wert ist bereits konfiguriert. Der aktuelle Wert ist <i><?php echo $currentValue; ?></i>.
|
179 |
+
Sie können den Wert so belassen oder ihn ändern.
|
180 |
+
</p>
|
181 |
+
<?php endif; ?>
|
182 |
+
|
183 |
+
<?php $blocks = $blockCandidates[Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION]; ?>
|
184 |
+
<?php if (empty($blocks)): ?>
|
185 |
+
<p>Es wurden keine passenden Blöcke gefunden.</p>
|
186 |
+
<?php else: ?>
|
187 |
+
<p>Es wurden folgende Blöcke gefunden, die wahrscheinlich zur Speicherung der Widerrufsbelehrung dienen:</p>
|
188 |
+
<ul style="margin-left: 1.5em; list-style-type: disc;">
|
189 |
+
<?php foreach ($blocks as $bCandidate => $isActive): ?>
|
190 |
+
<li>
|
191 |
+
<?php
|
192 |
+
echo $bCandidate;
|
193 |
+
if (!$isActive) echo ' (aktuell nicht aktiviert)';
|
194 |
+
?>
|
195 |
+
</li>
|
196 |
+
<?php endforeach; ?>
|
197 |
+
</ul>
|
198 |
+
<?php endif; ?>
|
199 |
+
|
200 |
+
<form method="post" id="form_block_id_revocation" action="<?php echo $actionSetBlockId; ?>" onsubmit="jlform.block_revocation.submit()">
|
201 |
+
<label for="block_id_revocation">Setzte Bezeichner für CMS-Block, in den die Widerrufsbelehrungs-Texte gespeichert werden sollen (Kopieren Sie einen der oben vorgeschlagenen Blöcke oder wählen Sie einen eigenen Bezeichner):</label><br />
|
202 |
+
<input id="block_id_revocation" name="block_identifier" class="validate-xml-identifier input-text" type="text" value="<?php echo $currentValue ?: ''?>"/>
|
203 |
+
<input type="hidden" name="type" value="<?php echo Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION; ?>"/>
|
204 |
+
<button>CMS-Block Bezeichner für Widerrufsbelehrung setzen</button><br />
|
205 |
+
</form>
|
206 |
+
|
207 |
+
<!-- Datenschutz -->
|
208 |
+
|
209 |
+
<br />
|
210 |
+
<b>CMS-Block zur Speicherung der Datenschutzbestimmungen</b>
|
211 |
+
<?php
|
212 |
+
$currentValue = Mage::getStoreConfig(Janolaw_Agb_Model_Downloader::XML_PATH_PRIVACY_ID, 0);
|
213 |
+
?>
|
214 |
+
<?php if ($currentValue): ?>
|
215 |
+
<p>
|
216 |
+
Dieser Wert ist bereits konfiguriert. Der aktuelle Wert ist <i><?php echo $currentValue; ?></i>.
|
217 |
+
Sie können den Wert so belassen oder ihn ändern.
|
218 |
+
</p>
|
219 |
+
<?php endif; ?>
|
220 |
+
|
221 |
+
<?php $blocks = $blockCandidates[Janolaw_Agb_Model_CmsAssistant::TYPE_PRIVACY]; ?>
|
222 |
+
<?php if (empty($blocks)): ?>
|
223 |
+
<p>Es wurden keine passenden Blöcke gefunden.</p>
|
224 |
+
<?php else: ?>
|
225 |
+
<p>Es wurden folgende Blöcke gefunden, die wahrscheinlich zur Speicherung der Datenschutzbestimmungen dienen:</p>
|
226 |
+
<ul style="margin-left: 1.5em; list-style-type: disc;">
|
227 |
+
<?php foreach ($blocks as $bCandidate => $isActive): ?>
|
228 |
+
<li>
|
229 |
+
<?php
|
230 |
+
echo $bCandidate;
|
231 |
+
if (!$isActive) echo ' (aktuell nicht aktiviert)';
|
232 |
+
?>
|
233 |
+
</li>
|
234 |
+
<?php endforeach; ?>
|
235 |
+
</ul>
|
236 |
+
<?php endif; ?>
|
237 |
+
|
238 |
+
<form method="post" id="form_block_id_privacy" action="<?php echo $actionSetBlockId; ?>" onsubmit="jlform.block_privacy.submit()">
|
239 |
+
<label for="block_id_privacy">Setzte Bezeichner für CMS-Block, in den die Datenschutzbestimmungen gespeichert werden sollen (Kopieren Sie einen der oben vorgeschlagenen Blöcke oder wählen Sie einen eigenen Bezeichner):</label><br />
|
240 |
+
<input id="block_id_privacy" name="block_identifier" class="validate-xml-identifier input-text" type="text" value="<?php echo $currentValue ?: ''?>"/>
|
241 |
+
<input type="hidden" name="type" value="<?php echo Janolaw_Agb_Model_CmsAssistant::TYPE_PRIVACY; ?>"/>
|
242 |
+
<button>CMS-Block Bezeichner für Datenschutzbestimmungen setzen</button><br />
|
243 |
+
</form>
|
244 |
+
|
245 |
+
<!-- Impressum -->
|
246 |
+
|
247 |
+
<br />
|
248 |
+
<b>CMS-Block zur Speicherung des Impressums</b>
|
249 |
+
<?php
|
250 |
+
$currentValue = Mage::getStoreConfig(Janolaw_Agb_Model_Downloader::XML_PATH_IMPRINT_ID, 0);
|
251 |
+
?>
|
252 |
+
<?php if ($currentValue): ?>
|
253 |
+
<p>
|
254 |
+
Dieser Wert ist bereits konfiguriert. Der aktuelle Wert ist <i><?php echo $currentValue; ?></i>.
|
255 |
+
Sie können den Wert so belassen oder ihn ändern.
|
256 |
+
</p>
|
257 |
+
<?php endif; ?>
|
258 |
+
|
259 |
+
<?php $blocks = $blockCandidates[Janolaw_Agb_Model_CmsAssistant::TYPE_IMPRINT]; ?>
|
260 |
+
<?php if (empty($blocks)): ?>
|
261 |
+
<p>Es wurden keine passenden Blöcke gefunden.</p>
|
262 |
+
<?php else: ?>
|
263 |
+
<p>Es wurden folgende Blöcke gefunden, die wahrscheinlich zur Speicherung des Impressums dienen:</p>
|
264 |
+
<ul style="margin-left: 1.5em; list-style-type: disc;">
|
265 |
+
<?php foreach ($blocks as $bCandidate => $isActive): ?>
|
266 |
+
<li>
|
267 |
+
<?php
|
268 |
+
echo $bCandidate;
|
269 |
+
if (!$isActive) echo ' (aktuell nicht aktiviert)';
|
270 |
+
?>
|
271 |
+
</li>
|
272 |
+
<?php endforeach; ?>
|
273 |
+
</ul>
|
274 |
+
<?php endif; ?>
|
275 |
+
|
276 |
+
<form method="post" id="form_block_id_imprint" action="<?php echo $actionSetBlockId; ?>" onsubmit="jlform.block_imprint.submit()">
|
277 |
+
<label for="block_id_imprint">Setzte Bezeichner für CMS-Block, in den das Impressum gespeichert werden soll (Kopieren Sie einen der oben vorgeschlagenen Blöcke oder wählen Sie einen eigenen Bezeichner):</label><br />
|
278 |
+
<input id="block_id_imprint" name="block_identifier" class="validate-xml-identifier input-text" type="text" value="<?php echo $currentValue ?: ''?>"/>
|
279 |
+
<input type="hidden" name="type" value="<?php echo Janolaw_Agb_Model_CmsAssistant::TYPE_IMPRINT; ?>"/>
|
280 |
+
<button>CMS-Block Bezeichner für Impressum setzen</button><br />
|
281 |
+
</form>
|
282 |
+
</div>
|
283 |
+
</div>
|
284 |
+
|
285 |
+
<div class="entry-edit" style="max-width: 800px;">
|
286 |
+
<div class="entry-edit-head">
|
287 |
+
<h4>Schritt 2b: Konfiguration - Zugangsdaten Janolaw</h4>
|
288 |
+
</div>
|
289 |
+
<div class="fieldset">
|
290 |
+
<p>
|
291 |
+
Gehen Sie zur <a href="<?php echo $linkSysConfig; ?>" target="_blank">Janolaw-Systemkonfiguration</a> und tragen Sie dort
|
292 |
+
unter <i>Userdaten</i> Ihre Zugangsdaten ein (die Sie von Janolaw Hosting bekommen haben). Als <i>API base url</i>
|
293 |
+
können Sie im Normalfall den konfigurierten Wert (http://www.janolaw.de/agb-service/shops) bestehen lassen.
|
294 |
+
</p>
|
295 |
+
<p>
|
296 |
+
Tipp: Sie können auch mit dem Scope-Selector arbeiten. So können Sie beispielsweise für verschiedene Stores
|
297 |
+
unterschiedliche Janolaw-Userdaten angeben und damit Store-spezifische Texte laden. Dieses Modul legt für
|
298 |
+
jeden Store einen eigenen Block an (die jedoch alle den gleichen <i>Bezeichner</i> haben).
|
299 |
+
</p>
|
300 |
+
</div>
|
301 |
+
</div>
|
302 |
+
|
303 |
+
|
304 |
+
<div class="entry-edit" style="max-width: 800px;">
|
305 |
+
<div class="entry-edit-head">
|
306 |
+
<h4>Schritt 3: Blöcke in Seiten einbinden</h4>
|
307 |
+
</div>
|
308 |
+
<div class="fieldset">
|
309 |
+
<p>
|
310 |
+
In der Regel sollen alle vier Texte als CMS-Seite in Ihrem Shop angezeigt werden. Dazu müssen CMS-Seiten
|
311 |
+
erstellt werden (wenn sie nicht bereits existieren) und die oben konfigurierten CMS-Blöcke eingebunden
|
312 |
+
werden.
|
313 |
+
</p>
|
314 |
+
<p>
|
315 |
+
Als ersten Schritt müssen Sie dazu herausfinden, welche Seiten bereits existieren. Die schon erwähnten Module
|
316 |
+
<i>FireGento_GermanSetup</i>, <i>FireGento_MageSetup</i>
|
317 |
+
und <i>Market Ready Germany</i> legen bereits einige dieser Seiten an, das Modul <i>MageSetup</i> sogar
|
318 |
+
gegebenenfalls in mehreren Sprachen. Vielleicht haben Sie auch selbst schon Seiten zu diesem Zweck angelegt.
|
319 |
+
</p>
|
320 |
+
<p>
|
321 |
+
Jetzt <a href="<?php echo $cmsPageUrl; ?>" target="_blank">CMS-Seiten öffnen</a>.
|
322 |
+
</p>
|
323 |
+
<p>
|
324 |
+
Tragen Sie anschließend — falls noch nicht vorhanden — folgende Snippets in die Seiten ein.
|
325 |
+
Damit werden die CMS-Blöcke "inkludiert". Falls Sie für verschiedene Stores unterschiedliche
|
326 |
+
CMS-Seiten verwenden, fügen Sie die Snippets in alle Seiten ein (es kann jeweils das gleiche Snippet verwendet
|
327 |
+
werden, über den Bezeichner wird automatisch der CMS-Block des entsprechenden Stores verwendet).<br />
|
328 |
+
</p>
|
329 |
+
<ul style="margin-left: 1.5em; list-style-type: disc;">
|
330 |
+
<li>
|
331 |
+
Die Snippets basieren auf den Einstellungen aus Schritt 2. Falls Sie die dort erwähnte Konfiguration
|
332 |
+
vollständig abgeschlossen haben, und dennoch die Meldung von nicht definierten CMS-Blöcken erhalten,
|
333 |
+
dann laden Sie die Seite bitte neu.
|
334 |
+
</li>
|
335 |
+
<li>
|
336 |
+
Um die Snippets in die CMS-Seiten einzufügen, müssen Sie die Seiten im Raw-Editor-Modus bearbeiten.
|
337 |
+
Klicken Sie dafür den Button <i>Editor anzeigen/ausblenden</i>. Wenn Sie keine Text-Formatierungs-Buttons
|
338 |
+
mehr sehen, sind Sie im Raw-Modus.
|
339 |
+
</li>
|
340 |
+
</ul>
|
341 |
+
|
342 |
+
<br />
|
343 |
+
<b>Snippet zur Einbindung des AGB Blocks:</b>
|
344 |
+
<?php $currentValue = Mage::getStoreConfig(Janolaw_Agb_Model_Downloader::XML_PATH_TAC_ID, 0); ?>
|
345 |
+
|
346 |
+
<?php if ($currentValue): ?>
|
347 |
+
<pre><?php echo $cmsAssistant->getCmsDirectiveSnippet($currentValue); ?></pre>
|
348 |
+
<?php else: ?>
|
349 |
+
<p>
|
350 |
+
Es wurde noch kein CMS-Block zur Speicherung der AGB-Texte definiert. (Bitte befolgen Sie die Anweisungen
|
351 |
+
aus Schritt 2).
|
352 |
+
</p>
|
353 |
+
<?php endif; ?>
|
354 |
+
|
355 |
+
<br />
|
356 |
+
<b>Snippet zur Einbindung der Widerrufsbelehrung:</b>
|
357 |
+
<?php $currentValue = Mage::getStoreConfig(Janolaw_Agb_Model_Downloader::XML_PATH_REVOCATION_ID, 0); ?>
|
358 |
+
|
359 |
+
<?php if ($currentValue): ?>
|
360 |
+
<pre><?php echo $cmsAssistant->getCmsDirectiveSnippet($currentValue); ?></pre>
|
361 |
+
<?php else: ?>
|
362 |
+
<p>
|
363 |
+
Es wurde noch kein CMS-Block zur Speicherung der Widerrufsbelehrung definiert. (Bitte befolgen Sie die
|
364 |
+
Anweisungen
|
365 |
+
aus Schritt 2).
|
366 |
+
</p>
|
367 |
+
<?php endif; ?>
|
368 |
+
|
369 |
+
<br />
|
370 |
+
<b>Snippet zur Einbindung der Datenschutzbestimmungen:</b>
|
371 |
+
<?php $currentValue = Mage::getStoreConfig(Janolaw_Agb_Model_Downloader::XML_PATH_PRIVACY_ID, 0); ?>
|
372 |
+
<?php if ($currentValue): ?>
|
373 |
+
<pre><?php echo $cmsAssistant->getCmsDirectiveSnippet($currentValue); ?></pre>
|
374 |
+
<?php else: ?>
|
375 |
+
<p>
|
376 |
+
Es wurde noch kein CMS-Block zur Speicherung der Datenschutzbestimmungen definiert. (Bitte befolgen Sie die Anweisungen
|
377 |
+
aus Schritt 2).
|
378 |
+
</p>
|
379 |
+
<?php endif; ?>
|
380 |
+
|
381 |
+
<br />
|
382 |
+
<b>Snippet zur Einbindung des Impressum Blocks:</b>
|
383 |
+
<?php $currentValue = Mage::getStoreConfig(Janolaw_Agb_Model_Downloader::XML_PATH_IMPRINT_ID, 0); ?>
|
384 |
+
<?php if ($currentValue): ?>
|
385 |
+
<pre><?php echo $cmsAssistant->getCmsDirectiveSnippet($currentValue); ?></pre>
|
386 |
+
<?php else: ?>
|
387 |
+
<p>
|
388 |
+
Es wurde noch kein CMS-Block zur Speicherung des Impressums definiert. (Bitte befolgen Sie die Anweisungen
|
389 |
+
aus Schritt 2).
|
390 |
+
</p>
|
391 |
+
<?php endif; ?>
|
392 |
+
|
393 |
+
<br />
|
394 |
+
<p>
|
395 |
+
Nun sollten Sie sicherstellen, dass die angelegten Seiten verlinkt werden. Meistens
|
396 |
+
nutzt man dafür den Footer. In einem neu installierten Magento gibt es bereits einen
|
397 |
+
CMS-Block mit dem Bezeichner
|
398 |
+
"footer_links" (bzw. "footer_links_company" ab v1.9), bei dem Sie
|
399 |
+
Links zu den neu angelegten Seiten definieren können.
|
400 |
+
</p>
|
401 |
+
</div>
|
402 |
+
</div>
|
403 |
+
|
404 |
+
<div class="entry-edit" style="max-width: 800px;">
|
405 |
+
<div class="entry-edit-head">
|
406 |
+
<h4>Schritt 4: Agreements erstellen</h4>
|
407 |
+
</div>
|
408 |
+
<div class="fieldset">
|
409 |
+
<p>
|
410 |
+
Unter <a href="<?php echo $agreementsUrl; ?>" target="_blank">Agreements (Bestellbedingungen)</a>
|
411 |
+
finden Sie alle bereits definierten Bestellbedingungen. Wenn Sie eines der Module von
|
412 |
+
<i>FireGento</i> und <i>Market Ready Germany</i> installiert (und initialisiert) haben, dann wurden
|
413 |
+
dort vermutlich schon Bedingungen für AGB und Widerrufsbelehrung angelegt. Kontrollieren Sie bitte folgende
|
414 |
+
Punkte:
|
415 |
+
</p>
|
416 |
+
<ul style="margin-left: 1.5em; list-style-type: disc;">
|
417 |
+
<li>
|
418 |
+
Existieren Bedingungen für AGB und Widerrufsbelehrung? Wenn nicht, empfehlen wir, diese noch anzulegen
|
419 |
+
(über den Button "Neue Bedingung", den Sie oben rechts finden).
|
420 |
+
</li>
|
421 |
+
<li>
|
422 |
+
Sind die Bedingungen aktiviert (Feld <i>Status</i>) und sind sie den entsprechenden Stores zugewiesen
|
423 |
+
(Feld <i>StoreView</i>)?
|
424 |
+
</li>
|
425 |
+
<li>
|
426 |
+
Sind im Feld <i>Inhalt</i> die korrekten Blöcke eingebunden? Wenn nicht, können Sie die Snippets
|
427 |
+
aus Schritt 3 (Blöcke in Seiten einbinden) verwenden, um die AGB bzw. Widerrufsbelehrung einzubinden.
|
428 |
+
</li>
|
429 |
+
</ul>
|
430 |
+
|
431 |
+
<br />
|
432 |
+
<p>
|
433 |
+
Alternativ können Sie auch folgende Buttons nutzen, um komplett neue Bestellbedingungen mit den von
|
434 |
+
Ihnen konfigurierten Blöcken automatisch anzulegen. Sie können die Bedinungen nach Bedarf unter
|
435 |
+
<a href="<?php echo $agreementsUrl; ?>" target="_blank">Agreements (Bestellbedingungen)</a>
|
436 |
+
nach Belieben anpassen.
|
437 |
+
</p>
|
438 |
+
<p>
|
439 |
+
<button onclick="jlform.createAgreement('<?php echo Janolaw_Agb_Model_CmsAssistant::TYPE_TAC; ?>')">AGB Bestellbedingung anlegen</button>
|
440 |
+
</p>
|
441 |
+
<p>
|
442 |
+
<button onclick="jlform.createAgreement('<?php echo Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION; ?>')">Widerrufsbelehrung Bestellbedingung anlegen</button>
|
443 |
+
</p>
|
444 |
+
<p>
|
445 |
+
Damit die Bestellbedingungen im Checkout auch angezeigt werden, muss noch eine Konfigurationseinstellung
|
446 |
+
berücksichtigt werden:<br />
|
447 |
+
Unter <a href="<?php echo $urlModel->getUrl('adminhtml/system_config/edit', array('section' => 'checkout')); ?>" target="_blank">Checkout</a>
|
448 |
+
muss die Option <i>Bestellbedingungen aktivieren</i> aktiviert werden.
|
449 |
+
</p>
|
450 |
+
</div>
|
451 |
+
</div>
|
452 |
+
|
453 |
+
<div class="entry-edit" style="max-width: 800px;">
|
454 |
+
<div class="entry-edit-head">
|
455 |
+
<h4>Schritt 5: E-Mail Templates bearbeiten (optional)</h4>
|
456 |
+
</div>
|
457 |
+
<div class="fieldset">
|
458 |
+
<p>
|
459 |
+
<?php $salesEmailUrl = $urlModel->getUrl('adminhtml/system_config/edit', array('section' => 'sales_email')); ?>
|
460 |
+
<?php $editEmails = $urlModel->getUrl('adminhtml/system_email_template'); ?>
|
461 |
+
|
462 |
+
Unter <a href="<?php echo $salesEmailUrl; ?>" target="_blank">Verkaufs-E-Mails</a> finden Sie die aktuell konfigurierten
|
463 |
+
E-Mail Templates. Merken Sie sich, welche E-Mails dort als Vorlagen konfiguriert sind.
|
464 |
+
</p>
|
465 |
+
<p>
|
466 |
+
Sie können diese Templates nun unter <a href="<?php echo $editEmails; ?>" target="_blank">Transaktions-E-Mails</a>
|
467 |
+
anpassen. Wenn in der Verkauf-E-Mails-Konfiguration der Hinweis "(Standard-Vorlage aus Lokalisierung)" steht,
|
468 |
+
dann müssen Sie erst ein neues Template anlegen (Button "Neue Vorlage" oben rechts bei den
|
469 |
+
<a href="<?php echo $editEmails; ?>" target="_blank">Transaktions-E-Mails</a>)
|
470 |
+
und dieses anschließend in der Konfiguration auswählen.
|
471 |
+
</p>
|
472 |
+
<p>
|
473 |
+
Um z. B. den AGB-Text in das E-mail einzufügen, kopieren Sie das entsprechende Block-Snippet aus
|
474 |
+
Schritt 3 an die gewünschte Stelle in der E-Mail-Vorlage.
|
475 |
+
</p>
|
476 |
+
</div>
|
477 |
+
</div>
|
478 |
+
|
479 |
+
<div class="entry-edit" style="max-width: 800px;">
|
480 |
+
<div class="entry-edit-head">
|
481 |
+
<h4>Schritt 6: Erste Synchronisation durchführen</h4>
|
482 |
+
</div>
|
483 |
+
<div class="fieldset">
|
484 |
+
<?php $statusUrl = $urlModel->getUrl('adminhtml/janolaw_status'); ?>
|
485 |
+
<p>
|
486 |
+
Wenn Sie alles konfiguriert haben, können Sie nun auf der
|
487 |
+
<a href="<?php echo $statusUrl; ?>">Status-Seite von Janolaw</a> die erste
|
488 |
+
Synchronisation durchführen.
|
489 |
+
</p>
|
490 |
+
</div>
|
491 |
+
</div>
|
492 |
+
|
493 |
+
<div class="entry-edit" style="max-width: 800px;">
|
494 |
+
<div class="entry-edit-head">
|
495 |
+
<h4>Schritt 7: Cronjob</h4>
|
496 |
+
</div>
|
497 |
+
<div class="fieldset">
|
498 |
+
Die Texte werden automatisch alle 2 Stunden synchronisiert. Voraussetzung dazu ist jedoch, dass die Cronjobs
|
499 |
+
in Ihrem System korrekt konfiguriert sind. Falls das bei Ihrem Magento-System nicht der Fall sein sollte, wenden Sie
|
500 |
+
sich bitte an Ihren Administrator.
|
501 |
+
</div>
|
502 |
+
</div>
|
503 |
+
|
504 |
+
<script>
|
505 |
+
var jlform = {};
|
506 |
+
jlform.block_tac = new varienForm("form_block_id_tac", "");
|
507 |
+
jlform.block_revocation = new varienForm("form_block_id_revocation", "");
|
508 |
+
jlform.block_privacy = new varienForm("form_block_id_privacy", "");
|
509 |
+
jlform.block_imprint = new varienForm("form_block_id_imprint", "");
|
510 |
+
document.observe("dom:loaded", function() {
|
511 |
+
var jlform_fkey = new Element("input", {
|
512 |
+
"type" : "hidden",
|
513 |
+
"name" : "form_key",
|
514 |
+
"value" : FORM_KEY
|
515 |
+
});
|
516 |
+
document.getElementById("form_block_id_tac").insert(jlform_fkey.clone());
|
517 |
+
document.getElementById("form_block_id_revocation").insert(jlform_fkey.clone());
|
518 |
+
document.getElementById("form_block_id_privacy").insert(jlform_fkey.clone());
|
519 |
+
document.getElementById("form_block_id_imprint").insert(jlform_fkey.clone());
|
520 |
+
});
|
521 |
+
|
522 |
+
jlform.createAgreement = function(agreement_type) {
|
523 |
+
var data = {};
|
524 |
+
if (agreement_type == "<?php echo Janolaw_Agb_Model_CmsAssistant::TYPE_TAC; ?>") {
|
525 |
+
data.name = "AGB";
|
526 |
+
data.type = agreement_type;
|
527 |
+
} else if (agreement_type == "<?php echo Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION; ?>") {
|
528 |
+
data.name = "Widerrufsbelehrung";
|
529 |
+
data.type = agreement_type;
|
530 |
+
} else {
|
531 |
+
alert("Konnte Bestellbedingung nicht speichern (unbekannter Typ)");
|
532 |
+
return;
|
533 |
+
}
|
534 |
+
data.overwrite = ""; // note setting to false sends a string parameter "false" which is evaluated as true in php
|
535 |
+
data.is_ajax = 1;
|
536 |
+
var req = new Ajax.Request("<?php echo $actionSaveAgreement; ?>", {
|
537 |
+
"method": "post",
|
538 |
+
"parameters": data,
|
539 |
+
onSuccess: function(response) {
|
540 |
+
var result = response.responseText.evalJSON();
|
541 |
+
if (result.message) {
|
542 |
+
alert(result.message);
|
543 |
+
} else {
|
544 |
+
alert("Ein Fehler ist aufgetreten");
|
545 |
+
}
|
546 |
+
},
|
547 |
+
onFailure: function(response) {
|
548 |
+
alert("Ein Fehler ist aufgetreten");
|
549 |
+
}
|
550 |
+
});
|
551 |
+
}
|
552 |
+
|
553 |
+
</script>
|
554 |
+
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* @var $this Janolaw_Agb_Block_Adminhtml_Status_Config */
|
3 |
+
$missingConfig = $this->getNotConfiguredValues();
|
4 |
+
$lastRunFlag = $this->getLastRunFlagData();
|
5 |
+
|
6 |
+
/* @var $urlModel Mage_Adminhtml_Model_Url */
|
7 |
+
$urlModel = Mage::getModel('adminhtml/url');
|
8 |
+
$linkSysConfig = $urlModel->getUrl('adminhtml/system_config/edit', array('section' => 'agbdownload'));
|
9 |
+
?>
|
10 |
+
|
11 |
+
<div class="entry-edit" style="max-width: 800px;">
|
12 |
+
<div class="entry-edit-head">
|
13 |
+
<h4><?php echo $this->__('Configuration'); ?></h4>
|
14 |
+
</div>
|
15 |
+
|
16 |
+
<div class="fieldset">
|
17 |
+
<?php if (isset($missingConfig['block_config'])): ?>
|
18 |
+
<?php $configOk = false; ?>
|
19 |
+
<h5><?php echo $this->__('The following block identifiers are not configured yet') . ':'; ?></h5>
|
20 |
+
<ul style="list-style-type: disc; margin-left: 1.5em;">
|
21 |
+
<?php foreach ($missingConfig['block_config'] as $type => $text): ?>
|
22 |
+
<li><?php echo $text; ?></li>
|
23 |
+
<?php endforeach; ?>
|
24 |
+
</ul>
|
25 |
+
<?php else: ?>
|
26 |
+
<p>
|
27 |
+
<?php echo $this->__('All block identifiers are configured...'); ?>
|
28 |
+
</p>
|
29 |
+
<?php endif; ?>
|
30 |
+
|
31 |
+
<br />
|
32 |
+
<?php foreach ($missingConfig as $k => $v): ?>
|
33 |
+
<?php
|
34 |
+
if ($k == 'block_config') {
|
35 |
+
continue; // already printed
|
36 |
+
} else {
|
37 |
+
echo '<p>' . $this->__('Missing configuration for') . ': <b>' . $v . '</b></p><br />';
|
38 |
+
}
|
39 |
+
?>
|
40 |
+
<?php endforeach; ?>
|
41 |
+
|
42 |
+
<?php if (!empty($missingConfig)): ?>
|
43 |
+
<p>
|
44 |
+
<a href="<?php echo $linkSysConfig; ?>" target="_blank"><?php echo $this->__('Edit configuration'); ?></a>
|
45 |
+
</p>
|
46 |
+
<?php endif; ?>
|
47 |
+
</div>
|
48 |
+
</div>
|
49 |
+
|
50 |
+
<div class="entry-edit" style="max-width: 800px;">
|
51 |
+
<div class="entry-edit-head">
|
52 |
+
<h4><?php echo $this->__('Status'); ?></h4>
|
53 |
+
</div>
|
54 |
+
|
55 |
+
<div class="fieldset">
|
56 |
+
<?php if (!$lastRunFlag->getId()): ?>
|
57 |
+
<?php echo $this->__('No synchronisation was done so far..!'); ?>
|
58 |
+
<?php else: ?>
|
59 |
+
|
60 |
+
<b><?php echo $this->__('Last synchronisation run') . ': ' . $this->convertUTCToLocaleTime($lastRunFlag->getLastUpdate()); ?></b><br/>
|
61 |
+
<?php $errors = $lastRunFlag->getFlagData(); ?>
|
62 |
+
<?php if (empty($errors)): ?>
|
63 |
+
<?php echo $this->__('Last synchronisation run was successful'); ?><br/>
|
64 |
+
<?php else: ?>
|
65 |
+
<?php echo $this->__('Last synchronisation run had errors') . ':'; ?><br/>
|
66 |
+
<ul style="list-style-type: disc; margin-left: 1.5em;">
|
67 |
+
<?php foreach ($errors as $e): ?>
|
68 |
+
<li><?php echo $e; ?></li>
|
69 |
+
<?php endforeach; ?>
|
70 |
+
</ul>
|
71 |
+
<?php endif; ?>
|
72 |
+
<?php endif; ?>
|
73 |
+
|
74 |
+
<br /><br />
|
75 |
+
<p>
|
76 |
+
<button id="jl_btn_start_sync" onclick="jl_start_synchronisation()"><?php echo $this->__('Start synchronisation'); ?></button>
|
77 |
+
</p>
|
78 |
+
</div>
|
79 |
+
</div>
|
80 |
+
|
81 |
+
<script>
|
82 |
+
var jl_start_synchronisation = function() {
|
83 |
+
var req = new Ajax.Request("<?php echo $urlModel->getUrl('adminhtml/janolaw_status/runSynchronisation');; ?>", {
|
84 |
+
"method": "post",
|
85 |
+
onSuccess: function(response) {
|
86 |
+
var result = response.responseText.evalJSON();
|
87 |
+
if (result.success) {
|
88 |
+
alert("<?php echo $this->__('Success'); ?>");
|
89 |
+
} else if (result.messages) {
|
90 |
+
var msg = '';
|
91 |
+
if (result.messages instanceof Array) {
|
92 |
+
msg = result.messages.length + " errors";
|
93 |
+
} else {
|
94 |
+
msg = result.messages;
|
95 |
+
}
|
96 |
+
alert(msg);
|
97 |
+
}
|
98 |
+
// reload to update status information
|
99 |
+
window.location.reload();
|
100 |
+
},
|
101 |
+
onFailure: function(response) {
|
102 |
+
alert("<?php echo $this->__('Failure'); ?>");
|
103 |
+
// reload to update status information
|
104 |
+
window.location.reload();
|
105 |
+
}
|
106 |
+
});
|
107 |
+
}
|
108 |
+
</script>
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Janolaw_Agb>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Janolaw_Agb>
|
8 |
+
</modules>
|
9 |
+
</config>
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!-- This file can also be deleted if you like... (e.g. if it conflicts with another package
|
3 |
+
from Janolaw). We keep the file in the repository to ensure
|
4 |
+
backwards compatibility, as older versions of Janolaw_Agb had the module
|
5 |
+
Janolaw_Agb defined in this file (so we need to overwrite it to prevent inconsistency) -->
|
6 |
+
<config/>
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Successfully saved agreement %s","Bestellbedingung %s erfolgreich gespeichert"
|
2 |
+
"Successfully set block identifer %s","Block-Bezeichner %s erfolgreich in Konfiguration gespeichert"
|
3 |
+
"Could not save block identifier to configuration. Wrong type given (%s)","Konnte Block-Bezeichner nicht in Konfiguration speichern. Falscher Typ (%s)"
|
4 |
+
"Could not save block identifier to configuration. Details: %s","Konnte Block-Bezeichner nicht in Konfiguration speichern. Details: %s"
|
5 |
+
"Agreement with name %s does already exist in default store","Bestellbedingung mit Namen %s existiert bereits im Default Store"
|
6 |
+
"Error on save agreement action. Unknown type %s given.","Fehler beim Speichern der Bestellbedingung. Unbekannter Typ (%s)."
|
7 |
+
"The following block identifiers are not configured yet:,"Die folgenden Block-Bezeichner sind noch nicht konfiguriert worden:"
|
8 |
+
"Imprint","Impressum"
|
9 |
+
"Privacy statement","Datenschutzbestimmungen",
|
10 |
+
"Terms and conditions","Allgemeine Geschäftsbedingungen"
|
11 |
+
"Revocation","Widerrufsbelehrung"
|
12 |
+
"Configuration","Konfiguration"
|
13 |
+
"All block identifiers are configured...","Alle Block-Bezeichner sind konfiguriert..."
|
14 |
+
"The following block identifiers are not configured yet","Die folgenden Block-Bezeichner sind noch nicht konfiguriert"
|
15 |
+
"Status","Status"
|
16 |
+
"Last synchronisation run","Letzte Synchronisierung"
|
17 |
+
"Last synchronisation run was successful","Letzte Synchronisierung war erfolgreich"
|
18 |
+
"No synchronisation was done so far..!","Bis jetzt wurde noch keine Synchronisierung durchgeführt!"
|
19 |
+
"Last synchronisation run had errors","Beim letzten Synchronisierungs-Durchgang sind Fehler aufgetreten"
|
20 |
+
"Note that this only works if a pdf is available from janolaw","Bitte beachten Sie, dass dies nur funktioniert, wenn ein PDF von Janolaw verfügbar ist"
|
21 |
+
"Include T&C pdf as Attachment","AGB als PDF-Anhang hinzufügen"
|
22 |
+
"Include revocation pdf as Attachment","Widerrufsbelehrung als PDF-Anhang hinzufügen"
|
23 |
+
"Terms-and-conditions","AGB"
|
24 |
+
"Revocation-policy","Widerrufsbelehrung"
|
25 |
+
"Given block identifer (%s) has the wrong format.","Der angegebene Block-Bezeichner (%s) hat ein ungültiges Format"
|
26 |
+
"Given block identifier is too large (only 255 characters allowed at maximum)","Der angegebene Block-Bezeichner ist zu lang (maximal 255 Zeichen sind erlaubt)"
|
27 |
+
"Missing configuration for","Fehlende Konfiguration für"
|
28 |
+
"Edit configuration","Konfiguration bearbeiten"
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>janolaw_agb2</name>
|
4 |
+
<version>0.1.6</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Dieses Modul integriert die von Janolaw AGB Hosting bereitgestellten Texte (AGB, Widerrufsbelehrung, Impressum, Datenschutzbestimmungen) in Ihren Magento-Shop.
|
10 |
+
</summary>
|
11 |
+
<description><p>
|
12 |
+
Mittlerweile hinlänglich bekannt sind die Abmahnrisiken durch Fehler z.&nbsp;B. in den AGB, der Datenschutzerklärung oder der Widerrufsbelehrung. Um das Risiko einer teuren Abmahnung zu verringern, gibt es jetzt für Magento die Extension Janolaw_Agb2.
|
13 |
+
Diese bietet eine Schnittstelle zum AGB Hosting-Service des Online-Rechtsdienstleisters <i>janolaw AG</i>.
|
14 |
+
Nach jeder rechtlichen Änderung werden die Texte durch <i>Janolaw</i> entsprechend angepasst und über einen Cronjob automatisch in Ihrem Magento-Shop aktualisiert.
|
15 |
+
Nach korrekter Konfiguration muss sich ein Shopbetreiber also keine Sorgen mehr um fehlerhafte oder lückenhafte AGB, Datenschutzerklärungen oder Widerrufsbelehrungen machen. Detail zu den Angeboten von <i>Janolaw</i> finden Sie unter
|
16 |
+
<a href="http://www.janolaw.de/internetrecht/internetshop/abmahnschutz-internetshop.html">http://www.janolaw.de/internetrecht/internetshop/abmahnschutz-internetshop.html</a>.
|
17 |
+
</p>
|
18 |
+

|
19 |
+
<p>
|
20 |
+
<b>Achtung</b>: Diese Extension ersetzt die ältere Version unter <a href="http://www.magentocommerce.com/magento-connect/janolaw-agb-hosting.html">http://www.magentocommerce.com/magento-connect/janolaw-agb-hosting.html</a>. Sollten Sie noch die alte Version installiert haben, deinstallieren Sie bitte die alte Version und installieren anschließend die neue Version.
|
21 |
+
</p>
|
22 |
+

|
23 |
+
<p>
|
24 |
+
Diese Extension ist kompatibel zu den Extensions GermanSetup bzw. MageSetup von FireGento, sowie zu Market Ready Germany. Im Gegensatz zur Vorgängerversion kann sie jedoch auch Standalone eingesetzt werden.
|
25 |
+
</p>
|
26 |
+

|
27 |
+
<p>
|
28 |
+
Hinweise zur Konfiguration:
|
29 |
+
</p>
|
30 |
+
<ul>
|
31 |
+
<li>Voraussetzung für die automatische Aktualisierung der Texte ist die korrekte Konfiguration der Magento-Cronjobs.</li>
|
32 |
+
<li>Nach der Installation führt die Setup-Seite (im Magento-Backend unter <i>System -&gt; Konfiguration -&gt; Janolaw AGB Hosting -&gt; Setup</i> zu finden) durch die Konfiguration.</li>
|
33 |
+
</ul></description>
|
34 |
+
<notes>Janolaw_Agb2 ist eine umfangreiche Überarbeitung der Vorgänger-Extension Janolaw_Agb. Unter anderem ist die Extension nicht mehr abhängig von Market Ready Germany. Sie kann standalone, oder aber im Zusammenspiel mit FireGento_MageSetup (bzw. deren Vorgänger FireGento_GermanSetup) oder MarketReadyGermany verwendet werden. Wenn Sie die Vorgänger-Version installiert haben, empfehlen wir, diese erst zu deinstallieren (dazu entfernen Sie einfach die Dateien "app/etc/Janolaw_All.xml", "app/code/community/Janolaw/update_agb.php" und den kompletten Ordner "app/code/community/Janolaw/Agb".). Anschließend kann die neue Version Janolaw_Agb2 installiert werden.
|
35 |
+
Nach Installation dieser Version sollten Sie den Cache leeren, sich abmelden und neu anmelden, und dann unter System -> Konfiguration -> Janolaw AGB Hosting -> Setup die Anweisungen zur Konfiguration befolgen.</notes>
|
36 |
+
<authors><author><name>Claudio Kressibucher</name><user>ckressibucher</user><email>ck@inmedias.de</email></author><author><name>team in medias</name><user>team_in_medias</user><email>e.lammenett@inmedias.de</email></author></authors>
|
37 |
+
<date>2014-08-18</date>
|
38 |
+
<time>14:51:52</time>
|
39 |
+
<contents><target name="magecommunity"><dir name="Janolaw"><dir name="Agb"><dir name="Block"><dir name="Adminhtml"><file name="Setup.php" hash="f5acf1c70aa6e5527c2e295b25a3aec2"/><dir name="Status"><file name="Config.php" hash="d76825cf02c65b5e15de56e9fcf0c2e8"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="d5460210a5bfd6624e3d3343dda36995"/><file name="HttpStatusNotSuccessfulException.php" hash="0a0bb085993ebf7d02539a38df3e574b"/></dir><dir name="Model"><file name="CmsAssistant.php" hash="00bcb7358abfde81168d3c83273d4cb7"/><file name="Downloader.php" hash="f50a1bd6f68d7828d0b98802e52f9688"/><dir name="Email"><file name="Template.php" hash="1bae9a5024b3ed6212c7de1134999e3b"/></dir><file name="MissingConfigException.php" hash="85f354bd9846700b454e5236349b79ee"/><file name="Observer.php" hash="e1a0aacd89234b312f77b2aebf351f56"/><file name="RemoteException.php" hash="7ba3d53a8e943fab51668a508cd0a2fa"/><dir name="Resource"><file name="Downloader.php" hash="e7a6fd4edb5afb0c8a0be7a4864596bb"/></dir><file name="Setup.php" hash="ecb8afc63f1609a51baf364612eb226c"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Janolaw"><file name="SetupController.php" hash="ff8ea509ff4eb7f1f86b0c563733ff5b"/><file name="StatusController.php" hash="3f985c74590a103747368aacd63cfd2e"/></dir></dir></dir><dir name="data"><dir name="agb_setup"><file name="data-upgrade-0.1.5-0.1.6.php" hash="e22329b3a6cb81614092430957b2489a"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="4aa748b5daab21aeabd0b55949e9ccba"/><file name="config.xml" hash="65775bc529f0215a4265a807b6db7e31"/><file name="system.xml" hash="54ab79b04ca6284aab172f73e6da287b"/></dir><dir name="sql"><dir name="agb_setup"><file name="mysql4-install-0.1.4.php" hash="71c2909026e4e76c0d5d0707795d3051"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="janolawagb"><file name="agbdownloader.xml" hash="fa6b3549599e1aa29098a34bf8d380d2"/></dir></dir><dir name="template"><dir name="janolawagb"><file name="setup.phtml" hash="b012b046dfcd1bf6b7d886803d16ca65"/><dir name="status"><file name="config.phtml" hash="a380ede88dd5656443b8c94b7bc3f08a"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Janolaw_Agb.csv" hash="20f82ffced3db78fe1921b30507a5845"/></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Janolaw_Agb.xml" hash="d5195b8cc8c533d48bdd33cb5aa14c44"/><file name="Janolaw_All.xml" hash="0cc9865429cdba17a980e5f91ce6acc6"/></dir></dir></dir><dir name="shell"><file name="janolaw.php" hash="1c4e7e6127945159875f1bedc553f152"/></dir></target></contents>
|
40 |
+
<compatible/>
|
41 |
+
<dependencies><required><php><min>5.2.0</min><max>5.100.0</max></php></required></dependencies>
|
42 |
+
</package>
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// get mage basedir
|
4 |
+
|
5 |
+
$mageBaseDir = null;
|
6 |
+
|
7 |
+
// check if magento base dir is defined as argument (magebase=/path/to/magento)...
|
8 |
+
// this is useful if this script is symlinked into shell directory (or is not in shell
|
9 |
+
// directory at all).
|
10 |
+
if (is_array($argv)) {
|
11 |
+
foreach ($argv as $a) {
|
12 |
+
$matches = array();
|
13 |
+
if (preg_match('/^magebase=(.*)$/', $a, $matches)) {
|
14 |
+
$mageBaseDir = realpath($matches[1]);
|
15 |
+
if (!is_dir($mageBaseDir)) {
|
16 |
+
throw new Exception($mageBaseDir . ' is not a directory');
|
17 |
+
}
|
18 |
+
}
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
if (is_null($mageBaseDir)) {
|
23 |
+
if (is_file('app' . DIRECTORY_SEPARATOR . 'Mage.php')) {
|
24 |
+
$mageBaseDir = realpath(getcwd());
|
25 |
+
} elseif (is_file('..' . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'Mage.php')) {
|
26 |
+
$mageBaseDir = realpath(dirname(getcwd()));
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
if (is_null($mageBaseDir)) {
|
31 |
+
throw new Exception('Could not determine magento base directory');
|
32 |
+
}
|
33 |
+
|
34 |
+
$abstractFile = $mageBaseDir . DIRECTORY_SEPARATOR . 'shell' . DIRECTORY_SEPARATOR . 'abstract.php';
|
35 |
+
include_once $abstractFile;
|
36 |
+
|
37 |
+
class Janolaw_Shelp extends Mage_Shell_Abstract
|
38 |
+
{
|
39 |
+
|
40 |
+
public function run()
|
41 |
+
{
|
42 |
+
if ($this->getArg('update')) {
|
43 |
+
Mage::getModel('agbdownloader/downloader')->download();
|
44 |
+
echo 'Successfully synchronized data' . PHP_EOL;
|
45 |
+
} else {
|
46 |
+
echo $this->usageHelp();
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
public function usageHelp()
|
51 |
+
{
|
52 |
+
return <<<USAGE
|
53 |
+
Usage: php -f janolaw.php -- command [options]
|
54 |
+
|
55 |
+
commands:
|
56 |
+
update Synchronize content (legal texts, pdf) from
|
57 |
+
janolaw.
|
58 |
+
CAUTION: This will replace content of the cms
|
59 |
+
blocks or pages defined in the configuration
|
60 |
+
of the Janolaw Module
|
61 |
+
(System -> config -> Tab "General"
|
62 |
+
-> Janoloaw AGB Hosting)
|
63 |
+
|
64 |
+
options:
|
65 |
+
magebase="/path/to/magento" relative or absoulte path to magento base
|
66 |
+
directory. This is required if this script is
|
67 |
+
symlinked into the shell directory or is not
|
68 |
+
in the (expected) shell directory at all...
|
69 |
+
|
70 |
+
USAGE;
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
$shell = new Janolaw_Shelp();
|
75 |
+
$shell->run();
|