Commit Graph

82 Commits

Author SHA1 Message Date
James Allan 53e6a7317b Add filter to allow third-parties to filter exportable product types 2021-02-02 14:41:03 +10:00
Nestor Soriano 52eed70f04 Add a 'NumberUtil' class with a 'round' method.
There's a number of places in the WooCommerce codebase where the
built-in function 'round' is executed passing a non-numeric value
(not a number and not a string that can be parsed as a number),
for example round(''). In PHP 7 this yields a value of 0, but in
PHP 8 this throws an error.

This commit adds a 'NumberUtil' class with a static 'round' method,
this method checks if the passed value is numeric and if so it just
executes the built-in function, otherwise it returns 0. And all the
calls to 'round' in the codebase are replaced with 'NumberUtil::round'.
2020-10-01 11:08:51 +02:00
Claudio Sanches d48f1d4e2e Fixed package tag usage 2020-08-05 13:36:24 -03:00
Claudio Sanches 9020cebdbb Normalize parameters for woocommerce_product_importer_parsed_data filter 2020-06-02 14:21:33 -03:00
Claudio Sanches cd137915b8 Set correct post type for product variation
And catch any WC_Data_Exception
2020-01-06 21:36:54 -03:00
Claudio Sanches 8033d5751e Changed wc_get_product_classname function name to wc_get_product_object 2019-12-04 16:15:16 -03:00
Claudio Sanches ba0773d12e Apply wc_get_product_classname() in the current code base 2019-11-13 15:30:09 -03:00
Nico Hauser 5c84557984
Updated filter name 2019-08-20 08:05:19 +02:00
Nico Hauser 5291767228
Add new filter in addition to existing action
Currently there is no way to change the data fed into the importer. An example use of it is the following filter:

    add_filter('woocommerce_product_import_before_process_item', "product_import_before_process_item", 10, 1);
    function product_import_before_process_item($data){
        //modify the data before importing e.g. prevent inserting an empty name!
        foreach($data as $key => $value){
            if(isset($data[$key]) && empty($value)){
                unset($data[$key]);
            }
        }
    return $data;
    }
2019-08-15 22:00:31 +02:00
Mike Jolley 93535047fd Ability to parse tags with space separators 2019-04-15 15:55:42 +01:00
Viktor Szépe bd6a348af5
Fix PHPDoc in WC_Product_Importer
old stuff
2019-03-30 00:35:32 +01:00
Mike Jolley 8c2e305823 phpcs 2019-02-14 15:05:56 +00:00
Mike Jolley 621229b894 Variations cannot be drafts - set to private. 2019-02-14 15:05:10 +00:00
Ron Rennick 900c150569 Introduce `unescape_data` replacing `unescape_negative_number` for consistency with `escape_data` for strings in a CSV context 2018-11-15 15:49:39 -04:00
Nicolas Bovee b7ef951ac0 Revised error message and set is_type method on . 2018-11-05 23:19:10 -07:00
Nicolas Bovee fe5f2d411b added an error for variation using variation for parent in import and removed @access on 87 2018-11-04 23:34:17 -07:00
Joey b08b55a651 added changes for low stock notifications per product 2018-05-27 05:40:58 +01:00
Mike Jolley e6ddc65c2a Wrap cell in ' rather than prepend 2018-05-11 12:16:02 +01:00
Mike Jolley 565f1c6e66 Inherit 'is variation' from existing attribute during csv import 2018-03-15 12:18:31 +00:00
Gerhard Potgieter 85636f8fe7 PHPCS passing for abstract-wc-product-importer.php 2018-03-06 10:04:37 +02:00
Mike Jolley 47b39caf83 phpcs 2017-12-15 13:19:23 +00:00
Mike Jolley ea8681280a Only get ID when it's not empty so 0 and '' is ignored 2017-12-15 12:59:54 +00:00
Claudio Sanches c07d039242 [Importer] Get global attribute ID only when is a global attribute.
Closes #17923
2017-12-05 16:55:56 -02:00
Mike Jolley 0a9485c465 Merge branch 'master' into feature/11259
# Conflicts:
#	assets/css/admin-rtl.css
#	assets/css/admin.css
#	includes/admin/list-tables/class-wc-admin-list-table-products.php
#	includes/class-wc-install.php
#	includes/wc-update-functions.php
2017-12-04 14:14:03 +00:00
claudiulodro 160e562dc6 Better negative number unescape 2017-11-27 09:48:28 -08:00
Manos Psychogyiopoulos 7463182c3f Change abstract importer methods visibility 2017-11-27 17:22:19 +02:00
claudiulodro ee445b6ee5 Importer/Exporter backorder compatibility 2017-11-22 11:48:19 -08:00
axelmm 1a309856c3
Access to importer parameters - DRY
Access (read only) to params can be required in many cases when you're playing with importing. 
In my case it was extending importer with filters and actions (procedural way - within original csv importer process) but it relates to objective way (extending importer class), too.

I wanted to know if 'update_existing' flag is set (other way than $_POST values) within filter 'woocommerce_product_importer_parsed_data' in parse/expand loop (called from class-wc-product-csv-importer.php 'set_parsed_data' method). Unfortunately this (and similiar) filter doesn't receive importer instance, only row data (raw, parsed and product object). Thanks to https://github.com/woocommerce/woocommerce/pull/15796 we have 'woocommerce_product_importer_formatting_callbacks' filter receiving importer instance. Unfortunately importer '$params' field is not accessible (protected in abstract). This PR resolves this simple problem - we can get this flag (and other params) before importing loops, processing rows etc.
2017-11-20 02:09:49 +01:00
Mike Jolley b72268172a Fix image matching queries 2017-10-12 16:32:40 +01:00
Mike Jolley a8ab4860ca Reverse image logic in get_attachment_id_from_url
Closes #16905
2017-09-25 12:58:25 +01:00
claudiulodro 24e9f80f1a wc_get_attribute_taxonomies returns objects 2017-08-18 09:17:04 -07:00
Mike Jolley 90f0a835b1 Fix filename image handling 2017-08-08 15:00:03 +01:00
Claudio Sanches 1a9b499be8 Apply attribute helper functions to importers and REST API 2017-08-07 22:34:25 -03:00
Jaydeep Rami 46d3638089 Fix missing return statement (#16148)
* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement
2017-07-20 18:01:14 +01:00
Jaydeep Rami 3522857d23 Fix typo in WooCommerce plugin (#16135)
* Fixed typo

* Fixed more typo

* Fixed more typo

* Fix tyop

* Fix more typo

* Fix more typo

* Fix typo

* Fix typo

* Fix typo

* Fix typo datatime object

* Fix short name of compat

* Fix typo: update short name

* Fix typo "deactive" to "deactivate" and short BW - Compat

* Fix typo "Backwards compat"

* Fix typo 'parameters'

* Fix more typo 'pararmeters'

* Fix typo 'compund'

* FIx typo order

* Fix typo

* Fix typo 'incorrecly'

* Fix typo 'genarate'

* Fix typo 'reletive'

* Fix typo 'Handly'

* Fix typo 'rotatated'

* Fix typo

* Fix typo 'additonal'

* Fix typos
2017-07-17 11:10:52 +01:00
Mike Jolley eb5c6d688b Added method to escape commas in CSV values 2017-07-03 14:47:48 +01:00
Mike Jolley 26b98bc3df Fix notice and return correct attribute ID 2017-06-27 14:39:30 +01:00
Claudiu Lodromanean 9399a8dca2 Merge pull request #15702 from woocommerce/fix/15697
Correctly map attribute labels to names
2017-06-20 14:46:45 -07:00
Mike Jolley 6a6aca4132 Correctly map attribute labels to names
Fixes #15697
2017-06-20 14:15:35 +01:00
Frédéric Demarle 4960af34aa Add an action before importing a row 2017-06-20 14:25:23 +02:00
Claudiu Lodromanean b9842b6f21 Merge pull request #15615 from woocommerce/update/15576
Prevent memory and time limits in importer
2017-06-14 10:20:29 -07:00
Mike Jolley 4dea3ece8a Fix memory limit detection on some systems 2017-06-14 18:16:39 +01:00
Mike Jolley 0de65b3a8d Start time 2017-06-14 17:04:47 +01:00
Mike Jolley fdc6c46e80 Clear slug for placeholder products 2017-06-14 16:37:21 +01:00
Mike Jolley 77cee56ae8 Prevent memory and time limits 2017-06-14 14:02:47 +01:00
Frédéric Demarle 08e30450b5 Add action after a product has been imported 2017-06-09 08:30:22 +02:00
Mike Jolley e185d5572b Merge branch 'feature/product-csv-import-export' into refactor/fix-importer-and-improve-unit-tests 2017-05-31 12:19:58 +01:00
Claudio Sanches d6fb028481 Allow import and create new global attributes 2017-05-30 18:46:32 -03:00
Claudio Sanches 6d54ae3504 Fetch product ID for temporary products only while processing the item 2017-05-26 19:57:31 -03:00
Claudio Sanches 2eeb444eeb Properly set stock quantity 2017-05-26 18:53:22 -03:00