Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Hello, guys
I am new to the commerce module, when i download the newest module which release in data 2012-Sep-22. I find one issue.
It will create duplicate billing information items if i check the checkbox "copy chipping information to billing information" and did not choose the existing address file.
Since many duplicate billing information items is annoying. Is it possible do not create a new billing information item when i check the checkbox and didn't choose any exist billing information item?
Comments
Comment #1
rszrama CreditAttribution: rszrama commentedIf I'm not mistaken, what you're describing is the default behavior of Commerce, but I can't really tell. Yes, a new profile will be created each trip through checkout unless you're using Commerce Addressbook, but in my experience (corroborated by some quick local testing) you should not end up with multiple customer profiles from a single trip through checkout, even if you go back and forth toggling and untoggling the address copy checkbox as you go.
I'm moving this to "works as designed" unless you have some set of steps I can follow to reproduce the issue on a single trip through the checkout form.
Comment #2
brephraim CreditAttribution: brephraim commentedI am also having this issue, but with Commerce Addressbook installed.
To recap:
A customer has an existing billing address and an existing shipping address stored in Commerce Addressbook. The customer places a new order, selects their old billing address, and has the checkbox selected to use it for their shipping address. Meanwhile, they still have the --Choose-- option selected on the shipping address dropdown box. Now, even if the selected billing address matches the shipping address already stored, it will create a duplicate shipping address entry.
While this isn't critical, I'm sure it could become quite annoying for a customer.
Comment #3
rszrama CreditAttribution: rszrama commentedCan I get a screenshot? It sounds like the Addressbook module will just need to be updated once Commerce 1.4 comes out to disable the address copy option if an address from the addressbook is used.
Comment #4
bojanz CreditAttribution: bojanz commentedAddressbook will definitely need an update, nothing was done to make it compatible with the new feature in -dev.
Comment #5
brephraim CreditAttribution: brephraim commentedSubmit the order with the configuration show in step1.jpg, yielding the results in result.jpg on the next order.
Comment #6
rszrama CreditAttribution: rszrama commentedSpecifically, if the customer has chosen to use an existing address, we should suppress profile copying if possible to prevent it saving a duplicate profile. It should be possible through the #ajax refresh to disable the copying checkbox entirely.
Comment #7
B-Prod CreditAttribution: B-Prod commentedI just created a patch to hide the select box when the "same address" option is checked: Issue #1427264 Comment 12.
Still have to avoid duplicates.
Comment #8
rszrama CreditAttribution: rszrama commentedI don't think it's enough to simply hide this form element. We should likely just remove it entirely when the pane form is rebuilt and nullify its value. Not entirely sure; haven't played with the combination yet.
Comment #9
B-Prod CreditAttribution: B-Prod commentedYou totally right, since this still causes some troubles with existing profile: the duplicate address is stored on the existing profile defined by the address book select box, instead of been added to a new profile.
I modified this on the original issue rather than here (comment 13).
Comment #10
rszrama CreditAttribution: rszrama commentedWhy don't we just close that one as "won't fix" since the Shipping module doesn't have that functionality any more and continue on in this one?
Comment #11
brephraim CreditAttribution: brephraim commented#9: Unless I am missing something, the whole point is that the duplicate address should NOT be added to a new profile at all.
Comment #12
jsacksick CreditAttribution: jsacksick commentedI'm not sure this issue really belongs to commerce addressbook as there's actually no code that deals with commerce customer profile copying.
Comment #13
B-Prod CreditAttribution: B-Prod commentedI am afraid the problem seems complicated, but not really dedicated to Addressbook module, but to the Commerce Customer module.
When using the "same address" checkbox, the source profile is used (no duplication), but the other profile is created from the source profile, so is duplicated if it existed already.
The module should check if a profile contains the same data than the source profile before creating a new one.
Comment #14
rszrama CreditAttribution: rszrama commentedPlease re-read my comment #6: the problem is precisely that this module doesn't take profile copying into account. : )
It needs to as of Commerce 1.4.
Comment #15
Cellar Door CreditAttribution: Cellar Door commentedI'm seeing this as well on a kickstart install. If you need patch testing on any solutions let me know.
Also in a semi related nature - what's a good way to bulk remove duplicates. Our test user has about 50-60 billing address profiles now :)
Comment #16
salbertz CreditAttribution: salbertz commentedI had the same problems with duplicate shipping addresses when "My shipping adress is the same as my billing address" is selected, while the addressbook selection remains on "-choose-" (and thus creates a new address). But the latter fact simply arises from the fact, that, after a regular purchase process, so far no default address has been selected - and thus the address selector will display "-choose-" on the next visit also and the same happens again and again...
As soon as you visit "My Account => Address Book" and specify a (shipping) address to be "set as default" this behavior seems to disappear. On the next visit the default address is selected automatically and there seem to be no more duplicates.
The behavior is not 100% perfect though, since the coexistence of the "use billing address as shipping address" and "select shipping address" is still logically inconsistent: if you enter a new billing address, it will be correctly copied as a new shipping address (if that option is selected) but the shipping adress selector still displays the old default shipping address - at least until the next submit. (The perfect way would be a realtime change via ajax.)
But at least to me a simple fix of the most annoying consequences of this copy/select-compatibility conflict would seem to simply set the first (billing and shipping address) being entered for a customer as default (there seem to be issues about that, e.g. http://drupal.org/node/1799958).
Comment #17
vasikehere is patch that change the addressbook selection order in checkout profile form and hides it if the copy option it's present and checked.
Comment #18
rszrama CreditAttribution: rszrama commentedHmm, it looks like you took the opposite approach to what I recommended in #6, but I don't see why we can't have it both ways. With your patch as is, would it still create a duplicate profile if they chose an Addressbook address first and then clicked the profile copy checkbox?
Comment #19
vasikeduplicates still there.
but duplicates are made in Drupal commerce if the same data is entered twice.
some maybe we can have some validation in Drupal commerce about profiles duplicates. what do you think?
Comment #20
rszrama CreditAttribution: rszrama commentedI'm not talking about the expected duplicates but rather the unexpected ones that this issues is trying to mitigate. There shouldn't be any issue with profile duplication in Commerce core itself; we just needed to make sure that the Addressbook module and profile copying don't both act on the same time for an order's customer profile reference field.
Comment #21
jsacksick CreditAttribution: jsacksick commentedI commited a fix in dev that puts the default value to 0 for the profile copy checkbox when there's a default address selected.
When checking the checkbox, it flushed the address selected from the order, the
$form_state['input']
and$form_state['values']
Comment #22
brephraim CreditAttribution: brephraim commentedPatch?
Comment #23
jsacksick CreditAttribution: jsacksick commentedUpdate to dev and test it, it's probably quicker :)
Comment #24
jsacksick CreditAttribution: jsacksick commentedWe still have duplication issues, the last commits try to fix ux issues but this still needs work...
Comment #25
rszrama CreditAttribution: rszrama commentedLet's get a link in to the original commit so we can talk about it: http://drupalcode.org/project/commerce_addressbook.git/commitdiff/3099a82
From here, it looks like you're simply disabling the checkbox by changing the default value. My recommendation in #6 was actually to disable that checkbox entirely - i.e.
unset($form['...']['...'])
, not just set the#default_value = 0
. Along with that, note that profile copying actually works based on a variable in the $order->data array that you'll have to unset as well, e.g.unset($order->data['profile_copy'][$pane_id]['status')
.Comment #26
jsacksick CreditAttribution: jsacksick commentedWhat we can probably do is :
1) When there's not yet any customer profile for a type, keep the checkbox, and then disable it once you already have one customer profile of this type, what do you think ?
Comment #27
bojanz CreditAttribution: bojanz commentedQuoting #1876282: billing address book strange entries are created when copy from shipping information option is selected (marked as duplicate) for some more info:
Comment #28
bojanz CreditAttribution: bojanz commentedI've thought about this problem a bit.
We have two solutions:
1) Quick & clean: Don't show the "profile copy" checkbox for panes that have an addressbook with entries in it. So if there are existing shipping addresses, you don't get the "Same as billing" checkbox because you can already use an address from the addressbook.
2) More complicated: if the "profile copy" checkbox is checked, and the source profile is selected through the addressbook dropdown, do an EFQ comparing (only) the addressfield, and if a matching profile of that type exists, select it. So if a shipping profile with the same address as a billing profile exists, it will be selected. Otherwise, the fields are filled normally and a new profile is created.
Comment #29
manuelgutierrezlopez CreditAttribution: manuelgutierrezlopez commentedMy vote for the two options in #28 would go for option 2. For a usability of the site my feeling is that it is less confusing if we have the profile copy option checked and (hidden usign the pacth in #7) the selected address dropdown is not shown.
Comment #30
brephraim CreditAttribution: brephraim commentedOption two is preferable, agreed.
Comment #31
checker CreditAttribution: checker commentedI would prefer option one because of "quick & clean". Later it is still possible to do a complicate version like option two and I guess this version needs more testings and could have bad side effects etc. Option one could be really fast rtbc.
Comment #32
emptyvoid CreditAttribution: emptyvoid commentedHello,
I am getting duplicate billing addresses for a customer's account every time the profile is saved. It is my understanding that the system should "disable" previous revisions of the profile when an update is saved.
For a better picture (if you have installed this module for integration with Drupal Commerce) the following modules are used together to manage addresses.
Address Field (this module)
http://drupal.org/project/addressfield
This of course the Drupal Commerce Modules:
Drupal Commerce
http://drupal.org/project/commerce
It is important to note that commerce has several sub-modules most notably the customer module. The module has business logic to managing addresses (address field is a dependency). Address instances are appended to the customer profile entity in methods located in the commerce_customer.module file.
I'm leveraging a community module that extends the basic integration between addressfield and commerce entitled:
Commerce Address Book
http://drupal.org/project/commerce_addressbook
This module extends the basic integration and provides more business rules that don't exist in the standard commerce_customer module. Most notably it adds a management interface for the customer with the ability to create, edit, and delete addresses outside of the order process.
I believe the issue that causes duplicates is located here:
commerce_addressbook/includes/commerce_addressbook.user.inc
Line 30:
This method calls "commerce_customer_profile_can_delete($profile) which states:
commerce/modules/commerce_customer.module
Online 628:
// Return FALSE if the given profile does not have an ID; it need not be
// deleted, which is functionally equivalent to cannot be deleted as far as
// code depending on this function is concerned.
And a little later in the method
Online: 635
// If any module implementing hook_commerce_customer_profile_can_delete()
// returns FALSE the customer profile cannot be deleted. Return TRUE if none
// return FALSE.
So a quick search of my source code reveals the following places where modules influence if a profile can be deleted:
commerce/modules/commerce_order.module
Online: 458
function commerce_order_commerce_customer_profile_can_delete($profile)
The function comments say it all:
So, if an order in the past used the address then modifying the address for a current or future order will result in the system duplicating the address with the changed values. Old addresses are not deleted, period.
What I'm assuming is not working is that the "expired" addresses should be hidden from the user and only the "new" address revision should be visible.
Retracing back to ye old commerce_addressbook module the submission method is suppose to accomplish this.
commerce_addressbook/includes/commerce_addressbook.user.inc
Online: 45
Online 52 of the method the current "target" profile has the status set to 0. Meaning it is disabled and should not be visible any longer. However it still appears both in the management indexes and during order checkout.
:(
Cross Posted at:
http://drupal.org/node/1940156
http://drupal.org/node/1185996
Comment #33
rszrama CreditAttribution: rszrama commented@emptyvoid It sounds to me like you're just describing the normal customer profile duplication process, the solution of Commerce core to maintaining the integrity of historical order data. The system is not able to use revisions (because we can't "branch" within a single customer profile) and does not do anything with previously used addresses. You can rig something up to disable previously used addresses via Rules if you want, or you might look into http://drupal.org/project/commerce_single_address from bojanz.
Comment #34
generalredneckThat's actually emptyvoid. Nadavoid isn't in this thread I believe.
Comment #35
rszrama CreditAttribution: rszrama commentedYou're right, but I ended up responding to him elsewhere, too, and didn't bother coming back here... but since I'm here now. [edit]
Comment #36
acidpotato CreditAttribution: acidpotato commentedBoth of them are good alternatives in my book.
Comment #37
jsacksick CreditAttribution: jsacksick commentedHere's a patch that implements the 1) solution proposed in the #28 comment, the 2) solution is longer to implement and I'll try to implement it later.
Comment #38
jsacksick CreditAttribution: jsacksick commentedAttached patch removes useless checks.
Comment #39
jsacksick CreditAttribution: jsacksick commentedComment #40
jsacksick CreditAttribution: jsacksick commentedThere was a last remaining bug, The latest patch only hide the profile copy checkbox if there is an address selected in the select list.
I'm marking this issue as fixed, we'll open a new issue to implement the 2) solution later.
Comment #42
acidpotato CreditAttribution: acidpotato commentedUsing patch in #40 the checkbox does get hidden. But if user selects "Choose" (unselecting all options) from the Addressbook select list, the checkbox shows up again and is checked by default. If this checkbox is unselected and selected again, a duplicate profile is created.
Comment #43
jsacksick CreditAttribution: jsacksick commentedI kept the profile copy checkbox when you don't select an existing address allowing the users to copy the billing information if the address entered in the billing hasn't been stored yet.
So the profile duplication is the expected behavior there.