Changeset 2803642
- Timestamp:
- 10/24/2022 09:15:06 PM (3 years ago)
- Location:
- obselling/trunk
- Files:
-
- 6 edited
-
admin/admin.php (modified) (1 diff)
-
admin/css/admin.css (modified) (2 diffs)
-
includes/functions.php (modified) (2 diffs)
-
includes/views/html-product-page-recommended-products-block.php (modified) (3 diffs)
-
obselling.php (modified) (4 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
obselling/trunk/admin/admin.php
r2761635 r2803642 8 8 function obselling_admin_enqueue_scripts( $hook_suffix ) { 9 9 10 $admin_pages = array('post.php', 'edit.php', ' settings_page_obselling-pro');10 $admin_pages = array('post.php', 'edit.php', 'woocommerce_page_obselling-pro'); 11 11 12 12 if( ! in_array( $hook_suffix, $admin_pages) ){ -
obselling/trunk/admin/css/admin.css
r2761635 r2803642 203 203 color: #555; 204 204 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; 213 214 } 214 215 … … 218 219 color: white; 219 220 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; 224 226 text-align: center; 225 227 text-decoration: none; -
obselling/trunk/includes/functions.php
r2761635 r2803642 13 13 function obselling_product_is_visible( $is_visible, $product_id ){ 14 14 $product = wc_get_product($product_id); 15 15 16 if ( obselling_is_product_obsolete( $product ) ) { 16 $is_visible = true;17 $is_visible = apply_filters( 'obselling_product_is_visible', true ); 17 18 } 18 19 … … 42 43 function obselling_before_single_product_summary(){ 43 44 global $product; 44 45 45 $recommended_ids = $product->get_meta( 'recommended_ids', true ); 46 46 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 5 5 global $post; 6 6 7 $p arams = 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 ), 10 10 ); 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', ) ); 12 13 // not sure why but 'loop' is at '1' after loading the page. 13 14 // so we have to set it to 'O' so wc_product_class can work properly. … … 16 17 ?> 17 18 <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> 19 20 <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 ):?> 21 22 <li <?php wc_product_class('recommended_product') ?> > 22 23 <?php 23 24 woocommerce_template_loop_product_link_open(); 24 25 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 26 29 woocommerce_template_loop_rating(); 27 30 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 );31 31 if( !obselling_is_product_obsolete( $product ) ){ 32 32 woocommerce_template_loop_price(); … … 38 38 </li> 39 39 <?php 40 endwhile; 41 wp_reset_query(); 40 endforeach; 41 wp_reset_query(); 42 $product = $product_orig; 42 43 ?> 43 44 </ul> -
obselling/trunk/obselling.php
r2761635 r2803642 4 4 * Plugin URI: https://obselling.com/ 5 5 * Description: Sell other products of an obsolete product or out of stock. 6 * Version: 1. 0.16 * Version: 1.2 7 7 * Author: Korteex 8 8 * Author URI: https://korteex.fr/ … … 16 16 defined( 'ABSPATH' ) || exit; 17 17 18 define( 'OBSELLING_VERSION', '1. 0.1' );18 define( 'OBSELLING_VERSION', '1.2' ); 19 19 20 20 define( 'OBSELLING_PLUGIN', __FILE__ ); … … 90 90 91 91 function obselling_enqueue_scripts() { 92 wp_enqueue_style( ' OBSELLING',92 wp_enqueue_style( 'obselling', 93 93 plugins_url( 'includes/css/style.css', OBSELLING_PLUGIN_BASENAME ), 94 94 array(), OBSELLING_VERSION, 'all' … … 97 97 // right-to-left styling 98 98 if ( is_rtl() ) { 99 wp_enqueue_style( ' OBSELLING-rtl',99 wp_enqueue_style( 'obselling-rtl', 100 100 plugins_url( 'includes/css/style-rtl.css', OBSELLING_PLUGIN_BASENAME ), 101 101 array(), OBSELLING_VERSION, 'all' -
obselling/trunk/readme.txt
r2761635 r2803642 6 6 Plugin URI: https://obselling.com/ 7 7 Requires at least: 4.7+ 8 Tested up to: 6.0. 18 Tested up to: 6.0.3 9 9 Requires PHP: 7.0 10 Stable tag: 1. 0.110 Stable tag: 1.2 11 11 License: GPLv3 or later 12 12 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 54 54 * Number of recommended products: *4* 55 55 * 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 61 60 62 61 Get PRO version: [Obselling EN](https://obselling.com/) | [Obselling FR](https://obselling.fr/) … … 108 107 == Changelogs == 109 108 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* 111 117 * Improvement: Code 112 118 * Updated: Translate
Note: See TracChangeset
for help on using the changeset viewer.