Product URI and product catalogs. Get product from different catalogs?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Product URI and product catalogs. Get product from different catalogs?

rohit
Hi,

How do we get full product links, to get products from different catalogs.
For eg. a link to a product in a catalog, other than the first catalog, returns a product not found error.
  http://www.mysite.com/ecommerce/control/product/~category_id=10090/~product_id=8178085739

I guess the catalogworker.java file is used to call products. It only works if the catalog ID is included in the URI,

http://www.mysite.com/ecommerce/control/product/~category_id=10090/~product_id=8178085739/~CURRENT_CATALOG_ID=MARKETPLACE


In the catalogworker.java it is mentioned as:

 /**
     * Retrieves the current prodCatalogId.  First it will attempt to find it from a special
     * request parameter or session attribute named CURRENT_CATALOG_ID.  Failing that, it will
     * get the first catalog from the database as specified in getCatalogIdsAvailable().  
     * If this behavior is undesired, give the user a selectable list of catalogs.
     */

I am not sure if this logic is correct. Should it not get catalod ID for the product instead of getting the first catalod ID from the database. I am not aware if there are any other reasons for doing this.

But this also causes the link in the last products viewed box to break, when a browser views product from different catalogs.

Any suggestions on can we get this fixed.

Rohit
Reply | Threaded
Open this post in threaded view
|

Re: Product URI and product catalogs. Get product from different catalogs?

cjhowe
roll your own or put all of the products in one
catalog

--- rohit2006 <[hidden email]> wrote:

>
> Hi,
>
> How do we get full product links, to get products
> from different catalogs.
> For eg. a link to a product in a catalog, other than
> the first catalog,
> returns a product not found error.
>  
>
http://www.mysite.com/ecommerce/control/product/~category_id=10090/~product_id=8178085739
>
> I guess the catalogworker.java file is used to call
> products. It only works
> if the catalog ID is included in the URI,
>
>
http://www.mysite.com/ecommerce/control/product/~category_id=10090/~product_id=8178085739/~CURRENT_CATALOG_ID=MARKETPLACE

>
>
> In the catalogworker.java it is mentioned as:
>
>  /**
>      * Retrieves the current prodCatalogId.  First
> it will attempt to find
> it from a special
>      * request parameter or session attribute named
> CURRENT_CATALOG_ID.
> Failing that, it will
>      * get the first catalog from the database as
> specified in
> getCatalogIdsAvailable().  
>      * If this behavior is undesired, give the user
> a selectable list of
> catalogs.
>      */
>
> I am not sure if this logic is correct. Should it
> not get catalod ID for the
> product instead of getting the first catalod ID from
> the database. I am not
> aware if there are any other reasons for doing this.
>
> But this also causes the link in the last products
> viewed box to break, when
> a browser views product from different catalogs.
>
> Any suggestions on can we get this fixed.
>
> Rohit
> --
> View this message in context:
>
http://www.nabble.com/Product-URI-and-product-catalogs.-Get-product-from-different-catalogs--tf2088673.html#a5756783
> Sent from the OFBiz - User forum at Nabble.com.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Product URI and product catalogs. Get product from different catalog

rohit
i am not sure if putting all the products in one catalog is a solution.  


cjhowe wrote
roll your own or put all of the products in one
catalog

--- rohit2006 <rohitksureka@yahoo.com> wrote:

>
> Hi,
>
> How do we get full product links, to get products
> from different catalogs.
> For eg. a link to a product in a catalog, other than
> the first catalog,
> returns a product not found error.
>  
>
http://www.mysite.com/ecommerce/control/product/~category_id=10090/~product_id=8178085739
>
> I guess the catalogworker.java file is used to call
> products. It only works
> if the catalog ID is included in the URI,
>
>
http://www.mysite.com/ecommerce/control/product/~category_id=10090/~product_id=8178085739/~CURRENT_CATALOG_ID=MARKETPLACE
>
>
> In the catalogworker.java it is mentioned as:
>
>  /**
>      * Retrieves the current prodCatalogId.  First
> it will attempt to find
> it from a special
>      * request parameter or session attribute named
> CURRENT_CATALOG_ID.
> Failing that, it will
>      * get the first catalog from the database as
> specified in
> getCatalogIdsAvailable().  
>      * If this behavior is undesired, give the user
> a selectable list of
> catalogs.
>      */
>
> I am not sure if this logic is correct. Should it
> not get catalod ID for the
> product instead of getting the first catalod ID from
> the database. I am not
> aware if there are any other reasons for doing this.
>
> But this also causes the link in the last products
> viewed box to break, when
> a browser views product from different catalogs.
>
> Any suggestions on can we get this fixed.
>
> Rohit
> --
> View this message in context:
>
http://www.nabble.com/Product-URI-and-product-catalogs.-Get-product-from-different-catalogs--tf2088673.html#a5756783
> Sent from the OFBiz - User forum at Nabble.com.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Product URI and product catalogs. Get product from different catalog

cjhowe

Products can exists in multiple categories.
Categories can exist in multiple catalogs.  So,
products can exist in multiple catalogs. It
shouldn't/doesn't AFAIK hurt ecommerce or ordermgr to
have the products in multiple places.

--- rohit2006 <[hidden email]> wrote:

>
> i am not sure if putting all the products in one
> catalog is a solution.  
>
>
>
> cjhowe wrote:
> >
> > roll your own or put all of the products in one
> > catalog
> >
> > --- rohit2006 <[hidden email]> wrote:
> >
> >>
> >> Hi,
> >>
> >> How do we get full product links, to get products
> >> from different catalogs.
> >> For eg. a link to a product in a catalog, other
> than
> >> the first catalog,
> >> returns a product not found error.
> >>  
> >>
> >
>
http://www.mysite.com/ecommerce/control/product/~category_id=10090/~product_id=8178085739
> >>
> >> I guess the catalogworker.java file is used to
> call
> >> products. It only works
> >> if the catalog ID is included in the URI,
> >>
> >>
> >
>
http://www.mysite.com/ecommerce/control/product/~category_id=10090/~product_id=8178085739/~CURRENT_CATALOG_ID=MARKETPLACE

> >>
> >>
> >> In the catalogworker.java it is mentioned as:
> >>
> >>  /**
> >>      * Retrieves the current prodCatalogId.
> First
> >> it will attempt to find
> >> it from a special
> >>      * request parameter or session attribute
> named
> >> CURRENT_CATALOG_ID.
> >> Failing that, it will
> >>      * get the first catalog from the database as
> >> specified in
> >> getCatalogIdsAvailable().  
> >>      * If this behavior is undesired, give the
> user
> >> a selectable list of
> >> catalogs.
> >>      */
> >>
> >> I am not sure if this logic is correct. Should it
> >> not get catalod ID for the
> >> product instead of getting the first catalod ID
> from
> >> the database. I am not
> >> aware if there are any other reasons for doing
> this.
> >>
> >> But this also causes the link in the last
> products
> >> viewed box to break, when
> >> a browser views product from different catalogs.
> >>
> >> Any suggestions on can we get this fixed.
> >>
> >> Rohit
> >> --
> >> View this message in context:
> >>
> >
>
http://www.nabble.com/Product-URI-and-product-catalogs.-Get-product-from-different-catalogs--tf2088673.html#a5756783

> >> Sent from the OFBiz - User forum at Nabble.com.
> >>
> >>
> >
> >
> >
>
> --
> View this message in context:
>
http://www.nabble.com/Product-URI-and-product-catalogs.-Get-product-from-different-catalogs--tf2088673.html#a5758291
> Sent from the OFBiz - User forum at Nabble.com.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Product URI and product catalogs. Get product from different catalog

rohit
You are right, Chris it does not really hurt to do so. But what, it helps me to do is customize the interface and product pages, for different line of products. For e.g. i use template path prefix to create new flt file product pages in different catalogs.

The URLS however, do not really support this. For e.g. even if i include the catalog_id in the URL, though i am able to get the product from different catalogs, the correct flt are not used. This is probably because the session cookie does not have the catalog_id in it yet.


This looks pretty messed up, when u use product links at various places like, ads etc.

I wonder how other have been using it.

Rohit

Rohit
cjhowe wrote
Products can exists in multiple categories.
Categories can exist in multiple catalogs.  So,
products can exist in multiple catalogs. It
shouldn't/doesn't AFAIK hurt ecommerce or ordermgr to
have the products in multiple places.

--- rohit2006 <rohitksureka@yahoo.com> wrote:

>
> i am not sure if putting all the products in one
> catalog is a solution.  
>
>
>
> cjhowe wrote:
> >
> > roll your own or put all of the products in one
> > catalog
> >
> > --- rohit2006 <rohitksureka@yahoo.com> wrote:
> >
> >>
> >> Hi,
> >>
> >> How do we get full product links, to get products
> >> from different catalogs.
> >> For eg. a link to a product in a catalog, other
> than
> >> the first catalog,
> >> returns a product not found error.
> >>  
> >>
> >
>
http://www.mysite.com/ecommerce/control/product/~category_id=10090/~product_id=8178085739
> >>
> >> I guess the catalogworker.java file is used to
> call
> >> products. It only works
> >> if the catalog ID is included in the URI,
> >>
> >>
> >
>
http://www.mysite.com/ecommerce/control/product/~category_id=10090/~product_id=8178085739/~CURRENT_CATALOG_ID=MARKETPLACE
> >>
> >>
> >> In the catalogworker.java it is mentioned as:
> >>
> >>  /**
> >>      * Retrieves the current prodCatalogId.
> First
> >> it will attempt to find
> >> it from a special
> >>      * request parameter or session attribute
> named
> >> CURRENT_CATALOG_ID.
> >> Failing that, it will
> >>      * get the first catalog from the database as
> >> specified in
> >> getCatalogIdsAvailable().  
> >>      * If this behavior is undesired, give the
> user
> >> a selectable list of
> >> catalogs.
> >>      */
> >>
> >> I am not sure if this logic is correct. Should it
> >> not get catalod ID for the
> >> product instead of getting the first catalod ID
> from
> >> the database. I am not
> >> aware if there are any other reasons for doing
> this.
> >>
> >> But this also causes the link in the last
> products
> >> viewed box to break, when
> >> a browser views product from different catalogs.
> >>
> >> Any suggestions on can we get this fixed.
> >>
> >> Rohit
> >> --
> >> View this message in context:
> >>
> >
>
http://www.nabble.com/Product-URI-and-product-catalogs.-Get-product-from-different-catalogs--tf2088673.html#a5756783
> >> Sent from the OFBiz - User forum at Nabble.com.
> >>
> >>
> >
> >
> >
>
> --
> View this message in context:
>
http://www.nabble.com/Product-URI-and-product-catalogs.-Get-product-from-different-catalogs--tf2088673.html#a5758291
> Sent from the OFBiz - User forum at Nabble.com.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Product URI and product catalogs. Get product from different catalog

cjhowe
I'm assuming that you're trying to show the exact same
product/category information just displayed
differently depending on the catalog.

If this assumption is correct, this is how I would do
it:

widget/CatalogScreens.xml#category calls the
"category-include" screen
category-include calls:
component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh

this script sets the ${detailScreen} to be
"categorydetail"

if you move the setting of this variable to below the
getting of the productCategoryId and put your logic
about which detailScreen should be used here and
create new screens that display the category
differently it should work.





--- rohit2006 <[hidden email]> wrote:

>
> You are right, Chris it does not really hurt to do
> so. But what, it helps me
> to do is customize the interface and product pages,
> for different line of
> products. For e.g. i use template path prefix to
> create new flt file product
> pages in different catalogs.
>
> The URLS however, do not really support this. For
> e.g. even if i include the
> catalog_id in the URL, though i am able to get the
> product from different
> catalogs, the correct flt are not used. This is
> probably because the session
> cookie does not have the catalog_id in it yet.
>
>
> This looks pretty messed up, when u use product
> links at various places
> like, ads etc.
>
> I wonder how other have been using it.
>
> Rohit
>
> Rohit
>
> cjhowe wrote:
> >
> >
> > Products can exists in multiple categories.
> > Categories can exist in multiple catalogs.  So,
> > products can exist in multiple catalogs. It
> > shouldn't/doesn't AFAIK hurt ecommerce or ordermgr
> to
> > have the products in multiple places.
> >
> > --- rohit2006 <[hidden email]> wrote:
> >
> >>
> >> i am not sure if putting all the products in one
> >> catalog is a solution.  
> >>
> >>
> >>
> >> cjhowe wrote:
> >> >
> >> > roll your own or put all of the products in one
> >> > catalog
> >> >
> >> > --- rohit2006 <[hidden email]> wrote:
> >> >
> >> >>
> >> >> Hi,
> >> >>
> >> >> How do we get full product links, to get
> products
> >> >> from different catalogs.
> >> >> For eg. a link to a product in a catalog,
> other
> >> than
> >> >> the first catalog,
> >> >> returns a product not found error.
> >> >>  
> >> >>
> >> >
> >>
> >
>
http://www.mysite.com/ecommerce/control/product/~category_id=10090/~product_id=8178085739

> >> >>
> >> >> I guess the catalogworker.java file is used to
> >> call
> >> >> products. It only works
> >> >> if the catalog ID is included in the URI,
> >> >>
> >> >>
> >> >
> >>
> >
>
http://www.mysite.com/ecommerce/control/product/~category_id=10090/~product_id=8178085739/~CURRENT_CATALOG_ID=MARKETPLACE

> >> >>
> >> >>
> >> >> In the catalogworker.java it is mentioned as:
> >> >>
> >> >>  /**
> >> >>      * Retrieves the current prodCatalogId.
> >> First
> >> >> it will attempt to find
> >> >> it from a special
> >> >>      * request parameter or session attribute
> >> named
> >> >> CURRENT_CATALOG_ID.
> >> >> Failing that, it will
> >> >>      * get the first catalog from the database
> as
> >> >> specified in
> >> >> getCatalogIdsAvailable().  
> >> >>      * If this behavior is undesired, give the
> >> user
> >> >> a selectable list of
> >> >> catalogs.
> >> >>      */
> >> >>
> >> >> I am not sure if this logic is correct. Should
> it
> >> >> not get catalod ID for the
> >> >> product instead of getting the first catalod
> ID
> >> from
> >> >> the database. I am not
> >> >> aware if there are any other reasons for doing
> >> this.
> >> >>
> >> >> But this also causes the link in the last
> >> products
> >> >> viewed box to break, when
> >> >> a browser views product from different
> catalogs.
> >> >>
> >> >> Any suggestions on can we get this fixed.
> >> >>
> >> >> Rohit
> >> >> --
> >> >> View this message in context:
> >> >>
> >> >
> >>
> >
>
http://www.nabble.com/Product-URI-and-product-catalogs.-Get-product-from-different-catalogs--tf2088673.html#a5756783

> >> >> Sent from the OFBiz - User forum at
> Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> >
>
http://www.nabble.com/Product-URI-and-product-catalogs.-Get-product-from-different-catalogs--tf2088673.html#a5758291

> >> Sent from the OFBiz - User forum at Nabble.com.
> >>
> >>
> >
> >
> >
>
> --
> View this message in context:
>
http://www.nabble.com/Product-URI-and-product-catalogs.-Get-product-from-different-catalogs--tf2088673.html#a5782246
> Sent from the OFBiz - User forum at Nabble.com.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Product URI and product catalogs. Get product from different catalog

rohit
Hi Chris,

You got me right to a certian extent. i will try to be more clear by giving you an example.

I have a catalog each for Jewelry and Silverware. The display requirement for each of this is different and  
 i use to different catalogs for each of them since the display requirements for each of them is very different. For eg. i also use different screens, stylesheet, buttons for each catalog. Each product is found in one catalog only. They are not available across catalogs.

The problem arises when i want to create ads for my products. The link to products in different catagories only work when the catalog_id is included in the URL, else the first catalog is called which may not have the product and hence returns a product not found error.

Including the catalogID in the URI solves the first problem of finding the product, but the stylesheets, etc for the particular catalog which has the product is not loaded. Beacuse of the way the catalogworker.java file works, the cookie is set up with the first catalog ID and not with the catalog which actaully has the product.

I was able to able to achieve this by editing the catalogworker.java, as below. i have added the lines

 
       if (prodCatalogId != null) {
        session.setAttribute("CURRENT_CATALOG_ID", prodCatalogId);
        }


in the section

    /**
     * Retrieves the current prodCatalogId.  First it will attempt to find it from a

special
     * request parameter or session attribute named CURRENT_CATALOG_ID.  Failing that,

it will
     * get the first catalog from the database as specified in getCatalogIdsAvailable

().  
     * If this behavior is undesired, give the user a selectable list of catalogs.
     */
    public static String getCurrentCatalogId(ServletRequest request) {
        HttpSession session = ((HttpServletRequest) request).getSession();
        Map requestParameters = UtilHttp.getParameterMap((HttpServletRequest)

request);
        String prodCatalogId = null;
        boolean fromSession = false;

        // first see if a new catalog was specified as a parameter
        prodCatalogId = (String) requestParameters.get("CURRENT_CATALOG_ID");
       
       if (prodCatalogId != null) {
        session.setAttribute("CURRENT_CATALOG_ID", prodCatalogId);
        }


which creates the cookie with the CatalogID passed by the URI. By doing this the customer stays in that catalog and the customization etc. for that catalog is used.

I hope that Chis and other commitors can look into this and suggest whether it is the best way to achieve this..

Rohit

       



cjhowe wrote
I'm assuming that you're trying to show the exact same
product/category information just displayed
differently depending on the catalog.

If this assumption is correct, this is how I would do
it:

widget/CatalogScreens.xml#category calls the
"category-include" screen
category-include calls:
component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh

this script sets the ${detailScreen} to be
"categorydetail"

if you move the setting of this variable to below the
getting of the productCategoryId and put your logic
about which detailScreen should be used here and
create new screens that display the category
differently it should work.





--- rohit2006 <rohitksureka@yahoo.com> wrote:

>
> You are right, Chris it does not really hurt to do
> so. But what, it helps me
> to do is customize the interface and product pages,
> for different line of
> products. For e.g. i use template path prefix to
> create new flt file product
> pages in different catalogs.
>
> The URLS however, do not really support this. For
> e.g. even if i include the
> catalog_id in the URL, though i am able to get the
> product from different
> catalogs, the correct flt are not used. This is
> probably because the session
> cookie does not have the catalog_id in it yet.
>
>
> This looks pretty messed up, when u use product
> links at various places
> like, ads etc.
>
> I wonder how other have been using it.
>
> Rohit
>
> Rohit
>
> cjhowe wrote:
> >
> >
> > Products can exists in multiple categories.
> > Categories can exist in multiple catalogs.  So,
> > products can exist in multiple catalogs. It
> > shouldn't/doesn't AFAIK hurt ecommerce or ordermgr
> to
> > have the products in multiple places.
> >
> > --- rohit2006 <rohitksureka@yahoo.com> wrote:
> >
> >>
> >> i am not sure if putting all the products in one
> >> catalog is a solution.  
> >>
> >>
> >>
> >> cjhowe wrote:
> >> >
> >> > roll your own or put all of the products in one
> >> > catalog
> >> >
> >> > --- rohit2006 <rohitksureka@yahoo.com> wrote:
> >> >
> >> >>
> >> >> Hi,
> >> >>
> >> >> How do we get full product links, to get
> products
> >> >> from different catalogs.
> >> >> For eg. a link to a product in a catalog,
> other
> >> than
> >> >> the first catalog,
> >> >> returns a product not found error.
> >> >>  
> >> >>
> >> >
> >>
> >
>
http://www.mysite.com/ecommerce/control/product/~category_id=10090/~product_id=8178085739
> >> >>
> >> >> I guess the catalogworker.java file is used to
> >> call
> >> >> products. It only works
> >> >> if the catalog ID is included in the URI,
> >> >>
> >> >>
> >> >
> >>
> >
>
http://www.mysite.com/ecommerce/control/product/~category_id=10090/~product_id=8178085739/~CURRENT_CATALOG_ID=MARKETPLACE
> >> >>
> >> >>
> >> >> In the catalogworker.java it is mentioned as:
> >> >>
> >> >>  /**
> >> >>      * Retrieves the current prodCatalogId.
> >> First
> >> >> it will attempt to find
> >> >> it from a special
> >> >>      * request parameter or session attribute
> >> named
> >> >> CURRENT_CATALOG_ID.
> >> >> Failing that, it will
> >> >>      * get the first catalog from the database
> as
> >> >> specified in
> >> >> getCatalogIdsAvailable().  
> >> >>      * If this behavior is undesired, give the
> >> user
> >> >> a selectable list of
> >> >> catalogs.
> >> >>      */
> >> >>
> >> >> I am not sure if this logic is correct. Should
> it
> >> >> not get catalod ID for the
> >> >> product instead of getting the first catalod
> ID
> >> from
> >> >> the database. I am not
> >> >> aware if there are any other reasons for doing
> >> this.
> >> >>
> >> >> But this also causes the link in the last
> >> products
> >> >> viewed box to break, when
> >> >> a browser views product from different
> catalogs.
> >> >>
> >> >> Any suggestions on can we get this fixed.
> >> >>
> >> >> Rohit
> >> >> --
> >> >> View this message in context:
> >> >>
> >> >
> >>
> >
>
http://www.nabble.com/Product-URI-and-product-catalogs.-Get-product-from-different-catalogs--tf2088673.html#a5756783
> >> >> Sent from the OFBiz - User forum at
> Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> >
>
http://www.nabble.com/Product-URI-and-product-catalogs.-Get-product-from-different-catalogs--tf2088673.html#a5758291
> >> Sent from the OFBiz - User forum at Nabble.com.
> >>
> >>
> >
> >
> >
>
> --
> View this message in context:
>
http://www.nabble.com/Product-URI-and-product-catalogs.-Get-product-from-different-catalogs--tf2088673.html#a5782246
> Sent from the OFBiz - User forum at Nabble.com.
>
>