public static function migrateOldShippingMethod(Package $pkg) { $shippingMethodEnabled = Config::get('vividstore.shippingenabled'); //if it wasn't even enabled, then why bother. if ($shippingMethodEnabled) { $basePrice = Config::get('vividstore.shippingbase'); $perItem = Config::get('vividstore.shippingitem'); $data = array('baseRate' => $basePrice, 'rateType' => 'quantity', 'perItemRate' => $perItem, 'minimumAmount' => 0, 'maximumAmount' => 0, 'minimumWeight' => 0, 'maximumWeight' => 0, 'countries' => 'all'); $shippingMethodType = ShippingMethodType::getByHandle('flat_rate'); $shippingMethodTypeMethod = $shippingMethodType->addMethod($data); ShippingMethod::add($shippingMethodTypeMethod, $shippingMethodType, 'Flat Rate', true); } }
public function uninstall() { $authnetpm = PaymentMethod::getByHandle('auth_net'); if (is_object($authnetpm)) { $authnetpm->delete(); } $invoicepm = PaymentMethod::getByHandle('invoice'); if (is_object($invoicepm)) { $invoicepm->delete(); } $paypalpm = PaymentMethod::getByHandle('paypal_standard'); if (is_object($paypalpm)) { $paypalpm->delete(); } $shippingMethodType = ShippingMethodType::getByHandle('flat_rate'); if (is_object($shippingMethodType)) { $shippingMethodType->delete(); } $shippingMethodType = ShippingMethodType::getByHandle('free_shipping'); if (is_object($shippingMethodType)) { $shippingMethodType->delete(); } parent::uninstall(); }