本文整理汇总了PHP中mage\catalog\test\page\product\CatalogProductView::getViewBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductView::getViewBlock方法的具体用法?PHP CatalogProductView::getViewBlock怎么用?PHP CatalogProductView::getViewBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mage\catalog\test\page\product\CatalogProductView
的用法示例。
在下文中一共展示了CatalogProductView::getViewBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Assert that products' MAP has been applied before checkout.
*
* @param CatalogCategory $category
* @param Customer $customer
* @param Address $address
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $cart
* @param CheckoutOnepage $checkoutOnePage
* @param array $products
* @return void
*/
public function processAssert(CatalogCategory $category, Customer $customer, Address $address, CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, CatalogProductView $catalogProductView, CheckoutCart $cart, CheckoutOnepage $checkoutOnePage, array $products)
{
for ($i = 0; $i < count($products); $i++) {
$cart->getCartBlock()->clearShoppingCart();
$productName = $products[$i]->getName();
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($category->getName());
// Check that price is not present on category page.
$listProductBlock = $catalogCategoryView->getListProductBlock();
$productPriceBlock = $listProductBlock->getProductPriceBlock($productName);
$productPriceBlock->clickForPrice();
\PHPUnit_Framework_Assert::assertFalse($productPriceBlock->getMapBlock()->isPriceVisible(), 'Price is present in MSRP dialog on category page.');
// Check that price is not present on product page.
$listProductBlock->openProductViewPage($productName);
\PHPUnit_Framework_Assert::assertFalse($catalogProductView->getViewBlock()->getPriceBlock()->isRegularPriceVisible(), 'Price is present in View block on product page.');
// Check that price is not present on cart.
$catalogProductView->getViewBlock()->addToCart($products[$i]);
\PHPUnit_Framework_Assert::assertTrue($cart->getCartBlock()->getCartItem($products[$i])->isMsrpVisible(), "MSRP link is not visible in cart.");
// Check that price is present on review block in onepage checkout page.
$cart->getCartBlock()->getProceedToCheckoutBlock()->proceedToCheckout();
$checkoutMethodBlock = $checkoutOnePage->getLoginBlock();
$billingBlock = $checkoutOnePage->getBillingBlock();
$paymentMethodBlock = $checkoutOnePage->getPaymentMethodsBlock();
$shippingBlock = $checkoutOnePage->getShippingMethodBlock();
$checkoutMethodBlock->guestCheckout();
$checkoutMethodBlock->clickContinue();
$billingBlock->fillBilling($address, $customer);
$billingBlock->clickContinue();
$shippingBlock->selectShippingMethod(['shipping_service' => 'Flat Rate', 'shipping_method' => 'Fixed']);
$shippingBlock->clickContinue();
$paymentMethodBlock->selectPaymentMethod(['method' => 'checkmo']);
$paymentMethodBlock->clickContinue();
\PHPUnit_Framework_Assert::assertEquals(number_format($products[$i]->getPrice(), 2), $checkoutOnePage->getReviewBlock()->getTotalBlock()->getData('subtotal'), "Subtotal in checkout one page for {$productName} is not equal to expected.");
}
}
示例2: run
/**
* Add products to the wish list.
*
* @return void
*/
public function run()
{
foreach ($this->products as $product) {
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$viewBlock = $this->catalogProductView->getViewBlock();
$this->configure ? $viewBlock->addToWishlist($product) : $viewBlock->clickAddToWishlist();
}
}
示例3: processAssert
/**
* Assert that redirect from newCategory/oldProduct is correct to new product.
*
* @param InjectableFixture $product
* @param InjectableFixture $initialProduct
* @param Browser $browser
* @param CatalogProductView $catalogProductView
* @return void
*/
public function processAssert(InjectableFixture $product, InjectableFixture $initialProduct, Browser $browser, CatalogProductView $catalogProductView)
{
$category = $product->getDataFieldConfig('category_ids')['source']->getProductCategory();
$productUrl = $_ENV['app_frontend_url'] . $category->getUrlKey() . '/' . $initialProduct->getUrlKey() . '.html';
$browser->open($productUrl);
\PHPUnit_Framework_Assert::assertEquals($catalogProductView->getViewBlock()->getProductName(), strtoupper($product->getName()));
}
示例4: isNotDisplayingOnFrontendAssert
/**
* Verify product displaying on frontend.
*
* @param InjectableFixture $product
* @return array
*/
protected function isNotDisplayingOnFrontendAssert(InjectableFixture $product)
{
$errors = [];
//Check that product is not available by url
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
if ($this->catalogProductView->getViewBlock()->isVisible()) {
$errors[] = '- product view block is visible in product page.';
}
//Check that product can't be found
$this->cmsIndex->open()->getSearchBlock()->search($product->getSku());
if ($this->catalogSearchResult->getListProductBlock()->isProductVisible($product)) {
$errors[] = '- successful product search.';
}
//Check that product is not available in category page
$categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $this->category->getName();
$this->cmsIndex->open()->getTopmenu()->selectCategory($categoryName);
$isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product);
$bottomToolBar = $this->catalogCategoryView->getBottomToolbar();
while (!$isProductVisible && $bottomToolBar->nextPage()) {
$isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product);
}
if ($isProductVisible) {
$errors[] = "- product with name '{$product->getName()}' is found in this category.";
}
return $errors;
}
示例5: processAssert
/**
* Check whether there is an opportunity to compare products using given attribute.
*
* @param InjectableFixture $product
* @param CatalogProductAttribute $attribute
* @param BrowserInterface $browser
* @param CatalogProductView $catalogProductView
* @param CatalogProductCompare $catalogProductCompare
* @return void
*/
public function processAssert(InjectableFixture $product, CatalogProductAttribute $attribute, BrowserInterface $browser, CatalogProductView $catalogProductView, CatalogProductCompare $catalogProductCompare)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->clickAddToCompare();
$catalogProductCompare->open();
$label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
\PHPUnit_Framework_Assert::assertTrue($catalogProductCompare->getCompareProductsBlock()->isAttributeVisible($label), 'Attribute is absent on product compare page.');
}
示例6: processAssert
/**
* Assertion that the product is correctly displayed in cart.
*
* @param CatalogProductView $catalogProductView
* @param InjectableFixture $product
* @param Browser $browser
* @param CheckoutCart $checkoutCart
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, InjectableFixture $product, Browser $browser, CheckoutCart $checkoutCart)
{
// Add product to cart
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->addToCart($product);
// Check price
$this->assertOnShoppingCart($product, $checkoutCart);
}
示例7: addToCart
/**
* Get price after fill product options, and add product to cart.
*
* @param CatalogProductSimple $product
* @param array $actualPrices
* @return array
*/
protected function addToCart(CatalogProductSimple $product, array $actualPrices)
{
$this->catalogProductView->getViewBlock()->fillOptions($product);
$priceBlock = $this->catalogProductView->getViewBlock()->getPriceBlock();
$actualPrices['product_view_price_incl_tax'] = $this->getPrice($priceBlock, 'product_view_price_incl_tax');
$this->catalogProductView->getViewBlock()->clickAddToCart();
return $actualPrices;
}
示例8: processAssert
/**
* Assert that product can be configured and added to cart after added this product to cart by sku.
*
* @param CheckoutCart $checkoutCart
* @param CatalogProductView $catalogProductView
* @param array $requiredAttentionProducts
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, CatalogProductView $catalogProductView, array $requiredAttentionProducts)
{
foreach ($requiredAttentionProducts as $product) {
$checkoutCart->open()->getAdvancedCheckoutCart()->clickSpecifyProductOptionsLink($product);
$catalogProductView->getViewBlock()->addToCart($product);
\PHPUnit_Framework_Assert::assertEquals(sprintf(self::SUCCESS_MESSAGE, $product->getName()), $checkoutCart->getMessagesBlock()->getSuccessMessages());
}
}
示例9: addToCartFromCrossSell
/**
* Add to cart.
*
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @param InjectableFixture $productCheck
* @return void
*/
protected function addToCartFromCrossSell(CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, InjectableFixture $productCheck)
{
$crossSellBlock = $checkoutCart->getCrosssellBlock();
$crossSellBlock->getItemBlock($productCheck)->addToCart();
if ($catalogProductView->getViewBlock()->isVisible()) {
$catalogProductView->getViewBlock()->addToCart($productCheck);
}
}
示例10: processAssert
/**
* Assert that price stored in fixture equals to product price on product page.
*
* @param CatalogProductSimple $productSimple
* @param Browser $browser
* @param CatalogProductView $catalogProductView
* @return void
*/
public function processAssert(CatalogProductSimple $productSimple, Browser $browser, CatalogProductView $catalogProductView)
{
$productSimple->persist();
$browser->open($_ENV['app_frontend_url'] . $productSimple->getUrlKey() . '.html');
$productPriceFromFixture = $productSimple->getPrice();
$productPrice = number_format($catalogProductView->getViewBlock()->getPriceBlock()->getPrice(), 2);
\PHPUnit_Framework_Assert::assertEquals($productPrice, $productPriceFromFixture);
}
示例11: processAssert
/**
* Assertion that commodity options are displayed correctly.
*
* @param CatalogProductView $catalogProductView
* @param InjectableFixture $product
* @param Browser $browser
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, InjectableFixture $product, Browser $browser)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$fixtureCustomOptions = $this->prepareOptions($product);
$formCustomOptions = $catalogProductView->getViewBlock()->getOptions($product)['custom_options'];
$error = $this->verifyData($fixtureCustomOptions, $formCustomOptions);
\PHPUnit_Framework_Assert::assertEmpty($error, $error);
}
示例12: processAssert
/**
* Assertion that the product is correctly displayed in cart.
*
* @param CatalogProductView $catalogProductView
* @param InjectableFixture $product
* @param Browser $browser
* @param CheckoutCart $checkoutCart
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, InjectableFixture $product, Browser $browser, CheckoutCart $checkoutCart)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->addToCart($product);
$checkoutData = $product->getCheckoutData();
$price = $checkoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('price');
\PHPUnit_Framework_Assert::assertEquals($checkoutData['cartItem']['price'], $price, 'Product price in shopping cart is not correct.');
}
示例13: processAssert
/**
* Assert that gift card usable in frontend.
*
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @param CatalogProductSimple $product
* @param Browser $browser
* @param string $code
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, CatalogProductSimple $product, Browser $browser, $code)
{
$this->checkoutCart = $checkoutCart;
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->clickAddToCart();
$checkoutCart->getGiftCardAccountBlock()->addGiftCard($code);
$this->assert();
}
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:18,代码来源:AbstractAssertGiftCardAccountUsableInCartOnFrontend.php
示例14: processAssert
/**
* Assert that Samples links are present on the downloadable product on front-end.
*
* @param CatalogProductView $productView
* @param DownloadableProduct $product
* @param Browser $browser
* @return void
*/
public function processAssert(CatalogProductView $productView, DownloadableProduct $product, Browser $browser)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$fixtureSampleLinks = $this->prepareFixtureData($product);
$pageOptions = $productView->getViewBlock()->getOptions($product);
$pageSampleLinks = isset($pageOptions['downloadable_options']['downloadable_sample']) ? $this->preparePageData($pageOptions['downloadable_options']['downloadable_sample']) : [];
$error = $this->verifyData($fixtureSampleLinks, $pageSampleLinks);
\PHPUnit_Framework_Assert::assertEmpty($error, $error);
}
示例15: run
/**
* Add products to the cart.
*
* @return void
*/
public function run()
{
// Ensure that shopping cart is empty
$this->checkoutCart->open()->getCartBlock()->clearShoppingCart();
foreach ($this->products as $product) {
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$this->catalogProductView->getViewBlock()->addToCart($product);
}
}