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

Modify Order, Issues #2163, #194, #662 #2165

Merged
merged 42 commits into from
Nov 28, 2016
Merged

Modify Order, Issues #2163, #194, #662 #2165

merged 42 commits into from
Nov 28, 2016

Conversation

jtsternberg
Copy link
Contributor

@jtsternberg jtsternberg commented Nov 3, 2016

Starting this PR off. Still a bit more work to do, namely:

  • Editing contact details.
  • Make editing contact details Ajax-ey
  • When adding a product that is already in the list, increment the quantity instead of adding another line item.
  • Testing with taxes/shipping
  • etc

Copy link
Member

@JustinSainton JustinSainton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple minor issues, otherwise, A++

while( wpsc_have_purchaselog_details() ) : wpsc_the_purchaselog_item(); ?>
<tr>
while( wpsc_have_purchaselog_details() ) : wpsc_the_purchaselog_item();
$this->purchase_log_cart_item( $this->can_edit );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this use self, as it is a static method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be good.

@@ -599,6 +599,8 @@ function save_to_db($purchase_log_id) {
}

do_action( 'wpsc_save_cart_item', $cart_item_id, $this->product_id, $this );

return $cart_item_id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noice to have a return value here, but let's document it in the doc block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be good.

Copy link
Member

@JustinSainton JustinSainton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few more minor stylistic changes.

$log_id = absint( $_POST['log_id'] );
$log = new WPSC_Purchase_Log( $log_id );


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the double blank line here, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be good.

$item_ids[] = absint( $item_id );
}

return _wpsc_init_log_items( $log, $item_ids );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If $_POST['product_ids'] is set to an empty array(), it will pass the first condition, but not be iterated through, and the $log variable will not exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be good.

if ( ! empty( $item_ids ) && in_array( absint( wpsc_purchaselog_details_id() ), $item_ids, true ) ) {
$html .= $cart_item;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the blank line after the control structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@JustinSainton
Copy link
Member

@jtsternberg looking noice so far amigo.

jtsternberg and others added 21 commits November 5, 2016 14:55
…n fact, getting cart contents - we are getting order items - legacy table names be darned.
…ing the WPSC_Purchase_Log::update_caches method
…ing the WPSC_Purchase_Log::delete_caches method
@@ -649,7 +650,7 @@ public function get_meta() {
* @access protected
* @since 3.8.9
*
* @return void
* @return WPSC_Query_Base
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shan't this actually return a WPSC_Purchase_Log object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah it shad

@jtsternberg jtsternberg changed the title Modify Order, Issues #2163, #194 Modify Order, Issues #2163, #194, #662 Nov 8, 2016
This was referenced Nov 15, 2016
@mihaijoldis
Copy link
Contributor

Some testing feedback:

Checkout page: https://dl.dropboxusercontent.com/u/16683640/Screenshots/2016-11-15_1959.png
Sales log page (order still pending) https://dl.dropboxusercontent.com/u/16683640/Screenshots/2016-11-15_2000.png
Edit order https://dl.dropboxusercontent.com/u/16683640/Screenshots/2016-11-15_2001.png

Also there is a weird behaviour with both billing/shipping showing/hiding when Shipping address is same as billing enabled

And when i increase the product quantity to 2 for all products the overall numbers look confusing a bit to me.
https://dl.dropboxusercontent.com/u/16683640/Screenshots/2016-11-15_2005.png

You have per item shipping 20$ and 20$ international shipping. The 40 is good IF you count /item shipping for the whole item and not /each item. so if there are 2 Per-item shipping products in cart there is a 40$ shipping + the global flat rate of 20$ i setup ?
And the Item total shows 29.5 in my example and if someone adds all the item totals + shipping it will be 20$ more than the 67.50

and, https://dl.dropboxusercontent.com/u/16683640/Screenshots/2016-11-15_2011.png after i increased the quantity. Same on the user account page (Tev1) https://dl.dropboxusercontent.com/u/16683640/Screenshots/2016-11-15_2012.png

@JustinSainton JustinSainton merged commit 22c2711 into master Nov 28, 2016
@JustinSainton JustinSainton deleted the issue-2163 branch November 28, 2016 21:22
@JustinSainton JustinSainton restored the issue-2163 branch November 28, 2016 23:09
JustinSainton added a commit that referenced this pull request Nov 28, 2016
* Kill more $purchlogitem global usage

* Add utility methods for getting forms data in different ways

* Refactor wpsc_purchaselogs_items to use WPSC_Purchase_Log and WPSC_Checkout_Form_Data objects.

* Favor the get_items() method, over get_cart_contents(). We are not, in fact, getting cart contents - we are getting order items - legacy table names be darned.

* Capitalize classes WPSC_Cart and WPSC_Cart_Item. Backwards-compatible, as PHP class names are case-insensitive.

* Static WPSC_Purchase_Log::update_cache is now just a wrapper for calling the WPSC_Purchase_Log::update_caches method

* Static WPSC_Purchase_Log::delete_cache is now just a wrapper for calling the WPSC_Purchase_Log::delete_caches method

* Fix typos

* Add note about delete_caches params being for back-compat

* Add a contextual document title on sales log view pages

* Scrutinize PR.

* No longer necessary to pass object to update_caches() method.

* Docs improvements.

* Stub for new wpsc_get_order() helper function.

* Log property should be a log object, not checkout form data object.

* Add reset method to WPSC_Query_Base

* Be sure $exists is set with each fetch()

* WPSC_Coupon now also extends WPSC_Query_Base

* add WPSC_Purchase_Log::form_data for initiating WPSC_Checkout_Form_Data object

* fix shipping_name missing last name

* Replace log cart language with "item"

* Update @return docs for the fetch methods

* Implement contact details editing for logs.

* Introduce multiple_meta static key definition, and use to get multiple

Also _wpsc_doing_it_wrong for when get()-ing 'notes' key

* Introduce better sales log notes. Re: #194, for #2165

* Hookup adding/deleting notes via ajax

* Pass item_id to remove_item() method.

* move shipping/billing display output to separate methods

* Hook up ajax-saving for log-page contact-details editing

* Ajax-load payment details as well, since fields are ajax-editable

* Move to proper WP metaboxes on log screen

* Move to proper WP metaboxes on log screen

* Add a edit-contact-details cancel button

* Clean up log pagination styling

* Include item shipping when calculating the total log shipping total

* If we're going to reference a global, we better darn well define it.

* Add helper function for payment gateway support checking

* Add action for registering metaboxes.

* Add base method for processing refunds.

* Minor whitespace and docs cleanup
@JustinSainton JustinSainton deleted the issue-2163 branch November 28, 2016 23:10
@JustinSainton JustinSainton mentioned this pull request Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants