コード例 #1
0
ファイル: controller.php プロジェクト: pvernaglia/vivid_store
 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();
 }
コード例 #2
0
 public function getShippingMethodType()
 {
     return StoreShippingMethodType::getByID($this->smtID);
 }
コード例 #3
0
ファイル: Installer.php プロジェクト: pvernaglia/vivid_store
 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 = StoreShippingMethodType::getByHandle('flat_rate');
         $shippingMethodTypeMethod = $shippingMethodType->addMethod($data);
         StoreShippingMethod::add($shippingMethodTypeMethod, $shippingMethodType, 'Flat Rate', true);
     }
 }
コード例 #4
0
ファイル: shipping.php プロジェクト: pvernaglia/vivid_store
 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 = StoreShippingMethodType::getByID($data['shippingMethodTypeID']);
     $e = $shippingMethodType->getMethodTypeController()->validate($data, $e);
     return $e;
 }