Backoffice - max cost margin #31

Merged
bilal.catic merged 22 commits from backoffice-max-cost-margin into master 2018-10-15 00:24:34 +02:00
bilal.catic commented 2018-10-11 05:22:29 +02:00 (Migrated from gitlab.com)

https://app.asana.com/0/697944902557002/838943199344918/f

SMOKE TEST :

  1. Create three simple products

  2. Create two bundles containing two simple product and one bundle that contains third simple product. Set margin (pricing tab) to 0

  3. Bundles should be visible now in market and package status in products tab in back office should show "available"

  4. Change margin in one bundle to value like 100

  5. Change price of simple product to price that exceeds margin, like 5000

  6. Bundle with margin different than zero should change status to "margin_exceeded" and it should not be visible in market. Other two bundles should keep their available status.

  7. Now change margin to be greater than simple product price, like 10000

  8. Bundle should be available again and visible in market.

  9. Open bundle in market while status is available and keep that page open

  10. Now change price of simple product or margin to make bundle invalid

  11. Go back to opened package page / tab and try to add it to cart

  12. There should be error and package should not be added

  13. Reverse price again so bundle is available

  14. Add it to cart but don't create order yet

  15. Change price or margin so that bundle become invalid

  16. Try to create order

  17. There should be error and order should not be placed

  18. Reverse price again so bundle is available

  19. Try to create order

  20. Order should be created without errors

https://app.asana.com/0/697944902557002/838943199344918/f SMOKE TEST : 1. Create three simple products 2. Create two bundles containing two simple product and one bundle that contains third simple product. Set margin (pricing tab) to 0 3. Bundles should be visible now in market and package status in products tab in back office should show "available" 4. Change margin in one bundle to value like 100 5. Change price of simple product to price that exceeds margin, like 5000 6. Bundle with margin different than zero should change status to "margin_exceeded" and it should not be visible in market. Other two bundles should keep their available status. 7. Now change margin to be greater than simple product price, like 10000 8. Bundle should be available again and visible in market. 9. Open bundle in market while status is available and keep that page open 10. Now change price of simple product or margin to make bundle invalid 11. Go back to opened package page / tab and try to add it to cart 12. There should be error and package should not be added 13. Reverse price again so bundle is available 14. Add it to cart but don't create order yet 15. Change price or margin so that bundle become invalid 16. Try to create order 17. There should be error and order should not be placed 18. Reverse price again so bundle is available 19. Try to create order 20. Order should be created without errors
bilal.catic commented 2018-10-11 05:27:30 +02:00 (Migrated from gitlab.com)

added 1 commit

  • feae5a81 - remove debug logging

Compare with previous version

added 1 commit <ul><li>feae5a81 - remove debug logging</li></ul> [Compare with previous version](https://gitlab.com/saburly/wiaas/new-wiaas/merge_requests/31/diffs?diff_id=24877623&start_sha=3b6848cb1fa3554bd25df8a5068ed42572ba2ec5)
bilal.catic commented 2018-10-11 05:53:52 +02:00 (Migrated from gitlab.com)

added 1 commit

  • 6682ada3 - add tests

Compare with previous version

added 1 commit <ul><li>6682ada3 - add tests</li></ul> [Compare with previous version](https://gitlab.com/saburly/wiaas/new-wiaas/merge_requests/31/diffs?diff_id=24878170&start_sha=feae5a8131e41a6823c00390e43214e09846aa93)
bilal.catic commented 2018-10-11 06:05:53 +02:00 (Migrated from gitlab.com)

This part with total cost is confusing to me. If bundle contains simple product + add on + option, total cost is calculated only for simple products. What if supplier increase price of option or/and add on ? Should package still be available or not, or just option/add on should not be available ?

This part with total cost is confusing to me. If bundle contains simple product + add on + option, total cost is calculated only for simple products. What if supplier increase price of option or/and add on ? Should package still be available or not, or just option/add on should not be available ?
bilal.catic commented 2018-10-12 11:16:20 +02:00 (Migrated from gitlab.com)

added 18 commits

  • 6682ada3...089bea5c - 3 commits from branch master
  • 57d61918 - add minimum cost margin input box
  • accc359c - handle bundle minimum cost margin read and update
  • ea638707 - use minimum cost margin in pricing panel
  • ac9c89e8 - update name to reflect logic behind margin
  • c7e8a526 - add custom package status
  • afe4ac16 - update package status on product update
  • 1e9f959b - fetch only available packages
  • 63c1ee94 - prevent adding invalid package to cart
  • 8d2b1e52 - prevent checkout with invalid package
  • bc74b504 - fix const declaration
  • 4f31cc94 - update package status on package update
  • 84ba574b - add detailed error message
  • e4a7b283 - fix tests
  • f3d911e5 - remove debug logging
  • 4bdad78e - add tests

Compare with previous version

added 18 commits <ul><li>6682ada3...089bea5c - 3 commits from branch <code>master</code></li><li>57d61918 - add minimum cost margin input box</li><li>accc359c - handle bundle minimum cost margin read and update</li><li>ea638707 - use minimum cost margin in pricing panel</li><li>ac9c89e8 - update name to reflect logic behind margin</li><li>c7e8a526 - add custom package status</li><li>afe4ac16 - update package status on product update</li><li>1e9f959b - fetch only available packages</li><li>63c1ee94 - prevent adding invalid package to cart</li><li>8d2b1e52 - prevent checkout with invalid package</li><li>bc74b504 - fix const declaration</li><li>4f31cc94 - update package status on package update</li><li>84ba574b - add detailed error message</li><li>e4a7b283 - fix tests</li><li>f3d911e5 - remove debug logging</li><li>4bdad78e - add tests</li></ul> [Compare with previous version](https://gitlab.com/saburly/wiaas/new-wiaas/merge_requests/31/diffs?diff_id=24978042&start_sha=6682ada37ec8b19fdab8e16499abfe4322589f96)
akrdzic commented 2018-10-12 17:11:41 +02:00 (Migrated from gitlab.com)

This code does not take into into account relationships between packages and should only be used to get total prices for single package, since price margins are calculated on package level.

This code does not take into into account relationships between packages and should only be used to get total prices for single package, since price margins are calculated on package level.
akrdzic commented 2018-10-12 18:08:26 +02:00 (Migrated from gitlab.com)

Do not handle this here. Separate into method that will be triggered on checkout validation hook and add notice error.

Do not handle this here. Separate into method that will be triggered on checkout validation hook and add notice error.
akrdzic commented 2018-10-12 19:34:57 +02:00 (Migrated from gitlab.com)

This action should not have its own separate file, the name is confusing and it is not clear on the first glance what is this for
and why do we have it.
Logic implemented is not related to product but package, and also logic implemented is specifically for
package pricing.

This action should be moved to Package_Pricing file since it applies package pricing logic.

This action should not have its own separate file, the name is confusing and it is not clear on the first glance what is this for and why do we have it. Logic implemented is not related to product but package, and also logic implemented is specifically for package pricing. This action should be moved to Package_Pricing file since it applies package pricing logic.
akrdzic commented 2018-10-12 21:30:20 +02:00 (Migrated from gitlab.com)

Note: You cannot set taxonomy query like this, since there may be queries before yours. You query should
be added ass element to array, but first check if $query['tax_query'] is initialized.

Note: You cannot set taxonomy query like this, since there may be queries before yours. You query should be added ass element to array, but first check if `$query['tax_query']` is initialized.
bilal.catic commented 2018-10-14 16:03:18 +02:00 (Migrated from gitlab.com)

changed this line in version 5 of the diff

changed this line in [version 5 of the diff](https://gitlab.com/saburly/wiaas/new-wiaas/merge_requests/31/diffs?diff_id=25070012&start_sha=4bdad78ed895c2ca0f235ebfb51b44a5e09bb899#12de204f89963d1b3c16239e9e41c8fb1b23dde8_40_0)
bilal.catic commented 2018-10-14 16:03:18 +02:00 (Migrated from gitlab.com)

changed this line in version 5 of the diff

changed this line in [version 5 of the diff](https://gitlab.com/saburly/wiaas/new-wiaas/merge_requests/31/diffs?diff_id=25070012&start_sha=4bdad78ed895c2ca0f235ebfb51b44a5e09bb899#40e0ba1a46c3e28110cb08f5ff2bd98c02050dce_19_36)
bilal.catic commented 2018-10-14 16:03:18 +02:00 (Migrated from gitlab.com)

changed this line in version 5 of the diff

changed this line in [version 5 of the diff](https://gitlab.com/saburly/wiaas/new-wiaas/merge_requests/31/diffs?diff_id=25070012&start_sha=4bdad78ed895c2ca0f235ebfb51b44a5e09bb899#12de204f89963d1b3c16239e9e41c8fb1b23dde8_1_0)
bilal.catic commented 2018-10-14 16:03:18 +02:00 (Migrated from gitlab.com)

changed this line in version 5 of the diff

changed this line in [version 5 of the diff](https://gitlab.com/saburly/wiaas/new-wiaas/merge_requests/31/diffs?diff_id=25070012&start_sha=4bdad78ed895c2ca0f235ebfb51b44a5e09bb899#e80982a52d66d1be7faa15f44c574ce766a54011_35_35)
bilal.catic commented 2018-10-14 16:03:18 +02:00 (Migrated from gitlab.com)

added 5 commits

  • 8df4ec3d - move package validation to seperate function
  • 14eda981 - add notice instead of throwing error
  • ba2629ca - refactor
  • 9f3fe44b - add proper message when adding invalid package to cart
  • 55dc87e1 - check if taxonomy query exists and append if exists

Compare with previous version

added 5 commits <ul><li>8df4ec3d - move package validation to seperate function</li><li>14eda981 - add notice instead of throwing error</li><li>ba2629ca - refactor</li><li>9f3fe44b - add proper message when adding invalid package to cart</li><li>55dc87e1 - check if taxonomy query exists and append if exists</li></ul> [Compare with previous version](https://gitlab.com/saburly/wiaas/new-wiaas/merge_requests/31/diffs?diff_id=25070012&start_sha=4bdad78ed895c2ca0f235ebfb51b44a5e09bb899)
akrdzic commented 2018-10-14 20:19:14 +02:00 (Migrated from gitlab.com)

This should not be here.
The idea is that calling of WC()->checkout()->check_cart_items(); will trigger action woocommerce_check_cart_items to which all validation functions should be hooked in to validate cart items.
So check for existing error notices is handled below.

This should not be here. The idea is that calling of `WC()->checkout()->check_cart_items();` will trigger action `woocommerce_check_cart_items` to which all validation functions should be hooked in to validate cart items. So check for existing error notices is handled below.
akrdzic commented 2018-10-14 20:19:32 +02:00 (Migrated from gitlab.com)

Why is this here?

Why is this here?
akrdzic commented 2018-10-14 20:20:08 +02:00 (Migrated from gitlab.com)

This hook is not he one used for validation cart items. It is woocommerce_check_cart_items

This hook is not he one used for validation cart items. It is `woocommerce_check_cart_items`
bilal.catic commented 2018-10-14 23:38:53 +02:00 (Migrated from gitlab.com)

changed this line in version 6 of the diff

changed this line in [version 6 of the diff](https://gitlab.com/saburly/wiaas/new-wiaas/merge_requests/31/diffs?diff_id=25078422&start_sha=55dc87e1744be59d701b5d78c76a04200c631215#40e0ba1a46c3e28110cb08f5ff2bd98c02050dce_36_36)
bilal.catic commented 2018-10-14 23:38:54 +02:00 (Migrated from gitlab.com)

changed this line in version 6 of the diff

changed this line in [version 6 of the diff](https://gitlab.com/saburly/wiaas/new-wiaas/merge_requests/31/diffs?diff_id=25078422&start_sha=55dc87e1744be59d701b5d78c76a04200c631215#40e0ba1a46c3e28110cb08f5ff2bd98c02050dce_41_37)
bilal.catic commented 2018-10-14 23:38:54 +02:00 (Migrated from gitlab.com)

changed this line in version 6 of the diff

changed this line in [version 6 of the diff](https://gitlab.com/saburly/wiaas/new-wiaas/merge_requests/31/diffs?diff_id=25078422&start_sha=55dc87e1744be59d701b5d78c76a04200c631215#40e0ba1a46c3e28110cb08f5ff2bd98c02050dce_6_6)
bilal.catic commented 2018-10-14 23:38:54 +02:00 (Migrated from gitlab.com)

added 1 commit

  • d7c34c3b - remove double code, change hook for validation

Compare with previous version

added 1 commit <ul><li>d7c34c3b - remove double code, change hook for validation</li></ul> [Compare with previous version](https://gitlab.com/saburly/wiaas/new-wiaas/merge_requests/31/diffs?diff_id=25078422&start_sha=55dc87e1744be59d701b5d78c76a04200c631215)
bilal.catic commented 2018-10-14 23:42:27 +02:00 (Migrated from gitlab.com)

added 1 commit

Compare with previous version

added 1 commit <ul><li>a5168d34 - remove unnecessary code</li></ul> [Compare with previous version](https://gitlab.com/saburly/wiaas/new-wiaas/merge_requests/31/diffs?diff_id=25078458&start_sha=d7c34c3b0b90adbb1723bf58d442e54c0fc10f2b)
akrdzic commented 2018-10-15 00:24:34 +02:00 (Migrated from gitlab.com)

merged

merged
akrdzic commented 2018-10-15 00:24:34 +02:00 (Migrated from gitlab.com)

mentioned in commit 803e62ea69

mentioned in commit 803e62ea69933b677e825779e842034bbf9fa70a
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: senaduka/old-new-wiaas#31