Changeset 2476144
- Timestamp:
- 02/17/2021 08:22:31 AM (5 years ago)
- Location:
- ecommerce-table
- Files:
-
- 49 added
- 6 edited
-
tags/1.1/LICENSE (added)
-
tags/1.1/assets/admin-options.png (added)
-
tags/1.1/assets/ect_table_script.js (added)
-
tags/1.1/assets/ect_table_style.css (added)
-
tags/1.1/assets/front-end.png (added)
-
tags/1.1/ect_table_functions.php (added)
-
tags/1.1/includes (added)
-
tags/1.1/includes/ect-activator.php (added)
-
tags/1.1/includes/ect-add-to-cart.php (added)
-
tags/1.1/includes/ect-deactivator.php (added)
-
tags/1.1/includes/ect-front-end.php (added)
-
tags/1.1/includes/ect_table_admin.php (added)
-
tags/1.1/init.php (added)
-
tags/1.1/readme.txt (added)
-
tags/1.2 (added)
-
tags/1.2/LICENSE (added)
-
tags/1.2/assets (added)
-
tags/1.2/assets/admin-options.png (added)
-
tags/1.2/assets/banner-772x250.png (added)
-
tags/1.2/assets/cart.webp (added)
-
tags/1.2/assets/ect_table_script.js (added)
-
tags/1.2/assets/ect_table_style.css (added)
-
tags/1.2/assets/ectp_admin_script.js (added)
-
tags/1.2/assets/ectp_admin_style.css (added)
-
tags/1.2/assets/icon-128x128.png (added)
-
tags/1.2/assets/icon-256x256.png (added)
-
tags/1.2/assets/sortable.js (added)
-
tags/1.2/assets/table.png (added)
-
tags/1.2/includes (added)
-
tags/1.2/includes/class-ect-front-end.php (added)
-
tags/1.2/includes/class-ect-table-activator.php (added)
-
tags/1.2/includes/class-ect-table-admin.php (added)
-
tags/1.2/includes/class-ect-table-deactivator.php (added)
-
tags/1.2/includes/ect-add-to-cart.php (added)
-
tags/1.2/includes/ect-table-admin.php (added)
-
tags/1.2/includes/ect-table-functions.php (added)
-
tags/1.2/init.php (added)
-
tags/1.2/readme.txt (added)
-
trunk/assets/admin-options.png (modified) (previous)
-
trunk/assets/cart.webp (added)
-
trunk/assets/ect_table_script.js (modified) (4 diffs)
-
trunk/assets/ect_table_style.css (modified) (6 diffs)
-
trunk/assets/ectp_admin_script.js (added)
-
trunk/assets/ectp_admin_style.css (added)
-
trunk/assets/sortable.js (added)
-
trunk/assets/table.png (added)
-
trunk/includes/class-ect-front-end.php (added)
-
trunk/includes/class-ect-table-activator.php (added)
-
trunk/includes/class-ect-table-admin.php (added)
-
trunk/includes/class-ect-table-deactivator.php (added)
-
trunk/includes/ect-add-to-cart.php (modified) (1 diff)
-
trunk/includes/ect-table-admin.php (added)
-
trunk/includes/ect-table-functions.php (added)
-
trunk/init.php (modified) (1 diff)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ecommerce-table/trunk/assets/ect_table_script.js
r2472896 r2476144 63 63 $('.single_add_to_cart_button').prop('disabled', false); 64 64 65 alert(quantity+' '+$('.ect_title_'+product_id).children('a').text()+" has been added to cart"); 65 var cart_quantity = parseInt($('.ectp_cart_contents_count').html()); 66 67 cart_quantity += parseInt(quantity); 68 69 // $('.ectp_cart_contents_count').html(' '+cart_quantity); 70 71 var notification = quantity+' '+$('.ect_title_'+product_id).children('a').text()+" has been added to cart"; 72 73 $('.ectp_notification').html(notification); 74 75 $('.ectp_notification').css('display','block'); 76 77 $('.ectp_notification').css('background-color', '#229922'); 78 79 $( document.body ).trigger( 'wc_fragment_refresh' ); 80 81 setTimeout(function(){ $('.ectp_notification').css('display','none'); }, 4000); 66 82 67 83 } … … 85 101 if(var_id == "0"){ 86 102 87 alert("select options"); 103 $('.ectp_notification').html('Select Options'); 104 105 $('.ectp_notification').css('display','block'); 106 107 $('.ectp_notification').css('background-color', '#992222'); 108 109 setTimeout(function(){ $('.ectp_notification').css('display','none'); }, 4000); 88 110 89 111 $('.single_add_to_cart_button').prop('disabled', false); … … 113 135 success: function( data ) { 114 136 137 console.log(data); 138 115 139 if(data == 'added'){ 116 140 117 141 $('.single_add_to_cart_button').prop('disabled', false); 118 142 119 alert(quantity+' '+$('.ect_title_'+product_id).children('a').text()+" has been added to cart");143 var cart_quantity = parseInt($('.ectp_cart_contents_count').html()); 120 144 145 cart_quantity += parseInt(quantity); 146 147 // $('.ectp_cart_contents_count').html(' '+cart_quantity); 148 149 var notification = quantity+' '+$('.ect_title_'+product_id).children('a').text()+" has been added to cart"; 150 151 $('.ectp_notification').html(notification); 152 153 $('.ectp_notification').css('display','block'); 154 155 $('.ectp_notification').css('background-color', '#229922'); 156 157 $( document.body ).trigger( 'wc_fragment_refresh' ); 158 159 setTimeout(function(){ $('.ectp_notification').css('display','none'); }, 4000); 160 121 161 } 122 162 … … 129 169 }else{ 130 170 131 alert("select options"); 171 $('.ectp_notification').html('Select Options'); 172 173 $('.ectp_notification').css('display','block'); 174 175 $('.ectp_notification').css('background-color', '#992222'); 176 177 setTimeout(function(){ $('.ectp_notification').css('display','none'); }, 4000); 132 178 133 179 $('.single_add_to_cart_button').prop('disabled', false); -
ecommerce-table/trunk/assets/ect_table_style.css
r2472896 r2476144 19 19 .ect_table input.input-text { 20 20 width: 80%; 21 padding: 0 !important; 22 height: 40px; 23 text-align: center; 21 24 } 22 25 … … 24 27 padding: 0px; 25 28 height: 42px; 26 width: 100%;29 width: 96%; 27 30 align-self: center; 31 font-size: 14px; 32 font-weight: 100; 33 margin: 0px 2%; 28 34 } 29 35 … … 57 63 .ect_table>div { 58 64 59 text-align: center;65 text-align: left; 60 66 margin: auto 0; 61 67 … … 76 82 .ect_table { 77 83 78 padding: 10px 0;84 padding: 5px 0; 79 85 80 86 } … … 110 116 } 111 117 112 .ect_table .variations .label{118 .ect_table .variations td { 113 119 114 margin-top: 5px!important; 120 /* margin-top: 5px!important; */ 121 background-color: transparent !important; 115 122 116 123 } … … 121 128 122 129 } 130 131 .ect_table .ectp_cart_align { 132 133 display: grid; 134 /* grid-template-columns: 7fr 3fr; */ 135 text-align: center; 136 137 } 138 139 .ect_table .ectp_align_right{ 140 text-align: right; 141 } 142 143 .ect_table img.ectp_ajax_cart_image { 144 width: 22px; 145 display: inline-block; 146 } 147 148 .ect_table .image_padding { 149 padding-left: 20px; 150 } 151 152 .ect_table .ect_price>p { 153 display: inline-block; 154 } 155 156 .ectp_notification { 157 background-color: #229922; 158 color: #fff; 159 text-align: center; 160 padding: 10px; 161 position: fixed; 162 top: 32px; 163 z-index: 9999; 164 width: 100%; 165 left: 0; 166 display: none; 167 } -
ecommerce-table/trunk/includes/ect-add-to-cart.php
r2472896 r2476144 1 1 <?php 2 /** 3 * Ecommerce Table. 4 * 5 * @package Ecommerce_Table 6 * @author Mukul Lodhi 7 * @license GPL-2.0+ 8 * 9 * @wordpress-plugin 10 * Plugin Name: Ecommerce Table 11 * Description: This Plugin displays products in tabular format * Author: Mukul Lodhi 12 * Version: 1.2 13 */ 2 14 3 15 if ( ! defined( 'ABSPATH' ) ) { 4 exit; // Exit if accessed directly 16 exit; // Exit if accessed directly. 5 17 } 6 18 7 if (!function_exists('ectp_generate_heading')) { 19 if ( ! function_exists( 'ectp_generate_heading' ) ) { 20 /** 21 * Function ectp_product_update. 22 */ 23 function ectp_product_update() { 8 24 9 function ectp_product_update(){25 if ( isset( $_POST['nonce'] ) ) { 10 26 11 if(isset($_POST['nonce'])){ 27 $nonce = sanitize_text_field( wp_unslash( $_POST['nonce'] ) ); 12 28 13 $nonce = sanitize_text_field( $_POST['nonce'] ); 29 if ( ! wp_verify_nonce( $nonce, 'ect-ajax-nonce' ) ) { 14 30 15 if ( ! wp_verify_nonce( $nonce, 'ect-ajax-nonce' ) ) { 31 die( 'Nonce value cannot be verified.' ); 16 32 17 die( 'Nonce value cannot be verified.' ); 33 } 18 34 19 } 35 $product_id = apply_filters( 'woocommerce_add_to_cart_product_id', absint( sanitize_text_field( wp_unslash( isset( $_POST['post_id'] ) ? $_POST['post_id'] : null ) ) ) ); 20 36 21 $product_id = apply_filters('woocommerce_add_to_cart_product_id', absint(sanitize_text_field( $_POST['post_id'] )));37 $quantity = empty( sanitize_text_field( wp_unslash( isset( $_POST['quantity'] ) ? $_POST['quantity'] : null ) ) ) ? 1 : wc_stock_amount( sanitize_text_field( wp_unslash( isset( $_POST['quantity'] ) ? $_POST['quantity'] : null ) ) ); 22 38 23 $quantity = empty(sanitize_text_field( $_POST['quantity'] )) ? 1 : wc_stock_amount(sanitize_text_field( $_POST['quantity'] ));39 $variation_id = absint( sanitize_text_field( wp_unslash( isset( $_POST['var_id'] ) ? $_POST['var_id'] : null ) ) ); 24 40 25 $variation_id = absint(sanitize_text_field( $_POST['var_id'] ));41 wc_stock_amount( sanitize_text_field( wp_unslash( isset( $_POST['quantity'] ) ? $_POST['quantity'] : null ) ) ); 26 42 27 wc_stock_amount(sanitize_text_field($_POST['quantity']));43 $passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity ); 28 44 29 $passed_validation = apply_filters('woocommerce_add_to_cart_validation', true, $product_id, $quantity);45 $product_status = get_post_status( $product_id ); 30 46 31 $product_status = get_post_status($product_id); 47 if ( $passed_validation && WC()->cart->add_to_cart( $product_id, $quantity, $variation_id ) && 'publish' === $product_status ) { 32 48 33 if ($passed_validation && WC()->cart->add_to_cart($product_id, $quantity, $variation_id) && 'publish' === $product_status) { 49 echo 'added'; 34 50 35 echo 'added'; 51 } else { 36 52 37 } else { 53 $data = array( 38 54 39 $data = array( 55 'error' => true, 40 56 41 'error' => true,57 'product_url' => apply_filters( 'woocommerce_cart_redirect_after_error', get_permalink( $product_id ), $product_id ), 42 58 43 'product_url' => apply_filters('woocommerce_cart_redirect_after_error', get_permalink($product_id), $product_id));59 ); 44 60 45 echo wp_send_json($data);61 echo esc_html( wp_send_json( $data ) ); 46 62 47 }63 } 48 64 49 die();65 die(); 50 66 51 }67 } 52 68 53 die();69 die(); 54 70 55 } 56 71 } 57 72 } 58 73 add_action( 'wp_ajax_ectp_product_update', 'ectp_product_update' ); -
ecommerce-table/trunk/init.php
r2472896 r2476144 1 <?php 2 3 /* 4 Plugin Name: Ecommerce Table 5 Author: Mukul Lodhi 6 Version: 1.1 7 Requires at least: 5.5.3 8 Tested up to: 5.6 9 Description: This Plugin displays products in tabular format 10 Requires PHP: 5.4 11 License: GPLv2 or later 12 License URI: http://www.gnu.org/licenses/gpl-2.0.html 13 14 This Plugin arrange products into tabular format. 15 16 */ 1 <?php 2 /** 3 * Plugin Name: Ecommerce Table 4 * Author: Mukul Lodhi 5 * Version: 1.2 6 * Requires at least: 5.5.3 7 * Tested up to: 5.6 8 * Description: This Plugin displays products in tabular format 9 * Requires PHP: 5.4 10 * License: GPLv2 or later 11 * License URI: http://www.gnu.org/licenses/gpl-2.0.html 12 * 13 * This Plugin arrange products into tabular format. 14 * 15 * @package Ecommerce_Table 16 * @author Mukul Lodhi 17 * @license GPL-2.0+ 18 */ 17 19 18 20 if ( ! defined( 'ABSPATH' ) ) { 19 exit; // Exit if accessed directly 21 exit; // Exit if accessed directly. 20 22 } 21 23 22 function activate_ect_Table() { 23 require_once plugin_dir_path( __FILE__ ) . 'includes/ect-activator.php'; 24 /** Functions to activate plugin */ 25 function activate_ect_table() { 26 require_once plugin_dir_path( __FILE__ ) . 'includes/class-ect-table-activator.php'; 24 27 Ect_Table_Activator::activate(); 25 28 } 26 27 function deactivate_ect_Table() { 28 require_once plugin_dir_path( __FILE__ ) . 'includes/ect-deactivator.php'; 29 30 /** Functions to deactivate plugin */ 31 function deactivate_ect_table() { 32 require_once plugin_dir_path( __FILE__ ) . 'includes/class-ect-table-deactivator.php'; 29 33 Ect_Table_Deactivator::deactivate(); 30 34 } 31 32 register_activation_hook( __FILE__, 'activate_ect_Table' );33 register_deactivation_hook( __FILE__, 'deactivate_ect_Table' );34 register_uninstall_hook( __FILE__, 'deactivate_ect_Table' );35 35 36 require plugin_dir_path( __FILE__ ) . 'ect_table_functions.php'; 36 register_activation_hook( __FILE__, 'activate_ect_table' ); 37 register_deactivation_hook( __FILE__, 'deactivate_ect_table' ); 38 register_uninstall_hook( __FILE__, 'deactivate_ect_table' ); 39 40 require plugin_dir_path( __FILE__ ) . 'includes/ect-table-functions.php'; -
ecommerce-table/trunk/readme.txt
r2473153 r2476144 4 4 Requires at least: 5.5.3 5 5 Tested up to: 5.6 6 Stable tag: trunk6 Stable tag: 1.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 18 18 Features: 19 19 20 * Option to set number of products to display in table 21 * Option to set size or product images to display 22 * Option in front end to sort products using categories and tags 23 * Option to display featured and instock products 24 * Separated admin menu for customization 20 * Option to set number of products to display in table. 21 * Option to change order of columns. 22 * Option to set size or product images to display. 23 * Option in front end to sort products using categories and tags. 24 * Option to sort display featured and instock products. 25 * Separated admin menu for customization. 25 26 * Supports multiple product types, plugin handles any type of product. 26 * Clean layout 27 * Not obstructive 27 * Clean layout. 28 * Not obstructive. 28 29 29 30 *Perfect tool to display tabular products.* … … 36 37 37 38 == Frequently asked questions == 38 = A question that someone might have =39 An answer to that question.40 39 41 40 42 41 == Screenshots == 43 1. Admin options44 2. Front end preview42 1. admin-options.png 43 2. table.png 45 44 46 45 … … 49 48 Version 1.0: initial release 50 49 Version 1.1: final release 50 Version 1.2: Added multiple features 51 51 52 52
Note: See TracChangeset
for help on using the changeset viewer.