Commit Graph

95 Commits

Author SHA1 Message Date
Peter Fabian 309c48ab0e Deprecated old cache function and replaced it with a new one. 2019-11-28 14:03:57 +01:00
Mike Jolley 8e4807ac92 Correct keys when migrating attribute data 2019-03-25 12:27:18 +00:00
Mike Jolley 20d7603dd6 Merge branch 'fix/21034' 2019-03-12 13:47:08 +00:00
Gerhard 10557868dd Missing space after != 2019-03-12 12:04:26 +02:00
Mike Jolley 16a0a3e27e Update from master 2019-03-05 19:03:01 +00:00
Mike Jolley 8cb385e3db Cleanup/test 2019-03-05 18:23:51 +00:00
Mike Jolley 0e943a38d7 Fix wc_get_attribute 2019-03-05 17:02:58 +00:00
Mike Jolley a42bdf94d0 avoid query in wc_attribute_orderby 2019-03-05 16:53:58 +00:00
Mike Jolley d03f5d4373 Index by ID and cache 2019-03-05 16:49:45 +00:00
Mike Jolley ed6c02b8ec wc_get_attribute caching 2019-03-05 16:21:10 +00:00
Mike Jolley 9452616a7f wc_get_attribute_taxonomy_labels with cache 2019-03-05 16:19:00 +00:00
Mike Jolley abc3b6ca47 Use cache helper for invalidation 2019-03-05 16:16:46 +00:00
Mike Jolley b2a136bfb8 wc_get_attribute_taxonomy_ids function, with cache 2019-03-05 16:10:31 +00:00
Mike Jolley 1efe7747a8 merge conflict 2019-02-08 13:08:55 +00:00
Mike Jolley b2c33b8e34 Merge branch 'master' into performance/slow-term-queries 2019-02-07 13:49:48 +00:00
Mike Jolley 893b33973c Merge branch 'fix/22147' 2019-02-04 13:05:40 +00:00
Mike Jolley 4622af890a wc_attribute_taxonomy_slug cache 2019-01-30 16:11:04 +00:00
Mike Jolley 8823559880 get rid of old term meta table 2019-01-25 20:44:25 +00:00
Ron Rennick 8709351994 update function name to `wc_attribute_taxonomy_slug` 2019-01-23 11:11:27 -04:00
Mike Jolley e31b35597a Slash meta values to preserve slashes on save 2019-01-08 13:28:26 +00:00
Ron Rennick e95842228a phpcs sniff fixes wc-attribute-functions.php, introduct `wc_attribute_taxonomy_name_raw()` 2018-12-03 11:30:26 -04:00
Claudio Sanches 2f7f514f14 Fixed coding standards 2018-10-11 13:31:37 -07:00
claudiulodro d1e9e85cbb Extra safety 2018-10-11 13:31:37 -07:00
claudiulodro c9c12c2518 Initial implementation 2018-10-11 13:31:37 -07:00
Claudio Sanches 4738162c25 Improvements to wc_create_attributes (DRI) 2018-08-30 12:13:16 -07:00
Mike Jolley 812586742b Allow only valid default attributes 2018-06-13 14:33:13 +01:00
Claudio Sanches 6130a222cc Properly check for old and new slug while updating attributes
Closes #19247
2018-03-12 15:52:26 -03:00
Claudio Sanches 435caeadae Fixed wc_attribute_label() logic 2018-03-08 18:41:39 -03:00
Claudio Sanches be12e37e34 Fixed includes/wc-attribute-functions.php PHPCS violations 2018-03-07 10:58:37 -03:00
Caleb Burks 221b4672d9 Use wc_has_custom_attribute_types() 2018-02-09 17:31:56 -05:00
Mike Jolley 1944bf7191 Remove text type setting 2017-12-08 11:24:21 +00:00
Mike Jolley 684a2b22ed typo 2017-08-08 11:07:36 +01:00
Claudio Sanches 2796615054 Flush rewrite rules after delete attributes 2017-08-07 22:30:14 -03:00
Claudio Sanches 6dfcf95b5e Properly update and delete attributes
- Now keep all the original hooks without deprecated anything,
- Update product metadata and terms metadata while changing slugs.
- Delete terms while deleting attributes
2017-08-07 22:29:37 -03:00
Claudio Sanches 29e73d27f4 Introduced woocommerce_attribute_created
And flush rewrite rules when created attribute.
2017-08-07 22:26:46 -03:00
Claudio Sanches dd36ae87d3 Improved wc_create_attribute() inline doc 2017-08-07 22:26:42 -03:00
Claudio Sanches a7c4eb3eb7 Improved error handler for wc_delete_attribute() 2017-07-07 18:49:46 -03:00
Claudio Sanches fe1d54b360 Added missing global $wpdb in wc_delete_attribute() 2017-07-07 18:15:59 -03:00
Claudio Sanches e235984e75 Fixed inserted data and clear transients after save attributes 2017-07-07 17:52:13 -03:00
Claudio Sanches 1600edee95 Delete attribute helper 2017-07-07 17:44:31 -03:00
Claudio Sanches b02fc2f516 Updated and create attribute helpers 2017-07-07 17:40:40 -03:00
Claudio Sanches 1f039280aa Added function to get attribute 2017-07-07 17:40:19 -03:00
Nicola Mustone cd5c24d7c3 Prevent fatal error on order page
Prevents a fatal error on order pages when variable products are purchased.
2017-07-05 08:20:08 +03:00
claudiulodro 506c01f56a Fix codesniffer violations 2017-06-27 14:19:59 -07:00
Mike Jolley 49958a13a6 Prevent empty attributes being loaded or used 2017-06-09 12:14:11 +01:00
Mike Jolley a3b89a9efc Merge pull request #15144 from timondavis/fix/15103-cannot_set_default_variation_to_string_zero
#15103 Variation default value of '0' fails to save on product.
2017-05-23 19:31:38 +01:00
Mike Jolley d3666738d8 Merge branch 'pr/15069' 2017-05-23 18:56:58 +01:00
Timon Davis af308da6b9 Fix bug #15103 where site operator cannot assign a variation with value of '0' as the default choice on the customer facing form.
The WC_Product::set_default_attributes function uses an array_filter (using the default callback for filtration)
to remove null and false values from the defaults array for a given product.  The issue here is that, in the above use case,
the array_filter will evaluate '0' as 0 and therefore as false.  Ultimately, array_filter then prevents the value from being
recorded, moving forward.

I've added a new filter callback to includes/wc-attribute-functions which will disregard all FALSE PHP equivalents except for
'0' (as a a string).  Also, I've updated the filter_array call in WC_Product::set_default_attributes so that it uses this new callback,
instead of the PHP default. Finally, I've added a phpunit test to assert that, when storing default variations / attributes on a product,
the false/true PHP synonyms are evaluating and storing like one would normally expect, with the exception that (string) '0'
evaluates as true in this special case.

This solution could potentially be broadened to facililate similar rules elsewhere, but the need raised in the bug is specific and
this is a specific solution.
2017-05-18 02:43:14 -07:00
Rasmus Bengtsson 185934fad9 Fix phpdoc to include params and correct types 2017-05-15 13:50:52 +02:00
Rasmus Bengtsson 6a7fc8650f Remove unused local variables 2017-05-15 12:06:52 +02:00