Version Description
(2020-09-13) = * Added: Custom fields for unique identifier (GTIN,MPN,EAN) added to product edit page.
Download this release
Release Info
Developer | wahid0003 |
Plugin | CTX Feed – WooCommerce Product Feed Manager Plugin |
Version | 3.7.16 |
Comparing to | |
See all releases |
Code changes from version 3.7.15 to 3.7.16
- README.txt +4 -1
- includes/classes/class-woo-feed-dropdown.php +3 -0
- includes/classes/class-woo-feed-products-v3.php +42 -0
- includes/helper.php +193 -0
- woo-feed.php +2 -2
README.txt
CHANGED
@@ -5,7 +5,7 @@ Tags:product feed,woocommerce product feed,google shopping feed,google shopping,
|
|
5 |
Requires at least: 3.6
|
6 |
Tested Up To: 5.5
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 3.7.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -308,6 +308,9 @@ Using pro version:
|
|
308 |
|
309 |
== Changelog ==
|
310 |
|
|
|
|
|
|
|
311 |
= 3.7.15 (2020-09-09) =
|
312 |
* Tweak: stock status on backorder will be returned as out of stock for Google Shopping, Facebook and Pinterest template.
|
313 |
|
5 |
Requires at least: 3.6
|
6 |
Tested Up To: 5.5
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 3.7.16
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
308 |
|
309 |
== Changelog ==
|
310 |
|
311 |
+
= 3.7.16 (2020-09-13) =
|
312 |
+
* Added: Custom fields for unique identifier (GTIN,MPN,EAN) added to product edit page.
|
313 |
+
|
314 |
= 3.7.15 (2020-09-09) =
|
315 |
* Tweak: stock status on backorder will be returned as out of stock for Google Shopping, Facebook and Pinterest template.
|
316 |
|
includes/classes/class-woo-feed-dropdown.php
CHANGED
@@ -215,6 +215,9 @@ class Woo_Feed_Dropdown {
|
|
215 |
'date_updated' => esc_html__( 'Date Updated', 'woo-feed' ),
|
216 |
'tax_class' => esc_html__( 'Tax Class', 'woo-feed' ),
|
217 |
'tax_status' => esc_html__( 'Tax Status', 'woo-feed' ),
|
|
|
|
|
|
|
218 |
'---1' => '',
|
219 |
);
|
220 |
if ( class_exists( 'All_in_One_SEO_Pack' ) ) {
|
215 |
'date_updated' => esc_html__( 'Date Updated', 'woo-feed' ),
|
216 |
'tax_class' => esc_html__( 'Tax Class', 'woo-feed' ),
|
217 |
'tax_status' => esc_html__( 'Tax Status', 'woo-feed' ),
|
218 |
+
'woo_feed_gtin' => esc_html__( 'GTIN', 'woo-feed' ),
|
219 |
+
'woo_feed_mpn' => esc_html__( 'MPN', 'woo-feed' ),
|
220 |
+
'woo_feed_ean' => esc_html__( 'EAN', 'woo-feed' ),
|
221 |
'---1' => '',
|
222 |
);
|
223 |
if ( class_exists( 'All_in_One_SEO_Pack' ) ) {
|
includes/classes/class-woo-feed-products-v3.php
CHANGED
@@ -2449,6 +2449,48 @@ class Woo_Feed_Products_v3
|
|
2449 |
return $product->get_tax_status();
|
2450 |
}
|
2451 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2452 |
/**
|
2453 |
* Get Product Sale Price Effected Date for Google Shopping
|
2454 |
*
|
2449 |
return $product->get_tax_status();
|
2450 |
}
|
2451 |
|
2452 |
+
/**
|
2453 |
+
* Get Product GTIN
|
2454 |
+
* @param WC_Product $product Product object.
|
2455 |
+
* @return string
|
2456 |
+
*/
|
2457 |
+
protected function woo_feed_gtin($product) {
|
2458 |
+
$id=$product->get_id();
|
2459 |
+
$meta='woo_feed_gtin';
|
2460 |
+
if($product->is_type('variation')) {
|
2461 |
+
$meta='woo_feed_gtin_var';
|
2462 |
+
}
|
2463 |
+
return $this->getProductMeta($product,$meta);
|
2464 |
+
}
|
2465 |
+
|
2466 |
+
/**
|
2467 |
+
* Get Product MPN
|
2468 |
+
* @param WC_Product $product Product object.
|
2469 |
+
* @return string
|
2470 |
+
*/
|
2471 |
+
protected function woo_feed_mpn($product) {
|
2472 |
+
$id=$product->get_id();
|
2473 |
+
$meta='woo_feed_mpn';
|
2474 |
+
if($product->is_type('variation')) {
|
2475 |
+
$meta='woo_feed_mpn_var';
|
2476 |
+
}
|
2477 |
+
return $this->getProductMeta($product,$meta);
|
2478 |
+
}
|
2479 |
+
|
2480 |
+
/**
|
2481 |
+
* Get Product EAN
|
2482 |
+
* @param WC_Product $product Product object.
|
2483 |
+
* @return string
|
2484 |
+
*/
|
2485 |
+
protected function woo_feed_ean($product) {
|
2486 |
+
$id=$product->get_id();
|
2487 |
+
$meta='woo_feed_ean';
|
2488 |
+
if($product->is_type('variation')) {
|
2489 |
+
$meta='woo_feed_ean_var';
|
2490 |
+
}
|
2491 |
+
return $this->getProductMeta($product,$meta);
|
2492 |
+
}
|
2493 |
+
|
2494 |
/**
|
2495 |
* Get Product Sale Price Effected Date for Google Shopping
|
2496 |
*
|
includes/helper.php
CHANGED
@@ -2535,4 +2535,197 @@ if ( ! function_exists( 'woo_feed_get_category_mapping_value' ) ) {
|
|
2535 |
}
|
2536 |
}
|
2537 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2538 |
// End of file helper.php.
|
2535 |
}
|
2536 |
}
|
2537 |
|
2538 |
+
|
2539 |
+
if( ! function_exists( 'woo_feed_add_identifier_fields' ) ) {
|
2540 |
+
/**
|
2541 |
+
* Add Custom fields into product inventory tab for Unique Identifier (GTIN,MPN,EAN)
|
2542 |
+
*
|
2543 |
+
* @since 3.7.8
|
2544 |
+
*/
|
2545 |
+
function woo_feed_add_identifier_fields() {
|
2546 |
+
|
2547 |
+
echo '<div class="options_group">';
|
2548 |
+
echo sprintf( '<h4 class="%s" style="padding-left: 10px;">%s</h4>', esc_attr( 'woo-feed-option-title' ), esc_html( 'Unique Identifier - Woo Feed', 'woo-feed' ) );
|
2549 |
+
|
2550 |
+
//GTIN input field
|
2551 |
+
woocommerce_wp_text_input( array(
|
2552 |
+
'id' => 'woo_feed_gtin',
|
2553 |
+
'value' => get_post_meta( get_the_ID(), 'woo_feed_gtin', true ),
|
2554 |
+
'placeholder' => esc_html( 'Set product GTIN', 'woo-feed' ),
|
2555 |
+
'label' => esc_html( 'GTIN', 'woo-feed' ),
|
2556 |
+
'desc_tip' => true,
|
2557 |
+
'description' => esc_html( 'Set product GTIN code here.', 'woo-feed' ),
|
2558 |
+
) );
|
2559 |
+
|
2560 |
+
//MPN input field
|
2561 |
+
woocommerce_wp_text_input( array(
|
2562 |
+
'id' => 'woo_feed_mpn',
|
2563 |
+
'value' => get_post_meta( get_the_ID(), 'woo_feed_mpn', true ),
|
2564 |
+
'placeholder' => esc_html( 'Set product MPN', 'woo-feed' ),
|
2565 |
+
'label' => esc_html( 'MPN', 'woo-feed' ),
|
2566 |
+
'desc_tip' => true,
|
2567 |
+
'description' => esc_html( 'Set product MPN code here.', 'woo-feed' ),
|
2568 |
+
) );
|
2569 |
+
|
2570 |
+
//EAN input field
|
2571 |
+
woocommerce_wp_text_input( array(
|
2572 |
+
'id' => 'woo_feed_ean',
|
2573 |
+
'value' => get_post_meta( get_the_ID(), 'woo_feed_ean', true ),
|
2574 |
+
'placeholder' => esc_html( 'Set product EAN', 'woo-feed' ),
|
2575 |
+
'label' => esc_html( 'EAN', 'woo-feed' ),
|
2576 |
+
'desc_tip' => true,
|
2577 |
+
'description' => esc_html( 'Set product EAN code here.', 'woo-feed' ),
|
2578 |
+
) );
|
2579 |
+
|
2580 |
+
echo '</div>';
|
2581 |
+
|
2582 |
+
}
|
2583 |
+
add_action( 'woocommerce_product_options_inventory_product_data', 'woo_feed_add_identifier_fields');
|
2584 |
+
}
|
2585 |
+
|
2586 |
+
if( ! function_exists( 'woo_feed_save_identifier_fields_data' ) ) {
|
2587 |
+
|
2588 |
+
/**
|
2589 |
+
* Updating custom fields data. (Unique Identifier (GTIN,MPN,EAN))
|
2590 |
+
*
|
2591 |
+
* @param int $id Post Id
|
2592 |
+
* @param WP_Post $post Wp Post Object.
|
2593 |
+
* @since 3.7.8
|
2594 |
+
*/
|
2595 |
+
function woo_feed_save_identifier_fields_data( $id, $post ) {
|
2596 |
+
|
2597 |
+
//save gtin fields value
|
2598 |
+
if( isset( $_POST['woo_feed_gtin'] ) && ! empty( $_POST['woo_feed_gtin'] ) ) {
|
2599 |
+
update_post_meta( $id, 'woo_feed_gtin', $_POST['woo_feed_gtin'] );
|
2600 |
+
} else {
|
2601 |
+
delete_post_meta( $id, 'woo_feed_gtin' );
|
2602 |
+
}
|
2603 |
+
|
2604 |
+
//save mpn fields value
|
2605 |
+
if( isset( $_POST['woo_feed_mpn'] ) && ! empty( $_POST['woo_feed_mpn'] ) ) {
|
2606 |
+
update_post_meta( $id, 'woo_feed_mpn', $_POST['woo_feed_mpn'] );
|
2607 |
+
} else {
|
2608 |
+
delete_post_meta( $id, 'woo_feed_mpn' );
|
2609 |
+
}
|
2610 |
+
|
2611 |
+
//save ean fields value
|
2612 |
+
if( isset( $_POST['woo_feed_ean'] ) && ! empty( $_POST['woo_feed_ean'] ) ) {
|
2613 |
+
update_post_meta( $id, 'woo_feed_ean', $_POST['woo_feed_ean'] );
|
2614 |
+
} else {
|
2615 |
+
delete_post_meta( $id, 'woo_feed_ean' );
|
2616 |
+
}
|
2617 |
+
}
|
2618 |
+
|
2619 |
+
add_action( 'woocommerce_process_product_meta', 'woo_feed_save_identifier_fields_data', 10, 2 );
|
2620 |
+
}
|
2621 |
+
|
2622 |
+
if( ! function_exists( 'woo_feed_add_identifier_fields_for_variation' ) ) {
|
2623 |
+
|
2624 |
+
/**
|
2625 |
+
* Custom options in variation tab, here we are putting gtin, mpn, ean input fields in product variation tab
|
2626 |
+
*
|
2627 |
+
* @param int $loop Variation loop index.
|
2628 |
+
* @param array $variation_data Variation info.
|
2629 |
+
* @param WP_Post $variation Post Object.
|
2630 |
+
*
|
2631 |
+
* @since 3.7.8
|
2632 |
+
*/
|
2633 |
+
function woo_feed_add_identifier_fields_for_variation( $loop, $variation_data, $variation ) {
|
2634 |
+
|
2635 |
+
echo '<div class="woo-feed-variation-options">';
|
2636 |
+
echo sprintf( '<h4 class="%s">%s</h4>', esc_attr( 'woo-feed-variation-option-title' ), esc_html( 'Unique Identifier - Woo Feed', 'woo-feed' ) );
|
2637 |
+
?>
|
2638 |
+
<style>
|
2639 |
+
.woo-feed-variation-options {
|
2640 |
+
border-top: 1px solid #ccc;
|
2641 |
+
margin-top: 20px;
|
2642 |
+
}
|
2643 |
+
.woo-feed-variation-options h4 {
|
2644 |
+
margin-bottom: 0;
|
2645 |
+
}
|
2646 |
+
.woo-feed-variation-options .form-field input[type="text"] {
|
2647 |
+
width: 100%;
|
2648 |
+
padding: 5px;
|
2649 |
+
}
|
2650 |
+
.woo-feed-variation-items {
|
2651 |
+
display: flex;
|
2652 |
+
flex-wrap: wrap;
|
2653 |
+
}
|
2654 |
+
.woo-feed-variation-items p {
|
2655 |
+
width: 33.33%;
|
2656 |
+
padding: 0 10px;
|
2657 |
+
box-sizing: border-box;
|
2658 |
+
}
|
2659 |
+
.woo-feed-variation-items p:first-child,.woo-feed-variation-items p:last-child {
|
2660 |
+
padding: 0;
|
2661 |
+
}
|
2662 |
+
</style>
|
2663 |
+
<?php
|
2664 |
+
|
2665 |
+
echo '<div class="woo-feed-variation-items">';
|
2666 |
+
//GTIN variation input field
|
2667 |
+
woocommerce_wp_text_input( array(
|
2668 |
+
'id' => "woo_feed_gtin_var[$variation->ID]",
|
2669 |
+
'value' => get_post_meta( $variation->ID, "woo_feed_gtin_var", true ),
|
2670 |
+
'placeholder' => esc_html( 'Set product GTIN', 'woo-feed' ),
|
2671 |
+
'label' => esc_html( 'GTIN', 'woo-feed' ),
|
2672 |
+
) );
|
2673 |
+
|
2674 |
+
//MPN variation input field
|
2675 |
+
woocommerce_wp_text_input( array(
|
2676 |
+
'id' => "woo_feed_mpn_var[$variation->ID]",
|
2677 |
+
'value' => get_post_meta( $variation->ID, 'woo_feed_mpn_var', true ),
|
2678 |
+
'placeholder' => esc_html( 'Set product MPN', 'woo-feed' ),
|
2679 |
+
'label' => esc_html( 'MPN', 'woo-feed' ),
|
2680 |
+
) );
|
2681 |
+
|
2682 |
+
//EAN variation input field
|
2683 |
+
woocommerce_wp_text_input( array(
|
2684 |
+
'id' => "woo_feed_ean_var[$variation->ID]",
|
2685 |
+
'value' => get_post_meta( $variation->ID, 'woo_feed_ean_var', true ),
|
2686 |
+
'placeholder' => esc_html( 'Set product EAN', 'woo-feed' ),
|
2687 |
+
'label' => esc_html( 'EAN', 'woo-feed' ),
|
2688 |
+
) );
|
2689 |
+
|
2690 |
+
echo '</div></div>';
|
2691 |
+
|
2692 |
+
}
|
2693 |
+
add_action( 'woocommerce_product_after_variable_attributes', 'woo_feed_add_identifier_fields_for_variation', 10, 3 );
|
2694 |
+
}
|
2695 |
+
|
2696 |
+
if( ! function_exists( 'woo_feed_save_identifier_fields_data_for_variation' ) ) {
|
2697 |
+
|
2698 |
+
/**
|
2699 |
+
* Saving variation custom fields.
|
2700 |
+
*
|
2701 |
+
* @param int $variation_id Variation Id.
|
2702 |
+
* @param int $i variations loop index.
|
2703 |
+
*
|
2704 |
+
* @since 3.7.8
|
2705 |
+
*/
|
2706 |
+
function woo_feed_save_identifier_fields_data_for_variation( $variation_id, $i ) {
|
2707 |
+
|
2708 |
+
//save gtin field
|
2709 |
+
if( isset($_POST['woo_feed_gtin_var'][$variation_id]) ) {
|
2710 |
+
$woo_feed_gtin_field = $_POST['woo_feed_gtin_var'][$variation_id];
|
2711 |
+
if ( isset( $woo_feed_gtin_field ) ) update_post_meta( $variation_id, 'woo_feed_gtin_var', esc_attr( $woo_feed_gtin_field ) );
|
2712 |
+
}
|
2713 |
+
|
2714 |
+
//save mpn field
|
2715 |
+
if( isset($_POST['woo_feed_mpn_var'][$variation_id]) ) {
|
2716 |
+
$woo_feed_mpn_field = $_POST['woo_feed_mpn_var'][$variation_id];
|
2717 |
+
if ( isset( $woo_feed_mpn_field ) ) update_post_meta( $variation_id, 'woo_feed_mpn_var', esc_attr( $woo_feed_mpn_field ) );
|
2718 |
+
}
|
2719 |
+
|
2720 |
+
//save ean field
|
2721 |
+
if( isset($_POST['woo_feed_ean_var'][$variation_id]) ) {
|
2722 |
+
$woo_feed_ean_field = $_POST['woo_feed_ean_var'][$variation_id];
|
2723 |
+
if ( isset( $woo_feed_ean_field ) ) update_post_meta( $variation_id, 'woo_feed_ean_var', esc_attr( $woo_feed_ean_field ) );
|
2724 |
+
}
|
2725 |
+
|
2726 |
+
}
|
2727 |
+
add_action( 'woocommerce_save_product_variation', 'woo_feed_save_identifier_fields_data_for_variation', 10, 2 );
|
2728 |
+
}
|
2729 |
+
|
2730 |
+
|
2731 |
// End of file helper.php.
|
woo-feed.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
* Plugin URI: https://webappick.com/
|
12 |
* Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
|
13 |
*
|
14 |
-
* Version: 3.7.
|
15 |
* Author: WebAppick
|
16 |
* Author URI: https://webappick.com/
|
17 |
* License: GPL v2
|
@@ -39,7 +39,7 @@ if ( ! defined( 'WOO_FEED_FREE_VERSION' ) ) {
|
|
39 |
* @var string
|
40 |
* @since 3.1.6
|
41 |
*/
|
42 |
-
define( 'WOO_FEED_FREE_VERSION', '3.7.
|
43 |
}
|
44 |
|
45 |
if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
|
11 |
* Plugin URI: https://webappick.com/
|
12 |
* Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
|
13 |
*
|
14 |
+
* Version: 3.7.16
|
15 |
* Author: WebAppick
|
16 |
* Author URI: https://webappick.com/
|
17 |
* License: GPL v2
|
39 |
* @var string
|
40 |
* @since 3.1.6
|
41 |
*/
|
42 |
+
define( 'WOO_FEED_FREE_VERSION', '3.7.16' );
|
43 |
}
|
44 |
|
45 |
if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
|