Skip to content

Commit

Permalink
Merge pull request #131 from BeAPI/ver/6.9.0
Browse files Browse the repository at this point in the history
Release 6.9.0
  • Loading branch information
petitphp authored Dec 19, 2024
2 parents cd2c54e + 49a940e commit b4dc52b
Show file tree
Hide file tree
Showing 9 changed files with 734 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .plugin-data
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "6.8.0",
"version": "6.9.0",
"slug": "shopping-feed"
}
12 changes: 8 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@

* Contributors: ShoppingFeed, BeAPI
* Tags: shoppingfeed, marketplace, woocommerce, woocommerce shoppingfeed, create woocommerce products shoppingfeed, products feed, generate shoppingfeed, amazon, Jet, Walmart, many marketplace, import orders
* Stable tag: 6.8.0
* Version: 6.8.0
* Stable tag: 6.9.0
* Version: 6.9.0
* Requires PHP: 7.3
* Requires at least: 5.7
* Tested up to: 6.5
* Tested up to: 6.7
* WC requires at least: 5.1.0
* WC tested up to: 8.8
* WC tested up to: 9.4.3

## Upgrade Notice

> Version 6.0.0 is a major version, there are several changes and improvements which affect the architecture of the plugin. You will have to re-configure the plugin, all the previous settings will be lost
## Changelog
* 6.9.0
* Feed : Fix attributes not use in variations missing in the feed.
* Feed : Dimension data are correctly included in the feed.
* Orders : Fix invalid timestamp when scheduling async task to acknowledge orders.
* 6.8.0
* Feed : Fix the promotion date
* 6.7.0
Expand Down
14 changes: 9 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
## ShoppingFeed
Contributors: ShoppingFeed, BeAPI
Tags: shoppingfeed, marketplace, woocommerce, woocommerce shoppingfeed, create woocommerce products shoppingfeed, products feed, generate shoppingfeed, amazon, Jet, Walmart, many marketplace, import orders
Stable tag: 6.8.0
Version: 6.8.0
Stable tag: 6.9.0
Version: 6.9.0
Requires PHP: 7.3
Requires at least: 5.7
Tested up to: 6.5
Tested up to: 6.7
WC requires at least: 5.1.0
WC tested up to: 8.8
WC tested up to: 9.4.3

== Upgrade Notice ==
Version 6.0.0 is a major version, there are several changes and improvements which affect the architecture of the plugin. You will have to re-configure the plugin, all the previous settings will be lost

== Changelog ==
* 6.9.0
* Feed : Fix attributes not use in variations missing in the feed.
* Feed : Dimension data are correctly included in the feed.
* Orders : Fix invalid timestamp when scheduling async task to acknowledge orders.
* 6.8.0
* Feed : Fix the promotion date
* Feed : Fix the promotion date.
* 6.7.0
* Orders : The 'buyer_identification_number' field is imported in an order custom field if it exists.
* Orders : Product updates (price and stock) via the SF API are made asynchronously via a scheduled task.
Expand Down
4 changes: 2 additions & 2 deletions shoppingfeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author URI: https://www.shopping-feed.com/
* Text Domain: shopping-feed
* Domain Path: /languages
* Version: 6.8.0
* Version: 6.9.0
* Requires at least: 5.7
* Requires PHP: 7.3
* WC requires at least: 5.1.0
Expand All @@ -26,7 +26,7 @@
require_once plugin_dir_path( __FILE__ ) . '/vendor/autoload.php';
}

define( 'SF_VERSION', '6.8.0' );
define( 'SF_VERSION', '6.9.0' );
define( 'SF_DB_VERSION_SLUG', 'SF_DB_VERSION' );
define( 'SF_DB_VERSION', '1.0.0' );
define( 'SF_UPGRADE_RUNNING', 'SF_UPGRADE_RUNNING' );
Expand Down
24 changes: 22 additions & 2 deletions src/Feed/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,23 @@ function (
$product->setWeight( (float) $sf_product->get_weight() );
}

if ( ! empty( $sf_product->get_length() ) ) {
$product->setAttribute( 'length', (string) $sf_product->get_length() );
}

if ( ! empty( $sf_product->get_width() ) ) {
$product->setAttribute( 'width', (string) $sf_product->get_width() );
}

if ( ! empty( $sf_product->get_height() ) ) {
$product->setAttribute( 'height', (string) $sf_product->get_height() );
}

if ( ! empty( $sf_product->get_category_name() ) ) {
$product->setCategory( $sf_product->get_category_name(), $sf_product->get_category_link() );
}

// For variable products, don't include attributes. They will be available in the variations.
if ( ! $sf_product->has_variations() && ! empty( $sf_product->get_attributes() ) ) {
if ( ! empty( $sf_product->get_attributes() ) ) {
$product->setAttributes( $sf_product->get_attributes() );
}

Expand Down Expand Up @@ -213,6 +224,15 @@ function (
if ( ! empty( $variation_images ) ) {
$variation->setAdditionalImages( $variation_images );
}
if ( ! empty( $sf_product_variation['width'] ) ) {
$variation->setAttribute( 'width', (string) $sf_product_variation['width'] );
}
if ( ! empty( $sf_product_variation['length'] ) ) {
$variation->setAttribute( 'length', (string) $sf_product_variation['length'] );
}
if ( ! empty( $sf_product_variation['height'] ) ) {
$variation->setAttribute( 'height', (string) $sf_product_variation['height'] );
}
}
}
);
Expand Down
2 changes: 1 addition & 1 deletion src/Orders/Operations.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public static function acknowledge_order( $order_id, $message = '' ) {
if ( false === $ok ) {
//if we cant acknowledge order => add action after 15 min
as_schedule_single_action(
MINUTE_IN_SECONDS * 15,
time() + ( 15 * MINUTE_IN_SECONDS ),
'sf_acknowledge_remain_order',
array(
$order_id,
Expand Down
64 changes: 63 additions & 1 deletion src/Products/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ class Product {
*/
private $weight;

/**
* @var string
*/
private $length;

/**
* @var string
*/
private $width;

/**
* @var string
*/
private $height;

/**
* @var bool|mixed|\WP_Term
*/
Expand All @@ -52,6 +67,9 @@ public function __construct( $product ) {
$this->brand = $this->set_brand();
$this->category = $this->set_category();
$this->weight = $this->product->get_weight();
$this->length = $this->product->get_length();
$this->width = $this->product->get_width();
$this->height = $this->product->get_height();
}

/**
Expand Down Expand Up @@ -225,6 +243,39 @@ public function get_weight() {
return $this->weight;
}

/**
* @return string
*/
public function get_length() {
if ( empty( $this->length ) ) {
return '';
}

return $this->length;
}

/**
* @return string
*/
public function get_width() {
if ( empty( $this->width ) ) {
return '';
}

return $this->width;
}

/**
* @return string
*/
public function get_height() {
if ( empty( $this->height ) ) {
return '';
}

return $this->height;
}

/**
* @return string
*/
Expand Down Expand Up @@ -327,7 +378,15 @@ public function get_attributes() {

$wc_attributes = $this->product->get_attributes();

$attributes = array();
if ( 'variable' === $this->product->get_type() && is_array( $wc_attributes ) && ! empty( $wc_attributes ) ) {
foreach ( $wc_attributes as $key => $attribute ) {
if ( $attribute->get_variation() ) {
unset( $wc_attributes[ $key ] );
}
}
}

$attributes = [];
if ( ! empty( $wc_attributes ) ) {
foreach ( $wc_attributes as $taxonomy => $attribute_obj ) {
$attribute = reset( $attribute_obj );
Expand Down Expand Up @@ -415,6 +474,9 @@ public function get_variations( $for_feed = false ) {
$variation_data['quantity'] = $this->_get_quantity( $variation );
$variation_data['price'] = ! is_null( $variation->get_regular_price() ) ? $variation->get_regular_price() : $variation->get_price();
$variation_data['discount'] = $variation->is_on_sale() ? $variation->get_sale_price() : 0;
$variation_data['width'] = $variation->get_width();
$variation_data['height'] = $variation->get_height();
$variation_data['length'] = $variation->get_length();
if ( ! empty( get_the_post_thumbnail_url( $variation->get_id(), 'full' ) ) ) {
$variation_data['image_main'] = get_the_post_thumbnail_url( $variation->get_id(), 'full' );
}
Expand Down
Loading

0 comments on commit b4dc52b

Please sign in to comment.