Witam,
Potrzebuje uzyskac informacje z virtuemarta o ilosci sztuk w koszyku. Na podstawie innego skryptu wywnioskowalem ze miesci sie ono w klasie calculationHelper w polu _amount. (przynajmniej skrypt ktory wlasnie ustawia zaleznosci od ilosci towarów w koszyku, pracuje na tym polu).

Jestem poczatkujacy więc pierwsze pytanie.

  1. Czy ja w ogóle dobrze myśle?
  2. Jak odwołać się do tego pola? Nie jestem zabardzo ogarniety w obiektowości, ale cały czas się ucze (dzisiaj ponad 10h ).

oto mój kod:

<?php
  
 defined( '_JEXEC' ) or die( 'Restricted access' );
  
if (!class_exists('vmCalculationPlugin')) require(JPATH_VM_PLUGINS.DS.'vmcalculationplugin.php');
  
  abstract class testowa extends vmCalculationPlugin {
    
      
      function __construct(& $subject, $config) {
  
          parent::__construct($subject, $config);
  
          $this->_tablepkey = 'virtuemart_calc_id';
          $this->_tablename = '#__virtuemart_calc_plg_'. $this->_name;
  //      $this->_tablename = '#__virtuemart_calc_' . $this->_name;
      }
  
  /*  protected function storePluginInternalDataCalc(&$data){
  
  //      vmdebug('plgVmStorePluginInternalDataCalc $data',$data);
  //      parent::plgVmOnStoreInstallPluginTable($this->_psType);
          $this->storePluginInternalData($data);
      }
   */
        protected function getPluginInternalDataCalc(&$calcData){
    
            $datas = $this->getPluginInternalData($calcData->virtuemart_calc_id,'virtuemart_calc_id');
    
    //      vmdebug('getPluginInternalDataCalc',$datas);
            if($datas){
                $attribsCalc = get_object_vars($datas);
    
                unset($attribsCalc['virtuemart_calc_id']);
                foreach($attribsCalc as $k=>$v){
                    $calcData->$k = $v;
                }
            }
    
        }
    
    /*  protected function plgVmAddMathOp(&$entryPoints){
    
            return ;
        }
    */
    /*  protected function plgVmOnDisplayEdit(&$calc){
            return $html;
        }*/
    
    protected function plgVmInGatherEffectRulesProduct(&$calculationHelper,&$rules){
       foreach ($rules as $i => $rule) {
          $ruleData = $this -> getPluginInternalData($rule['virtuemart_calc_id'],'virtuemart_calc_id');
      }
   
$this->dupa = &$calculationHelper->_amount;  
           return false;
        }
    
        protected function plgVmInGatherEffectRulesBill(&$calculationHelper,&$rules){
    
            return false;
       }

           

    }
    

echo '<p>DUPA </p>';

zamiana znacznika [code] na <code class="php"> - Furious Programming