add release 1.x

This commit is contained in:
Daniel Seifert 2020-02-24 15:53:45 +01:00
commit c17878f773
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
6 changed files with 333 additions and 0 deletions

View File

@ -0,0 +1,60 @@
<?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&sup3;') . ' Mehrfachzuordnungen bei Attributen',
'description' => array(
'de' => '',
'en' => '',
),
'thumbnail' => 'picture.png',
'version' => 'indiv.',
'author' => 'D&sup3; 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',
),
);

View File

@ -0,0 +1,70 @@
<?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 © Data Development, Thomas Dartsch
* @author 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();
}
}
}
}
}

View File

@ -0,0 +1,37 @@
<?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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @link http://www.oxidmodule.com
*/
class d3_article_attribute_multivalues extends d3_article_attribute_multivalues_parent
{
/**
* Collects article attributes and selection lists, passes them to Smarty engine,
* returns name of template file "article_attribute.tpl".
*
* @return string
*/
public function render()
{
$sTplName = parent::render();
$iAoc = oxRegistry::getConfig()->getRequestParameter("aoc");
if ($iAoc == 1) {
$sTplName = "d3_article_attribute_multivalues.tpl";
}
return $sTplName;
}
}

View File

@ -0,0 +1,38 @@
<?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 © Data Development, Thomas Dartsch
* @author Data Development - Daniel Seifert <ds@shopmodule.com>
* @link http://www.oxidmodule.com
*/
class d3_oxattributelist_multivalues extends d3_oxattributelist_multivalues_parent
{
/**
* Assign data from array to list
*
* @param array $aData data for list
*/
public function assignArray($aData)
{
$this->clear();
if (count($aData)) {
$oSaved = clone $this->getBaseObject();
foreach ($aData as $aItem) {
$oListObject = clone $oSaved;
$this->_assignElement($oListObject, $aItem);
$this->_aArray[] = $oListObject;
}
}
}
}

View File

@ -0,0 +1,120 @@
[{include file="popups/headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}]
<script type="text/javascript">
initAoc = function()
{
YAHOO.oxid.container1 = new YAHOO.oxid.aoc( 'container1',
[ [{foreach from=$oxajax.container1 item=aItem key=iKey}]
[{$sSep}][{strip}]{ key:'_[{$iKey}]', ident: [{if $aItem.4}]true[{else}]false[{/if}]
[{if !$aItem.4}],
label: '[{oxmultilang ident="GENERAL_AJAX_SORT_"|cat:$aItem.0|oxupper}]',
visible: [{if $aItem.2}]true[{else}]false[{/if}]
[{/if}]}
[{/strip}]
[{assign var="sSep" value=","}]
[{/foreach}] ],
'[{$oViewConf->getAjaxLink()}]cmpid=container1&container=article_attribute&synchoxid=[{$oxid}]'
);
[{assign var="sSep" value=""}]
YAHOO.oxid.container2 = new YAHOO.oxid.aoc( 'container2',
[ [{foreach from=$oxajax.container2 item=aItem key=iKey}]
[{$sSep}][{strip}]{ key:'_[{$iKey}]', ident: [{if $aItem.4}]true[{else}]false[{/if}]
[{if !$aItem.4}],
label: '[{oxmultilang ident="GENERAL_AJAX_SORT_"|cat:$aItem.0|oxupper}]',
visible: [{if $aItem.2}]true[{else}]false[{/if}],
formatter: YAHOO.oxid.aoc.custFormatter
[{/if}]}
[{/strip}]
[{assign var="sSep" value=","}]
[{/foreach}] ],
'[{$oViewConf->getAjaxLink()}]cmpid=container2&container=article_attribute&oxid=[{$oxid}]'
)
YAHOO.oxid.container1.getDropAction = function()
{
return 'fnc=addattr';
}
YAHOO.oxid.container2.getDropAction = function()
{
return 'fnc=removeattr';
}
YAHOO.oxid.container2.subscribe( "rowClickEvent", function( oParam )
{
var aSelRows= YAHOO.oxid.container2.getSelectedRows();
if ( aSelRows.length ) {
oParam = YAHOO.oxid.container2.getRecord(aSelRows[0]);
$('_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' );
}
})
YAHOO.oxid.container2.subscribe( "dataReturnEvent", function()
{
$D.setStyle( $('arrt_conf'), 'visibility', 'hidden' );
})
YAHOO.oxid.container2.onSave = function()
{
YAHOO.oxid.container1.getDataSource().flushCache();
YAHOO.oxid.container1.getPage( 0 );
YAHOO.oxid.container2.getDataSource().flushCache();
YAHOO.oxid.container2.getPage( 0 );
}
YAHOO.oxid.container2.onFailure = function() { /* currently does nothing */ }
YAHOO.oxid.container2.saveAttribute = function()
{
var callback = {
success: YAHOO.oxid.container2.onSave,
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 ) + '&o2attr_oxid=' + encodeURIComponent( $('o2attr_oxid').value ), callback ); [{*** d3 completed***}]
}
// subscribint event listeners on buttons
$E.addListener( $('saveBtn'), "click", YAHOO.oxid.container2.saveAttribute, $('saveBtn') );
}
$E.onDOMReady( initAoc );
</script>
<table width="100%">
<colgroup>
<col span="2" width="40%" />
<col width="20%" />
</colgroup>
<tr class="edittext">
<td colspan="3">[{oxmultilang ident="GENERAL_AJAX_DESCRIPTION"}]<br>[{oxmultilang ident="GENERAL_FILTERING"}]<br /><br /></td>
</tr>
<tr class="edittext">
<td align="center" valign="top"><b>[{oxmultilang ident="ARTICLE_ATTRIBUTE_NOATTRIBUTE"}]</b></td>
<td align="center" valign="top"><b>[{oxmultilang ident="ARTICLE_ATTRIBUTE_ITEMSATTRIBUTE"}]</b></td>
<td align="center" valign="top">[{oxmultilang ident="ARTICLE_ATTRIBUTE_SELECTONEATTR"}]</td>
</tr>
<tr>
<td valign="top" id="container1"></td>
<td valign="top" id="container2"></td>
<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"}]">
</td>
</tr>
<tr>
<td class="oxid-aoc-actions"><input type="button" value="[{oxmultilang ident="GENERAL_AJAX_ASSIGNALL"}]" id="container1_btn"></td>
<td class="oxid-aoc-actions"><input type="button" value="[{oxmultilang ident="GENERAL_AJAX_UNASSIGNALL"}]" id="container2_btn"></td>
<td></td>
</tr>
</table>
</body>
</html>

8
setup+doku/usage.txt Normal file
View File

@ -0,0 +1,8 @@
entwickelt in EE 5.2.1
ermöglicht, im Admin ein Attribute einem Artikel mehrfach mit unterschiedlichen Werten zuzuordnen
Artikel A
-> Farbe "rot"
-> Farbe "grün"
-> Material "Stoff"