Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPC and shipping estimator #193

Closed
archelaus-cards opened this issue Mar 31, 2019 · 7 comments
Closed

OPC and shipping estimator #193

archelaus-cards opened this issue Mar 31, 2019 · 7 comments

Comments

@archelaus-cards
Copy link

Working with my clean install of ZC 1.5.6a and OPC 2.1.0beta8, I've found what looks like a lingering bug from our shipping-billing address saga. If I use guest checkout, enter a billing address, enter a different shipping address, and then return to the shopping cart, the shipping estimator defaults to the billing address, which seems a bit counter-intuitive (using returning-customer checkout it defaults to the shipping address, which seems more sensible). But more importantly, although there are two choices in the shipping estimator's drop-down, they both display in the drop-down itself as if they were the billing address, so the customer appears to have no meaningful choice. In actual fact, selecting the second one does then display the correct full shipping address on the screen, but the customer has no way of knowing that this will happen. The problem does not occur in returning-customer checkout.

@lat9 lat9 added the bug label Mar 31, 2019
@lat9
Copy link
Owner

lat9 commented Mar 31, 2019

I'm going to leave the OPC/shipping-estimator interoperability issue to the next OPC release.

@archelaus-cards
Copy link
Author

Fair enough. Can't blame you for that!

Unfortunately, I have more weird behavior to report. The clean install is now doing something wrong in returning-customer checkout, as well. Something it was not doing half-an-hour ago, even though I have not changed any code or settings in the meantime.

So, initially, after I logged in, there were two addresses in my address book. I left the billing address as default, but typed in a third address for shipping and saved it, but without clicking the "Save to Address Book" checkbox. Then I went to the shopping cart. The shipping estimator displayed the correct shipping address on screen, while the drop-down gave as choices the two addresses in the address book. Okay, that's what I think it was supposed to do. BUT, then, half-an-hour later, after a lot of logging in and out, as well as switching to guest checkout and back again, I started getting some weird results. So, I closed and reopened the browser, logged in again, and repeated the exact same procedure as the first time, only to have the shipping estimator put the default billing address on the screen instead of the shipping address! Since the desired shipping address isn't in the address book, it ceased to be available to the customer as a shipping-estimator option at all.

Two notes: First, the problem is restricted to the shipping estimator. When I return to checkout, the shipping address is still correct, as is the shipping cost and the shipping method. Second, I don't have a clean installation of ZC available right now without OPC installed on top of it, so I don't know how that would behave in the same situation.

@archelaus-cards
Copy link
Author

For future reference, please note that I've just figured out that in guest checkout, the shipping-estimator drop-down is not showing the default billing address twice, as I assumed; rather it is showing the location of the store. So, I was getting ", DC, United States," which I mistook for a weirdly truncated form of my home address, which I was using for testing. When I switched to a default billing address in California, the drop-down continued to be ", DC, United States."

@lat9
Copy link
Owner

lat9 commented Nov 10, 2019

Noting that the changes below apply to zc154 through zc156. I'll add a separate posting, below, to detail the changes for zc156a-c.

There are a couple of shipping_estimator-related changes that are required for its interoperation with OPC:

  1. /includes/modules/shipping_estimator.php and, if present, any template-override version. Find the two occurrences of

    if ($_SESSION['customer_id']) {

    and change to

    if (zen_is_logged_in() && !zen_in_guest_checkout()) {

  2. /includes/templates/template_default/templates/tpl_modules_shipping_estimator.php and, if present, any template-override version. Find the occurrence of

    if ($_SESSION['customer_id']) {

    and change to

    if (zen_is_logged_in() && !zen_in_guest_checkout()) {

    Then find the occurrence of

    <?php if ($_SESSION['customer_id'] < 1 ){ ?>

    and change to

    <?php if (!zen_is_logged_in() || zen_in_guest_checkout()) { ?>

@lat9
Copy link
Owner

lat9 commented Nov 10, 2019

For zc156a:

  1. /includes/modules/shipping_estimator.php and, if present, any template-override version. Find the two occurrences of

    if (!empty($_SESSION['customer_id'])) {

    and change to

    if (zen_is_logged_in() && !zen_in_guest_checkout()) {

  2. /includes/templates/template_default/templates/tpl_modules_shipping_estimator.php and, if present, any template-override version. Find the occurrence of

    if (!empty($_SESSION['customer_id'])) {

    and change to

    if (zen_is_logged_in() && !zen_in_guest_checkout()) {

    Then find the occurrence of

    <?php if (empty($_SESSION['customer_id'])){ ?>

    and change to

    <?php if (!zen_is_logged_in() || zen_in_guest_checkout()) { ?>

@lat9
Copy link
Owner

lat9 commented Nov 10, 2019

For zc156b and zc156c:

  1. /includes/modules/shipping_estimator.php and, if present, any template-override version. Find the two occurrences of

    if (!empty($_SESSION['customer_id'])) {

    and change to

    if (zen_is_logged_in() && !zen_in_guest_checkout()) {

  2. /includes/templates/template_default/templates/tpl_modules_shipping_estimator.php and, if present, any template-override version. Find the occurrence of

    if (zen_is_logged_in()) {

    and change to

    if (zen_is_logged_in() && !zen_in_guest_checkout()) {

    Then find the occurrence of

    <?php if (!zen_is_logged_in()){ ?>

    and change to

    <?php if (!zen_is_logged_in() || zen_in_guest_checkout()) { ?>

@lat9
Copy link
Owner

lat9 commented Nov 10, 2019

Arggh, that's quite the mess. I'll update the upgrade documentation to point to this issue rather than regurgitating these changes there!

@lat9 lat9 added this to the v2.2.1 milestone Nov 10, 2019
@lat9 lat9 closed this as completed Nov 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants