Commit Graph

256 Commits

Author SHA1 Message Date
Claudio Sanches 567a551d83 Fixed shortcode render for variations and backwards compatibility
Fixes #13949
2017-04-06 13:00:02 -03:00
Mike Jolley bf09c7df82 Ensure reg prices are the same 2017-04-06 13:08:18 +01:00
Mike Jolley 7e90a318cd On variable save, sync with children and avoid transient cache 2017-04-06 12:26:10 +01:00
Mike Jolley 93689a8107 Show a sale price on variable products if on sale and all prices are the same
Fixes #13968
2017-04-06 11:01:20 +01:00
Mike Jolley c06fdc2e2e If product has_options, don't show qty in grouped product add to cart form
Fixes #13875
2017-04-03 12:05:28 +01:00
Mike Jolley 73dd37fbd7 Show variation prices if the sale prices do not all match
fixes #13734
2017-03-23 14:21:16 +00:00
Claudio Sanches 59c2849736 Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00
Mike Jolley 5bdeddcb32 Hide suffix on variable product when dynamic.
Closes #13494
2017-03-07 13:25:52 +00:00
Brent Shepherd e427f90a24 Access data store consistently
WC_Data object's data store is accessed everywhere else directly
via $this->data_store. This patch uses that same approach here.
2017-02-17 10:25:27 -08:00
Mike Jolley 48c93d5293 Fix variation max qty. 2017-02-17 16:37:40 +00:00
Mike Jolley 1b268d2f63 use helpers 2017-02-17 15:52:47 +00:00
Mike Jolley d693863ad2 Merge pull request #13064 from thenbrent/variable_product_sync_filters
Modify variable product sync hooks
2017-02-10 18:40:48 +00:00
Brent Shepherd 5d560f380a Remove 'woocommerce_variable_product_synced' hook
And add additional suggested alternatives to the deprecated
woocommerce_variable_product_sync hook.
2017-02-10 10:36:35 -08:00
Brent Shepherd 5dec55928b Add 'woocommerce_variable_product_sync_data'
Renaming 'woocommerce_variable_product_sync_before_save'
2017-02-10 10:33:48 -08:00
Mike Jolley 718149f1d4 Merge pull request #12999 from thenbrent/add_sort_variation_prices
Move price sorting into WC_Product_Variable::sort_variation_prices()
2017-02-08 10:29:30 +00:00
Brent Shepherd a9a83ebae2 Add 'woocommerce_variable_product_synced' filter 2017-02-07 14:05:17 -08:00
Brent Shepherd 81ef55ef42 Add woocommerce_variable_product_sync_before_save
Removing woocommerce_variable_product_nsync filter and $save param.
2017-02-07 13:57:24 -08:00
Brent Shepherd d4ff61814a Deprecate 'woocommerce_variable_product_sync' 2017-02-07 13:51:21 -08:00
Brent Shepherd f768f9f04b Add new variable product sync hook
To provide a way for callbacks to modify the actual instance of the
variable product being sync'd, especially before its saved, in case
it needs to sync some meta data or other prop that can be set on the
object itself.
2017-02-03 15:30:56 -08:00
Brent Shepherd a6bed34358 Remoe unused 'edit' param
To avoid a merge conflict with #13063
2017-02-03 15:10:19 -08:00
Brent Shepherd 7e61cb8a24 Trigger variable product sync hook after save
Because only a product ID is passed to callbacks on 'woocommerce_variable_product_sync',
they will need to instantiate their own instance of the product to do anything useful
with it. This creates a lot of potential for problems given that the product has at that
stage had its data sync'd but not all of it saved. For example, a callback may modify some
meta data on its own instance of the product, then save that, only to immediately have
that overridden if the instance of $product in WC_Product_Variable::sync() also had changes
to that meta data.

Instead, trigger 'woocommerce_variable_product_sync' only after the product has been
saved. This is backward compatible because the hook was triggered at the very end of
the process in WC < 2.7.
2017-02-03 15:01:36 -08:00
Brent Shepherd 8431b2ac86 Remove 'edit' param on get_visible_children()
The WC_Product_Variable::get_visible_children() method accepts no parameters.
2017-02-03 14:53:03 -08:00
Brent Shepherd e7e434da4b WC_Product_Variable::sort_variation_prices()
To keep variation sorting logic inside the variable product, and separate
from the database storage logic in WC_Product_Variable_Data_Store_CPT
2017-01-26 12:47:46 -08:00
Mike Jolley 4eac304388 Merge pull request #12814 from woocommerce/fix-product-variable-filters
Remove deprecation notices on woocommerce_get_children
2017-01-17 10:19:17 +00:00
Claudio Sanches 20032fd170 Fixed declaration of is_on_sale() compatible with WC_Product::is_on_sale 2017-01-16 19:59:53 -02:00
Justin Shreve fab2e52bdd Remove deprecation filters. 2017-01-16 11:06:25 -08:00
Mike Jolley 5dba3d5bfe Sync variation names 2017-01-04 15:18:02 +00:00
Mike Jolley 564d3f4e33 Feedback 2017-01-04 13:56:07 +00:00
Mike Jolley 377bbf7767 Merge branch 'master' into read-price-data-caching 2016-12-23 14:08:08 +00:00
Mike Jolley ceee6c37ca Change how non-crud props get stored 2016-12-23 14:06:51 +00:00
Manos Psychogyiopoulos 40bf6afc29 fix incorrect inline comments
Ref: 01aba1fd2b
2016-12-22 19:41:23 +02:00
Mike Jolley 20680203bb Add actions for all object types 2016-12-19 17:09:52 +00:00
Mike Jolley ad7d8c14dc Do not suffix when ranges are used. 2016-12-05 13:44:21 +00:00
Mike Jolley ba56274662 Move get_price_suffix back to main class 2016-12-02 17:02:06 +00:00
Mike Jolley 9087a45f29 Remove attribute_ prefix rather than add so that get_attributes has better return values, and don't show duplicate data in cart. 2016-11-24 14:20:48 +00:00
Mike Jolley d7dfdd3d10 Wrap all deprecation calls. 2016-11-23 16:15:00 +00:00
Mike Jolley 885dad605a Interface naming 2016-11-22 13:54:51 +00:00
Daniel Abernathy 4a758ef5ca fix typo in get_variation_sale_price argument list 2016-11-21 19:17:50 -06:00
Justin Shreve 20fca44334 Handle product quick and bulk edit. 2016-11-16 12:54:53 -08:00
Mike Jolley 76b32c9aa5 WIP - Product CRUD (#12065)
* Created function to get the catalog visibility options

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* Hardcode the get_type per product class

* Initial look through getters and setters and abstract data

* Missing var

* Add related product functions and deprecate those in class.

* No need to exclude ID

* Fixed coding standards and improved the docblocks

* Get cached terms from wc_get_related_terms()

* Fixed wrong variable in wc_get_related_terms

* Use count() instead of sizeof()

* Sanitize ids later

* Remove unneeded comments

* wc_get_product_term_ids instead of related wording and use in other places.

get_the_terms is used here and also handles caching, something
wp_get_post_terms does not.

* Clean up the abstract product class a bit, deprecate two functions we have renamed, make update & create work properly, and add some tests for it.

* Bump template version

* Handle PR feedback: Remove duplicate regular_price update, allow changing of post status for products, remove deprecation for get_title since we might still offer it as a function

* Made abstract function useful

* External Product CRUD

* _virtual meta should be 'no', not taxable, in product unit test helper

* Grouped product class

* Tests

* Move children to meta and update test

* Use get_upsell_ids

* Spacing in query

* Moving and refactoring methods

* Availability html

* Tidy/add todos

* Rename method

* Put back review functions (still todo)

* missing $this

* get_price_including_tax/excluding_tax functions

* wc_get_price_to_display

* Price handling

* [Product CRUD] Variable (#12146)

* [Product CRUD] Variable Products

* Handle PR feedback.

* [Product CRUD] Grouped Handling (#12151)

* Handle grouped product saving

* Update routine

* [Product CRUD] Product crud terms (#12149)

* Category and tag id handling

* Replace template functions

* Remove todo

* Handle default name in save function

* Product crud admin save routine (#12174)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Spacing

* Fix comment

* wc_implode_text_attributes helper function

* [Product CRUD] Product crud admin use getters (#12196)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Move settings into new files

* Refactor panels and use getters

* Use getters for variation panel

* Revert save variation changes for now

* Add todos

* Fix downloads

* REST API CRUD Updates

* Additional API updates/fixes. Added some todos

* Fix final failing tests and implementing setters/getters and attributes functionality.

* Fix comparison for is_on_sale and remove download_type from WC_Product.

* Add a wc_get_products wrapper.

* Remove the download type input from the product data metabox for downloadable products. (#12221)

* [Product CRUD] Variations - setters, getters and admin. (#12228)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* Feedback fixes

* Implement CRUD in the legacy REST API

* Handle PR feedback

* [Product CRUD] Getter setter proxy methods (#12236)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* get_prop implementation in abstract and data classes

* Implement set_prop

* Change handling

* Array key exists

* set_object_read

* Use get_the_terms() instead of wp_get_post_terms()

wp_get_post_terms() is a wrapper around wp_get_object_terms() which does not
use the object cache, and generates a database query every time it is used.

get_the_terms() however can use data from the object cache if present.

* Allow WP_Query to preload post data, and meta in wc_get_products()

Allow WP_Query to bulk query for post data and meta if more than
just IDs are requested from wc_get_products(). Reduces query count
significantly.

* [Product CRUD] Variable, variation, notices, and stock handling (#12277)

* No longer needed

* Remove old todos

* Use getters in admin list

* Related and upsells update for CRUD

* Fix notice in gallery

* Variable fixes and todos

* Context

* Price sync

* Revert variation attributes change

* Return parent data in view context

* Defer term counting

* wc_find_matching_product_variation

* Stock manage tweaks

* Stock fixes

* Correct id

* correct id

* Better sync

* Data logic setter fix

* feedback

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* Hardcode the get_type per product class

* Initial look through getters and setters and abstract data

* Missing var

* Fixed coding standards and improved the docblocks

* Get cached terms from wc_get_related_terms()

* Fixed wrong variable in wc_get_related_terms

* Use count() instead of sizeof()

* Add related product functions and deprecate those in class.

* No need to exclude ID

* Sanitize ids later

* Clean up the abstract product class a bit, deprecate two functions we have renamed, make update & create work properly, and add some tests for it.

* Remove unneeded comments

* wc_get_product_term_ids instead of related wording and use in other places.

get_the_terms is used here and also handles caching, something
wp_get_post_terms does not.

* Handle PR feedback: Remove duplicate regular_price update, allow changing of post status for products, remove deprecation for get_title since we might still offer it as a function

* External Product CRUD

* _virtual meta should be 'no', not taxable, in product unit test helper

* Bump template version

* Made abstract function useful

* Grouped product class

* Tests

* Move children to meta and update test

* Use get_upsell_ids

* Spacing in query

* Moving and refactoring methods

* Availability html

* Tidy/add todos

* Rename method

* Put back review functions (still todo)

* missing $this

* get_price_including_tax/excluding_tax functions

* wc_get_price_to_display

* Price handling

* [Product CRUD] Variable (#12146)

* [Product CRUD] Variable Products

* Handle PR feedback.

* [Product CRUD] Grouped Handling (#12151)

* Handle grouped product saving

* Update routine

* [Product CRUD] Product crud terms (#12149)

* Category and tag id handling

* Replace template functions

* Remove todo

* Handle default name in save function

* Product crud admin save routine (#12174)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Spacing

* Fix comment

* wc_implode_text_attributes helper function

* [Product CRUD] Product crud admin use getters (#12196)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Move settings into new files

* Refactor panels and use getters

* Use getters for variation panel

* Revert save variation changes for now

* Add todos

* Fix downloads

* REST API CRUD Updates

* Additional API updates/fixes. Added some todos

* Fix final failing tests and implementing setters/getters and attributes functionality.

* Fix comparison for is_on_sale and remove download_type from WC_Product.

* Add a wc_get_products wrapper.

* Remove the download type input from the product data metabox for downloadable products. (#12221)

* [Product CRUD] Variations - setters, getters and admin. (#12228)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* Feedback fixes

* Implement CRUD in the legacy REST API

* Handle PR feedback

* [Product CRUD] Getter setter proxy methods (#12236)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* get_prop implementation in abstract and data classes

* Implement set_prop

* Change handling

* Array key exists

* set_object_read

* Use get_the_terms() instead of wp_get_post_terms()

wp_get_post_terms() is a wrapper around wp_get_object_terms() which does not
use the object cache, and generates a database query every time it is used.

get_the_terms() however can use data from the object cache if present.

* [Product CRUD] Variable, variation, notices, and stock handling (#12277)

* No longer needed

* Remove old todos

* Use getters in admin list

* Related and upsells update for CRUD

* Fix notice in gallery

* Variable fixes and todos

* Context

* Price sync

* Revert variation attributes change

* Return parent data in view context

* Defer term counting

* wc_find_matching_product_variation

* Stock manage tweaks

* Stock fixes

* Correct id

* correct id

* Better sync

* Data logic setter fix

* feedback

* Prevent notices

* Handle image_id from parent

* Fix error

* Remove _wc_save_product_price

* Remove todo

* Fixed wrong variation URLs

* Fixed undefined $image_id in WC_Product_Variation::get_image_id()

* Allow wc_rest_prepare_date_response() handle timestamps

* Updated get methods on REST API for variations

* Use variations CRUD to save variations metadata

* [Product CRUD] Abstract todos (#12305)

* Get dimensions and weights, with soft deprecation

* Product attributes

* Ratings

* Fix read method

* Downloads

* Feedback

* Revert "[Product CRUD] Abstract todos (#12305)"

This reverts commit 9a6136fcf8.

* Remove deprecated get_variation_id()

* New default attributes method

* [Product CRUD] Product Datastore (#12317)

* Fix up tests in the product/* folder.

* Handle data store updates for grouped, variable, external, simple, and general data store updates for products.

* Variations & variable changes.

* Update -functions.php calls to use data store.

* Add an interface for the public product data store methods.

* Finished product factory tests

* Correctly delete in the api, fix up some comments, and implement an interface for the public variable methods.

* Fix up delete in all versions of the api

* Handle feedback

* Match protected decloration to parent

* Product crud abstract todos (#12316)

* Get dimensions and weights, with soft deprecation

* Product attributes

* Ratings

* Fix read method

* Downloads

* Feedback

* Fix up store

* Fixed method returning in write context

* Fix error in variation admin

* Check for parent value - fixes tax class

* Remove old/complete todos

* Allow set tax class as "parent"

* Removed duplicated sync

* Fixed wrong variation URLs

* Fixed undefined $image_id in WC_Product_Variation::get_image_id()

* Allow wc_rest_prepare_date_response() handle timestamps

* Updated get methods on REST API for variations

* Use variations CRUD to save variations metadata

* Remove deprecated get_variation_id()

* New default attributes method

* Fixed method returning in write context

* Allow set tax class as "parent"

* Removed duplicated sync

* Fixed coding standards

* TODO is not accurate.

* Should pass WC_Product instancies to WC_Comments methods (#12327)

* Use new method in abstract order class to prevent headers sent issue in tests

* Fixed variable description in REST API

* Updated how create initial product variation

* Fixed a few fatal errors and warnings in Products CRUD (#12329)

* Fixed a few fatal errors and warnings in Products CRUD

* Fixed sync functions

* Add variations CRUD to legacy API (#12331)

* Apply crud to variable products in legacy API v1

* New REST API do not need fallback for default attributes

* Apply variations CRUD to legacy API v2

* Legacy v2 - save default attributes

* Variations in legacy API v2 do not have descriptions

* Fixed legacy API v2 variations params

* Applied variations CRUD to legacy API v3

* Sync before save in legacy apis

* Punc

* Removed API todos

* Removed test

* Products endpoint tweaks (#12354)

* Var type already normalized on CRUD

* Let Product CRUD handle with validation, sanitization and conditional checks

* Set downloads using WC_Product_Download

* Stop try catch exceptions more than one time

* Handle WC_Data_Exception in legacy API

* Complete remove products when fails on creating

* On creating I mean!

* Already have a method to complete delete products

* Fixed standards using WP CodeSniffer

* get_the_terms() returns false when empty

* get_manage_stock returns boolean

@claudiosanches

* Merge conflict

* Variations API endpoint fixes

* Product CRUD improvements (#12359)

* args is not used any more - remove todo

* Added test for attributes

* wc_get_price_excluding_tax usage

* parent usage

* Fix rating counts

* Test fixes

* Cleanup after tests

* Make sure status transition code runs even during API calls, not just in admin.

* Default visibility

* Fix attribute setting in API

* Use get name instead of get title

* variation id usage

* Improved cross sell templates

* variation_data

* Grouped product sync

* Notices

* Sync is not needed in API

* Delete

* Rename interfaces

* Update counts in data store
2016-11-16 12:38:24 +00:00
Mike Jolley 5f886c326a [2.6] Populate attribute dropdown when empty
Fixes #11983
2016-10-14 12:09:24 +01:00
Claudio Sanches e67bbba878 Fixed undefined variables 2016-10-13 20:29:50 -03:00
James Koster 3823b78318 Add/product galleries (#11665)
* register prettyPhoto but don't enqueue. #10721

* Remove lightbox option. #10721

Also registers the prettyPhoto styles instead of enqueueing

* Stip all prettyPhoto related stuff from the templates and tidy up some logic. #10721

* Add flexslider assets #10721

* styling and re-adds `woocommerce_single_product_image_thumbnail_html`. #10721.

* Add zoom functionality. #10721

* Move js to single-product.js. #10721

* styling of the gallery thumbnails when using the `product_page` shortcode. #10721

* Only enable the zoom if the image is large enough. #10721

* Use a 4 column layout by default. #10721

* Make the carousel options filterable. #10721

* rtl styles for gallery. #10721

* Don't zoom on handheld devices. #10721

* markup tweaks in prep for photoswipe

* disable zoom for now

* Add and enqueue photoswipe assets

* add the photoswipe template

* initialise photoswipe - it's alive!

* tidy up js. add title. add separate trigger. #10721

* Move photoswipe functions to single-product.js. #10721

* reactivate the zoom! #10721

* style the photoswipe trigger. #10721

* disable flexslider animation loop. #10721

* js tidy up. #10721

* Fix jshint

* Abstract the product gallery scripts

* Minify

* Fixed conflict with the admin bar

* Photoswipe conflict with admin bar

* Index. #10721

* photoswipe button styles. #10721

* Styling. #10721

* No animation on zoom
* Image width on mobile

* No shadows please. #10721

Looking at you, Twenty Twelve.

* code tidy and add class to placeholder figure. #10721

* simplify rtl query

* photoswipe button styles

* Comma should not be here

* zoom icon #10721

* gallery thumb styles. #10721

* trigger icon. #10721

* Image margins. #10721

* icon hover states. #10721

* Variation handling

* Fix zoom and heights

* Resize after timeout
2016-10-13 15:25:42 +01:00
Aristeides Stathopoulos 734f284fa4 WordPress.PHP.YodaConditions.NotYoda 2016-09-08 01:32:24 +03:00
Aristeides Stathopoulos d4e3faf014 PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket 2016-09-02 04:51:31 +03:00
Mike Jolley 402d0ff077 Merge branch 'master' into pr/11797
# Conflicts:
#	includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php
#	includes/api/class-wc-rest-coupons-controller.php
#	includes/class-wc-coupon.php
#	tests/unit-tests/api/coupons.php
#	tests/unit-tests/coupon/crud.php
2016-09-01 11:43:31 +01:00
Mike Jolley 0a3506777b Inline comments to make this clearer 2016-08-31 17:52:03 +01:00
Gabor Javorszky 219480b329 Save the version on the property too 2016-08-31 16:21:17 +01:00
Gabor Javorszky 9cfa231167 Fixes reset cache and version assignment for variable product prices
Fixes #11812

$this->array was only used to return to the user. Comparison was done with $prices_array, which did not contain the version information because it was never saved in the transient.
2016-08-31 11:12:49 +01:00
Aristeides Stathopoulos fb62d280b5 WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore 2016-08-27 09:07:42 +03:00
Aristeides Stathopoulos 72ee94d11b WordPress.Arrays.ArrayDeclaration.SpaceBeforeComma 2016-08-27 05:46:40 +03:00
Aristeides Stathopoulos b063bcfe4c last item in a multiline-array should end in a comma 2016-08-27 04:46:45 +03:00
Mike Jolley b0064bddf6 Remove boolval 2016-08-04 11:12:14 +01:00
Mike Jolley 5a9dacd595 Show variable weights/dimensions even when parent values are not set. 2016-08-03 16:07:34 +01:00
Mike Jolley 579175257f Add transient version to price hash
Closes #11520 @claudiosmweb
2016-07-25 13:33:35 +01:00
Claudio Sanches 08f95481e0 Normalize the "Read more" button text, closes #11319 2016-06-30 15:16:26 -03:00
Mike Jolley 594641422d Show read more if variable product is out of stock 2016-06-07 14:34:27 +01:00
Mike Jolley 3fd15ad50f Unused vars and code docs 2016-06-06 18:57:24 +01:00
Manos Psychogyiopoulos 35ff166a85 woocommerce_variation_prices filter runs only for the first hashed prices array loaded from the transient 2016-05-25 00:54:07 +03:00
Mike Jolley e552c3c916 Remove filter to hide variations with no prices in get_children()
#10854
2016-05-10 18:23:16 +01:00
Mike Jolley edbb03a5d8 Only exclude variations with no price if filter is set
Closes #10854
2016-05-05 16:05:40 +01:00
Mike Jolley be9b7bd4b5 If no variation ID is set, do a match
Closes #10737
2016-04-20 12:35:06 +01:00
Mike Jolley 3a5feddbf5 [2.5] Set captions 2016-03-30 11:15:34 +01:00
Mike Jolley 00a6fe8682 [2.5] Allow big selects when getting variations 2016-03-08 11:33:04 +00:00
Mike Jolley c469ab920b Use wpdb query instead of looping over children
Closes #10195

cc @claudiosmweb

Since this uses `$this->get_children( true );` it will also hide out of
stock variation attributes if that setting is enabled.
2016-02-15 15:53:43 +00:00
Mike Jolley 3dba3378c2 Merge pull request #10315 from woothemes/layered-nav-wp-query
Layered Nav Improvements
2016-02-12 11:59:40 +00:00
Mike Jolley fd38adcc36 Format variations to same type
Fixes #10310
2016-02-11 15:22:51 +00:00
Mike Jolley 5b0abaaa1b Sync min and max price for better filtering! 2016-02-09 20:16:08 +00:00
Mike Jolley a78edb2af2 [2.5] If an attribute meta key is not set, technically its 'any', so should match. Prevents issues when meta data is missing after renaming attributes
@claudiosmweb please test :)

#10272
2016-02-04 18:25:06 +00:00
Mike Jolley 35e45e6075 Make price function clearer
@tamarazuk @franticpsyx @daigo75 Hopefully this makes it clearer which
values are returned and when the filter is ran.
2016-01-13 15:07:47 +00:00
Fredrik Forsmo f1920cb882 Improve docblock comments in various WC_Product classes
* Added comments to methods that was `method function`
2016-01-06 16:15:00 +01:00
Mike Jolley 8b9bdbb228 Product version storage to invalidate cache when needed
#9922 for @daigo75
2015-12-31 16:31:20 +00:00
Mike Jolley 7c7e21be50 Only use the 'function' portion when generating price hashes
Keeps hashes the same after page load when a plugin uses a class method
callback or anonymous function Closes #9922 @claudiosmweb
2015-12-31 16:21:12 +00:00
Mike Jolley 429fee1703 JSON instead of serialise should reduce storage size
#9922
2015-12-31 13:15:01 +00:00
Mike Jolley 0b678ab2af Tweak save logic to set _price for variables/groups via sync functions only
Closes #9892
2015-12-23 13:08:45 +00:00
Mike Jolley 496eb3385e srcset sometimes is false. 2015-12-09 10:29:41 +00:00
Mike Jolley 61c3e74d4f srcset should not be set to 'false' 2015-12-07 11:57:02 +00:00
Mike Jolley 12db1d4637 Notify users of no variations but leave status as is.
Closes #9713
2015-12-03 10:14:00 +00:00
Mike Jolley 75529edbe5 Merge branch 'pr/9628' 2015-11-27 13:00:39 +00:00
Mike Jolley 03d9239f40 Correct variable name 2015-11-27 13:00:08 +00:00
Mike Jolley 615c262f6f Function exists for wp_get_attachment_image_srcset and sizes
Sizes #9714
2015-11-27 11:30:47 +00:00
Tiago Noronha 3fdec7f4a8 Init added variables if product doesnt have featured image. 2015-11-24 23:00:25 +00:00
Tiago Noronha 105105db06 Adds support for srcset and sizes attributes in variation images. 2015-11-23 16:35:11 +00:00
Dominic 5ef59c511b Optimize filter loop
The current method loops through every defined hook in the WordPress
environment (over 400 on one of my tests). This method only checks the 3
filters in question.
2015-11-17 00:27:44 -08:00
Mike Jolley b59ec6de76 Move var definition to abstract 2015-11-14 16:39:53 +00:00
Mike Jolley 3a096b3b64 Remove transient from get_total_stock and combine into abstract
Grouped and variable methods were identical. Caching benefit comes from
get_children
2015-11-14 16:34:47 +00:00
Mike Jolley 70d9f58811 Version not needed for wc_var_prices
This transient doesn’t need to expire often because the hashes will be
unique if taxes change.

This change means a variable product will only use 1 transient rather
than many.
2015-11-13 20:01:42 +00:00
Scrutinizer Auto-Fixer 08efaf84df Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2015-11-05 16:05:03 +00:00
Claudio Sanches ee30b5b308 Fixed php docs standards 2015-11-03 11:31:20 -02:00
Mike Jolley 6027b355ca Further get_variation_prices tweaks
For 2.5, I’ve adjusted the caching to store 1 transient per variable
product. The cache key etc is still needed, but its stored within a
single transient instead of several.

This should prevent exponential growth of transient data for users.

Thoughts?

@daigo75 @franticpsyx @claudiosmweb
2015-10-09 12:49:39 +01:00
Mike Jolley 84f83e0bf4 Fix return value @roykho 2015-10-05 14:39:08 +01:00
roykho 5ba6ff1dac fix variation image flicker issue when default variations are set closes #7904 2015-10-02 03:45:11 +02:00
Diego Zanella 5da98ce782 Fixed loading of variation prices
The original method loaded the prices once, then stored them in a property of the product instance. Any subsequent calls to WC_Product_Variable::get_variation_prices() would get the stored prices, regardless of the value of the $display argument.
2015-09-25 16:11:41 +01:00
Mike Jolley 3dbe9ccd95 Better fallback for ajax variations in case sync_attributes has ran 2015-09-14 16:50:58 +01:00
Mike Jolley fc78f85bc6 Merge branch 'pr/9034' 2015-09-14 15:56:38 +01:00
Mike Jolley 3a1bcd8e7d Store prices in class to prevent running get_variation_prices multiple times 2015-09-14 15:09:57 +01:00
Mike Jolley 2d90e1c6c6 Ensure _product_version checks act the same regardless of the attributes being checked 2015-09-14 12:12:05 +01:00
Mike Jolley 8ec5986d48 Tweak hash logic 2015-09-09 22:29:54 +01:00
Manos Psychogyiopoulos e3dad9106f elseif 2015-09-07 19:17:33 +03:00
Manos Psychogyiopoulos d9d11974fe introduce context in transient with price filters 2015-09-07 19:13:41 +03:00