Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIF-1638 - Add client-side support for staged catalog data #407

Merged
merged 3 commits into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import com.adobe.cq.commerce.magento.graphql.SimpleProduct;
import com.adobe.cq.commerce.magento.graphql.VirtualProduct;
import com.adobe.cq.sightly.SightlyWCMMode;
import com.adobe.cq.wcm.launches.utils.LaunchUtils;
import com.day.cq.wcm.api.Page;
import com.day.cq.wcm.api.designer.Style;
import com.fasterxml.jackson.core.JsonProcessingException;
Expand Down Expand Up @@ -287,7 +288,7 @@ public List<VariantAttribute> getVariantAttributes() {

@Override
public Boolean loadClientPrice() {
return loadClientPrice;
return loadClientPrice && !LaunchUtils.isLaunchBasedPath(currentPage.getPath());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.adobe.cq.commerce.core.search.internal.models.SearchResultsSetImpl;
import com.adobe.cq.commerce.core.search.models.SearchResultsSet;
import com.adobe.cq.commerce.core.search.services.SearchResultsService;
import com.adobe.cq.wcm.launches.utils.LaunchUtils;
import com.day.cq.wcm.api.Page;
import com.day.cq.wcm.api.designer.Style;

Expand Down Expand Up @@ -94,7 +95,7 @@ public Integer calculateCurrentPageCursor(final String currentPageIndexCandidate

@Override
public boolean loadClientPrice() {
return loadClientPrice;
return loadClientPrice && !LaunchUtils.isLaunchBasedPath(currentPage.getPath());
}

protected Map<String, String> createFilterMap(final Map<String, String[]> parameterMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,4 +417,13 @@ public void testProductNotFound() throws IOException {
productModel = context.request().adaptTo(ProductImpl.class);
Assert.assertFalse("Product is not found", productModel.getFound());
}

@Test
public void testClientLoadingIsDisabledOnLaunchPage() {
productModel = context.request().adaptTo(ProductImpl.class);
Assert.assertTrue(productModel.loadClientPrice());
Page launch = context.pageManager().getPage("/content/launches/2020/09/14/mylaunch" + PAGE);
Whitebox.setInternalState(productModel, "currentPage", launch);
Assert.assertFalse(productModel.loadClientPrice());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,13 @@ public void testSorting() {
Assert.assertEquals("Product Name", otherKey.getLabel());
Assert.assertEquals(Sorter.Order.ASC, otherKey.getOrder());
}

@Test
public void testClientLoadingIsDisabledOnLaunchPage() {
productListModel = context.request().adaptTo(ProductListImpl.class);
Assert.assertTrue(productListModel.loadClientPrice());
Page launch = context.pageManager().getPage("/content/launches/2020/09/14/mylaunch" + PAGE);
Whitebox.setInternalState(productListModel, "currentPage", launch);
Assert.assertFalse(productListModel.loadClientPrice());
}
}