示例#1
0
 public function getShippingMethodType()
 {
     return ShippingMethodType::getByID($this->smtID);
 }
示例#2
0
 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();
 }
示例#3
0
 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);
     }
 }
示例#4
0
 public function validate($data)
 {
     $this->error = null;
     $e = Loader::helper('validation/error');
     //check our manditory fields
     if ($data['methodName'] == "") {
         $e->add(t("Method Name must be set"));
     }
     if (!is_numeric($data['minimumAmount'])) {
         $e->add(t("Minimum Amount must be numeric"));
     }
     if (!is_numeric($data['maximumAmount'])) {
         $e->add(t("Maximum Amount must be numeric"));
     }
     //pass the validator to the shipping method to check for it's own errors
     $shippingMethodType = ShippingMethodType::getByID($data['shippingMethodTypeID']);
     $e = $shippingMethodType->getMethodTypeController()->validate($data, $e);
     return $e;
 }