public function disable() { $payment = $this->Payment(); $payment->active = 0; $payment->save(); return parent::disable(); }
public function __construct($name, $info = null) { parent::__construct($name, $info); if (version_compare(Shopware::VERSION, '5.0.0', '>=')) { $searchInterceptor = new Shopware_Plugins_Frontend_Boxalino_SearchInterceptor($this); } else { $searchInterceptor = new Shopware_Plugins_Frontend_Boxalino_SearchInterceptor4($this); } $this->searchInterceptor = $searchInterceptor; $this->frontendInterceptor = new Shopware_Plugins_Frontend_Boxalino_FrontendInterceptor($this); }
/** * Creates all Admin View Modifications * * @throws Exception */ private function _applyAdminViewModifications() { try { $parent = $this->_bootstrap->Menu()->findOneBy('label', 'logfile'); $this->_bootstrap->createMenuItem(array('label' => 'Sofort AG Log', 'class' => 'sprite-cards-stack', 'active' => 1, 'controller' => 'SofortLogView', 'action' => 'index', 'parent' => $parent)); $parent = $this->_bootstrap->Menu()->findOneBy('label', 'Zahlungen'); $this->_bootstrap->createMenuItem(array('label' => 'Sofort AG Orders', 'class' => 'sprite-cards-stack', 'active' => 1, 'controller' => 'SofortOrderView', 'action' => 'index', 'parent' => $parent)); } catch (Exception $exception) { throw new Exception("can not create menuentry." . $exception->getMessage()); } }
/** * This method is meant to be called during the installation of the plugin to allow use of the Model Helper. * * @param Shopware_Components_Plugin_Bootstrap $bootstrap * * @throws Exception * @return void */ public static function install($bootstrap) { try { $models = Shopware()->Models(); Shopware()->Db()->query("DROP TABLE IF EXISTS `paymill_fastCheckout`;"); //Add Order Properties $models->addAttribute('s_order_attributes', 'paymill', 'pre_authorization', 'varchar(255)'); $models->addAttribute('s_order_attributes', 'paymill', 'transaction', 'varchar(255)'); $models->addAttribute('s_order_attributes', 'paymill', 'refund', 'varchar(255)'); $models->addAttribute('s_order_attributes', 'paymill', 'sepa_date', 'int(11)'); //Add User Properties $models->addAttribute('s_user_attributes', 'paymill', 'client_id', 'varchar(255)'); $models->addAttribute('s_user_attributes', 'paymill', 'payment_id_cc', 'varchar(255)'); $models->addAttribute('s_user_attributes', 'paymill', 'payment_id_elv', 'varchar(255)'); //Persist changes $bootstrap->Application()->Models()->generateAttributeModels(array('s_order_attributes')); $bootstrap->Application()->Models()->generateAttributeModels(array('s_user_attributes')); } catch (Exception $exception) { throw new Exception("Cannot edit shopware models. " . $exception->getMessage()); } }
/** * Returns the instance of the enlight configuration. If no configuration is set, * the logDb, logTemplate and the logController flags will be set to true. * * @return Enlight_Config */ public function Config() { $config = parent::Config(); if(count($config) === 0) { $config->merge(new Enlight_Config(array( 'logDb' => true, 'logTemplate' => true, 'logController' => true, 'logModel' => true, ))); } return $config; }
/** * Disables the plugin * * @throws Exception * @return boolean */ public function disable() { try { $payment[0] = 'paymillcc'; $payment[1] = 'paymilldebit'; foreach ($payment as $key) { $currentPayment = $this->Payments()->findOneBy(array('name' => $key)); if ($currentPayment) { $currentPayment->setActive(false); } } } catch (Exception $exception) { throw new Exception("Cannot disable payment: " . $exception->getMessage()); } return parent::disable(); }
/** * Uninstall method of the plugin. The plugin database table will be dropped. * * @return bool */ public function uninstall() { $sql = 'DROP TABLE IF EXISTS `s_plugin_migrations`;'; $this->db->query($sql); return parent::uninstall(); }
/** * Performs the necessary uninstall steps * * @return boolean */ public function uninstall() { $translationHelper = new Shopware_Plugins_Frontend_PaymPaymentCreditcard_Components_TranslationHelper(null); $translationHelper->dropSnippets(); $this->removeSnippets(); return parent::uninstall(); }
/** * Uninstalled the plugin. * * Deletes the payment row. * * @return bool */ public function uninstall() { if ($payment = $this->Payment()) { $sql = 'DELETE FROM `s_core_rulesets` WHERE `paymentID`=?'; Shopware()->Db()->query($sql, array($payment->getId())); $sql = 'DELETE FROM `s_core_paymentmeans_countries` WHERE `paymentID`=?'; Shopware()->Db()->query($sql, array($payment->getId())); $sql = 'DELETE FROM `s_core_paymentmeans_subshops` WHERE `paymentID`=?'; Shopware()->Db()->query($sql, array($payment->getId())); } $sql = 'DELETE FROM `s_core_documents_box` WHERE `name` LIKE ?'; Shopware()->Db()->query($sql, array('Billsafe_%')); return parent::uninstall(); }
/** * Registers a plugin in the collection. * * @param Shopware_Components_Plugin_Bootstrap $plugin * @return bool */ public function updatePlugin(Shopware_Components_Plugin_Bootstrap $plugin) { $this->reloadStorage(); $name = $plugin->getName(); $oldVersion = $this->getInfo($name, 'version'); $newInfo = $plugin->getInfo(); $newInfo = new Enlight_Config($newInfo, true); unset($newInfo->source); $this->Application()->Events()->notify('Shopware_Plugin_PreUpdate', array('subject' => $this, 'plugin' => $plugin)); $result = $plugin->update($oldVersion); $success = is_bool($result) ? $result : !empty($result['success']); if ($success) { $this->Application()->Events()->notify('Shopware_Plugin_PostUpdate', array('subject' => $this, 'plugin' => $plugin)); $newInfo->set('updateVersion', null); $newInfo->set('updateSource', null); $newInfo->set('updateDate', Zend_Date::now()); $plugin->Info()->merge($newInfo); $this->registerPlugin($plugin); // Save events / Hooks $this->write(); $form = $plugin->Form(); if ($form->hasElements()) { $this->Application()->Models()->persist($form); } $this->Application()->Models()->flush(); Shopware()->Container()->get('shopware.snippet_database_handler')->loadToDatabase($plugin->Path() . 'Snippets/'); Shopware()->Container()->get('shopware.snippet_database_handler')->loadToDatabase($plugin->Path() . 'snippets/'); Shopware()->Container()->get('shopware.snippet_database_handler')->loadToDatabase($plugin->Path() . 'Resources/snippet/'); // Clear proxy cache $this->Application()->Hooks()->getProxyFactory()->clearCache(); } return $result; }
/** * Registers a plugin in the collection. * * @param Shopware_Components_Plugin_Bootstrap $plugin * @return bool */ public function updatePlugin(Shopware_Components_Plugin_Bootstrap $plugin) { $name = $plugin->getName(); $oldVersion = $this->getInfo($name, 'version'); $newInfo = $plugin->getInfo(); $newInfo = new Enlight_Config($newInfo, true); $result = $plugin->update($oldVersion); $success = is_bool($result) ? $result : !empty($result['success']); if ($success) { $newInfo->set('updateVersion', null); $newInfo->set('updateSource', null); $newInfo->set('updateDate', Zend_Date::now()); $plugin->Info()->merge($newInfo); $this->registerPlugin($plugin); // Save events / Hooks $this->write(); $form = $plugin->Form(); if($form->hasElements()) { $this->Application()->Models()->persist($form); } $this->Application()->Models()->flush(); // Clear proxy cache $this->Application()->Hooks()->getProxyFactory()->clearCache(); } return $result; }
/** * Uninstalls the Plugin and its components * * @return boolean */ public function uninstall() { $this->disable(); $this->_dropDatabaseTables(); return parent::uninstall(); }
/** * Uninstalls the menu-item * * @return bool|void */ public function uninstall() { $sql = "DELETE FROM s_cms_static\n WHERE link='GlossarInventory'"; Shopware()->Db()->query($sql); return parent::uninstall(); }
public function __construct($name, $info = null) { $this->pluginConfig = json_decode($this->pluginConfig, true); parent::__construct($name, $info); }
/** * Plugin unistall method * * @return bool */ public function uninstall() { try { $piKlarnaInvoiceId = piKlarnaGetInvoicePaymentId(); $piKlarnaRateId = piKlarnaGetRatePaymentId(); $piKlarnaPluginId = piKlarnaGetPluginId(); $sql = "DELETE FROM s_core_rulesets WHERE paymentID = ? OR paymentID = ?"; Shopware()->Db()->query($sql, array((int)$piKlarnaInvoiceId, (int)$piKlarnaRateId)); $sql = "DELETE FROM s_core_paymentmeans WHERE name IN ('KlarnaInvoice','KlarnaPartPayment')"; Shopware()->Db()->query($sql); $sql = "DELETE FROM s_core_states WHERE description IN ( '<span style=\"color:orange\">Zahlung wird von Klarna geprüft</span>', '<span style=\"color:green\">Zahlung von Klarna akzeptiert</span>', '<span style=\"color:red\">Zahlung von Klarna nicht akzeptiert</span>', '<span style=\"color:red\">Reservierung abgebrochen</span>', '<span style=\"color:orange\">Reservierung teilweise aktiviert</span>', '<span style=\"color:green\">Reservierung komplett aktiviert</span>', '<span style=\"color:orange\">Teilweise retourniert</span>', '<span style=\"color:red\">Komplett retourniert</span>', '<span style=\"color:orange\">Teilweise storniert</span>', '<span style=\"color:red\">Komplett storniert</span>' )"; Shopware()->Db()->query($sql); return parent::uninstall(); } catch (Exception $e) { throw new Exception('Fehler beim deinstallieren(uninstall)'); } return true; }
/** * Standard uninstall method which removes the trusted shops db tables * @return boolean */ public function uninstall() { $sql = "DELETE FROM s_core_states WHERE description LIKE 'TS - Antrag%'"; Shopware()->Db()->query($sql); return parent::uninstall(); }
/** * Standard uninstall method which removes the trusted shops db tables * * @return boolean */ public function uninstall() { $sql = "DELETE FROM s_core_states\n\t\t\t\tWHERE description LIKE 'TS - Antrag%'"; $this->db->query($sql); $sql = "DELETE FROM s_crontab\n\t\t\t\tWHERE pluginID = ?"; $this->db->query($sql, array($this->getId())); return parent::uninstall(); }
/** * Legacy wrapper for di container * * @param string $name * @return mixed */ public function get($name) { if (version_compare(Shopware::VERSION, '4.2.0', '<') && Shopware::VERSION != '___VERSION___') { if ($name == 'loader') { return $this->Application()->Loader(); } $name = ucfirst($name); return $this->Application()->Bootstrap()->getResource($name); } return parent::get($name); }
/** * Shopware method automatically getting called for plugin Activation * * @return boolean Indicator of success */ public function enable() { if (parent::enable()) { try { $installer = new Shopware_Plugins_Frontend_SofortPayment_Components_Services_Setup($this); $installer->softUpdate(); return true; } catch (Exception $exception) { return false; } } return false; }