How to Filter Out Identical Billing and Shipping Addresses?

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

How to Filter Out Identical Billing and Shipping Addresses?

Prakhar Kumar
My requirement is to display billing and shipping addresses of the customer
during checkout. But I want to avoid identical addresses from getting
displayed. This can be simply achieved by putting some checks on the front
end but it's not that elegant. So, Is there any way to do it more
efficiently in Ofbiz?

--
Thanks and Regards
Prakhar Kumar
Enterprise Software Engineer
HotWax Systems
Reply | Threaded
Open this post in threaded view
|

Re: How to Filter Out Identical Billing and Shipping Addresses?

Nicolas Malin-2
If you postalAddress creation respect the ContactMechPurpose partner,
you have only one address with two purposes *billing* and *shipping*.

So the problem would don't exist.

:) please check you postal address creation

Nicolas


Le 28/04/2017 à 15:30, Prakhar Kumar a écrit :
> My requirement is to display billing and shipping addresses of the customer
> during checkout. But I want to avoid identical addresses from getting
> displayed. This can be simply achieved by putting some checks on the front
> end but it's not that elegant. So, Is there any way to do it more
> efficiently in Ofbiz?
>

Reply | Threaded
Open this post in threaded view
|

Re: How to Filter Out Identical Billing and Shipping Addresses?

Aditya Sharma
Hi Prakhar,

I think you can use methods of EntityUtil class here. There are many useful
methods available there.

<http://goog_1018801742>
https://ci.apache.org/projects/ofbiz/site/javadocs/org/ofbiz/entity/util/
EntityUtil.html

For example, One way can be that
1. You get contactMechId of all the address associated with given partyId &
with contactMechPurposeTypeId (Billing and Shipping location)
2. Filter them out according to its contactMechPurposeTypeId using
filterByCondition() or filterByAnd() for the first list
3. FilterOutByCondition() to remove all those already in first list for the
second one.

It will avoid multiple entity hits and may serve the purpose.

Though it is just an example, there may be some other possibility depending
upon your exact scenario.

Thanks & Regards,
Aditya Sharma
Enterprise Software Engineer
HotWax Systems Pvt. Ltd.
http://www.hotwaxsystems.com/

      <https://www.linkedin.com/in/aditya-sharma-78291810a/>

On Tue, May 2, 2017 at 12:29 PM, Nicolas Malin <[hidden email]>
wrote:

> If you postalAddress creation respect the ContactMechPurpose partner, you
> have only one address with two purposes *billing* and *shipping*.
>
> So the problem would don't exist.
>
> :) please check you postal address creation
>
> Nicolas
>
>
>
> Le 28/04/2017 à 15:30, Prakhar Kumar a écrit :
>
>> My requirement is to display billing and shipping addresses of the
>> customer
>> during checkout. But I want to avoid identical addresses from getting
>> displayed. This can be simply achieved by putting some checks on the front
>> end but it's not that elegant. So, Is there any way to do it more
>> efficiently in Ofbiz?
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to Filter Out Identical Billing and Shipping Addresses?

Prakhar Kumar
Thanks, Nicolas and Aditya for pointing in the right direction :)

On Wed, May 3, 2017 at 10:43 AM, Aditya Sharma <
[hidden email]> wrote:

> Hi Prakhar,
>
> I think you can use methods of EntityUtil class here. There are many useful
> methods available there.
>
> <http://goog_1018801742>
> https://ci.apache.org/projects/ofbiz/site/javadocs/org/ofbiz/entity/util/
> EntityUtil.html
>
> For example, One way can be that
> 1. You get contactMechId of all the address associated with given partyId &
> with contactMechPurposeTypeId (Billing and Shipping location)
> 2. Filter them out according to its contactMechPurposeTypeId using
> filterByCondition() or filterByAnd() for the first list
> 3. FilterOutByCondition() to remove all those already in first list for the
> second one.
>
> It will avoid multiple entity hits and may serve the purpose.
>
> Though it is just an example, there may be some other possibility depending
> upon your exact scenario.
>
> Thanks & Regards,
> Aditya Sharma
> Enterprise Software Engineer
> HotWax Systems Pvt. Ltd.
> http://www.hotwaxsystems.com/
>
>       <https://www.linkedin.com/in/aditya-sharma-78291810a/>
>
> On Tue, May 2, 2017 at 12:29 PM, Nicolas Malin <[hidden email]>
> wrote:
>
> > If you postalAddress creation respect the ContactMechPurpose partner, you
> > have only one address with two purposes *billing* and *shipping*.
> >
> > So the problem would don't exist.
> >
> > :) please check you postal address creation
> >
> > Nicolas
> >
> >
> >
> > Le 28/04/2017 à 15:30, Prakhar Kumar a écrit :
> >
> >> My requirement is to display billing and shipping addresses of the
> >> customer
> >> during checkout. But I want to avoid identical addresses from getting
> >> displayed. This can be simply achieved by putting some checks on the
> front
> >> end but it's not that elegant. So, Is there any way to do it more
> >> efficiently in Ofbiz?
> >>
> >>
> >
>



--
Thanks and Regards
Prakhar Kumar
Enterprise Software Engineer
HotWax Systems