Hi Jones,Chris ..
To be more specific I m able to add products for category of
type Quick Add or Promotions and also able to use it for shopping cart ...
but the problem is with current design in ofbiz shopping cart flow it is not
storing all the information about a product or an item in ShoppingCart
object
as expected ... for example a product can be part of more than one category
or a Catalog .. then the information stored with the item is not as expected
it is taking the first category where this product is found and storing ...
which is actually restricting me to add one product to one category ......
the files about which i am looking at are ...
Package
org.ofbiz.order.shoppingcart
classes are
ShoppingCart.java
ShoppingCartItem.java
Specific Lines of Code from ShoppingCartItem.java makeItem(.....)
try {
product = delegator.findByPrimaryKeyCache("Product",
UtilMisc.toMap("productId", productId));
// first see if there is a purchase allow category and if this
product is in it or not
String purchaseProductCategoryId =
CatalogWorker.getCatalogPurchaseAllowCategoryId(delegator, prodCatalogId);
if (product != null && purchaseProductCategoryId != null) {
if (!CategoryWorker.isProductInCategory(delegator,
product.getString("productId"), purchaseProductCategoryId)) {
// a Purchase allow productCategoryId was found, but the
product is not in the category, axe it...
product = null;
}
}
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
product = null;
}
Specific Lines of Code from CatalogWorker.java
getCatalogPurchaseAllowCategoryId(GenericDelegator delegator, String
prodCatalogId)
if (prodCatalogId == null || prodCatalogId.length() <= 0) return null;
List prodCatalogCategories = getProdCatalogCategories(delegator,
prodCatalogId, "PCCT_PURCH_ALLW");
if (prodCatalogCategories != null && prodCatalogCategories.size() >
0) {
GenericValue prodCatalogCategory = EntityUtil.getFirst
(prodCatalogCategories);
return prodCatalogCategory.getString("productCategoryId");
} else {
return null;
}
The problem with the lines above that are in bold we r returning only the
first catagory that is found which will not be the case always ........
please tell me know if i am missing somting .... in the code .....
regards,
G Venkata Phanindra.
On 12/18/06, David E Jones <[EMAIL PROTECTED]> wrote:
Yeah, I'm not really sure what your question is, but Chris may be
going in the right direction... so...
To clarify: for performance reasons it does not recurse, so the
products do have to be direct members of the purchase allow category.
There is some stuff in the Catalog Manager to add all products in a
category and its children to another category to help with this sort
of thing.
BTW, check out the section on this stuff in the Basic Product Setup
Guide (in the technical section on docs.ofbiz.org), it has some
information about these category types.
-David
On Dec 17, 2006, at 9:47 PM, Chris Howe wrote:
> I haven't found it necessary as of yet to utilize the
> PCCT_PURCH_ALLW restriction. However, I would suspect
> that if you made your additional category a
> subcategory of your PCCT_PURCH_ALLW category it should
> recurse. If this is not the case, simply add your
> products to that category. Products can be a member
> of more than one category. And a category does not
> have to recurse from your root category.
>
> --- "G.Venkata Phanindra" <[EMAIL PROTECTED]> wrote:
>
>> Hi all,
>> I waitted for about a week for some reply
>> from forums... but i did
>> not get any ... can any one please look into this
>> .... i am also feeling is
>> my question not clear ... please reply me.. if that
>> is the case ..
>> regards
>> G Venkata Phanindra.
>>
>> On 12/12/06, G.Venkata Phanindra
>> <[EMAIL PROTECTED]> wrote:
>>>
>>> Hi All,
>>> I saw the following logic found a point to
>> be very confusing ....
>>> i.e in ShoppingCart.java file in makeItem(...)
>>> method we r getting the ProductCategory as the
>> first productCatergory i
>>> that particular catalog of Type "PCCT_PURCH_ALLW"
>> which can be only be one
>>> per catalog ... but that does Restrict me from
>> Selling Products of any
>>> another Categories in Ofbiz ... because i am
>> successfully able to use the
>>> Shopping Cart and Check out processes ...
>>> is this correct functionality of Ofbiz ...
>>> as i see its not ????? am i missing anything
>> here?????
>>> Regards
>>>
>>> G.Venkata Phanindra
>>> Mob:: 9849852989
>>
>>
>>
>>
>> --
>> G.Venkata Phanindra
>> Mob:: 9849852989
>>
>
--
G.Venkata Phanindra
Mob:: 9849852989