Beispiel #1
0
 /**
  * Method to assign payment/shipping methods to the geozones
  */
 function selectplugins()
 {
     $type = JRequest::getVar('type');
     Tienda::load("TiendaHelperPlugin", 'helpers.plugin');
     $suffix = TiendaHelperPlugin::getSuffix($type);
     $state = parent::_setModelState();
     $app = JFactory::getApplication();
     $model = $this->getModel($suffix);
     $ns = $app->getName() . '::' . 'com.tienda.model.' . $model->getTable()->get('_suffix');
     $id = JRequest::getVar('id', JRequest::getVar('id', '0', 'post', 'int'), 'get', 'int');
     $row = $model->getTable('geozones');
     $row->load($id);
     $state['filter_enabled'] = '1';
     $state['filter_name'] = $app->getUserStateFromRequest($ns . 'name', 'filter_name', '', '');
     $state['order'] = $app->getUserStateFromRequest($ns . '.filter_order', 'filter_order', 'tbl.name', 'cmd');
     foreach (@$state as $key => $value) {
         $model->setState($key, $value);
     }
     $view = $this->getView('geozones', 'html');
     $view->set('_controller', 'geozones');
     $view->set('_view', 'geozones');
     $view->set('leftMenu', false);
     $view->set('_action', "index.php?option=com_tienda&controller=geozones&task=selectplugins&type={$type}&tmpl=component&id=" . $model->getId());
     $view->setModel($model, true);
     $items = $model->getList();
     foreach ($items as $item) {
         $params = new DSCParameter($item->params);
         $item->geozones = explode(',', $params->get('geozones'));
     }
     $view->assign('suffix', $suffix);
     $view->assign('state', $model->getState());
     $view->assign('row', $row);
     $view->setLayout('selectplugins');
     $view->setTask(true);
     $view->display();
 }
Beispiel #2
0
        ?>
                	<?php 
    } elseif ($item->geozonetype_id == 2) {
        ?>
                		<?php 
        echo JText::_('COM_TIENDA_SHIPPINGS_ASSIGNED');
        ?>
                		<?php 
        $text = JText::_('COM_TIENDA_SELECT_SHIPPINGS');
        ?>
                	<?php 
    }
    ?>
:                	
                    <?php 
    echo TiendaHelperPlugin::countPlgtoGeozone($item);
    ?>
                    <br/>
                    [<?php 
    echo TiendaUrl::popup(@$item->link_plugins, $text, array('update' => true));
    ?>
]
                </td>
                <td style="text-align: center;">
                    <?php 
    echo $item->geozonetype_name;
    ?>
                </td>
            </tr>
            <?php 
    $i = $i + 1;
Beispiel #3
0
 /**
  * Method to get the Payment Methods
  * @param object $order -
  * @return array
  */
 function getPaymentOptions($order = null)
 {
     $options = array();
     if (is_null($order)) {
         return $options;
     }
     //get payment plugins
     // get all the enabled payment plugins
     Tienda::load('TiendaHelperPlugin', 'helpers.plugin');
     $plugins = TiendaHelperPlugin::getPluginsWithEvent('onGetPaymentPlugins');
     if ($plugins) {
         Tienda::load('TiendaTablePayment', 'tables.payment');
         $dispatcher = JDispatcher::getInstance();
         foreach ($plugins as $plugin) {
             $results = $dispatcher->trigger("onGetPaymentOptions", array($plugin->element, $order));
             if (in_array(true, $results, true)) {
                 $table = new TiendaTablePayment();
                 $table->bind($plugin);
                 $options[] = $table;
             }
         }
     }
     return $options;
 }
Beispiel #4
0
 /**
  * Method to count the number of plugin assigned to a geozone
  * @param obj $geozone 
  * @return int
  */
 public static function countPlgtoGeozone($geozone)
 {
     $count = 0;
     if (!is_object($geozone)) {
         return $count;
     }
     static $plugins;
     static $geozones;
     if (empty($plugins[$geozone->geozonetype_id])) {
         $suffix = TiendaHelperPlugin::getSuffix($geozone->geozonetype_id);
         JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models');
         $model = JModel::getInstance($suffix, 'TiendaModel');
         $model->setState('filter_enabled', '1');
         $plugins[$geozone->geozonetype_id] = $model->getList();
     }
     foreach ($plugins[$geozone->geozonetype_id] as $plugin) {
         if (isset($plugin->params)) {
             if (empty($geozones[$plugin->id])) {
                 $params = new DSCParameter($plugin->params);
                 $geozones[$plugin->id] = explode(',', $params->get('geozones'));
             }
             if (in_array($geozone->geozone_id, $geozones[$plugin->id])) {
                 $count++;
             }
         }
     }
     return $count;
 }