Skip to content

Commit

Permalink
deployment of the base component elements
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreSmits committed Aug 2, 2016
1 parent 1c2f405 commit 539752f
Show file tree
Hide file tree
Showing 370 changed files with 38,484 additions and 0 deletions.
1 change: 1 addition & 0 deletions patches/production/readme
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Put your component specific patch references here.
1 change: 1 addition & 0 deletions patches/qa/readme
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Put your component specific patch references here.
1 change: 1 addition & 0 deletions patches/test/readme
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Put your component specific patch references here.
1 change: 1 addition & 0 deletions script/readme
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Put your component specific scripts here.
30 changes: 30 additions & 0 deletions servicedef/services.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
(C) Copyright 2015 Somonar B.V.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
<description>oshop Services</description>
<vendor></vendor>
<version>1.0</version>

<service name="noSyntaxError" engine="interface">
<description>
Dummy service to prevent empty files and syntax error - Remove when the 1st real service will be added here
</description>
</service>

</services>
34 changes: 34 additions & 0 deletions src/org/apache/ofbiz/ecommerce/Login.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import org.ofbiz.base.util.*;
import org.ofbiz.common.CommonWorkers;
import org.ofbiz.webapp.control.*;

context.autoUserLogin = session.getAttribute("autoUserLogin");
context.autoLogoutUrl = LoginWorker.makeLoginUrl(request, "autoLogout");

previousParams = session.getAttribute("_PREVIOUS_PARAMS_");
if (previousParams) {
previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, ["USERNAME", "PASSWORD"]);
previousParams = "?" + previousParams;
} else {
previousParams = "";
}
context.previousParams = previousParams;
42 changes: 42 additions & 0 deletions src/org/apache/ofbiz/ecommerce/Main.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import org.ofbiz.product.catalog.*;

catalogId = CatalogWorker.getCurrentCatalogId(request);
promoCat = CatalogWorker.getCatalogPromotionsCategoryId(request, catalogId);
request.setAttribute("productCategoryId", promoCat);

/* NOTE DEJ20070220 woah, this is doing weird stuff like always showing the last viewed category when going to the main page;
* It appears this was done for to make it go back to the desired category after logging in, but this is NOT the place to do that,
* and IMO this is an unacceptable side-effect.
*
* 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.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.
*
productCategoryId = session.getAttribute("productCategoryId");
if (!productCategoryId) {
request.setAttribute("productCategoryId", promoCat);
} else {
request.setAttribute("productCategoryId", productCategoryId);
}
*/
78 changes: 78 additions & 0 deletions src/org/apache/ofbiz/ecommerce/cart/ShowCart.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.product.catalog.CatalogWorker;
import org.ofbiz.order.shoppingcart.product.ProductDisplayWorker;
import org.ofbiz.order.shoppingcart.ShoppingCartEvents;
import org.ofbiz.product.store.ProductStoreWorker;
import org.ofbiz.entity.condition.*;
import org.ofbiz.entity.util.EntityUtil;

// Get the Cart and Prepare Size
shoppingCart = ShoppingCartEvents.getCartObject(request);
context.shoppingCartSize = shoppingCart?.size() ?: 0;
context.shoppingCart = shoppingCart;

context.productStore = ProductStoreWorker.getProductStore(request);

if (parameters.add_product_id) { // check if a parameter is passed
add_product_id = parameters.add_product_id;
product = from("Product").where("productId", add_product_id).cache(true).queryOne();
context.product = product;
}

// get all the possible gift wrap options
allgiftWraps = from("ProductFeature").where("productFeatureTypeId", "GIFT_WRAP").orderBy("defaultSequenceNum").queryList();
context.allgiftWraps = allgiftWraps;

// get the shopping lists for the logged in user
if (userLogin) {
allShoppingLists = from("ShoppingList").where(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, userLogin.partyId),
EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")).orderBy("listName").queryList();
context.shoppingLists = allShoppingLists;
}

// Get Cart Associated Products Data
associatedProducts = ProductDisplayWorker.getRandomCartProductAssoc(request, true);
context.associatedProducts = associatedProducts;

context.contentPathPrefix = CatalogWorker.getContentPathPrefix(request);

//Get Cart Items
shoppingCartItems = shoppingCart.items();

if(shoppingCartItems) {
shoppingCartItems.each { shoppingCartItem ->
if (shoppingCartItem.getProductId()) {
if (shoppingCartItem.getParentProductId()) {
parentProductId = shoppingCartItem.getParentProductId();
} else {
parentProductId = shoppingCartItem.getProductId();
}
context.parentProductId = parentProductId;
}
productCategoryMembers = from("ProductCategoryMember").where("productId", parentProductId).queryList();
if (productCategoryMembers) {
productCategoryMember = EntityUtil.getFirst(productCategoryMembers);
productCategory = productCategoryMember.getRelatedOne("ProductCategory", false);
context.productCategory = productCategory;
}
}
}
58 changes: 58 additions & 0 deletions src/org/apache/ofbiz/ecommerce/cart/ShowPromoText.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.order.shoppingcart.product.ProductPromoWorker;

promoShowLimit = 3;

//Get Promo Text Data
productPromosAll = ProductPromoWorker.getStoreProductPromos(delegator, dispatcher, request);
//Make sure that at least one promo has non-empty promoText
showPromoText = false;
promoToShow = 0;
productPromosAllShowable = new ArrayList(productPromosAll.size());
productPromosAll.each { productPromo ->
promoText = productPromo.promoText;

if (promoText && !"N".equals(productPromo.showToCustomer)) {
showPromoText = true;
promoToShow++;
productPromosAllShowable.add(productPromo);
}
}

// now slim it down to promoShowLimit
productPromosRandomTemp = new ArrayList(productPromosAllShowable);
productPromos = null;
if (productPromosRandomTemp.size() > promoShowLimit) {
productPromos = new ArrayList(promoShowLimit);
for (i = 0; i < promoShowLimit; i++) {
randomIndex = Math.round(java.lang.Math.random() * (productPromosRandomTemp.size() - 1)) as int;
productPromos.add(productPromosRandomTemp.remove(randomIndex));
}
} else {
productPromos = productPromosRandomTemp;
}

context.promoShowLimit = promoShowLimit;
context.productPromosAllShowable = productPromosAllShowable;
context.productPromos = productPromos;
context.showPromoText = showPromoText;
context.promoToShow = promoToShow;
42 changes: 42 additions & 0 deletions src/org/apache/ofbiz/ecommerce/catalog/BestSellingCategory.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.product.catalog.*;
import org.ofbiz.product.category.*;

catalogId = CatalogWorker.getCurrentCatalogId(request);
bestSellerCates = [];

if (UtilValidate.isNotEmpty(catalogId)) {
prodCatalogCategoryList = CatalogWorker.getProdCatalogCategories(request, catalogId, "PCCT_BEST_SELL");
if (prodCatalogCategoryList.size() > 0) {
for (int i = 0; i < prodCatalogCategoryList.size(); i++) {
prodCatalogCategory = prodCatalogCategoryList[i];
productCategoryId = prodCatalogCategory.getString("productCategoryId");
childCategoryList = CategoryWorker.getRelatedCategoriesRet(request, "childCategoryList", productCategoryId, true);
if (childCategoryList.size() > 0) {
bestSellerCates.add(childCategoryList);
}
}
}
}

context.productCategoryList = bestSellerCates;
Loading

0 comments on commit 539752f

Please sign in to comment.