|
Author: hansbak
Date: Sat Feb 6 07:16:28 2010 New Revision: 907182 URL: http://svn.apache.org/viewvc?rev=907182&view=rev Log: EbayStore component: - function export product listing to ebay - create product listing with checkfield to use inventory or not. Added: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/ebayApiKeywordSearch.ftl ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/productsearchExport.ftl Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreForms.xml ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreScreens.xml Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java?rev=907182&r1=907181&r2=907182&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java (original) +++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java Sat Feb 6 07:16:28 2010 @@ -177,7 +177,7 @@ return result; } - private static Map buildDataItemsXml(DispatchContext dctx, Map context, StringBuffer dataItemsXml, String token, GenericValue prod) { + public static Map buildDataItemsXml(DispatchContext dctx, Map context, StringBuffer dataItemsXml, String token, GenericValue prod) { Locale locale = (Locale)context.get("locale"); try { Delegator delegator = dctx.getDelegator(); @@ -220,13 +220,16 @@ } // Buy it now is the optional value for a product that you send to eBay. Once this value is entered by user - this option allow user to win auction immediately. - GenericValue buyItNowPriceValue = EntityUtil.getFirst(EntityUtil.filterByDate(prod.getRelatedByAnd("ProductPrice", UtilMisc.toMap("productPricePurposeId", "EBAY", "productPriceTypeId", "MAXIMUM_PRICE")))); - String buyItNowPrice = null; + String buyItNowPrice = (String)context.get("buyItNowPrice");; String buyItNowCurrencyUomId = null; - if (UtilValidate.isNotEmpty(buyItNowPriceValue)) { - buyItNowPrice = buyItNowPriceValue.getString("price"); - buyItNowCurrencyUomId = buyItNowPriceValue.getString("currencyUomId"); + if (UtilValidate.isEmpty(buyItNowPrice)) { + GenericValue buyItNowPriceValue = EntityUtil.getFirst(EntityUtil.filterByDate(prod.getRelatedByAnd("ProductPrice", UtilMisc.toMap("productPricePurposeId", "EBAY", "productPriceTypeId", "MAXIMUM_PRICE")))); + if (UtilValidate.isNotEmpty(buyItNowPriceValue)) { + buyItNowPrice = buyItNowPriceValue.getString("price"); + buyItNowCurrencyUomId = buyItNowPriceValue.getString("currencyUomId"); + } } + Element itemElem = UtilXml.addChildElement(itemRequestElem, "Item", itemDocument); UtilXml.addChildElementValue(itemElem, "Country", (String)context.get("country"), itemDocument); @@ -240,6 +243,32 @@ UtilXml.addChildElementValue(itemElem, "ListingDuration", (String)context.get("listingDuration"), itemDocument); UtilXml.addChildElementValue(itemElem, "Quantity", qnt, itemDocument); + String listingFormat = ""; + if (UtilValidate.isNotEmpty(context.get("listingFormat"))) { + listingFormat = (String) context.get("listingFormat"); + UtilXml.addChildElementValue(itemElem, "ListingType", listingFormat, itemDocument); + } + if (listingFormat.equals("FixedPriceItem")) { + Element startPriceElem = UtilXml.addChildElementValue(itemElem, "StartPrice", startPrice, itemDocument); + if (UtilValidate.isEmpty(startPriceCurrencyUomId)) { + startPriceCurrencyUomId = UtilProperties.getPropertyValue("general.properties", "currency.uom.id.default", "USD"); + } + startPriceElem.setAttribute("currencyID", startPriceCurrencyUomId); + }else{ + Element startPriceElem = UtilXml.addChildElementValue(itemElem, "StartPrice", startPrice, itemDocument); + if (UtilValidate.isEmpty(startPriceCurrencyUomId)) { + startPriceCurrencyUomId = UtilProperties.getPropertyValue("general.properties", "currency.uom.id.default", "USD"); + } + startPriceElem.setAttribute("currencyID", startPriceCurrencyUomId); + if (UtilValidate.isNotEmpty(buyItNowPrice)) { + Element buyNowPriceElem = UtilXml.addChildElementValue(itemElem, "BuyItNowPrice", buyItNowPrice, itemDocument); + if (UtilValidate.isEmpty(buyItNowCurrencyUomId)) { + buyItNowCurrencyUomId = UtilProperties.getPropertyValue("general.properties", "currency.uom.id.default", "USD"); + } + buyNowPriceElem.setAttribute("currencyID", buyItNowCurrencyUomId); + } + } + ProductContentWrapper pcw = new ProductContentWrapper(dctx.getDispatcher(), prod, locale, "text/html"); StringUtil.StringWrapper ebayDescription = pcw.get("EBAY_DESCRIPTION"); if (UtilValidate.isNotEmpty(ebayDescription.toString())) { @@ -262,17 +291,19 @@ Element pictureDetails = UtilXml.addChildElement(itemElem, "PictureDetails", itemDocument); UtilXml.addChildElementValue(pictureDetails, "PictureURL", webSiteUrl + ebayImage, itemDocument); } + setPaymentMethodAccepted(itemDocument, itemElem, context); setMiscDetails(itemDocument, itemElem, context, delegator); - String primaryCategoryId = ""; String categoryCode = (String)context.get("ebayCategory"); + String primaryCategoryId = ""; if (categoryCode != null) { - String[] params = categoryCode.split("_"); - - if (params == null || params.length != 3) { - ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "productsExportToEbay.parametersNotCorrectInGetEbayCategories", locale)); - } else { - primaryCategoryId = params[1]; + if (categoryCode.indexOf("_") != -1) { + String[] params = categoryCode.split("_"); + if (params == null || params.length != 3) { + ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "productsExportToEbay.parametersNotCorrectInGetEbayCategories", locale)); + } + }else{ + primaryCategoryId = categoryCode; } } else { GenericValue productCategoryValue = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("ProductCategoryAndMember", UtilMisc.toMap("productCategoryTypeId", "EBAY_CATEGORY", "productId", prod.getString("productId"))))); @@ -280,22 +311,10 @@ primaryCategoryId = productCategoryValue.getString("categoryName"); } } + Element primaryCatElem = UtilXml.addChildElement(itemElem, "PrimaryCategory", itemDocument); UtilXml.addChildElementValue(primaryCatElem, "CategoryID", primaryCategoryId, itemDocument); - Element startPriceElem = UtilXml.addChildElementValue(itemElem, "StartPrice", startPrice, itemDocument); - if (UtilValidate.isEmpty(startPriceCurrencyUomId)) { - startPriceCurrencyUomId = UtilProperties.getPropertyValue("general.properties", "currency.uom.id.default", "USD"); - } - startPriceElem.setAttribute("currencyID", startPriceCurrencyUomId); - - if (UtilValidate.isNotEmpty(buyItNowPrice)) { - Element buyNowPriceElem = UtilXml.addChildElementValue(itemElem, "BuyItNowPrice", buyItNowPrice, itemDocument); - if (UtilValidate.isEmpty(buyItNowCurrencyUomId)) { - buyItNowCurrencyUomId = UtilProperties.getPropertyValue("general.properties", "currency.uom.id.default", "USD"); - } - buyNowPriceElem.setAttribute("currencyID", buyItNowCurrencyUomId); - } //Debug.logInfo("The generated string is ======= " + UtilXml.writeXmlDocument(itemDocument), module); dataItemsXml.append(UtilXml.writeXmlDocument(itemDocument)); } catch (Exception e) { @@ -566,7 +585,7 @@ return results; } - private static Map exportToEbayResponse(String msg, GenericValue product) { + public static Map exportToEbayResponse(String msg, GenericValue product) { Map result = ServiceUtil.returnSuccess(); try { Document docResponse = UtilXml.readXmlDocument(msg, true); @@ -591,4 +610,11 @@ } return result; } + public static List<String> getProductExportSuccessMessageList(){ + return productExportSuccessMessageList; + } + + public static List<String> getproductExportFailureMessageList(){ + return productExportFailureMessageList; + } } Modified: ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml?rev=907182&r1=907181&r2=907182&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/config/EbayStoreUiLabels.xml Sat Feb 6 07:16:28 2010 @@ -172,7 +172,7 @@ <property key="EbayBlockItemOutOfStock"> <value xml:lang="en">Block items out of stock</value> </property> - + <!-- ebay inventory --> <property key="EbayReserveProductFrom"> <value xml:lang="en">Reserve Product From</value> @@ -186,4 +186,17 @@ <property key="EbayUpdateInventoryStatus"> <value xml:lang="en">Update Inventory Status</value> </property> + <property key="FormFieldTitle_buyItNowPrice"> + <value xml:lang="en">Buy It Now price</value> + <value xml:lang="th">ราà¸à¸²à¸ªà¸¸à¸à¸à¸´</value> + </property> + <property key="eBayOnlineAuction"> + <value xml:lang="en">Online Auction</value> + </property> + <property key="eBayFixedPrice"> + <value xml:lang="en">Fixed Price</value> + </property> + <property key="requireEbayInventory"> + <value xml:lang="en">Require eBay Inventory</value> + </property> </resource> Modified: ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml?rev=907182&r1=907181&r2=907182&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/servicedef/services.xml Sat Feb 6 07:16:28 2010 @@ -252,5 +252,41 @@ <attribute name="quantity" type="BigDecimal" mode="IN" optional="false"></attribute> <attribute name="actionType" type="String" mode="IN" optional="false"></attribute> </service> + <service name="exportProductsFromEbayStore" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebaystore.EbayStore" invoke="exportProductsFromEbayStore" auth="true"> + <description>Export categories in store to eBay store</description> + <attribute name="productStoreId" type="String" mode="IN" optional="false"/> + <attribute name="productId" type="String" mode="IN" optional="false"/> + <attribute type="String" mode="IN" name="webSiteUrl" optional="false"/> + <attribute name="requireEbayInventory" type="String" mode="IN" optional="true"/> + <attribute name="listingTypeAuc" type="String" mode="IN" optional="true"/> + <attribute name="listingDurationAuc" type="String" mode="IN" optional="true"/> + <attribute name="listingTypeFixed" type="String" mode="IN" optional="true"/> + <attribute name="listingDurationFixed" type="String" mode="IN" optional="true"/> + <attribute name="quantity" type="String" mode="IN" optional="false"/> + <attribute name="country" type="String" mode="IN" optional="false"/> + <attribute name="location" type="String" mode="IN" optional="false"/> + <attribute name="payPalEmail" type="String" mode="IN" optional="true"/> + <attribute name="customXml" type="String" mode="IN" optional="false" allow-html="any"/> + <attribute type="String" mode="IN" name="prodCatalogId" optional="true"/> + <attribute type="String" mode="IN" name="productCategoryId" optional="true"/> + <attribute type="String" mode="IN" name="paymentPayPal" optional="true"/> + <attribute type="String" mode="IN" name="paymentVisaMC" optional="true"/> + <attribute type="String" mode="IN" name="paymentAmEx" optional="true"/> + <attribute type="String" mode="IN" name="paymentDiscover" optional="true"/> + <attribute type="String" mode="IN" name="paymentCCAccepted" optional="true"/> + <attribute type="String" mode="IN" name="paymentCashInPerson" optional="true"/> + <attribute type="String" mode="IN" name="paymentCashOnPickup" optional="true"/> + <attribute type="String" mode="IN" name="paymentCOD" optional="true"/> + <attribute type="String" mode="IN" name="paymentCODPrePayDelivery" optional="true"/> + <attribute type="String" mode="IN" name="paymentMOCC" optional="true"/> + <attribute type="String" mode="IN" name="paymentMoneyXferAccepted" optional="true"/> + <attribute type="String" mode="IN" name="paymentPersonalCheck" optional="true"/> + </service> + <service name="updateEbayProductStoreInventory" default-entity-name="EbayProductStoreInventory" engine="entity-auto" invoke="update" auth="true"> + <description>Update EbayProductStoreInventory entity</description> + <auto-attributes include="pk" mode="IN" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + </service> </services> \ No newline at end of file Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java?rev=907182&r1=907181&r2=907182&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java Sat Feb 6 07:16:28 2010 @@ -23,6 +23,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; +import java.math.BigDecimal; import java.net.HttpURLConnection; import java.net.URL; import java.util.Calendar; @@ -1633,4 +1634,123 @@ } return result; } + public static Map<String, Object> exportProductsFromEbayStore(DispatchContext dctx, Map context){ + Map<String,Object> result = FastMap.newInstance(); + Locale locale = (Locale) context.get("locale"); + Delegator delegator = dctx.getDelegator(); + LocalDispatcher dispatcher = dctx.getDispatcher(); + Map<String, Object> eBayConfigResult = EbayHelper.buildEbayConfig(context, delegator); + Map response = null; + try{ + GenericValue product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId",context.get("productId").toString())); + int intAtp = 1; + String facilityId = ""; + if (UtilValidate.isNotEmpty(context.get("requireEbayInventory")) && "on".equals(context.get("requireEbayInventory").toString())) { + GenericValue ebayProductStore = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("EbayProductStoreInventory", UtilMisc.toMap("productStoreId", context.get("productStoreId").toString(), "productId", context.get("productId"))))); + if (UtilValidate.isNotEmpty(ebayProductStore)) { + facilityId = ebayProductStore.getString("facilityId"); + BigDecimal atp = ebayProductStore.getBigDecimal("availableToPromiseListing"); + intAtp = atp.intValue(); + if (intAtp == 0) { + result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_FAIL); + result.put(ModelService.ERROR_MESSAGE, "ATP is not enough, can not create listing."); + } + } + } + GenericValue userLogin = (GenericValue) context.get("userLogin"); + if (UtilValidate.isNotEmpty(context.get("productCategoryId"))) { + GenericValue prodCategoryMember = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("ProductCategoryMember", UtilMisc.toMap("productCategoryId", context.get("productCategoryId"),"productId", context.get("productId"))))); + if (UtilValidate.isNotEmpty(prodCategoryMember)) { + GenericValue prodCategoryRole = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("ProductCategoryRole", UtilMisc.toMap("productCategoryId", prodCategoryMember.get("productCategoryId").toString(), "partyId", userLogin.get("partyId"),"roleTypeId", "EBAY_ACCOUNT")))); + if (UtilValidate.isNotEmpty(prodCategoryRole)) { + context.put("ebayCategory", prodCategoryRole.get("comments")); + } else { + result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_FAIL); + result.put(ModelService.ERROR_MESSAGE, "Category not found for this product on ebay."); + } + } + } else { + List<GenericValue> prodCategoryMember = EntityUtil.filterByDate(delegator.findByAnd("ProductCategoryMember", UtilMisc.toMap("productId", context.get("productId")))); + Iterator prodCategoryMemberIter = prodCategoryMember.iterator(); + while (prodCategoryMemberIter.hasNext()) { + GenericValue prodCategory = (GenericValue) prodCategoryMemberIter.next(); + GenericValue prodCatalogCategory = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("ProdCatalogCategory", UtilMisc.toMap("prodCatalogId", context.get("prodCatalogId"), "productCategoryId", prodCategory.get("productCategoryId").toString())))); + if (UtilValidate.isNotEmpty(prodCatalogCategory)) { + GenericValue prodCategoryRole = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("ProductCategoryRole", UtilMisc.toMap("productCategoryId", prodCatalogCategory.get("productCategoryId").toString(), "partyId", userLogin.get("partyId"),"roleTypeId", "EBAY_ACCOUNT")))); + if (UtilValidate.isNotEmpty(prodCategoryRole)) { + context.put("ebayCategory", prodCategoryRole.get("comments")); + } else { + result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_FAIL); + result.put(ModelService.ERROR_MESSAGE, "Category not found for this product on ebay."); + } + } + } + } + + if (intAtp != 0) { + if (UtilValidate.isNotEmpty(context.get("listingTypeAuc")) && "on".equals(context.get("listingTypeAuc").toString())) { + context.put("listingFormat", "Chinese"); + context.put("listingDuration", context.get("listingDurationAuc").toString()); + + StringBuffer dataItemsXml = new StringBuffer(); + Map resultMap = ProductsExportToEbay.buildDataItemsXml(dctx, context, dataItemsXml, eBayConfigResult.get("token").toString(), product); + if (!ServiceUtil.isFailure(resultMap)) { + response = postItem(eBayConfigResult.get("xmlGatewayUri").toString(), dataItemsXml, eBayConfigResult.get("devID").toString(), eBayConfigResult.get("appID").toString(), eBayConfigResult.get("certID").toString(), "AddItem", eBayConfigResult.get("compatibilityLevel").toString(), eBayConfigResult.get("siteID").toString()); + if (ServiceUtil.isFailure(response)) { + return ServiceUtil.returnFailure(ServiceUtil.getErrorMessage(response)); + } + if (UtilValidate.isNotEmpty(response)) { + ProductsExportToEbay.exportToEbayResponse((String) response.get("successMessage"), product); + } + } else { + return ServiceUtil.returnFailure(ServiceUtil.getErrorMessage(resultMap)); + } + } + + if (UtilValidate.isNotEmpty(context.get("listingTypeFixed")) && "on".equals(context.get("listingTypeFixed").toString())) { + context.put("listingFormat", "FixedPriceItem"); + context.put("listingDuration", context.get("listingDurationFixed").toString()); + + StringBuffer dataItemsXml = new StringBuffer(); + Map resultMap = ProductsExportToEbay.buildDataItemsXml(dctx, context, dataItemsXml, eBayConfigResult.get("token").toString(), product); + if (!ServiceUtil.isFailure(resultMap)) { + response = postItem(eBayConfigResult.get("xmlGatewayUri").toString(), dataItemsXml, eBayConfigResult.get("devID").toString(), eBayConfigResult.get("appID").toString(), eBayConfigResult.get("certID").toString(), "AddItem", eBayConfigResult.get("compatibilityLevel").toString(), eBayConfigResult.get("siteID").toString()); + if (ServiceUtil.isFailure(response)) { + return ServiceUtil.returnFailure(ServiceUtil.getErrorMessage(response)); + } + if (UtilValidate.isNotEmpty(response)) { + ProductsExportToEbay.exportToEbayResponse((String) response.get("successMessage"), product); + } + } else { + return ServiceUtil.returnFailure(ServiceUtil.getErrorMessage(resultMap)); + } + } + } + + + if (UtilValidate.isNotEmpty(productExportEbay.getProductExportSuccessMessageList())) { + if ((facilityId != "") && (intAtp != 0)) { + int newAtp = intAtp - 1; + Map<String,Object> inMap = FastMap.newInstance(); + inMap.put("productStoreId", context.get("productStoreId").toString()); + inMap.put("facilityId", facilityId); + inMap.put("productId",context.get("productId")); + inMap.put("availableToPromiseListing", new BigDecimal(newAtp)); + inMap.put("userLogin",context.get("userLogin")); + dispatcher.runSync("updateEbayProductStoreInventory", inMap); + } + result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); + result.put(ModelService.SUCCESS_MESSAGE, "Export products listing success.."); + } + + if (UtilValidate.isNotEmpty(productExportEbay.getproductExportFailureMessageList())) { + result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_FAIL); + result.put(ModelService.ERROR_MESSAGE_LIST, productExportEbay.getproductExportFailureMessageList()); + } + + }catch (Exception e) { + return ServiceUtil.returnError(e.getMessage()); + } + return result; + } } \ No newline at end of file Modified: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml?rev=907182&r1=907181&r2=907182&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/controller.xml Sat Feb 6 07:16:28 2010 @@ -170,6 +170,22 @@ <event type="service" invoke="updateEbayProductQtyReserved"/> <response name="success" type="view" value="ebayLoadStoreInventory"/> </request-map> + <request-map uri="exportProductListing"> + <security https="true" auth="true"/> + <response name="success" type="view" value="exportProductListing"/> + <response name="error" type="view" value="exportProductListing"/> + </request-map> + <request-map uri="productsearch"> + <security https="true" auth="true"/> + <response name="success" type="view" value="productsearch"/> + <response name="error" type="view" value="productsearch"/> + </request-map> + <request-map uri="exportProductsFromEbayStore"> + <security https="true" auth="true"/> + <event type="service-multi" invoke="exportProductsFromEbayStore"/> + <response name="success" type="view" value="exportProductListing"/> + <response name="error" type="view" value="exportProductListing"/> + </request-map> <!-- end of request mappings --> <!-- View Mappings --> @@ -196,5 +212,8 @@ <view-map name="ebayLoadStoreInventory" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#ebayLoadStoreInventory"/> <view-map name="reserveEbayProductInventory" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#reserveEbayProductInventory"/> <view-map name="updateQuantityReserved" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#updateQuantityReserved"/> + + <view-map name="exportProductListing" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#exportProductListing"/> + <view-map name="productsearch" type="screen" page="component://ebaystore/widget/EbayStoreScreens.xml#productsearchexport"/> <!-- end of view mappings --> </site-conf> Added: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/ebayApiKeywordSearch.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/ebayApiKeywordSearch.ftl?rev=907182&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/ebayApiKeywordSearch.ftl (added) +++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/ebayApiKeywordSearch.ftl Sat Feb 6 07:16:28 2010 @@ -0,0 +1,143 @@ +<#-- +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. +--> + +<script type="text/javascript"> +//<![CDATA[ + function selectChange(formId, elementId) { + if (elementId.id == 'searchCatalogId') { + if ($('searchCategoryId').selectedIndex) { + $('searchCategoryId')[$('searchCategoryId').selectedIndex].value = ""; + } else { + $('searchCategoryId').value = ""; + } + } + formId.action="<@ofbizUrl>main</@ofbizUrl>"; + formId.submit(); + } + function submit (id) { + var formId = id; + if(!$('searchCatalogId').empty()){ + $(formId).submit(); + } else { + if($('searchCatalogId').empty()) { + $('catalogErrorMessage').show(); + } + } + } +//]]> +</script> +<div class="screenlet"> + <div class="screenlet-title-bar"> + <h3>${uiLabelMap.ProductAdvancedSearchInCategory}</h3> + </div> + <div class="screenlet-body"> + <form id="productSearchform" method="post" action="<@ofbizUrl>productsearch</@ofbizUrl>" style="margin: 0;"> + <input type="hidden" name="productStoreId" value="${parameters.productStoreId?if_exists}"> + <fieldset> + <input type="hidden" name="VIEW_SIZE" value="25"/> + <input type="hidden" name="PAGING" value="Y"/> + <input type="hidden" name="noConditionFind" value="Y"/> + <table cellspacing="0" class="basic-table"> + <tr> + <td class="label" align="right" valign="top"> + ${uiLabelMap.ProductCatalog}: + </td> + <td valign="middle"> + <div> + <select name="SEARCH_CATALOG_ID" id="searchCatalogId" onchange="javascript:selectChange($('advToKeywordSearchform'), $('searchCatalogId'));" class="required"> + <#list prodCatalogList as prodCatalog> + <#assign displayDesc = prodCatalog.catalogName?default("${uiLabelMap.ProductNoDescription}") /> + <#if (18 < displayDesc?length)> + <#assign displayDesc = displayDesc[0..15] + "..."> + </#if> + <option value="${prodCatalog.prodCatalogId}" <#if searchCatalogId?if_exists == prodCatalog.prodCatalogId> selected="selected"</#if>>${displayDesc} [${prodCatalog.prodCatalogId}]</option> + </#list> + </select> + <span id="catalogErrorMessage" style="display:none;" class="errorMessage">${uiLabelMap.CommonRequired}</span> + </div> + </td> + </tr> + <tr> + <td class="label" align="right" valign="top"> + ${uiLabelMap.ProductCategory}: + </td> + <td valign="middle"> + <div> + <#if categoryIds?has_content> + <select name="SEARCH_CATEGORY_ID" id="searchCategoryId"> + <option value="">- ${uiLabelMap.ProductAnyCategory} -</option> + <#list categoryIds as categoryId> + <#assign productCategory = delegator.findOne("ProductCategory", {"productCategoryId" : categoryId}, true) /> + <#assign displayDesc = productCategory.categoryName?default("${uiLabelMap.ProductNoDescription}") /> + <#if (18 < displayDesc?length)> + <#assign displayDesc = displayDesc[0..15] + "..."> + </#if> + <option value="${productCategory.productCategoryId}">${displayDesc} [${productCategory.productCategoryId}]</option> + </#list> + </select> + <#else> + <input type="text" id="searchCategoryId" name="SEARCH_CATEGORY_ID" size="20" maxlength="20" value="${requestParameters.SEARCH_CATEGORY_ID?if_exists}" /> + <a href="javascript:call_fieldlookup2($('searchCategoryId'),'LookupProductCategory');"><img src='/images/fieldlookup.gif' width='15' height='14' border='0' alt="${uiLabelMap.CommonClickHereForFieldLookup}" /></a> + </#if> + </div> + </td> + </tr> + <tr> + <td class="label" align="right" valign="top"> + ${uiLabelMap.ProductProductName}: + </td> + <td valign="middle"> + <div> + <input type="text" name="SEARCH_PRODUCT_NAME" size="20" value="${requestParameters.SEARCH_PRODUCT_NAME?if_exists}" /> + </div> + </td> + </tr> + <tr> + <td class="label" align="right" valign="top"> + ${uiLabelMap.ProductInternalName}: + </td> + <td valign="middle"> + <div> + <input type="text" name="SEARCH_INTERNAL_PROD_NAME" size="20" value="${requestParameters.SEARCH_INTERNAL_PROD_NAME?if_exists}" /> + </div> + </td> + </tr> + <tr> + <td class="label" align="right" valign="top"> + ${uiLabelMap.ProductKeywords}: + </td> + <td valign="middle"> + <div> + <input type="text" name="SEARCH_STRING" size="40" value="${requestParameters.SEARCH_STRING?if_exists}" /> + ${uiLabelMap.CommonAny}<input type="radio" name="SEARCH_OPERATOR" value="OR" <#if searchOperator == "OR">checked</#if> /> + ${uiLabelMap.CommonAll}<input type="radio" name="SEARCH_OPERATOR" value="AND" <#if searchOperator == "AND">checked</#if> /> + </div> + </td> + </tr> + <tr> + <td align="center" colspan="2"> + <hr/> + <a href="javascript:submit($('productSearchform'));" class="buttontext">${uiLabelMap.CommonFind}</a> + </td> + </tr> + </table> + </fieldset> + </form> + </div> +</div> \ No newline at end of file Added: ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/productsearchExport.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/productsearchExport.ftl?rev=907182&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/productsearchExport.ftl (added) +++ ofbiz/trunk/specialpurpose/ebaystore/webapp/ebaystore/store/productsearchExport.ftl Sat Feb 6 07:16:28 2010 @@ -0,0 +1,200 @@ +<#-- +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. +--> +<script language="JavaScript" type="text/javascript"> + function changeEbayDuration(value) { + var listingDuration = document.ProductsExportToEbay.listingDuration; + listingDuration.options.length = 0; + for (i = listingDuration.options.length; i >= 0; i--) { + listingDuration.options[i] = null; + } + if (value == "FixedPriceItem"){ + listingDuration.options[0] = new Option("3 ${uiLabelMap.CommonDays}","Days_3"); + listingDuration.options[1] = new Option("5 ${uiLabelMap.CommonDays}","Days_5"); + listingDuration.options[2] = new Option("7 ${uiLabelMap.CommonDays}","Days_7"); + listingDuration.options[3] = new Option("10 ${uiLabelMap.CommonDays}","Days_10"); + listingDuration.options[4] = new Option("30 ${uiLabelMap.CommonDays}","Days_30"); + listingDuration.options[5] = new Option("Good 'Til Cancelled","2147483647"); + }else{ + listingDuration.options[0] = new Option("1 ${uiLabelMap.CommonDay}","Days_1"); + listingDuration.options[1] = new Option("3 ${uiLabelMap.CommonDays}","Days_3"); + listingDuration.options[2] = new Option("5 ${uiLabelMap.CommonDays}","Days_5"); + listingDuration.options[3] = new Option("7 ${uiLabelMap.CommonDays}","Days_7"); + listingDuration.options[4] = new Option("10 ${uiLabelMap.CommonDays} ($0.40)","Days_10"); + } + } +</script> +<div> + <form id="ProductsExportToEbay" method="post" action="<@ofbizUrl>exportProductsFromEbayStore</@ofbizUrl>" name="ProductsExportToEbay"> + <input type="hidden" name="productStoreId" value="${productStoreId?if_exists}"> + <input type="hidden" name="prodCatalogId" value="${parameters.SEARCH_CATALOG_ID?if_exists}"> + <input type="hidden" name="productCategoryId" value="${parameters.SEARCH_CATEGORY_ID?if_exists}"> + <#if !productIds?has_content> + <div><h2>${uiLabelMap.ProductNoResultsFound}.</h2></div> + </#if> + + <#if productIds?has_content> + <table border="0" cellpadding="2" cellspacing="0"> + <tr> + <td align="right" class="label">${uiLabelMap.CommonCountry}</td> + <td> </td> + <td> + <select name="country"> + <#if countries?exists> + <#list countries as country> + <option value="${country.geoCode}" <#if countryCode?exists && countryCode == country.geoCode>selected</#if>>${country.get("geoName",locale)}</option> + </#list> + </#if> + </select> + </td> + </tr> + <tr> + <td align="right" class="label">${uiLabelMap.FormFieldTitle_location}</td> + <td> </td> + <td> + <input type="text" name="location" size="50" maxlength="50" value="${parameters.location?if_exists}" /> + </td> + </tr> + <tr> + <td align="right" class="label">${uiLabelMap.FormFieldTitle_webSiteUrl}</td> + <td> </td> + <td> + <input type="text" name="webSiteUrl" size="100" value="${webSiteUrl?if_exists}"/> + </td> + </tr> + <tr> + <td align="center" colspan="3"><b><u>${uiLabelMap.FormFieldTitle_paymentMethodsAccepted}</u></b></td> + </tr> + <tr> + <td colspan="3"> + <table class="basic-table" cellspacing="0"> + <tr> + <td align="right" width="23%" class="label">${uiLabelMap.FormFieldTitle_paymentPayPal}</td> + <td width="2%"><input type="checkbox" name="paymentPayPal" <#if parameters.paymentPayPal?exists>checked</#if> /></td> + <td align="right" width="23%" class="label">${uiLabelMap.FormFieldTitle_paymentVisaMC}</td> + <td width="2%"><input type="checkbox" name="paymentVisaMC" <#if parameters.paymentVisaMC?exists>checked</#if> /></td> + <td align="right" width="23%" class="label">${uiLabelMap.FormFieldTitle_paymentAmEx}</td> + <td width="2%"><input type="checkbox" name="paymentAmEx" <#if parameters.paymentAmEx?exists>checked</#if> /></td> + <td align="right" width="23%" class="label">${uiLabelMap.FormFieldTitle_paymentDiscover}</td> + <td width="2%"><input type="checkbox" name="paymentDiscover" <#if parameters.paymentDiscover?exists>checked</#if> /></td> + </tr> + <tr> + <td align="right" width="23%" class="label">${uiLabelMap.FormFieldTitle_paymentMOCC}</td> + <td width="2%"><input type="checkbox" name="paymentMOCC" <#if parameters.paymentMOCC?exists>checked</#if> /></td> + <td align="right" width="23%" class="label">${uiLabelMap.FormFieldTitle_paymentPersonalCheck}</td> + <td width="2%"><input type="checkbox" name="paymentPersonalCheck" <#if parameters.paymentPersonalCheck?exists>checked</#if> /></td> + <td align="right" width="23%" class="label">${uiLabelMap.FormFieldTitle_paymentCCAccepted}</td> + <td width="2%"><input type="checkbox" name="paymentCCAccepted" <#if parameters.paymentCCAccepted?exists>checked</#if> /></td> + <td align="right" width="23%" class="label">${uiLabelMap.FormFieldTitle_paymentCashInPerson}</td> + <td width="2%"><input type="checkbox" name="paymentCashInPerson" <#if parameters.paymentCashInPerson?exists>checked</#if> /></td> + </tr> + <tr> + <td align="right" width="23%" class="label">${uiLabelMap.FormFieldTitle_paymentCashOnPickup}</td> + <td width="2%"><input type="checkbox" name="paymentCashOnPickup" <#if parameters.paymentCashOnPickup?exists>checked</#if> /></td> + <td align="right" width="23%" class="label">${uiLabelMap.FormFieldTitle_paymentCOD}</td> + <td width="2%"><input type="checkbox" name="paymentCOD" <#if parameters.paymentCOD?exists>checked</#if> /></td> + <td align="right" width="23%" class="label">${uiLabelMap.FormFieldTitle_paymentCODPrePayDelivery}</td> + <td width="2%"><input type="checkbox" name="paymentCODPrePayDelivery" <#if parameters.paymentCODPrePayDelivery?exists>checked</#if> /></td> + <td align="right" width="23%" class="label">${uiLabelMap.FormFieldTitle_paymentMoneyXferAccepted}</td> + <td width="2%"><input type="checkbox" name="paymentMoneyXferAccepted" <#if parameters.paymentMoneyXferAccepted?exists>checked</#if> /></td> + </tr> + </table> + </td> + </tr> + <tr> + <td align="right" class="label">${uiLabelMap.FormFieldTitle_payPalEmail}</td> + <td> </td> + <td> + <input type="text" name="payPalEmail" size="50" maxlength="50" value="${parameters.payPalEmail?if_exists}" /> + </td> + </tr> + <tr> + <td align="right" class="label">${uiLabelMap.FormFieldTitle_customXml}</td> + <td> </td> + <td> + <textarea cols="60" rows="6" wrap="soft" name="customXml"> ${(ebayConfig.customXml)?if_exists} </textarea> + </td> + </tr> + <#assign rowCount = 0 /> + <#list productIds as productId> + <tr> + <td colspan="3"> + <hr/> + <b>${productId}</b> + <input type="hidden" name="productId_o_${rowCount}" value="${productId}"/> + <table class="basic-table" cellspacing="0" width="50%"> + <tr> + <td colspan="2"> + <input type="checkbox" name="requireEbayInventory_o_${rowCount}" value="on"/> + </td> + <td colspan="2">${uiLabelMap.requireEbayInventory}</td> + </tr> + <tr> + <td> + <input type="checkbox" name="listingTypeAuc_o_${rowCount}" value="on"/> + </td> + <td>${uiLabelMap.eBayOnlineAuction}</td> + <td>${uiLabelMap.FormFieldTitle_listingDuration}</td> + <td> + <select name="listingDurationAuc_o_${rowCount}"> + <option value="Days_1">1 ${uiLabelMap.CommonDay}</option> + <option value="Days_3">3 ${uiLabelMap.CommonDays}</option> + <option value="Days_5">5 ${uiLabelMap.CommonDays}</option> + <option value="Days_7">7 ${uiLabelMap.CommonDays}</option> + <option value="Days_10">10 ${uiLabelMap.CommonDays}</option> + </select> + </td> + </tr> + <tr> + <td> + <input type="checkbox" name="listingTypeFixed_o_${rowCount}" value="on"/> + </td> + <td>${uiLabelMap.eBayFixedPrice}</td> + <td>${uiLabelMap.FormFieldTitle_listingDuration}</td> + <td> + <select name="listingDurationFixed_o_${rowCount}"> + <option value="Days_3">3 ${uiLabelMap.CommonDays}</option> + <option value="Days_5">5 ${uiLabelMap.CommonDays}</option> + <option value="Days_7">7 ${uiLabelMap.CommonDays}</option> + <option value="Days_10">10 ${uiLabelMap.CommonDays}</option> + <option value="Days_30">30 ${uiLabelMap.CommonDays}</option> + <option value="2147483647">Good 'Til Cancelled</option> + </select> + </td> + </tr> + <tr> + <td colspan="2">${uiLabelMap.CommonQuantity}</td> + <td colspan="2"> + <input type="text" name="quantity_o_${rowCount}" size="12" maxlength="12" value="<#if parameters.quantity?exists>${parameters.quantity?if_exists}<#else>1</#if>" /> + </td> + </tr> + </table> + </td> + </tr> + <#assign rowCount=rowCount + 1/> + </#list> + <tr> + <td colspan=2> </td> + <td> + <input type="submit" value="${uiLabelMap.EbayExportToEbay}" name="submitButton" class="smallSubmit"> + </td> + </tr> + </table> + </#if> + </form> +</div> \ No newline at end of file Modified: ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreForms.xml?rev=907182&r1=907181&r2=907182&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreForms.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreForms.xml Sat Feb 6 07:16:28 2010 @@ -26,7 +26,7 @@ odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> <field name="productStoreId" title="${uiLabelMap.ProductProductStore}" > <drop-down current="selected" > - <list-options list-name="ebayStoreList" description="${storeName} [${productStoreId}]" key-name="productStoreId"/> + <list-options list-name="ebayStoreList" description="${storeName} [${productStoreId}]" key-name="productStoreId"/> </drop-down> </field> <field name="submitButton" ><submit button-type="button"/></field> @@ -38,7 +38,7 @@ </actions> <field name="productStoreId" title="Account" > <drop-down current="selected"> - <list-options list-name="stores" description="${firstName} ${lastName}" key-name="productStoreId"/> + <list-options list-name="stores" description="${firstName} ${lastName}" key-name="productStoreId"/> </drop-down> </field> <field name="submitButton" ><submit button-type="button"/></field> Modified: ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml?rev=907182&r1=907181&r2=907182&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreMenus.xml Sat Feb 6 07:16:28 2010 @@ -63,6 +63,11 @@ <parameter param-name="productStoreId" value="${parameters.productStoreId}"/> </link> </menu-item> + <menu-item name="exportProductListing" title="Export Product Listing"> + <link target="exportProductListing"> + <parameter param-name="productStoreId" value="${parameters.productStoreId}"/> + </link> + </menu-item> </menu> <menu name="EbayFeedbackTabBar" selected-menuitem-context-field-name="eBayTabButtonItem" type="simple" default-selected-style="selected" menu-container-style="button-bar button-style-2"> Modified: ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreScreens.xml?rev=907182&r1=907181&r2=907182&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreScreens.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/widget/EbayStoreScreens.xml Sat Feb 6 07:16:28 2010 @@ -542,4 +542,57 @@ </widgets> </section> </screen> + <!-- Export product listing --> + <screen name="exportProductListing"> + <section> + <actions> + <set field="titleProperty" value="PageTitleAdvancedSearch"/> + <set field="headerItem" value="ebayStore"/> + <set field="tabButtonItem" value="exportProductListing"/> + <entity-condition entity-name="ProductCategory" list="productCategories"> + <condition-expr field-name="showInSelect" operator="not-equals" value="N"/> + <order-by field-name="description"/> + </entity-condition> + <script location="component://product/webapp/catalog/WEB-INF/actions/find/advancedsearchoptions.groovy"/> + <script location="component://ebay/webapp/ebay/WEB-INF/actions/find/EbayAdvancedSearch.groovy"/> + </actions> + <widgets> + <decorator-screen name="permission-decorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="body"> + <platform-specific> + <html><html-template location="component://ebaystore/webapp/ebaystore/store/ebayApiKeywordSearch.ftl"/></html> + </platform-specific> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> + <screen name="productsearchexport"> + <section> + <actions> + <set field="titleProperty" value="PageTitleSearchResults"/> + <set field="headerItem" value="ebayStore"/> + <set field="tabButtonItem" value="exportProductListing"/> + <entity-condition entity-name="Geo" list="countries"> + <condition-expr field-name="geoTypeId" value="COUNTRY"/> + <order-by field-name="geoName"/> + </entity-condition> + <set field="productStoreId" from-field="parameters.productStoreId"/> + <entity-one entity-name="EbayConfig" value-field="ebayConfig"> + <field-map field-name="productStoreId" from-field="parameters.productStoreId"/> + </entity-one> + <script location="component://product/webapp/catalog/WEB-INF/actions/find/keywordsearch.groovy"/> + <script location="component://ebay/webapp/ebay/WEB-INF/actions/find/ProductsExportToEbay.groovy"/> + </actions> + <widgets> + <decorator-screen name="permission-decorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="body"> + <platform-specific> + <html><html-template location="component://ebaystore/webapp/ebaystore/store/productsearchExport.ftl"/></html> + </platform-specific> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> </screens> \ No newline at end of file |
| Free forum by Nabble | Edit this page |
