Plugin Directory

Changeset 3414108


Ignore:
Timestamp:
12/08/2025 10:34:41 AM (4 months ago)
Author:
saffiretech
Message:

Added the fallback to product id to fix the inconsistent greyscale issue.

Location:
discontinued-product-stock-status-woocommerce
Files:
139 added
4 edited

Legend:

Unmodified
Added
Removed
  • discontinued-product-stock-status-woocommerce/trunk/discontinued-products-stock-status.php

    r3410883 r3414108  
    77 * Text Domain: discontinued-products-stock-status
    88 * Domain Path: /languages
    9  * Stable Tag : 1.5.6
     9 * Stable Tag : 1.5.7
    1010 * Requires at least: 5.0
    1111 * Tested up to: 6.8.1
     
    1414 * License:    GPLv3
    1515 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
    16  * Version: 1.5.6
     16 * Version: 1.5.7
    1717 */
    1818
  • discontinued-product-stock-status-woocommerce/trunk/includes/dpssw-functions.php

    r3410883 r3414108  
    9090                            filter: grayscale(1) !important;
    9191                        }
     92                        /*
     93                        li.sft-discontinued img.attachment-woocommerce_thumbnail{
     94                            filter: grayscale(1) !important;
     95                        }*/
    9296                    </style>
    9397                    <?php
     
    117121                            filter: grayscale(1) !important;
    118122                        }
     123                        /*
     124                        li.sft-discontinued img.attachment-woocommerce_thumbnail{
     125                            filter: grayscale(1) !important;
     126                        }
     127                        */
    119128                    </style>
    120129                    <?php
     
    477486 * Add custom class to discontinued product.
    478487 *
    479  * @param string $attr class attribute.
    480  * @param object $attachment .
    481  * @param array $size .
    482  * @return array attr
     488 * @param [type] $attr .
     489 * @param [type] $attachment .
     490 * @param [type] $size .
     491 * @return array
    483492 */
    484493function dpssw_attachment_image_attributes( $attr, $attachment, $size ) {
    485     // $product_id = $attachment->post_parent; // product id. METHDO DISCARDED DUE TO ISSUE.
    486 
    487     // Get the product id of the current product.
     494
     495    // Get the global product object.
    488496    global $product;
    489 
    490     // Fallback if product not available.
    491     if ( ! $product ) {
    492         return $attr;
    493     }
    494 
    495     $product_id = $product->get_id(); // Product id.
     497    $this_product = $product;
     498
     499    // Check if it's the object and object is of products.
     500    if ( gettype( $product ) === 'object' && $product instanceof WC_Product ) {
     501
     502        $product_id = $product->get_id(); // product id from global product.
     503
     504    } else {
     505        $product_id = $attachment->post_parent; // product id from attachment.
     506    }
    496507
    497508    if ( $product_id ) {
     
    536547        }
    537548    }
     549
     550    $product = $this_product;
     551
    538552    return $attr;
    539 }
     553
     554}
     555
     556// add_filter( 'woocommerce_post_class', 'dpssw_add_discontinued_class_to_product_wrapper', 10, 2 ); // MIGHT NOT FIRED IN CUSTOM THEMES/TEMPLATES.
     557// function dpssw_add_discontinued_class_to_product_wrapper( $classes, $product ) {}.
    540558
    541559
  • discontinued-product-stock-status-woocommerce/trunk/languages/discontinued-products-stock-status.pot

    r3410883 r3414108  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Discontinued Product Stock Status for WooCommerce 1.5.6\n"
     5"Project-Id-Version: Discontinued Product Stock Status for WooCommerce 1.5.7\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/discontinued-product-stock-status-woocommerce\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-12-04T12:06:05+00:00\n"
     12"POT-Creation-Date: 2025-12-08T09:49:58+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.12.0\n"
     
    136136msgstr ""
    137137
    138 #: includes/dpssw-functions.php:314
    139 #: includes/dpssw-functions.php:320
    140 #: includes/dpssw-functions.php:411
     138#: includes/dpssw-functions.php:323
     139#: includes/dpssw-functions.php:329
    141140#: includes/dpssw-functions.php:420
     141#: includes/dpssw-functions.php:429
    142142#: includes/dpssw-product-data-tabs.php:962
    143143msgid "This product has been discontinued."
    144144msgstr ""
    145145
    146 #: includes/dpssw-functions.php:552
     146#: includes/dpssw-functions.php:570
    147147msgid "Permission Denied."
    148148msgstr ""
    149149
    150 #: includes/dpssw-functions.php:597
     150#: includes/dpssw-functions.php:615
    151151msgid "Awesome, you've been using"
    152152msgstr ""
    153153
    154 #: includes/dpssw-functions.php:597
     154#: includes/dpssw-functions.php:615
    155155msgid "for more than 1 week"
    156156msgstr ""
    157157
    158 #: includes/dpssw-functions.php:598
     158#: includes/dpssw-functions.php:616
    159159msgid "If you like our plugin would you like to rate our plugin at WordPress.org ?"
    160160msgstr ""
    161161
    162 #: includes/dpssw-functions.php:600
     162#: includes/dpssw-functions.php:618
    163163msgid "Yes, I'd like to rate it!"
    164164msgstr ""
    165165
    166 #: includes/dpssw-functions.php:603
     166#: includes/dpssw-functions.php:621
    167167msgid "I already did!"
    168168msgstr ""
  • discontinued-product-stock-status-woocommerce/trunk/readme.txt

    r3410883 r3414108  
    55Tested up to: 6.8.1
    66Requires PHP: 7.2
    7 Stable tag: 1.5.6
     7Stable tag: 1.5.7
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    7575
    7676== Changelog ==
     77= 1.5.7 2025-12-08 =
     78
     79* Fix - Added a fallback to product ID detection to fix inconsistent grayscale behavior.
     80
    7781= 1.5.6 2025-12-04 =
    7882
Note: See TracChangeset for help on using the changeset viewer.