當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CheckoutCart::getCrosssellBlock方法代碼示例

本文整理匯總了PHP中mage\checkout\test\page\CheckoutCart::getCrosssellBlock方法的典型用法代碼示例。如果您正苦於以下問題:PHP CheckoutCart::getCrosssellBlock方法的具體用法?PHP CheckoutCart::getCrosssellBlock怎麽用?PHP CheckoutCart::getCrosssellBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mage\checkout\test\page\CheckoutCart的用法示例。


在下文中一共展示了CheckoutCart::getCrosssellBlock方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: processAssert

 /**
  * Assert that product is not displayed in cross-sell section.
  *
  * @param BrowserInterface $browser
  * @param CatalogProductSimple $product
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param InjectableFixture[]|null $promotedProducts
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CatalogProductSimple $product, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, array $promotedProducts = null)
 {
     if (!$promotedProducts) {
         $promotedProducts = $product->hasData('cross_sell_products') ? $product->getDataFieldConfig('cross_sell_products')['source']->getProducts() : [];
     }
     $checkoutCart->open();
     $checkoutCart->getCartBlock()->clearShoppingCart();
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     $checkoutCart->open();
     foreach ($promotedProducts as $promotedProduct) {
         \PHPUnit_Framework_Assert::assertFalse($checkoutCart->getCrosssellBlock()->getItemBlock($promotedProduct)->isVisible(), 'Product \'' . $promotedProduct->getName() . '\' is exist in cross-sell section.');
     }
 }
開發者ID:MikeTayC,項目名稱:magento.dev,代碼行數:24,代碼來源:AssertProductAbsentCrossSells.php

示例2: processAssert

 /**
  * Assert that products are displayed in cross-sell section.
  *
  * @param Browser $browser
  * @param CheckoutCart $checkoutCart
  * @param CatalogProductSimple $product
  * @param CatalogProductView $catalogProductView
  * @param InjectableFixture[] $crossSellProducts
  * @return void
  */
 public function processAssert(Browser $browser, CheckoutCart $checkoutCart, CatalogProductSimple $product, CatalogProductView $catalogProductView, array $crossSellProducts)
 {
     $checkoutCart->open()->getCartBlock()->clearShoppingCart();
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     $errors = [];
     $crosssellBlock = $checkoutCart->getCrosssellBlock();
     foreach ($crossSellProducts as $crossSellProduct) {
         if (!$crosssellBlock->getItemBlock($crossSellProduct)->isVisible()) {
             $errors[] = "Product {$crossSellProduct->getName()} is absent in cross-sell section.";
         }
     }
     \PHPUnit_Framework_Assert::assertEmpty($errors, implode(" ", $errors));
 }
開發者ID:cewolf2002,項目名稱:magento,代碼行數:24,代碼來源:AssertCrossSellProductsSection.php

示例3: processAssert

 /**
  * Assert that product is displayed in cross-sell section.
  *
  * @param BrowserInterface $browser
  * @param CheckoutCart $checkoutCart
  * @param CatalogProductSimple $product
  * @param CatalogProductView $catalogProductView
  * @param InjectableFixture[]|null $promotedProducts
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CheckoutCart $checkoutCart, CatalogProductSimple $product, CatalogProductView $catalogProductView, array $promotedProducts = null)
 {
     $errors = [];
     if (!$promotedProducts) {
         $promotedProducts = $product->hasData('cross_sell_products') ? $product->getDataFieldConfig('cross_sell_products')['source']->getProducts() : [];
     }
     $checkoutCart->open();
     $checkoutCart->getCartBlock()->clearShoppingCart();
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     $checkoutCart->open();
     foreach ($promotedProducts as $promotedProduct) {
         if (!$checkoutCart->getCrosssellBlock()->verifyProductCrosssell($promotedProduct)) {
             $errors[] = 'Product \'' . $promotedProduct->getName() . '\' is absent in cross-sell section.';
         }
     }
     \PHPUnit_Framework_Assert::assertEmpty($errors, implode(" ", $errors));
 }
開發者ID:hientruong90,項目名稱:ee_14_installer,代碼行數:28,代碼來源:AssertProductCrossSells.php

示例4: processAssert

 /**
  * Assert that product is displayed in cross-sell section for customer segment.
  *
  * @param Browser $browser
  * @param Customer $customer
  * @param CheckoutCart $checkoutCart
  * @param CatalogProductSimple $product
  * @param CatalogProductView $catalogProductView
  * @param CustomerAccountLogout $customerAccountLogout
  * @param InjectableFixture[] $promotedProducts
  * @return void
  */
 public function processAssert(Browser $browser, Customer $customer, CheckoutCart $checkoutCart, CatalogProductSimple $product, CatalogProductView $catalogProductView, CustomerAccountLogout $customerAccountLogout, array $promotedProducts)
 {
     // Create customer, logout and login to frontend
     $customer->persist();
     $customerAccountLogout->open();
     $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     // Clear cart
     $checkoutCart->open();
     $checkoutCart->getCartBlock()->clearShoppingCart();
     // Check display cross sell products
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     $catalogProductView->getMessagesBlock()->waitSuccessMessage();
     $checkoutCart->open();
     $errors = [];
     foreach ($promotedProducts as $promotedProduct) {
         if (!$checkoutCart->getCrosssellBlock()->getItemBlock($promotedProduct)->isVisible()) {
             $errors[] = "Product '{$promotedProduct->getName()}' is absent in cross-sell section.";
         }
     }
     \PHPUnit_Framework_Assert::assertEmpty($errors, implode(" ", $errors));
 }
開發者ID:MikeTayC,項目名稱:magento.dev,代碼行數:34,代碼來源:AssertProductCrossSellsForCustomerSegment.php

示例5: assertCrossSellSectionAbsent

 /**
  * Check that crossSell section is absent.
  *
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 protected function assertCrossSellSectionAbsent(CheckoutCart $checkoutCart)
 {
     \PHPUnit_Framework_Assert::assertFalse($checkoutCart->getCrosssellBlock()->isVisible());
 }
開發者ID:chucky515,項目名稱:Magento-CE-Mirror,代碼行數:10,代碼來源:AssertCrossSellProducts.php


注:本文中的mage\checkout\test\page\CheckoutCart::getCrosssellBlock方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。