add files for rel_2.x
This commit is contained in:
parent
c17878f773
commit
5a83ed0f11
42
composer.json
Normal file
42
composer.json
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "d3/attributemultivalues",
|
||||
"description": "mehrfache Wertezuordnung zu Attributen",
|
||||
"type": "oxideshop-module",
|
||||
"version": "1.0",
|
||||
"keywords": [
|
||||
"oxid",
|
||||
"modules",
|
||||
"eShop",
|
||||
"d3"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "D3 Data Development (Inh. Thomas Dartsch)",
|
||||
"email": "info@shopmodule.com",
|
||||
"homepage": "http://www.d3data.de",
|
||||
"role": "Owner"
|
||||
}
|
||||
],
|
||||
"homepage": "https://www.oxidmodule.com/",
|
||||
"license": [
|
||||
"proprietary"
|
||||
],
|
||||
"extra": {
|
||||
"oxideshop": {
|
||||
"source-directory": "/src",
|
||||
"target-directory": "d3/attributemultivalues"
|
||||
},
|
||||
"patches": {
|
||||
"oxid-esales/oxideshop-ce": {
|
||||
"add multi assignment to article attribute ajax template - 2020-02-24": "vendor/d3/attributemultivalues/patches/article_attribute_ajax.patch"
|
||||
}
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"D3\\AttributeMultiValues\\": "../../../source/modules/d3/attributemultivalues"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This Software is the property of Data Development and is protected
|
||||
* by copyright law - it is NOT Freeware.
|
||||
* Any unauthorized use of this software without a valid license
|
||||
* is a violation of the license agreement and will be prosecuted by
|
||||
* civil and criminal law.
|
||||
* http://www.shopmodule.com
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* Metadata version
|
||||
*/
|
||||
$sMetadataVersion = '1.1';
|
||||
|
||||
/**
|
||||
* Module information
|
||||
*/
|
||||
$aModule = array(
|
||||
'id' => 'd3multiattributevalues',
|
||||
'title' => (class_exists('d3utils') ? d3utils::getInstance()->getD3Logo() : 'D³') . ' Mehrfachzuordnungen bei Attributen',
|
||||
'description' => array(
|
||||
'de' => '',
|
||||
'en' => '',
|
||||
),
|
||||
'thumbnail' => 'picture.png',
|
||||
'version' => 'indiv.',
|
||||
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'http://www.oxidmodule.com/',
|
||||
'extend' => array(
|
||||
'article_attribute_ajax' => 'd3/d3multiattributevalues/modules/controllers/admin/d3_article_attribute_ajax_multivalues',
|
||||
'article_attribute' => 'd3/d3multiattributevalues/modules/controllers/admin/d3_article_attribute_multivalues',
|
||||
'oxattributelist' => 'd3/d3multiattributevalues/modules/models/d3_oxattributelist_multivalues',
|
||||
),
|
||||
'files' => array(
|
||||
),
|
||||
'templates' => array(
|
||||
'd3_article_attribute_multivalues.tpl' => 'd3/d3multiattributevalues/views/admin/tpl/d3_article_attribute_multivalues.tpl',
|
||||
),
|
||||
'events' => array(
|
||||
'onActivate' => 'd3install::checkUpdateStart',
|
||||
),
|
||||
'settings' => array(
|
||||
),
|
||||
'blocks' => array(
|
||||
),
|
||||
'd3FileRegister' => array(
|
||||
'd3/d3multilang/IntelliSenseHelper.php',
|
||||
'd3/d3multilang/metadata.php',
|
||||
'd3/d3multilang/views/admin/de/d3_multilang_lang.php',
|
||||
'd3/d3multilang/views/admin/en/d3_multilang_lang.php',
|
||||
'd3/d3multilang/views/admin/tpl/modcfg-pattern/oxid_lang_file.tpl',
|
||||
),
|
||||
);
|
@ -1,70 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This Software is the property of Data Development and is protected
|
||||
* by copyright law - it is NOT Freeware.
|
||||
*
|
||||
* Any unauthorized use of this software without a valid license
|
||||
* is a violation of the license agreement and will be prosecuted by
|
||||
* civil and criminal law.
|
||||
*
|
||||
* http://www.shopmodule.com
|
||||
*
|
||||
* @copyright © D³ Data Development, Thomas Dartsch
|
||||
* @author D³ Data Development - Daniel Seifert <ds@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
class d3_article_attribute_ajax_multivalues extends d3_article_attribute_ajax_multivalues_parent
|
||||
{
|
||||
/**
|
||||
* Returns SQL query for data to fetc
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _getQuery()
|
||||
{
|
||||
$sQAdd = parent::_getQuery();
|
||||
|
||||
$sArtId = oxRegistry::getConfig()->getRequestParameter('oxid');
|
||||
|
||||
if (false == $sArtId) {
|
||||
$sAttrViewName = $this->_getViewName('oxattribute');
|
||||
$sQAdd = " from {$sAttrViewName} where {$sAttrViewName}.oxid ";
|
||||
}
|
||||
|
||||
return $sQAdd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves attribute value
|
||||
*/
|
||||
public function saveAttributeValue()
|
||||
{
|
||||
$oDb = oxDb::getDb();
|
||||
|
||||
$soxId = oxRegistry::getConfig()->getRequestParameter("oxid");
|
||||
$sAttributeId = oxRegistry::getConfig()->getRequestParameter("attr_oxid");
|
||||
|
||||
$sAttributeValue = oxRegistry::getConfig()->getRequestParameter("attr_value");
|
||||
$sO2AttributeValue = $oDb->quote(oxRegistry::getConfig()->getRequestParameter("o2attr_oxid"));
|
||||
|
||||
if (!$this->getConfig()->isUtf()) {
|
||||
$sAttributeValue = iconv('UTF-8', oxRegistry::getLang()->translateString("charset"), $sAttributeValue);
|
||||
}
|
||||
|
||||
$oArticle = oxNew("oxarticle");
|
||||
if ($oArticle->load($soxId)) {
|
||||
if (isset($sAttributeId) && ("" != $sAttributeId)) {
|
||||
$sViewName = $this->_getViewName("oxobject2attribute");
|
||||
$sSelect = "select * from {$sViewName} where {$sViewName}.oxid= {$sO2AttributeValue}";
|
||||
$oO2A = oxNew("oxi18n");
|
||||
$oO2A->setLanguage(oxRegistry::getConfig()->getRequestParameter('editlanguage'));
|
||||
$oO2A->init("oxobject2attribute");
|
||||
if ($oO2A->assignRecord($sSelect)) {
|
||||
$oO2A->oxobject2attribute__oxvalue->setValue($sAttributeValue);
|
||||
$oO2A->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
29
patches/article_attribute_ajax.patch
Normal file
29
patches/article_attribute_ajax.patch
Normal file
@ -0,0 +1,29 @@
|
||||
diff --git "a/source/application/views/admin/tpl/popups/article_attribute.tpl" "b/source/application/views/admin/tpl/popups/article_attribute.tpl"
|
||||
index 8c7f89f59..8debd4f08 100644
|
||||
--- "a/source/application/views/admin/tpl/popups/article_attribute.tpl"
|
||||
+++ "b/source/application/views/admin/tpl/popups/article_attribute.tpl"
|
||||
@@ -49,6 +49,7 @@
|
||||
$('_attrname').innerHTML = oParam._oData._0;
|
||||
$('attr_value').value = oParam._oData._2;
|
||||
$('attr_oxid').value = oParam._oData._3;
|
||||
+ $('o2attr_oxid').value = oParam._oData._1; [{*** d3 completed ***}]
|
||||
$D.setStyle( $('arrt_conf'), 'visibility', '' );
|
||||
} else {
|
||||
$D.setStyle( $('arrt_conf'), 'visibility', 'hidden' );
|
||||
@@ -73,7 +74,7 @@
|
||||
failure: YAHOO.oxid.container2.onFailure,
|
||||
scope: YAHOO.oxid.container2
|
||||
};
|
||||
- YAHOO.util.Connect.asyncRequest( 'GET', '[{ $oViewConf->getAjaxLink() }]&cmpid=container2&container=article_attribute&fnc=saveAttributeValue&oxid=[{ $oxid }]&attr_value=' + encodeURIComponent( $('attr_value').value ) + '&attr_oxid=' + encodeURIComponent( $('attr_oxid').value ), callback );
|
||||
+ YAHOO.util.Connect.asyncRequest( 'GET', '[{ $oViewConf->getAjaxLink() }]&cmpid=container2&container=article_attribute&fnc=saveAttributeValue&oxid=[{ $oxid }]&attr_value=' + encodeURIComponent( $('attr_value').value ) + '&attr_oxid=' + encodeURIComponent( $('attr_oxid').value ) + '&o2attr_oxid=' + encodeURIComponent( $('o2attr_oxid').value ), callback ); [{*** d3 completed***}]
|
||||
|
||||
}
|
||||
// subscribint event listeners on buttons
|
||||
@@ -101,6 +102,7 @@
|
||||
<td valign="top" align="center" class="edittext" id="arrt_conf" style="visibility:hidden">
|
||||
<br><br>
|
||||
<b id="_attrname">[{ $attr_name }]</b>:<br><br>
|
||||
+ <input id="o2attr_oxid" type="hidden"> [{*** d3 completed ***}]
|
||||
<input id="attr_oxid" type="hidden">
|
||||
<input id="attr_value" class="editinput" type="text"><br><br>
|
||||
<input id="saveBtn" type="button" class="edittext" value="[{ oxmultilang ident="ARTICLE_ATTRIBUTE_SAVE" }]">
|
33
src/IntelliSenseHelper.php
Normal file
33
src/IntelliSenseHelper.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This Software is the property of Data Development and is protected
|
||||
* by copyright law - it is NOT Freeware.
|
||||
*
|
||||
* Any unauthorized use of this software without a valid license
|
||||
* is a violation of the license agreement and will be prosecuted by
|
||||
* civil and criminal law.
|
||||
*
|
||||
* http://www.shopmodule.com
|
||||
*
|
||||
* @copyright <EFBFBD> D<EFBFBD> Data Development, Thomas Dartsch
|
||||
* @author D<EFBFBD> Data Development - Daniel Seifert <ds@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
namespace D3\Modules\AttributeMultiValues\Application\Controllers\Admin {
|
||||
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\ArticleAttribute;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\ArticleAttributeAjax;
|
||||
|
||||
class d3_article_attribute_ajax_multivalues_parent extends ArticleAttributeAjax {}
|
||||
|
||||
class d3_article_attribute_multivalues_parent extends ArticleAttribute {}
|
||||
}
|
||||
|
||||
namespace D3\Modules\AttributeMultiValues\Application\Model {
|
||||
|
||||
use OxidEsales\Eshop\Application\Model\AttributeList;
|
||||
|
||||
class d3_oxattributelist_multivalues_parent extends AttributeList {}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This Software is the property of Data Development and is protected
|
||||
* by copyright law - it is NOT Freeware.
|
||||
*
|
||||
* Any unauthorized use of this software without a valid license
|
||||
* is a violation of the license agreement and will be prosecuted by
|
||||
* civil and criminal law.
|
||||
*
|
||||
* http://www.shopmodule.com
|
||||
*
|
||||
* @copyright <EFBFBD> D<EFBFBD> Data Development, Thomas Dartsch
|
||||
* @author D<EFBFBD> Data Development - Daniel Seifert <ds@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
namespace D3\Modules\AttributeMultiValues\Application\Controllers\Admin;
|
||||
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Application\Model\Article;
|
||||
use OxidEsales\Eshop\Application\Model\Attribute;
|
||||
use OxidEsales\Eshop\Core\DatabaseProvider;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Model\MultiLanguageModel;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class d3_article_attribute_ajax_multivalues extends d3_article_attribute_ajax_multivalues_parent
|
||||
{
|
||||
/**
|
||||
* Returns SQL query for data to fetc
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _getQuery()
|
||||
{
|
||||
$sQAdd = parent::_getQuery();
|
||||
|
||||
$sArtId = Registry::getRequest()->getRequestParameter('oxid');
|
||||
|
||||
if (false == $sArtId) {
|
||||
$attribute = oxNew(Attribute::class);
|
||||
$sAttrViewName = $attribute->_getViewName();
|
||||
$sQAdd = " from {$sAttrViewName} where {$sAttrViewName}.oxid ";
|
||||
}
|
||||
|
||||
return $sQAdd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves attribute value
|
||||
*
|
||||
* @return void|null
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function saveAttributeValue()
|
||||
{
|
||||
$database = DatabaseProvider::getDb();
|
||||
$request = Registry::getRequest();
|
||||
$this->resetContentCache();
|
||||
|
||||
$articleId = $request->getRequestParameter("oxid");
|
||||
$attributeId = $request->getRequestParameter("attr_oxid");
|
||||
$attributeValue = $request->getRequestParameter("attr_value");
|
||||
|
||||
$article = oxNew(Article::class);
|
||||
if ($article->load($articleId)) {
|
||||
if ($article->isDerived()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->onAttributeValueChange($article);
|
||||
|
||||
if (isset($attributeId) && ("" != $attributeId)) {
|
||||
$viewName = $this->_getViewName("oxobject2attribute");
|
||||
$quotedArticleId = $database->quote($article->getId());
|
||||
// D3: remove unused attrid selection
|
||||
$select = "select * from {$viewName} where {$viewName}.oxobjectid= {$quotedArticleId}";
|
||||
$objectToAttribute = oxNew(MultiLanguageModel::class);
|
||||
$objectToAttribute->setLanguage($request->getRequestParameter('editlanguage'));
|
||||
$objectToAttribute->init("oxobject2attribute");
|
||||
if ($objectToAttribute->assignRecord($select)) {
|
||||
$objectToAttribute->oxobject2attribute__oxvalue->setValue($attributeValue);
|
||||
$objectToAttribute->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,11 +9,13 @@
|
||||
*
|
||||
* http://www.shopmodule.com
|
||||
*
|
||||
* @copyright © D³ Data Development, Thomas Dartsch
|
||||
* @author D³ Data Development - Daniel Seifert <ds@shopmodule.com>
|
||||
* @copyright <EFBFBD> D<EFBFBD> Data Development, Thomas Dartsch
|
||||
* @author D<EFBFBD> Data Development - Daniel Seifert <ds@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
namespace D3\Modules\AttributeMultiValues\Application\Controllers\Admin;
|
||||
|
||||
class d3_article_attribute_multivalues extends d3_article_attribute_multivalues_parent
|
||||
{
|
||||
/**
|
@ -9,11 +9,13 @@
|
||||
*
|
||||
* http://www.shopmodule.com
|
||||
*
|
||||
* @copyright © D³ Data Development, Thomas Dartsch
|
||||
* @author D³ Data Development - Daniel Seifert <ds@shopmodule.com>
|
||||
* @copyright <EFBFBD> D<EFBFBD> Data Development, Thomas Dartsch
|
||||
* @author D<EFBFBD> Data Development - Daniel Seifert <ds@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
namespace D3\Modules\AttributeMultiValues\Application\Model;
|
||||
|
||||
class d3_oxattributelist_multivalues extends d3_oxattributelist_multivalues_parent
|
||||
{
|
||||
/**
|
46
src/metadata.php
Normal file
46
src/metadata.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This Software is the property of Data Development and is protected
|
||||
* by copyright law - it is NOT Freeware.
|
||||
* Any unauthorized use of this software without a valid license
|
||||
* is a violation of the license agreement and will be prosecuted by
|
||||
* civil and criminal law.
|
||||
* http://www.shopmodule.com
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
use D3\Modules\AttributeMultiValues\Application\Controllers\Admin\d3_article_attribute_ajax_multivalues;
|
||||
use D3\Modules\AttributeMultiValues\Application\Controllers\Admin\d3_article_attribute_multivalues;
|
||||
use D3\Modules\AttributeMultiValues\Application\Model\d3_oxattributelist_multivalues;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\ArticleAttribute;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\ArticleAttributeAjax;
|
||||
use OxidEsales\Eshop\Application\Model\AttributeList;
|
||||
|
||||
/**
|
||||
* Metadata version
|
||||
*/
|
||||
$sMetadataVersion = '2.1';
|
||||
|
||||
/**
|
||||
* Module information
|
||||
*/
|
||||
$aModule = array(
|
||||
'id' => 'd3attributemultivalues',
|
||||
'title' => 'D³ mehrfache Wertezuordnung zu Attributen',
|
||||
'version' => '0.0.0.1',
|
||||
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'http://www.oxidmodule.com/',
|
||||
'extend' => [
|
||||
ArticleAttributeAjax::class => d3_article_attribute_ajax_multivalues::class,
|
||||
ArticleAttribute::class => d3_article_attribute_multivalues::class,
|
||||
AttributeList::class => d3_oxattributelist_multivalues::class,
|
||||
],
|
||||
'templates' => [
|
||||
'd3_article_attribute_multivalues.tpl' => 'd3/d3multiattributevalues/Application/views/admin/tpl/d3_article_attribute_multivalues.tpl',
|
||||
]
|
||||
);
|
Loading…
Reference in New Issue
Block a user