A few more bsh -> groovy conversions
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@675930 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -29,7 +29,7 @@ request.setAttribute("productCategoryId", promoCat);
|
||||
*
|
||||
* The whole thing should be re-thought, and should preferably NOT use a custom session variable or try to go through the main page.
|
||||
*
|
||||
* NOTE: see section commented out in category.bsh for the other part of this.
|
||||
* NOTE: see section commented out in Category.groovy for the other part of this.
|
||||
*
|
||||
* NOTE JLR 20070221 this should be done using the same method than in add to cart. I will do it like that and remove all this after.
|
||||
*
|
||||
|
||||
@@ -110,7 +110,7 @@ under the License.
|
||||
<set field="MainColumnStyle" value="center"/>
|
||||
<set field="productsummaryScreen" value="component://ecommerce/widget/CatalogScreens.xml#productsummary"/>
|
||||
<set field="titleProperty" value="PageTitleShowPromotionDetails"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.groovy"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/ShowPromotionDetails.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
|
||||
@@ -37,7 +37,7 @@ under the License.
|
||||
<screen name="keywordsearchbox">
|
||||
<section>
|
||||
<actions>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearchoptions.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearchOptions.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/catalog/keywordsearchbox.ftl"/></html></platform-specific>
|
||||
@@ -145,7 +145,7 @@ under the License.
|
||||
<section>
|
||||
<actions>
|
||||
<property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/breadcrumbs.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Breadcrumbs.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/catalog/breadcrumbs.ftl"/></html></platform-specific>
|
||||
@@ -164,7 +164,7 @@ under the License.
|
||||
<set field="MainColumnStyle" value="center"/>
|
||||
|
||||
<set field="titleProperty" value="PageTitleCategoryPage"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
@@ -201,7 +201,7 @@ under the License.
|
||||
<set field="productsummaryScreen" value="component://ecommerce/widget/CatalogScreens.xml#productsummary"/>
|
||||
<set field="productCategoryLinkScreen" value="component://ecommerce/widget/CatalogScreens.xml#ProductCategoryLink"/>
|
||||
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/categorydetail.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy"/>
|
||||
|
||||
<entity-and entity-name="ProductCategoryLink" list-name="productCategoryLinks" use-cache="true" filter-by-date="true">
|
||||
<field-map field-name="productCategoryId" env-name="productCategoryId"/>
|
||||
@@ -234,7 +234,7 @@ under the License.
|
||||
<set field="titleProperty" value="PageTitleProductPage"/>
|
||||
<set field="layoutSettings.javaScripts[]" value="/images/prototypejs/prototype.js" global="true"/>
|
||||
<set field="configproductdetailScreen" value="component://ecommerce/widget/CatalogScreens.xml#configproductdetail"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
@@ -276,7 +276,7 @@ under the License.
|
||||
<set field="productsummaryScreen" value="component://ecommerce/widget/CatalogScreens.xml#productsummary"/>
|
||||
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/prepareconfigform.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/PrepareConfigForm.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<include-screen name="breadcrumbs"/>
|
||||
@@ -389,7 +389,7 @@ under the License.
|
||||
|
||||
<set field="titleProperty" value="PageTitleSearchResults"/>
|
||||
<set field="parameters.VIEW_SIZE" from-field="parameters.VIEW_SIZE" default-value="10"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearch.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearch.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
@@ -410,7 +410,7 @@ under the License.
|
||||
|
||||
<set field="titleProperty" value="PageTitleAdvancedSearch"/>
|
||||
<set field="headerItem" value="Advanced Search"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.groovy"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/AdvancedSearchOptions.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
|
||||
@@ -215,7 +215,7 @@ under the License.
|
||||
<set field="randomSurveyGroup" value="testSurveyGroup"/>
|
||||
|
||||
<script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
|
||||
+2
-2
@@ -27,8 +27,8 @@ import org.ofbiz.product.category.*;
|
||||
import javolution.util.FastMap;
|
||||
|
||||
categoryList = request.getAttribute("topLevelList");
|
||||
if(categoryList != null) {
|
||||
if(categoryList) {
|
||||
catContentWrappers = FastMap.newInstance();
|
||||
CategoryWorker.getCategoryContentWrappers(catContentWrappers, categoryList, request);
|
||||
context.put("catContentWrappers", catContentWrappers);
|
||||
context.catContentWrappers = catContentWrappers;
|
||||
}
|
||||
+26
-28
@@ -31,54 +31,52 @@ import org.ofbiz.product.category.CategoryContentWrapper;
|
||||
detailScreen = "categorydetail";
|
||||
catalogName = CatalogWorker.getCatalogName(request);
|
||||
|
||||
productCategoryId = request.getAttribute("productCategoryId");
|
||||
if (productCategoryId == null) {
|
||||
productCategoryId = parameters.get("category_id");
|
||||
}
|
||||
context.put("productCategoryId", productCategoryId);
|
||||
productCategoryId = request.getAttribute("productCategoryId") ?: parameters.category_id;
|
||||
context.productCategoryId = productCategoryId;
|
||||
|
||||
/* NOTE DEJ20070220: this is a weird way to do this and caused unacceptable side effects as described in the related
|
||||
* comment in the main.bsh file
|
||||
*
|
||||
* NOTE JLR 20070221 this should be done using the same method than in add to cart. I will do it like that and remove all this after.
|
||||
*
|
||||
if (productCategoryId != null) {
|
||||
session.setAttribute("productCategoryId",productCategoryId);// for language change
|
||||
if (productCategoryId) {
|
||||
session.setAttribute("productCategoryId", productCategoryId);// for language change
|
||||
previousParams = session.getAttribute("_PREVIOUS_PARAMS_");
|
||||
if (previousParams != null && previousParams.length() > 0) {
|
||||
previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, UtilMisc.toList("category_id"));
|
||||
previousParams = previousParams + "&category_id=" + productCategoryId;
|
||||
if (previousParams) {
|
||||
previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, ["category_id"]);
|
||||
previousParams += "&category_id=" + productCategoryId;
|
||||
} else {
|
||||
previousParams = "category_id=" + productCategoryId;
|
||||
}
|
||||
session.setAttribute("_PREVIOUS_PARAMS_", previousParams); // for login
|
||||
context.put("previousParams", previousParams);
|
||||
context.previousParams = previousParams;
|
||||
}
|
||||
*/
|
||||
|
||||
category = delegator.findByPrimaryKeyCache("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryId));
|
||||
if (category != null) {
|
||||
if (category.get("detailScreen") != null)
|
||||
detailScreen = category.getString("detailScreen");
|
||||
CategoryContentWrapper categoryContentWrapper = new CategoryContentWrapper(category, request);
|
||||
context.put("title", categoryContentWrapper.get("CATEGORY_NAME"));
|
||||
categoryDescription = categoryContentWrapper.get("DESCRIPTION");
|
||||
if (categoryDescription != null) {
|
||||
context.put("metaDescription", categoryDescription);
|
||||
context.put("metaKeywords", categoryDescription + ", " + catalogName);
|
||||
} else {
|
||||
context.put("metaKeywords", catalogName);
|
||||
category = delegator.findByPrimaryKeyCache("ProductCategory", [productCategoryId : productCategoryId]);
|
||||
if (category) {
|
||||
if (category.detailScreen) {
|
||||
detailScreen = category.detailScreen;
|
||||
}
|
||||
context.put("productCategory", category);
|
||||
categoryContentWrapper = new CategoryContentWrapper(category, request);
|
||||
context.title = categoryContentWrapper.CATEGORY_NAME;
|
||||
categoryDescription = categoryContentWrapper.DESCRIPTION;
|
||||
if (categoryDescription) {
|
||||
context.metaDescription = categoryDescription;
|
||||
context.metaKeywords = categoryDescription + ", " + catalogName;
|
||||
} else {
|
||||
context.metaKeywords = catalogName;
|
||||
}
|
||||
context.productCategory = category;
|
||||
}
|
||||
|
||||
// check the catalogs template path and update
|
||||
templatePathPrefix = CatalogWorker.getTemplatePathPrefix(request);
|
||||
if (templatePathPrefix != null) {
|
||||
if (templatePathPrefix) {
|
||||
detailScreen = templatePathPrefix + detailScreen;
|
||||
}
|
||||
context.put("detailScreen", detailScreen);
|
||||
context.detailScreen = detailScreen;
|
||||
|
||||
request.setAttribute("productCategoryId", productCategoryId);
|
||||
request.setAttribute("defaultViewSize", new Integer(10));
|
||||
request.setAttribute("limitView", new Boolean(true));
|
||||
request.setAttribute("defaultViewSize", 10);
|
||||
request.setAttribute("limitView", true);
|
||||
+27
-34
@@ -29,57 +29,50 @@ import org.ofbiz.product.catalog.*;
|
||||
import org.ofbiz.product.category.CategoryContentWrapper;
|
||||
|
||||
productCategoryId = request.getAttribute("productCategoryId");
|
||||
context.put("productCategoryId", productCategoryId);
|
||||
context.productCategoryId = productCategoryId;
|
||||
|
||||
viewSize = parameters.get("VIEW_SIZE");
|
||||
viewIndex = parameters.get("VIEW_INDEX");
|
||||
viewSize = parameters.VIEW_SIZE;
|
||||
viewIndex = parameters.VIEW_INDEX;
|
||||
currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
|
||||
|
||||
// set the default view size
|
||||
defaultViewSize = request.getAttribute("defaultViewSize");
|
||||
if (defaultViewSize == null) {
|
||||
defaultViewSize = new java.lang.Integer(10);
|
||||
}
|
||||
context.put("defaultViewSize", defaultViewSize);
|
||||
defaultViewSize = request.getAttribute("defaultViewSize") ?: 10;
|
||||
context.defaultViewSize = defaultViewSize;
|
||||
|
||||
// set the limit view
|
||||
Boolean limitViewObj = request.getAttribute("limitView");
|
||||
limitView = true;
|
||||
if (limitViewObj != null) {
|
||||
limitView = limitViewObj;
|
||||
}
|
||||
context.put("limitView", limitView);
|
||||
limitView = request.getAttribute("limitView") ?: true;
|
||||
context.limitView = limitView;
|
||||
|
||||
// get the product category & members
|
||||
andMap = UtilMisc.toMap("productCategoryId", productCategoryId,
|
||||
"viewIndexString", viewIndex, "viewSizeString", viewSize,
|
||||
"defaultViewSize", defaultViewSize, "limitView", limitView);
|
||||
andMap = [productCategoryId : productCategoryId,
|
||||
viewIndexString : viewIndex,
|
||||
viewSizeString : viewSize,
|
||||
defaultViewSize : defaultViewSize,
|
||||
limitView : limitView];
|
||||
andMap.put("prodCatalogId", currentCatalogId);
|
||||
andMap.put("checkViewAllow", Boolean.TRUE);
|
||||
if (context.get("orderByFields") != null) {
|
||||
andMap.put("orderByFields", context.get("orderByFields"));
|
||||
andMap.put("checkViewAllow", true);
|
||||
if (context.orderByFields) {
|
||||
andMap.put("orderByFields", context.orderByFields);
|
||||
} else {
|
||||
andMap.put("orderByFields", UtilMisc.toList("sequenceNum", "productId"));
|
||||
andMap.put("orderByFields", ["sequenceNum", "productId"]);
|
||||
}
|
||||
catResult = dispatcher.runSync("getProductCategoryAndLimitedMembers", andMap);
|
||||
|
||||
productCategory = catResult.get("productCategory");
|
||||
if (catResult != null) {
|
||||
context.put("productCategoryMembers", catResult.get("productCategoryMembers"));
|
||||
context.put("productCategory", productCategory);
|
||||
context.put("viewIndex", catResult.get("viewIndex"));
|
||||
context.put("viewSize", catResult.get("viewSize"));
|
||||
context.put("lowIndex", catResult.get("lowIndex"));
|
||||
context.put("highIndex", catResult.get("highIndex"));
|
||||
context.put("listSize", catResult.get("listSize"));
|
||||
}
|
||||
productCategory = catResult.productCategory;
|
||||
context.productCategoryMembers = catResult.productCategoryMembers;
|
||||
context.productCategory = productCategory;
|
||||
context.viewIndex = catResult.viewIndex;
|
||||
context.viewSize = catResult.viewSize;
|
||||
context.lowIndex = catResult.lowIndex;
|
||||
context.highIndex = catResult.highIndex;
|
||||
context.listSize = catResult.listSize;
|
||||
|
||||
// set this as a last viewed
|
||||
// DEJ20070220: WHY is this done this way? why not use the existing CategoryWorker stuff?
|
||||
int LAST_VIEWED_TO_KEEP = 10; // modify this to change the number of last viewed to keep
|
||||
LAST_VIEWED_TO_KEEP = 10; // modify this to change the number of last viewed to keep
|
||||
lastViewedCategories = session.getAttribute("lastViewedCategories");
|
||||
if (lastViewedCategories == null) {
|
||||
lastViewedCategories = new LinkedList();
|
||||
if (!lastViewedCategories) {
|
||||
lastViewedCategories = [];
|
||||
session.setAttribute("lastViewedCategories", lastViewedCategories);
|
||||
}
|
||||
lastViewedCategories.remove(productCategoryId);
|
||||
+5
-6
@@ -27,7 +27,6 @@ catalogCol = null;
|
||||
currentCatalogId = null;
|
||||
currentCatalogName = null;
|
||||
|
||||
delegator = request.getAttribute("delegator");
|
||||
cart = ShoppingCartEvents.getCartObject(request);
|
||||
productStoreId = cart.getProductStoreId();
|
||||
partyId = cart.getOrderPartyId();
|
||||
@@ -38,13 +37,13 @@ if ("SALES_ORDER".equals(cart.getOrderType())) {
|
||||
catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStoreId, partyId);
|
||||
} else {
|
||||
catalogCol = CatalogWorker.getAllCatalogIds(request);
|
||||
if (UtilValidate.isEmpty(currentCatalogId) && catalogCol.size() > 0) {
|
||||
currentCatalogId = (String) catalogCol.get(0);
|
||||
if (!currentCatalogId && catalogCol) {
|
||||
currentCatalogId = catalogCol.get(0);
|
||||
}
|
||||
session.setAttribute("CURRENT_CATALOG_ID", currentCatalogId);
|
||||
}
|
||||
currentCatalogName = CatalogWorker.getCatalogName(request, currentCatalogId);
|
||||
|
||||
context.put("catalogCol", catalogCol);
|
||||
context.put("currentCatalogId", currentCatalogId);
|
||||
context.put("currentCatalogName", currentCatalogName);
|
||||
context.catalogCol = catalogCol;
|
||||
context.currentCatalogId = currentCatalogId;
|
||||
context.currentCatalogName = currentCatalogName;
|
||||
+13
-13
@@ -27,21 +27,21 @@ import org.ofbiz.product.catalog.*;
|
||||
import org.ofbiz.product.feature.*;
|
||||
import org.ofbiz.product.product.*;
|
||||
|
||||
module = "keywordsearch.bsh";
|
||||
module = "KeywordSearch.groovy";
|
||||
|
||||
// note: this can be run multiple times in the same request without causing problems, will check to see on its own if it has run again
|
||||
ProductSearchSession.processSearchParameters(parameters, request);
|
||||
prodCatalogId = CatalogWorker.getCurrentCatalogId(request);
|
||||
Map result = ProductSearchSession.getProductSearchResult(request, delegator, prodCatalogId);
|
||||
result = ProductSearchSession.getProductSearchResult(request, delegator, prodCatalogId);
|
||||
|
||||
context.put("productIds", result.get("productIds"));
|
||||
context.put("viewIndex", result.get("viewIndex"));
|
||||
context.put("viewSize", result.get("viewSize"));
|
||||
context.put("listSize", result.get("listSize"));
|
||||
context.put("lowIndex", result.get("lowIndex"));
|
||||
context.put("highIndex", result.get("highIndex"));
|
||||
context.put("paging", result.get("paging"));
|
||||
context.put("previousViewSize", result.get("previousViewSize"));
|
||||
context.put("searchCategory", result.get("searchCategory"));
|
||||
context.put("searchConstraintStrings", result.get("searchConstraintStrings"));
|
||||
context.put("searchSortOrderString", result.get("searchSortOrderString"));
|
||||
context.productIds = result.productIds;
|
||||
context.viewIndex = result.viewIndex;
|
||||
context.viewSize = result.viewSize;
|
||||
context.listSize = result.listSize;
|
||||
context.lowIndex = result.lowIndex;
|
||||
context.highIndex = result.highIndex;
|
||||
context.paging = result.paging;
|
||||
context.previousViewSize = result.previousViewSize;
|
||||
context.searchCategory = result.searchCategory;
|
||||
context.searchConstraintStrings = result.searchConstraintStrings;
|
||||
context.searchSortOrderString = result.searchSortOrderString;
|
||||
+4
-4
@@ -33,7 +33,7 @@ if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) {
|
||||
searchOperator = "OR";
|
||||
}
|
||||
|
||||
context.put("currentCatalogId", currentCatalogId);
|
||||
context.put("searchCategoryId", searchCategoryId);
|
||||
context.put("otherSearchProdCatalogCategories", otherSearchProdCatalogCategories);
|
||||
context.put("searchOperator", searchOperator);
|
||||
context.currentCatalogId = currentCatalogId;
|
||||
context.searchCategoryId = searchCategoryId;
|
||||
context.otherSearchProdCatalogCategories = otherSearchProdCatalogCategories;
|
||||
context.searchOperator = searchOperator;
|
||||
+10
-11
@@ -28,28 +28,27 @@ import org.ofbiz.product.store.ProductStoreWorker;
|
||||
import org.ofbiz.base.util.*;
|
||||
|
||||
currencyUomId = ShoppingCartEvents.getCartObject(request).getCurrency();
|
||||
product = context.get("product");
|
||||
product = context.product;
|
||||
|
||||
if (product != null) {
|
||||
configWrapper = ProductConfigWorker.getProductConfigWrapper(product.getString("productId"), currencyUomId, request);
|
||||
if (product) {
|
||||
configWrapper = ProductConfigWorker.getProductConfigWrapper(product.productId, currencyUomId, request);
|
||||
ProductConfigWorker.fillProductConfigWrapper(configWrapper, request);
|
||||
|
||||
if (!configWrapper.isCompleted()) {
|
||||
configId = request.getParameter("configId");
|
||||
if (UtilValidate.isNotEmpty(configId)) {
|
||||
if (configId) {
|
||||
configWrapper.loadConfig(delegator, configId);
|
||||
} else {
|
||||
configWrapper.setDefaultConfig();
|
||||
}
|
||||
|
||||
}
|
||||
ProductConfigWorker.storeProductConfigWrapper(configWrapper, delegator);
|
||||
if (!ProductStoreWorker.isStoreInventoryAvailable(request, configWrapper, 1.0)) {
|
||||
context.put("productNotAvailable", "Y");
|
||||
context.productNotAvailable = "Y";
|
||||
}
|
||||
context.put("configwrapper", configWrapper);
|
||||
context.put("configId", configWrapper.getConfigId());
|
||||
context.put("totalPrice", configWrapper.getTotalPrice());
|
||||
context.put("renderSingleChoiceWithRadioButtons", "Y");
|
||||
context.put("showOffsetPrice", "Y");
|
||||
context.configwrapper = configWrapper;
|
||||
context.configId = configWrapper.getConfigId();
|
||||
context.totalPrice = configWrapper.getTotalPrice();
|
||||
context.renderSingleChoiceWithRadioButtons = "Y";
|
||||
context.showOffsetPrice = "Y";
|
||||
}
|
||||
+35
-43
@@ -27,94 +27,86 @@ import org.ofbiz.product.category.*;
|
||||
import org.ofbiz.product.product.ProductWorker;
|
||||
import org.ofbiz.product.product.ProductContentWrapper;
|
||||
|
||||
dispatcher = request.getAttribute("dispatcher");
|
||||
delegator = request.getAttribute("delegator");
|
||||
contentPathPrefix = CatalogWorker.getContentPathPrefix(request);
|
||||
catalogName = CatalogWorker.getCatalogName(request);
|
||||
currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
|
||||
requestParams = UtilHttp.getParameterMap(request);
|
||||
|
||||
detailScreen = "productdetail";
|
||||
productId = requestParams.get("product_id");
|
||||
if (UtilValidate.isEmpty(productId)) productId = request.getAttribute("product_id");
|
||||
productId = requestParams.product_id ?: request.getAttribute("product_id");
|
||||
|
||||
/*
|
||||
* NOTE JLR 20070221 this should be done using the same method than in add to cart. I will do it like that and remove all this after.
|
||||
*
|
||||
if (productId != null) {
|
||||
if (productId) {
|
||||
previousParams = session.getAttribute("_PREVIOUS_PARAMS_");
|
||||
if (previousParams != null && previousParams.length() > 0) {
|
||||
previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, UtilMisc.toList("product_id"));
|
||||
previousParams = previousParams + "&product_id=" + productId;
|
||||
if (previousParams) {
|
||||
previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, ["product_id"]);
|
||||
previousParams += "&product_id=" + productId;
|
||||
} else {
|
||||
previousParams = "product_id=" + productId;
|
||||
}
|
||||
session.setAttribute("_PREVIOUS_PARAMS_", previousParams); // for login
|
||||
context.put("previousParams", previousParams);
|
||||
context.previousParams = previousParams;
|
||||
}*/
|
||||
|
||||
// get the product entity
|
||||
if (productId != null) {
|
||||
product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId));
|
||||
|
||||
if (productId) {
|
||||
product = delegator.findByPrimaryKeyCache("Product", [productId : productId]);
|
||||
|
||||
// first make sure this isn't a variant that has an associated virtual product, if it does show that instead of the variant
|
||||
virtualProductId = ProductWorker.getVariantVirtualId(product);
|
||||
if (virtualProductId != null) {
|
||||
if (virtualProductId) {
|
||||
productId = virtualProductId;
|
||||
product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId));
|
||||
product = delegator.findByPrimaryKeyCache("Product", [productId : productId]);
|
||||
}
|
||||
|
||||
context.put("productId", productId);
|
||||
|
||||
|
||||
context.productId = productId;
|
||||
|
||||
// now check to see if there is a view allow category and if this product is in it...
|
||||
if (product != null) {
|
||||
if (product) {
|
||||
viewProductCategoryId = CatalogWorker.getCatalogViewAllowCategoryId(delegator, currentCatalogId);
|
||||
if (viewProductCategoryId != null) {
|
||||
if (viewProductCategoryId) {
|
||||
if (!CategoryWorker.isProductInCategory(delegator, productId, viewProductCategoryId)) {
|
||||
// a view allow productCategoryId was found, but the product is not in the category, axe it...
|
||||
product = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (product != null) {
|
||||
context.put("product", product);
|
||||
ProductContentWrapper contentWrapper = new ProductContentWrapper(product, request);
|
||||
|
||||
if (product) {
|
||||
context.product = product;
|
||||
contentWrapper = new ProductContentWrapper(product, request);
|
||||
context.put("title", contentWrapper.get("PRODUCT_NAME"));
|
||||
context.put("metaDescription", contentWrapper.get("DESCRIPTION"));
|
||||
|
||||
keywords = new ArrayList();
|
||||
keywords.add(product.getString("productName"));
|
||||
keywords = [];
|
||||
keywords.add(product.productName);
|
||||
keywords.add(catalogName);
|
||||
members = delegator.findByAndCache("ProductCategoryMember", UtilMisc.toMap("productId", productId));
|
||||
membersIter = members.iterator();
|
||||
while (membersIter.hasNext()) {
|
||||
member = membersIter.next();
|
||||
members = delegator.findByAndCache("ProductCategoryMember", [productId : productId]);
|
||||
members.each { member ->
|
||||
category = member.getRelatedOneCache("ProductCategory");
|
||||
keywords.add(category.getString("description"));
|
||||
keywords.add(category.description);
|
||||
}
|
||||
context.put("metaKeywords", StringUtil.join(keywords, ", "));
|
||||
|
||||
context.metaKeywords = StringUtil.join(keywords, ", ");
|
||||
|
||||
// Set the default template for aggregated product (product component configurator ui)
|
||||
if (product.getString("productTypeId") != null && product.getString("productTypeId").equals("AGGREGATED") && configproductdetailScreen != null) {
|
||||
if (product.productTypeId && "AGGREGATED".equals(product.productTypeId) && configproductdetailScreen) {
|
||||
detailScreen = configproductdetailScreen;
|
||||
}
|
||||
|
||||
productTemplate = product.getString("detailScreen");
|
||||
if (productTemplate != null && productTemplate.length() > 0) {
|
||||
productTemplate = product.detailScreen;
|
||||
if (productTemplate) {
|
||||
detailScreen = productTemplate;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check the catalog's template path and update
|
||||
templatePathPrefix = CatalogWorker.getTemplatePathPrefix(request);
|
||||
if (templatePathPrefix != null) {
|
||||
if (templatePathPrefix) {
|
||||
detailScreen = templatePathPrefix + detailScreen;
|
||||
}
|
||||
|
||||
// set the template for the view
|
||||
context.put("detailScreen", detailScreen);
|
||||
}
|
||||
|
||||
|
||||
// set the template for the view
|
||||
context.detailScreen = detailScreen;
|
||||
@@ -138,7 +138,7 @@ under the License.
|
||||
|
||||
<set field="title" value="Show Promotion Details"/>
|
||||
<set field="productsummaryScreen" value="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productsummary"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.groovy"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/ShowPromotionDetails.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="CommonOrderEntryDecorator" location="component://order/widget/ordermgr/OrderEntryCommonScreens.xml">
|
||||
|
||||
@@ -25,7 +25,7 @@ under the License.
|
||||
<screen name="choosecatalog">
|
||||
<section>
|
||||
<actions>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/choosecatalog.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ChooseCatalog.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/catalog/choosecatalog.ftl"/></html></platform-specific>
|
||||
@@ -35,7 +35,7 @@ under the License.
|
||||
<screen name="keywordsearchbox">
|
||||
<section>
|
||||
<actions>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearchoptions.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearchOptions.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/catalog/keywordsearchbox.ftl"/></html></platform-specific>
|
||||
@@ -68,7 +68,7 @@ under the License.
|
||||
<screen name="breadcrumbs">
|
||||
<section>
|
||||
<actions>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/breadcrumbs.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Breadcrumbs.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/catalog/breadcrumbs.ftl"/></html></platform-specific>
|
||||
@@ -97,7 +97,7 @@ under the License.
|
||||
<screen name="category-include">
|
||||
<section>
|
||||
<actions>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<section>
|
||||
@@ -118,7 +118,7 @@ under the License.
|
||||
<section>
|
||||
<actions>
|
||||
<set field="productsummaryScreen" value="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productsummary"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/categorydetail.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/catalog/categorydetail.ftl"/></html></platform-specific>
|
||||
@@ -134,7 +134,7 @@ under the License.
|
||||
<set field="layoutSettings.javaScripts[]" value="/images/prototypejs/prototype.js" global="true"/>
|
||||
<set field="title-property" value="PageTitleProductPage"/>
|
||||
<set field="configproductdetailScreen" value="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#configproductdetail"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="CommonOrderCatalogDecorator" location="component://order/widget/ordermgr/OrderEntryCommonScreens.xml">
|
||||
@@ -179,7 +179,7 @@ under the License.
|
||||
<set field="productsummaryScreen" value="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productsummary"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh"/>
|
||||
<!--<script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/prepareconfigform.bsh"/>-->
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/prepareconfigform.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/PrepareConfigForm.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<include-screen name="breadcrumbs"/>
|
||||
@@ -197,7 +197,7 @@ under the License.
|
||||
|
||||
<set field="title-property" value="PageTitleSearchResults"/>
|
||||
<set field="productsummaryScreen" value="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productsummary"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearch.bsh"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearch.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="CommonOrderCatalogDecorator" location="component://order/widget/ordermgr/OrderEntryCommonScreens.xml">
|
||||
@@ -216,7 +216,7 @@ under the License.
|
||||
|
||||
<set field="title-property" value="PageTitleAdvancedSearch"/>
|
||||
<set field="headerItem" value="Advanced Search"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.groovy"/>
|
||||
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/AdvancedSearchOptions.groovy"/>
|
||||
|
||||
<entity-condition entity-name="PartyRoleAndPartyDetail" list-name="supplerPartyRoleAndPartyDetails">
|
||||
<condition-expr field-name="roleTypeId" value="SUPPLIER"/>
|
||||
|
||||
Reference in New Issue
Block a user