当前位置: 首页>>代码示例>>PHP>>正文


PHP Discount类代码示例

本文整理汇总了PHP中Discount的典型用法代码示例。如果您正苦于以下问题:PHP Discount类的具体用法?PHP Discount怎么用?PHP Discount使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Discount类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     DB::table('discounts')->truncate();
     $discount = new Discount();
     $discount->role_id = 5;
     //Đại lý chính thức
     $discount->branch_id = 1;
     //Giày dép
     $discount->from_rate = 0;
     $discount->to_rate = 3000000;
     $discount->percentage = 5;
     $discount->save();
     $discount = new Discount();
     $discount->role_id = 5;
     //Đại lý chính thức
     $discount->branch_id = 1;
     //Giày dép
     $discount->from_rate = 3000001;
     $discount->to_rate = 6000000;
     $discount->percentage = 15;
     $discount->save();
     $discount = new Discount();
     $discount->role_id = 5;
     //Đại lý chính thức
     $discount->branch_id = 1;
     //Giày dép
     $discount->from_rate = 6000001;
     $discount->to_rate = 300000000;
     $discount->percentage = 25;
     $discount->save();
 }
开发者ID:hungleon2112,项目名称:giaymaster,代码行数:31,代码来源:DiscountTableSeeder.php

示例2: createDefaultBcashDiscounts

 public function createDefaultBcashDiscounts()
 {
     foreach ($this->names as $name) {
         $coupon = new Discount();
         $coupon->name = $this->getLangsForName($name);
         $coupon->quantity = self::billion;
         $coupon->quantity_per_user = self::billion;
         $coupon->date_from = date('Y-m-d H:i:s');
         $coupon->date_to = date('Y-m-d', strtotime('+30 year'));
         $coupon->partial_use = 0;
         $coupon->code = 'gerenciado_pelo_modulo_' . Tools::passwdGen(8);
         $coupon->active = 0;
         //Invisivel
         $coupon->highlight = 0;
         //Envio excluido
         $coupon->minimum_amount_shipping = 0;
         //Acoes
         $coupon->free_shipping = 0;
         $coupon->reduction_percent = 0;
         if ($coupon->add()) {
             Configuration::updateValue(self::prefix . self::bcash . $name, (int) $coupon->id);
         }
     }
     return true;
 }
开发者ID:payu-br,项目名称:bcash-prestashop-transparente,代码行数:25,代码来源:PaymentDiscount.php

示例3: registerDiscount

 public function registerDiscount($id_customer, $register = false)
 {
     $configurations = Configuration::getMultiple(array('REFERRAL_DISCOUNT_TYPE', 'REFERRAL_DISCOUNT_VALUE'));
     $discount = new Discount();
     $discount->id_discount_type = intval($configurations['REFERRAL_DISCOUNT_TYPE']);
     $discount->value = floatval($configurations['REFERRAL_DISCOUNT_VALUE']);
     $discount->quantity = 1;
     $discount->quantity_per_user = 1;
     $discount->date_from = date('Y-m-d H:i:s', time());
     $discount->date_to = date('Y-m-d H:i:s', time() + 31536000);
     // + 1 year
     $discount->name = $this->getDiscountPrefix() . Tools::passwdGen(6);
     $discount->description = Configuration::getInt('REFERRAL_DISCOUNT_DESCRIPTION');
     $discount->id_customer = intval($id_customer);
     if ($discount->add()) {
         if ($register != false) {
             if ($register == 'sponsor') {
                 $this->id_discount_sponsor = $discount->id;
             } elseif ($register == 'sponsored') {
                 $this->id_discount = $discount->id;
             }
             return $this->save();
         }
         return true;
     }
     return false;
 }
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:27,代码来源:ReferralProgramModule.php

示例4: createDiscountFromEntity

 /**
  * Create Discount, with applicable DiscountConditions
  */
 static function createDiscountFromEntity($entity)
 {
     $discount = new Discount();
     $discount->setId($entity->getId())->setName($entity->getName())->setAs($entity->getAppliedAs())->setTo($entity->getAppliedTo())->setValue($entity->getValue())->setIsPreTax($entity->getIsPreTax())->setIsAuto($entity->getIsAuto())->setCouponCode($entity->getCouponCode());
     //TODO: build discount conditions
     return $discount;
 }
开发者ID:luoshulin,项目名称:falcon,代码行数:10,代码来源:Factory.php

示例5: check

 public function check(Discount $discount)
 {
     $zones = $discount->Zones();
     if (!$zones->exists()) {
         return true;
     }
     $address = $this->order->getShippingAddress();
     if (!$address) {
         $this->error(_t("OrderCouponModifier.NOTINZONE", "This coupon can only be used for a specific shipping location."));
         return false;
     }
     $currentzones = Zone::get_zones_for_address($address);
     if (!$currentzones || !$currentzones->exists()) {
         $this->error(_t("OrderCouponModifier.NOTINZONE", "This discount can only be used for a specific shipping location."));
         return false;
     }
     //check if any of currentzones is in zones
     $inzone = false;
     foreach ($currentzones as $zone) {
         if ($zones->find('ID', $zone->ID)) {
             $inzone = true;
             break;
         }
     }
     if (!$inzone) {
         $this->error(_t("OrderCouponModifier.NOTINZONE", "This discount can only be used for a specific shipping location."));
         return false;
     }
     return true;
 }
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:30,代码来源:ZonesDiscountConstraint.php

示例6: check

 public function check(Discount $discount)
 {
     if ($discount->MinOrderValue > 0 && $this->order->SubTotal() < $discount->MinOrderValue) {
         $this->error(sprintf(_t("Discount.MINORDERVALUE", "Your cart subtotal must be at least %s to use this discount"), $discount->dbObject("MinOrderValue")->Nice()));
         return false;
     }
     return true;
 }
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:8,代码来源:ValueDiscountConstraint.php

示例7: check

 public function check(Discount $discount)
 {
     if ($discount->UseLimit) {
         if ($discount->getUseCount($this->order->ID) >= $discount->UseLimit) {
             $this->error("This discount has reached it's maximum number of uses.");
             return false;
         }
     }
     return true;
 }
开发者ID:burnbright,项目名称:silverstripe-shop-discount,代码行数:10,代码来源:UseLimitDiscountConstraint.php

示例8: showDetailData

 public function showDetailData()
 {
     if (isset($_GET['id'])) {
         $discount = new Discount();
         return $discount->getOneDiscountById($_GET['id']);
     } else {
         header("location:" . HOME_LINK);
         return false;
     }
 }
开发者ID:herandil,项目名称:discountnow,代码行数:10,代码来源:DetailController.php

示例9: check

 public function check(Discount $discount)
 {
     $group = $discount->Group();
     $member = $this->getMember();
     if ($group->exists() && (!$member || !$member->inGroup($group))) {
         $this->error(_t("Discount.GROUPED", "Only specific members can use this discount."));
         return false;
     }
     return true;
 }
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:10,代码来源:GroupDiscountConstraint.php

示例10: itemMatchesCriteria

 public function itemMatchesCriteria(OrderItem $item, Discount $discount)
 {
     $products = $discount->Products();
     $itemproduct = $item->Product(true);
     //true forces the current version of product to be retrieved.
     if ($products->exists() && !$products->find('ID', $item->ProductID)) {
         return false;
     }
     return true;
 }
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:10,代码来源:ProductsDiscountConstraint.php

示例11: check

 public function check(Discount $discount)
 {
     $members = $discount->Members();
     $member = $this->getMember();
     if ($members->exists() && (!$member || !$members->byID($member->ID))) {
         $this->error(_t("Discount.MEMBERSHIP", "Only specific members can use this discount."));
         return false;
     }
     return true;
 }
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:10,代码来源:MembershipDiscountConstraint.php

示例12: titleMaker

 public function titleMaker()
 {
     //check if id is set
     if (isset($_GET['id'])) {
         //if id is set, set the title to the discount title
         $id = $_GET['id'];
         $discount = new Discount();
         $title = $discount->getTitle($id);
         return $title['title'];
     }
     return isset($_GET['page']) ? ucfirst($_GET['page']) : "Homepage";
 }
开发者ID:herandil,项目名称:discountnow,代码行数:12,代码来源:HeaderController.php

示例13: itemMatchesCriteria

 public function itemMatchesCriteria(OrderItem $item, Discount $discount)
 {
     $discountcategoryids = $discount->Categories()->getIDList();
     if (empty($discountcategoryids)) {
         return true;
     }
     //get category ids from buyable
     $buyable = $item->Buyable();
     if (!method_exists($buyable, "getCategoryIDs")) {
         return false;
     }
     $ids = array_intersect($buyable->getCategoryIDs(), $discountcategoryids);
     return !empty($ids);
 }
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:14,代码来源:CategoriesDiscountConstraint.php

示例14: fromArray

 public static function fromArray($data)
 {
     $item = new InvoiceItem();
     if (isset($data['quantity'])) {
         $item->setQuantity($data['quantity']);
     }
     if (isset($data['vat'])) {
         $item->setVat($data['vat']);
     }
     if (isset($data['price_item'])) {
         $item->setPriceItem($data['price_item']);
     }
     if (isset($data['price'])) {
         $item->setPrice($data['price']);
     }
     if (isset($data['price_total'])) {
         $item->setPriceTotal($data['price_total']);
     }
     if (isset($data['description'])) {
         $item->setPriceTotal($data['description']);
     }
     if (isset($data['discount']) && is_array($data['discount'])) {
         $item->setDiscount(Discount::fromArray($data['discount']));
     }
     return $item;
 }
开发者ID:tomaj,项目名称:invoice-client,代码行数:26,代码来源:InvoiceItem.php

示例15: registerDiscount

 public function registerDiscount($id_customer, $register = false, $id_currency = 0)
 {
     $configurations = Configuration::getMultiple(array('REFERRAL_DISCOUNT_TYPE', 'REFERRAL_PERCENTAGE', 'REFERRAL_DISCOUNT_VALUE_' . (int) $id_currency));
     $discount = new Discount();
     $discount->id_discount_type = (int) $configurations['REFERRAL_DISCOUNT_TYPE'];
     /* % */
     if ($configurations['REFERRAL_DISCOUNT_TYPE'] == 1) {
         $discount->value = (double) $configurations['REFERRAL_PERCENTAGE'];
     } elseif ($configurations['REFERRAL_DISCOUNT_TYPE'] == 2 and isset($configurations['REFERRAL_DISCOUNT_VALUE_' . (int) $id_currency])) {
         $discount->value = (double) $configurations['REFERRAL_DISCOUNT_VALUE_' . (int) $id_currency];
     } else {
         $discount->value = 0;
     }
     $discount->quantity = 1;
     $discount->quantity_per_user = 1;
     $discount->date_from = date('Y-m-d H:i:s', time());
     $discount->date_to = date('Y-m-d H:i:s', time() + 31536000);
     // + 1 year
     $discount->name = $this->getDiscountPrefix() . Tools::passwdGen(6);
     $discount->description = Configuration::getInt('REFERRAL_DISCOUNT_DESCRIPTION');
     $discount->id_customer = (int) $id_customer;
     $discount->id_currency = (int) $id_currency;
     if ($discount->add()) {
         if ($register != false) {
             if ($register == 'sponsor') {
                 $this->id_discount_sponsor = (int) $discount->id;
             } elseif ($register == 'sponsored') {
                 $this->id_discount = (int) $discount->id;
             }
             return $this->save();
         }
         return true;
     }
     return false;
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:35,代码来源:ReferralProgramModule.php


注:本文中的Discount类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。