Example #1
0
 function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     $this->_tablepkey = 'virtuemart_calc_id';
     $this->_tablename = '#__virtuemart_calc_plg_' . $this->_name;
     $this->_psType = 'calculation';
 }
 /**
  * Constructor
  *
  * @param object $subject The object to observe
  * @param array  $config  An array that holds the plugin configuration
  */
 public function __construct(&$subject, $config = array())
 {
     parent::__construct($subject, $config);
     $this->_path = VMPATH_ROOT . DS . 'plugins' . DS . $this->getName();
     //$lang = JFactory::getLanguage();
     //$lang->load('plg_vmextended_'.$this->getName(),JPATH_ADMINISTRATOR);
 }
 function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     // $this->_tablename = '#__virtuemart_userfield_' . $this->_name;
     // $this->_createTable();
     // $this->_tableChecked = true;
 }
Example #4
0
 function display($tpl = null)
 {
     // Load the helper(s)
     $this->addHelperPath(VMPATH_ADMIN . DS . 'helpers');
     if (!class_exists('vmPSPlugin')) {
         require VMPATH_PLUGINLIBS . DS . 'vmpsplugin.php';
     }
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel();
     $layoutName = vRequest::getCmd('layout', 'default');
     $this->SetViewTitle();
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         VmConfig::loadJLang('plg_vmpsplugin', false);
         JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields');
         $shipment = $model->getShipment();
         // Get the payment XML.
         $formFile = vRequest::filterPath(VMPATH_ROOT . DS . 'plugins' . DS . 'vmshipment' . DS . $shipment->shipment_element . DS . $shipment->shipment_element . '.xml');
         if (file_exists($formFile)) {
             $shipment->form = JForm::getInstance($shipment->shipment_element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]');
             $shipment->params = new stdClass();
             $varsToPush = vmPlugin::getVarsToPushFromForm($shipment->form);
             VmTable::bindParameterableToSubField($shipment, $varsToPush);
             $shipment->form->bind($shipment->getProperties());
         } else {
             $shipment->form = null;
         }
         if (!class_exists('VmImage')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
         }
         if (!class_exists('VirtueMartModelVendor')) {
             require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
         }
         $vendor_id = 1;
         $currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
         $this->assignRef('vendor_currency', $currency->currency_symbol);
         if ($this->showVendors()) {
             $vendorList = ShopFunctions::renderVendorList($shipment->virtuemart_vendor_id);
             $this->assignRef('vendorList', $vendorList);
         }
         $this->pluginList = self::renderInstalledShipmentPlugins($shipment->shipment_jplugin_id);
         $this->assignRef('shipment', $shipment);
         $this->shopperGroupList = ShopFunctions::renderShopperGroupList($shipment->virtuemart_shoppergroup_ids, true);
         $this->addStandardEditViewCommands($shipment->virtuemart_shipmentmethod_id);
     } else {
         JToolBarHelper::custom('cloneshipment', 'copy', 'copy', vmText::_('COM_VIRTUEMART_SHIPMENT_CLONE'), true);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $this->shipments = $model->getShipments();
         VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
         foreach ($this->shipments as &$data) {
             // Write the first 5 shoppergroups in the list
             $data->shipmentShoppersList = shopfunctions::renderGuiList($data->virtuemart_shoppergroup_ids, 'shoppergroups', 'shopper_group_name', 'shopper');
         }
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
 }
Example #5
0
	/**
	 * Create the table for this plugin if it does not yet exist.
	 * This functions checks if the called plugin is active one.
	 * When yes it is calling the standard method to create the tables
	 *
	 * @author Valérie Isaksen
	 *
	 */
	public function onStoreInstallPluginTable ($jplugin_id, $name = FALSE) {

		if ($res = $this->selectedThisByJPluginId ($jplugin_id)) {
			parent::onStoreInstallPluginTable ($this->_psType);
		}
		return $res;
	}
Example #6
0
 /**
  * Create the table for this plugin if it does not yet exist.
  * This functions checks if the called plugin is active one.
  * When yes it is calling the standard method to create the tables
  *
  * @author Valérie Isaksen
  *
  */
 public function onStoreInstallPluginTable($jplugin_id, $name = FALSE)
 {
     if ($res = $this->selectedThisByJPluginId($jplugin_id)) {
         vmdebug('onStoreInstallPluginTable, going to execute onStoreInstallPluginTable');
         parent::onStoreInstallPluginTable($this->_psType);
     }
     return $res;
 }
Example #7
0
	function display($tpl = null) {
			$db = JFactory::getDBO();
		if ( $virtuemart_media_id = vRequest::getInt('virtuemart_media_id') ) {
			//$db = JFactory::getDBO();
			$query='SELECT `file_url`,`file_title` FROM `#__virtuemart_medias` where `virtuemart_media_id`='.$virtuemart_media_id;
			$db->setQuery( $query );
			$json = $db->loadObject();
			if (isset($json->file_url)) {
				$json->file_url = JURI::root().$json->file_url;
				$json->msg =  'OK';
				echo json_encode($json);
			} else {
				$json->msg =  '<b>'.vmText::_('COM_VIRTUEMART_NO_IMAGE_SET').'</b>';
				echo json_encode($json);
			}
		}
		elseif ( $custom_jplugin_id = vRequest::getInt('custom_jplugin_id') ) {

			$table = '#__extensions';
			$ext_id = 'extension_id';

			$q = 'SELECT `params`,`element` FROM `' . $table . '` WHERE `' . $ext_id . '` = "'.$custom_jplugin_id.'"';
			$db ->setQuery($q);
			$this->jCustom = $db ->loadObject();

			$customModel = VmModel::getModel('custom');
			$this->custom = $customModel -> getCustom();

			// Get the payment XML.
			$formFile	= JPath::clean( VMPATH_ROOT .DS. 'plugins' .DS. 'vmcustom' .DS . $this->jCustom->element . DS . $this->jCustom->element . '.xml');
			if (file_exists($formFile)){
				VmConfig::loadJLang('plg_vmpsplugin', false);
				if (!class_exists('vmPlugin')) require(VMPATH_PLUGINLIBS . DS . 'vmplugin.php');
				$filename = 'plg_vmcustom_' .  $this->jCustom->element;
				vmPlugin::loadJLang($filename,'vmcustom',$this->jCustom->element);

				$this->custom = VmModel::getModel('custom')->getCustom();
				$varsToPush = vmPlugin::getVarsToPushByXML($formFile,'customForm');
				$this->custom->form = JForm::getInstance($this->jCustom->element, $formFile, array(),false, '//vmconfig | //config[not(//vmconfig)]');
				$this->custom->params = new stdClass();

				foreach($varsToPush as $k => $field){
					if(strpos($k,'_')!=0){
						$this->custom->params->$k = $field[0];
					}
				}
				$this->custom->form->bind($this->custom->getProperties());
				$form = $this->custom->form;
				include(VMPATH_ADMIN.DS.'fields'.DS.'formrenderer.php');
				echo '<input type="hidden" value="'.$this->jCustom->element.'" name="custom_value">';
			} else {
				$this->custom->form = null;
				VmConfig::$echoDebug = 1;
				vmdebug ('File does not exist '.$formFile);
			}
		}
		jExit();
	}
Example #8
0
 function display($tpl = null)
 {
     $db = JFactory::getDBO();
     if ($field = vRequest::getVar('field')) {
         if (strpos($field, 'plugin') !== false) {
             JForm::addFieldPath(JPATH_VM_ADMINISTRATOR . DS . 'fields');
             $table = '#__extensions';
             $field = substr($field, 6);
             $q = 'SELECT `params`,`element`,`type` FROM `' . $table . '` WHERE `element` = "' . $field . '"';
             $db->setQuery($q);
             $this->userField = $db->loadObject();
             //$this->userField->element = substr($this->userField->type, 6);
             if (!class_exists('vmPlugin')) {
                 require JPATH_VM_PLUGINS . DS . 'vmplugin.php';
             }
             vmPlugin::loadJLang('plg_vmuserfield_' . $this->userField->element, 'vmuserfield', $this->userField->element);
             $path = JPATH_ROOT . DS . 'plugins' . DS . 'vmuserfield' . DS . $this->userField->element . DS . $this->userField->element . '.xml';
             // Get the payment XML.
             $formFile = JPath::clean($path);
             if (file_exists($formFile)) {
                 if (!class_exists('VmConfig')) {
                     require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
                 }
                 if (!class_exists('VmTable')) {
                     require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'vmtable.php';
                 }
                 $this->userField->form = JForm::getInstance($this->userField->element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]');
                 $this->userField->params = new stdClass();
                 $varsToPush = vmPlugin::getVarsToPushByXML($formFile, 'customForm');
                 /*
                 					$this->userField->params->userfield_params = $this->userField->params;
                 					VmTable::bindParameterable($this->userField->params,'userfield_params',$varsToPush);*/
                 if (empty($this->userField->userfield_params)) {
                     $this->userField->userfield_params = '';
                 }
                 $this->userField->params->userfield_params = $this->userField->userfield_params;
                 VmTable::bindParameterable($this->userField->params, 'userfield_params', $varsToPush);
                 $this->userField->form->bind($this->userField);
             } else {
                 $this->userField->form = false;
                 vmdebug('renderUserfieldPlugin could not find xml for ' . $this->userField->type . ' at ' . $path);
             }
             //vmdebug('renderUserfieldPlugin ',$this->userField->form);
             if ($this->userField->form) {
                 $form = $this->userField->form;
                 ob_start();
                 include JPATH_VM_ADMINISTRATOR . DS . 'fields' . DS . 'formrenderer.php';
                 $body = ob_get_contents();
                 ob_end_clean();
                 echo $body;
             }
         }
     }
     jExit();
 }
 function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     $this->_tablepkey = 'tsmart_product_id';
     $this->_tablename = '#__tsmart_product_' . $this->_psType . '_plg_' . $this->_name;
     $this->_idName = 'tsmart_custom_id';
     $this->_configTableFileName = $this->_psType . 's';
     $this->_configTableFieldName = 'custom_params';
     $this->_configTableClassName = 'Table' . ucfirst($this->_psType) . 's';
     //TablePaymentmethods
     $this->_configTable = '#__tsmart_customs';
 }
Example #10
0
 function display($tpl = null)
 {
     $db = JFactory::getDBO();
     if ($virtuemart_media_id = JRequest::getInt('virtuemart_media_id')) {
         //$db = JFactory::getDBO();
         $query = 'SELECT `file_url`,`file_title` FROM `#__virtuemart_medias` where `virtuemart_media_id`=' . $virtuemart_media_id;
         $db->setQuery($query);
         $json = $db->loadObject();
         if (isset($json->file_url)) {
             $json->file_url = JURI::root() . $json->file_url;
             $json->msg = 'OK';
             echo json_encode($json);
         } else {
             $json->msg = '<b>' . JText::_('COM_VIRTUEMART_NO_IMAGE_SET') . '</b>';
             echo json_encode($json);
         }
     } elseif ($custom_jplugin_id = JRequest::getInt('custom_jplugin_id')) {
         if (JVM_VERSION === 1) {
             $table = '#__plugins';
             $ext_id = 'id';
         } else {
             $table = '#__extensions';
             $ext_id = 'extension_id';
         }
         $q = 'SELECT `params`,`element` FROM `' . $table . '` WHERE `' . $ext_id . '` = "' . $custom_jplugin_id . '"';
         $db->setQuery($q);
         $this->plugin = $db->loadObject();
         if (!class_exists('vmParameters')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'parameterparser.php';
         }
         $parameters = new vmParameters($this->plugin->params, $this->plugin->element, 'plugin', 'vmcustom');
         if (!class_exists('vmPlugin')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'plugins' . DS . 'vmplugin.php';
         }
         $filename = 'plg_vmcustom_' . $this->plugin->element;
         vmPlugin::loadJLang($filename, 'vmcustom', $this->plugin->element);
         echo $parameters->render();
         echo '<input type="hidden" value="' . $this->plugin->element . '" name="custom_value">';
         jExit();
     }
     jExit();
 }
Example #11
0
 /**
  * @param        $pluginName
  * @param        $group
  * @param string $layout
  * @return mixed
  * @author Valérie Isaksen
  */
 public function getTemplatePath($pluginName, $group, $layout = 'default')
 {
     $layoutPath = vmPlugin::_getLayoutPath($pluginName, 'vm' . $group, $layout);
     return str_replace(DS . $layout . '.php', '', $layoutPath);
 }
 function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
 }
Example #13
0
 function renderInstalledCustomPlugins($selected)
 {
     $db = JFactory::getDBO();
     $table = '#__extensions';
     $enable = 'enabled';
     $ext_id = 'extension_id';
     //$q = 'SELECT * FROM `'.$table.'` WHERE `folder` = "vmcustom" AND `'.$enable.'`="1" ';
     $q = 'SELECT * FROM `' . $table . '` WHERE `folder` = "vmcustom" ';
     $db->setQuery($q);
     $results = $db->loadAssocList($ext_id);
     if (!class_exists('vmPlugin')) {
         require VMPATH_ADMIN . DS . 'plugins' . DS . 'vmplugin.php';
     }
     foreach ($results as $result) {
         //$filename = 'plg_' .strtolower ( $result['name']).'.sys';
         //$lang->load($filename, JPATH_ADMINISTRATOR);
         $filename = 'plg_' . strtolower($result['name']) . '.sys';
         vmPlugin::loadJLang($filename, 'vmcustom', $result['name']);
     }
     return VmHTML::select('custom_jplugin_id', $results, $selected, "", $ext_id, 'name');
     //return JHtml::_('select.genericlist', $result, 'custom_jplugin_id', null, $ext_id, 'name', $selected);
 }
 /**
  * Get the path to a layout for a type
  *
  * @param   string  $type  The name of the type
  * @param   string  $layout  The name of the type layout. If alternative
  *                           layout, in the form template:filename.
  * @param   array   $viewData  The data you want to use in the layout
  *                           can be an object/array/string... to reuse in the template
  * @return  string  The path to the type layout
  * original from libraries\joomla\application\module\helper.php
  * @since   11.1
  * @author Patrick Kohl, Valérie Isaksen
  */
 public function renderByLayout($layout = 'default', $viewData = NULL, $name = NULL, $psType = NULL)
 {
     if ($name === NULL) {
         $name = $this->_name;
     }
     if ($psType === NULL) {
         $psType = $this->_psType;
     }
     if (!($file = vmPlugin::_getLayoutPath($name, 'vm' . $psType, $layout))) {
         JError::raiseNotice(100, $layout . ' not found ');
         return;
     }
     ob_start();
     include $file;
     return ob_get_clean();
 }
Example #15
0
 function renderUserfieldPlugin()
 {
     if (!class_exists('vmUserfieldPlugin')) {
         require VMPATH_PLUGINLIBS . DS . 'vmuserfieldtypeplugin.php';
     }
     VmConfig::loadJLang('plg_vmpsplugin', false);
     JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields');
     //$selected = $this->userField->userfield_jplugin_id;
     //vmdebug('renderUserfieldPlugin $this->userField->element',$this->userField->type,$this->userField->element);
     $this->userField->element = substr($this->userField->type, 6);
     $path = VMPATH_ROOT . DS . 'plugins' . DS . 'vmuserfield' . DS . $this->userField->element . DS . $this->userField->element . '.xml';
     // Get the payment XML.
     $formFile = vRequest::filterPath($path);
     if (file_exists($formFile)) {
         $this->userField->form = JForm::getInstance($this->userField->element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]');
         $this->userField->params = new stdClass();
         $varsToPush = vmPlugin::getVarsToPushFromForm($this->userField->form);
         VmTable::bindParameterableToSubField($this->userField, $varsToPush);
         $this->userField->form->bind($this->userField->getProperties());
     } else {
         $this->userField->form = false;
         vmdebug('renderUserfieldPlugin could not find xml for ' . $this->userField->type . ' at ' . $path);
     }
     //vmdebug('renderUserfieldPlugin ',$this->userField->form);
     if ($this->userField->form) {
         $form = $this->userField->form;
         ob_start();
         include VMPATH_ADMIN . DS . 'fields' . DS . 'formrenderer.php';
         $body = ob_get_contents();
         ob_end_clean();
         return $body;
     }
     return;
 }
Example #16
0
 /**
  * Get the path to a layout for a type
  *
  * @param   string  $type  The name of the type
  * @param   string  $layout  The name of the type layout. If alternative
  *                           layout, in the form template:filename.
  * @param   array   $viewData  The data you want to use in the layout
  *                           can be an object/array/string... to reuse in the template
  * @return  string  The path to the type layout
  * original from libraries\joomla\application\module\helper.php
  * @since   11.1
  * @author Patrick Kohl, Valérie Isaksen
  */
 public function renderByLayout($layout_name = 'default', $viewData = NULL, $name = NULL, $psType = NULL)
 {
     if ($name === NULL) {
         $name = $this->_name;
     }
     static $theme;
     if (empty($theme)) {
         include JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'onepage.cfg.php';
         $theme = $selected_template;
     }
     if ($psType === NULL) {
         $psType = $this->_psType;
     }
     $layout = vmPlugin::_getLayoutPath($name, 'vm' . $psType, $layout_name);
     jimport('joomla.filesystem.file');
     $psType = strtolower($psType);
     $psType = JFile::makeSafe($psType);
     $isset = false;
     //echo  JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_onepage'.DIRECTORY_SEPARATOR.'themes'.DIRECTORY_SEPARATOR.$theme.DIRECTORY_SEPARATOR.'overrides'.DIRECTORY_SEPARATOR.$psType.DIRECTORY_SEPARATOR.$name.DIRECTORY_SEPARATOR.$layout_name.'.php';
     if (file_exists(JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $psType . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . $layout_name . '.php')) {
         $name = JFile::makeSafe($name);
         $layout_name = JFile::makeSafe($layout_name);
         $layout = JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $psType . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . $layout_name . '.php';
         $isset = true;
     } else {
         if (file_exists(JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $psType . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . $layout_name . '.php')) {
             $isset = true;
             $name = JFile::makeSafe($name);
             $layout_name = JFile::makeSafe($layout_name);
             $layout = JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $psType . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . $layout_name . '.php';
         }
     }
     if (!$isset) {
         if (strpos($layout, 'payment_form') !== false) {
             if (strpos($layout, 'klarna') !== false) {
                 $layout = JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $psType . DIRECTORY_SEPARATOR . 'klarna' . DIRECTORY_SEPARATOR . 'payment_form.php';
             }
         }
     }
     if (is_array($viewData)) {
         if (!empty($viewData['paymnentForm']) && $viewData['paymentForm'] == '#paymentForm') {
             $viewData['paymnentForm'] = '#adminForm';
         }
     }
     if (!$isset) {
         if (strpos($layout, 'javascript') !== false && $name == 'stripe') {
             $layout = JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $psType . DIRECTORY_SEPARATOR . 'stripe' . DIRECTORY_SEPARATOR . 'javascript.php';
         }
     }
     if (strpos($layout, 'display_payment') !== false) {
         if (strpos($layout, 'ddmandate') !== false) {
             $layout = JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $psType . DIRECTORY_SEPARATOR . 'ddmandate' . DIRECTORY_SEPARATOR . 'payment_form.php';
         }
     }
     if (!file_exists($layout)) {
         //JFactory::getApplication()->enqueueMessage('Layout not found: '.$layout);
     } else {
         ob_start();
         include $layout;
         $html = ob_get_clean();
         return $html;
     }
 }
Example #17
0
 function display($tpl = null)
 {
     // Load the helper(s)
     $this->addHelperPath(JPATH_VM_ADMINISTRATOR . DS . 'helpers');
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     if (!class_exists('vmPSPlugin')) {
         require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
     }
     $this->user = JFactory::getUser();
     $model = VmModel::getModel('paymentmethod');
     // TODO logo
     $this->SetViewTitle();
     $layoutName = vRequest::getCmd('layout', 'default');
     $vendorModel = VmModel::getModel('vendor');
     $vendorModel->setId(1);
     $vendor = $vendorModel->getVendor();
     $currencyModel = VmModel::getModel('currency');
     $currencyModel = $currencyModel->getCurrency($vendor->vendor_currency);
     $this->assignRef('vendor_currency', $currencyModel->currency_symbol);
     if ($layoutName == 'edit') {
         // Load the helper(s)
         if (!class_exists('VmImage')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
         }
         VmConfig::loadJLang('plg_vmpsplugin', false);
         JForm::addFieldPath(JPATH_VM_ADMINISTRATOR . DS . 'fields');
         $payment = $model->getPayment();
         // Get the payment XML.
         $formFile = JPath::clean(JPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . $payment->payment_element . DS . $payment->payment_element . '.xml');
         if (file_exists($formFile)) {
             $payment->form = JForm::getInstance($payment->payment_element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]');
             $payment->params = new stdClass();
             $varsToPush = vmPlugin::getVarsToPushByXML($formFile, 'paymentForm');
             $payment->params->payment_params = $payment->payment_params;
             VmTable::bindParameterable($payment->params, 'payment_params', $varsToPush);
             $payment->form->bind($payment);
         } else {
             $payment->form = null;
         }
         $this->assignRef('payment', $payment);
         $this->assignRef('vmPPaymentList', self::renderInstalledPaymentPlugins($payment->payment_jplugin_id));
         $this->assignRef('shopperGroupList', ShopFunctions::renderShopperGroupList($payment->virtuemart_shoppergroup_ids, true));
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $vendorList = ShopFunctions::renderVendorList($payment->virtuemart_vendor_id);
             $this->assignRef('vendorList', $vendorList);
         }
         $this->addStandardEditViewCommands($payment->virtuemart_paymentmethod_id);
     } else {
         JToolBarHelper::custom('clonepayment', 'copy', 'copy', vmText::_('COM_VIRTUEMART_PAYMENT_CLONE'), true);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $this->payments = $model->getPayments();
         foreach ($this->payments as &$data) {
             // Write the first 5 shoppergroups in the list
             $data->paymShoppersList = shopfunctions::renderGuiList($data->virtuemart_shoppergroup_ids, 'shoppergroups', 'shopper_group_name', 'payment');
         }
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
Example #18
0
 /**
  * Get the path to a layout for a type
  *
  * @param   string  $type  The name of the type
  * @param   string  $layout  The name of the type layout. If alternative
  *                           layout, in the form template:filename.
  * @param   array   $viewData  The data you want to use in the layout
  *                           can be an object/array/string... to reuse in the template
  * @return  string  The path to the type layout
  * original from libraries\joomla\application\module\helper.php
  * @since   11.1
  * @author Patrick Kohl, Valérie Isaksen
  */
 public function renderByLayout($layout = 'default', $viewData = NULL, $name = NULL, $psType = NULL)
 {
     if ($name === NULL) {
         $name = $this->_name;
     }
     if ($psType === NULL) {
         $psType = $this->_psType;
     }
     $layout = vmPlugin::_getLayoutPath($name, 'vm' . $psType, $layout);
     ob_start();
     include $layout;
     return ob_get_clean();
 }
 function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     $this->_tablename = '#__virtuemart_coupon_' . $this->_name;
 }
Example #20
0
 public function getCustomVariant($product, &$productCustomsPrice, $selected)
 {
     if ($productCustomsPrice->custom_element !== $this->_name) {
         return false;
     }
     vmPlugin::declarePluginParams('vmcustom', $productCustomsPrice->custom_element, $productCustomsPrice->custom_jplugin_id, $productCustomsPrice);
     // 		VmTable::bindParameterable($productCustomsPrice,'custom_params',$this->_varsToPushParam);
     $pluginFields = JRequest::getVar('customPlugin', null);
     if ($pluginFields == null) {
         $pluginFields = json_decode($product->customPlugin, true);
     }
     return $pluginFields[$productCustomsPrice->virtuemart_customfield_id][$this->_name];
 }
 private function setCartLayout($cart, $intoSession = true)
 {
     if (!class_exists('VmConfig')) {
         require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
     }
     VmConfig::loadConfig();
     $olgConfig = VmConfig::get('oncheckout_opc', true);
     VmConfig::set('oncheckout_opc', true);
     $cart->layoutPath = vmPlugin::getTemplatePath($this->_name, 'payment', 'cart');
     $cart->layout = 'cart';
     if ($intoSession) {
         $cart->setCartIntoSession();
     }
 }
 /**
  * Constructor
  *
  * @param object $subject The object to observe
  * @param array  $config  An array that holds the plugin configuration
  */
 public function __construct(&$subject, $config = array())
 {
     parent::__construct($subject, $config);
     $this->_path = JPATH_PLUGINS . DS . $this->getName();
     JPlugin::loadLanguage('plg_vmextended_' . $this->getName());
 }