Plugin Directory

Changeset 2803642


Ignore:
Timestamp:
10/24/2022 09:15:06 PM (3 years ago)
Author:
olivierwpt
Message:

Version 1.2 - Update (CSS, code, bug,...)

Location:
obselling/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • obselling/trunk/admin/admin.php

    r2761635 r2803642  
    88function obselling_admin_enqueue_scripts( $hook_suffix ) {
    99
    10     $admin_pages = array('post.php', 'edit.php', 'settings_page_obselling-pro');
     10    $admin_pages = array('post.php', 'edit.php', 'woocommerce_page_obselling-pro');
    1111
    1212    if( ! in_array( $hook_suffix, $admin_pages) ){
  • obselling/trunk/admin/css/admin.css

    r2761635 r2803642  
    203203    color: #555;
    204204    position: relative;
    205     background-color: #eee;
    206 }
    207 
    208 table.wp-list-table mark.obsolete {
    209     font-weight: 700;
    210     background: transparent none;
    211     line-height: 1;
    212     color: #a44;
     205    background-color: #eee
     206}
     207
     208.wp-list-table .obsolete {
     209    background-color: FireBrick;
     210    padding: 2px 4px;
     211    color: white;
     212    font-weight: 600;
     213    border-radius: 4px;
    213214}
    214215
     
    218219    color: white;
    219220    margin: 10px;
    220     border-radius: 10px;
    221     display: block;
    222     font-size: 1.5rem;
    223     line-height: 4rem;
     221    border-radius: 4px;
     222    display: block;
     223    width: 50%;
     224    font-size: 1.3rem;
     225    line-height: 3rem;
    224226    text-align: center;
    225227    text-decoration: none;
  • obselling/trunk/includes/functions.php

    r2761635 r2803642  
    1313function obselling_product_is_visible( $is_visible, $product_id ){
    1414    $product = wc_get_product($product_id);
     15
    1516    if ( obselling_is_product_obsolete( $product ) ) {
    16         $is_visible = true;
     17        $is_visible = apply_filters( 'obselling_product_is_visible', true );
    1718    }
    1819
     
    4243function obselling_before_single_product_summary(){
    4344  global $product;
    44 
    4545  $recommended_ids = $product->get_meta( 'recommended_ids', true );
    4646  if( obselling_is_product_obsolete( $product ) && !empty($recommended_ids) && count($recommended_ids) ) {
  • obselling/trunk/includes/views/html-product-page-recommended-products-block.php

    r2761635 r2803642  
    55global $post;
    66
    7 $params = array(
    8     'post_type' => 'product',
    9     'post__in' => $product->get_meta( 'recommended_ids', true ),
     7$product_orig = $product;
     8$args = array(
     9    'include' => $product->get_meta( 'recommended_ids', true ),
    1010);
    11 $query = new WP_Query( $params );
     11$products = wc_get_products( $args );
     12$products  = apply_filters( 'obselling_recommended_products_orderby', wc_products_array_orderby( $products, 'shuffle', ) );
    1213// not sure why but 'loop' is at '1' after loading the page.
    1314// so we have to set it to 'O' so wc_product_class can work properly.
     
    1617?>
    1718<div class="obselling-product-page">
    18   <div class="obselling-product-alert"><?php _e( "This product is no longer available. We recommend this selection:", 'obselling' )?></div>
     19  <div class="obselling-product-alert"><?php echo apply_filters( 'obselling_recommended_products_text', __( "This product is no longer available. We recommend this selection:", 'obselling' ) ) ?></div>
    1920  <ul class="products columns-<?php esc_attr_e( wc_get_loop_prop( 'columns' ) )?>">
    20   <?php while( $query->have_posts() ): $query->the_post(); ?>
     21  <?php foreach( $products as $product ):?>
    2122          <li <?php wc_product_class('recommended_product') ?> >
    2223              <?php
    2324              woocommerce_template_loop_product_link_open();
    2425              woocommerce_template_loop_product_thumbnail();
    25               woocommerce_template_loop_product_title(); //! prends le titre de la page et non de $product
     26              // we can"t use woocommerce_template_loop_product_title() because it uses the title of the page
     27              // copied from include/wc-template-functions.php
     28              echo '<h2 class="' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '">' . get_the_title( $product->get_id() ) . '</h2>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    2629              woocommerce_template_loop_rating();
    2730
    28               $product_type = WC_Product_Factory::get_product_type( $post->ID );
    29                 $classname    = WC_Product_Factory::get_product_classname( $post->ID, $product_type ? $product_type : 'simple' );
    30                 $product      = new $classname( $post->ID );
    3131              if( !obselling_is_product_obsolete( $product ) ){
    3232                woocommerce_template_loop_price();
     
    3838          </li>
    3939  <?php
    40     endwhile;
    41     wp_reset_query();
     40  endforeach;
     41  wp_reset_query();
     42  $product = $product_orig;
    4243   ?>
    4344  </ul>
  • obselling/trunk/obselling.php

    r2761635 r2803642  
    44 * Plugin URI: https://obselling.com/
    55 * Description: Sell other products of an obsolete product or out of stock.
    6  * Version: 1.0.1
     6 * Version: 1.2
    77 * Author: Korteex
    88 * Author URI: https://korteex.fr/
     
    1616defined( 'ABSPATH' ) || exit;
    1717
    18 define( 'OBSELLING_VERSION', '1.0.1' );
     18define( 'OBSELLING_VERSION', '1.2' );
    1919
    2020define( 'OBSELLING_PLUGIN', __FILE__ );
     
    9090
    9191function obselling_enqueue_scripts() {
    92     wp_enqueue_style( 'OBSELLING',
     92    wp_enqueue_style( 'obselling',
    9393        plugins_url( 'includes/css/style.css', OBSELLING_PLUGIN_BASENAME ),
    9494        array(), OBSELLING_VERSION, 'all'
     
    9797    // right-to-left styling
    9898    if ( is_rtl() ) {
    99         wp_enqueue_style( 'OBSELLING-rtl',
     99        wp_enqueue_style( 'obselling-rtl',
    100100            plugins_url( 'includes/css/style-rtl.css', OBSELLING_PLUGIN_BASENAME ),
    101101            array(), OBSELLING_VERSION, 'all'
  • obselling/trunk/readme.txt

    r2761635 r2803642  
    66Plugin URI: https://obselling.com/
    77Requires at least: 4.7+
    8 Tested up to: 6.0.1
     8Tested up to: 6.0.3
    99Requires PHP: 7.0
    10 Stable tag: 1.0.1
     10Stable tag: 1.2
    1111License: GPLv3 or later
    1212License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    5454* Number of recommended products: *4*
    5555* Add recommended products if the product is *out of stock*
    56 * Shortcode (Divi, Elementor,…) (coming soon)
    57 * Product display order (Name / Price) (coming soon)
    58 * Message customization (coming soon)
    59 * Redirection 301 (coming soon)
    60 * Hide: In Lists / Views (coming soon)
     56* Shortcode (Divi, Elementor,…)
     57* Product display order (Name / Price)
     58* Message customization
     59* Hide: In Lists / Views
    6160
    6261Get PRO version: [Obselling EN](https://obselling.com/) | [Obselling FR](https://obselling.fr/)
     
    108107== Changelogs ==
    109108
    110 = 1.0.1 - 2022-07-26 =
     109= 1.2 - 2022-10-24 =
     110* Design CSS
     111* Bug
     112* Improvement: Code
     113* Updated: Translate
     114
     115= 1.1 - 2022-07-26 =
     116* Add recommended products if the product is *out of stock*
    111117* Improvement: Code
    112118* Updated: Translate
Note: See TracChangeset for help on using the changeset viewer.