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


PHP CheckoutCart::getDiscountCodesBlock方法代码示例

本文整理汇总了PHP中Magento\Checkout\Test\Page\CheckoutCart::getDiscountCodesBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP CheckoutCart::getDiscountCodesBlock方法的具体用法?PHP CheckoutCart::getDiscountCodesBlock怎么用?PHP CheckoutCart::getDiscountCodesBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Checkout\Test\Page\CheckoutCart的用法示例。


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

示例1: run

 /**
  * Apply coupon before one page checkout.
  *
  * @return void
  */
 public function run()
 {
     if ($this->salesRule !== null) {
         $this->checkoutCart->getDiscountCodesBlock()->applyCouponCode($this->salesRule->getCouponCode());
         $this->checkoutCart->getTotalsBlock()->waitForUpdatedTotals();
     }
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:12,代码来源:ApplySalesRuleOnFrontendStep.php

示例2: processAssert

 /**
  * 1. Navigate to frontend
  * 2. If "Log Out" link is visible and "isLoggedIn" empty
  *    - makes logout
  * 3. If "isLoggedIn" not empty
  *    - login as customer
  * 4. Clear shopping cart
  * 5. Add test product(s) to shopping cart with specify quantity
  * 6. If "salesRule/data/coupon_code" not empty:
  *    - fill "Enter your code" input in Dіscount Codes
  *    - click "Apply Coupon" button
  * 7. If "address/data/country_id" not empty:
  *    On Estimate Shipping and Tax:
  *    - fill Country, State/Province, Zip/Postal Code
  *    - click 'Get a Quote' button
  *    - select 'Flat Rate' shipping
  *    - click 'Update Total' button
  * 8. Implementation assert
  *
  * @param CheckoutCart $checkoutCart
  * @param CmsIndex $cmsIndex
  * @param CustomerAccountLogin $customerAccountLogin
  * @param CustomerAccountLogout $customerAccountLogout
  * @param CatalogCategoryView $catalogCategoryView
  * @param CatalogProductView $catalogProductView
  * @param SalesRule $salesRule
  * @param SalesRule $salesRuleOrigin
  * @param array $productQuantity
  * @param CatalogProductSimple $productForSalesRule1
  * @param CatalogProductSimple $productForSalesRule2
  * @param Customer $customer
  * @param Address $address
  * @param int|null $isLoggedIn
  * @param array $shipping
  * @param array $cartPrice
  * @return void
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function processAssert(CheckoutCart $checkoutCart, CmsIndex $cmsIndex, CustomerAccountLogin $customerAccountLogin, CustomerAccountLogout $customerAccountLogout, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, SalesRule $salesRule, SalesRule $salesRuleOrigin, array $productQuantity, CatalogProductSimple $productForSalesRule1, CatalogProductSimple $productForSalesRule2 = null, Customer $customer = null, Address $address = null, $isLoggedIn = null, array $shipping = [], array $cartPrice = [])
 {
     $this->checkoutCart = $checkoutCart;
     $this->cmsIndex = $cmsIndex;
     $this->customerAccountLogin = $customerAccountLogin;
     $this->customerAccountLogout = $customerAccountLogout;
     $this->catalogCategoryView = $catalogCategoryView;
     $this->catalogProductView = $catalogProductView;
     $this->productForSalesRule1 = $productForSalesRule1;
     $this->productForSalesRule2 = $productForSalesRule2;
     $this->cartPrice = $cartPrice;
     if ($customer !== null) {
         $this->customer = $customer;
     }
     $isLoggedIn ? $this->login() : $this->customerAccountLogout->open();
     $this->checkoutCart->open()->getCartBlock()->clearShoppingCart();
     $this->addProductsToCart($productQuantity);
     $this->checkoutCart->open();
     if ($address !== null) {
         $this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($address);
         $this->checkoutCart->getShippingBlock()->selectShippingMethod($shipping);
     }
     if ($salesRule->getCouponCode() || $salesRuleOrigin->getCouponCode()) {
         $this->checkoutCart->getDiscountCodesBlock()->applyCouponCode($salesRule->getCouponCode() ? $salesRule->getCouponCode() : $salesRuleOrigin->getCouponCode());
     }
     $this->assert();
 }
开发者ID:hientruong90,项目名称:magento2_installer,代码行数:66,代码来源:AssertCartPriceRuleApplying.php

示例3: run

 /**
  * Apply coupon before one page checkout.
  *
  * @return void
  */
 public function run()
 {
     if ($this->salesRule !== null) {
         $this->checkoutCart->getDiscountCodesBlock()->applyCouponCode($this->salesRule->getCouponCode());
     }
 }
开发者ID:opexsw,项目名称:magento2,代码行数:11,代码来源:ApplySalesRuleOnFrontendStep.php


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