VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: usovdm on April 01, 2012, 12:45:29 PM

Title: Sentence on change of a code of a kernel (customfields plugins)
Post by: usovdm on April 01, 2012, 12:45:29 PM
VM 2.0.2

1.

\administrator\components\com_virtuemart\plugins\vmcustomplugin.php

Line 152:
   function storePluginInternalDataProduct

was:
   $values['id'] = $id

replace on:
   $values['id'] = $id ? $id : 0;

why: 1 product, 3 NEW fields of the one plugin. One NEW record in a plugin table saved only.

2.

\administrator\components\com_virtuemart\models\product.php

Line 390:

was:
if ($this->searchplugin!==0) {
if (!empty( $PluginJoinTables) ) {
$plgName = $PluginJoinTables[0] ;
$joinedTables .= ' LEFT JOIN `#__virtuemart_product_custom_plg_'.$plgName.'` as '.$plgName.' ON '.$plgName.'.`virtuemart_product_id` = p.`virtuemart_product_id` ' ;
}
}


replace on:
if ($this->searchplugin!==0) {
  if (count( $PluginJoinTables)>0) {
foreach($PluginJoinTables as $v){
  $plgName = $v[0] ;
  $plgOn = isset($v[1]) ? $v[1] : $v[0];
  $joinedTables .= ' LEFT JOIN `#__virtuemart_product_custom_plg_'.$plgName.'` as '.$plgOn.' ON '.$plgOn.'.`virtuemart_product_id` = p.`virtuemart_product_id` ' ;
}
  }
}

   
why: 1 product. Search by 3 fields of the one plugin (include multiple values). Example:
/component/virtuemart/?search=true&view=category&custom_parent_id=16&custom_value[16][]=v1&custom_value[16][]=v2&custom_parent_id=18&custom_value[18][]=v3&custom_value[18][]=v4&custom_parent_id=17&custom_value[17][]=v5
, where customfields with id (16,17,18) are by one plugin type

Demo (left side filter): http://demo.jgen.ru (http://demo.jgen.ru) (meanwhile only in Russian)

The plugin + module is in a development stage. After testing and the translation into English I will publish here.
Title: Re: Sentence on change of a code of a kernel (customfields plugins)
Post by: Milbo on April 01, 2012, 20:34:40 PM
Hmm, I cant add your second idea, because we changed it meanwhile, please adjust it to the new version 2.0.3 latest. Sounds interesting, no question. But maybe not needed anylonger (just not completly in that part of code).
Title: Re: Sentence on change of a code of a kernel (customfields plugins)
Post by: usovdm on April 12, 2012, 19:17:29 PM
UP
2.0.4 already released :) item 2 (from first post) on the former is actual.

And...

3.

File: \administrator\components\com_virtuemart\plugins\vmcustomplugin.php

Version: 2.0.4; Line 152: insert line:
$dispatcher->trigger('plgVmAddToSearchOption',array(&$where,&$joinCategory,&$joinMf,&$joinPrice,&$joinShopper));
why: To give to a customfields plugin control of flags. Example: search at the price from 0 to 999 or category_id... with customfields values