Plugin Directory

Changeset 3256536


Ignore:
Timestamp:
03/16/2025 11:35:21 AM (2 weeks ago)
Author:
gravitymaster97
Message:

Description of changes

Location:
pdf-catalog-woocommerce
Files:
14 added
9 edited

Legend:

Unmodified
Added
Removed
  • pdf-catalog-woocommerce/trunk/css/print-style.css

    r2988752 r3256536  
    1 body{
    2     font-family: 'DejaVu Sans';
    3     margin:0;
    4     padding:50px 20px;
    5 }
    6 html{
    7     margin:0;
    8     padding:0;
     1.gmwcpApp{
     2  text-align:center;
    93}
    10 header, footer{
    11     position: fixed;
    12     left: 0px;
    13     right: 0px;
    14     z-index:9556222222;
    15     padding-right:20px;
    16     padding-left:20px;
    17 }
    18 header{
    19     height: 40px;
    20     top:0;
    21 
    22 }
    23 footer{
    24     height: 40px;
    25     bottom:0;
    26     text-align: right;
    27 }
    28 header p, header span{
    29     margin:0;
    30     line-height: 25px;
    31 }
    32 footer p{
    33     margin:0;
    34     line-height: 30px;
    35 }
    36 main{
    37     margin-top: 0px;
    38     margin-bottom: 0px;
    39 }
    40 .leftimage{
    41     width:40%;
    42     float: left;
    43 }
    44 .leftimage img{
    45     max-width: 100%;
    46 
    47 }
    48 .rightimage{
    49     width: 60%;
    50     float: right;
    51 }
    52 .innerrightimage h2{
    53     margin-top: 0;
     4/* Styling for the download button */
     5.pdf-download-button {
     6  display: inline-block;
     7  padding: 10px 20px;
     8  margin: 20px auto;
     9  font-size: 16px;
     10  font-weight: bold;
     11  color: #fff;
     12  background-color: #007bff;
     13  border: none;
     14  border-radius: 5px;
     15  text-decoration: none;
     16  transition: background-color 0.3s ease;
    5417}
    5518
    56 .fullwdithimag h3{
    57     margin-top: 0;
     19.pdf-download-button:hover {
     20  background-color: #0056b3;
    5821}
    59 .innerrightimage{
    60     margin-left: 20px;
     22
     23.pdf-download-button:focus {
     24  outline: none;
    6125}
    62 .upperdivs{
    63     display: inline-block;
    64     width: 100%;
    6526
     27.pdf-download-button:active {
     28  background-color: #00408d;
     29}
    6630
     31/* Loader styles */
     32.loader {
     33  display: inline-block;
     34  width: 50px;
     35  height: 50px;
     36  border: 3px solid rgba(0, 0, 0, 0.3);
     37  border-radius: 50%;
     38  border-top-color: #000;
     39  animation: spin 1s ease-in-out infinite;
     40  margin-top: 20px;
    6741}
    68 .fullwdithimag{
    69     display: block;
    70     width: 100%;
     42
     43@keyframes spin {
     44  to {
     45    transform: rotate(360deg);
     46  }
    7147}
    72 .spacea{
    73     display: block;
    74     height: 5px;
    75     clear: both;
     48
     49/* Centered text for loading state */
     50.loading-text {
     51  font-size: 16px;
     52  font-weight: bold;
     53  margin-top: 10px;
    7654}
    77 .spacear{
    78     display: block;
    79     height: 25px;
    80     clear: both;
    81 }
    82 .main{
    83     border-bottom: 1px solid #000;
    84     display: block;
    85     width: 100%;
    86 }
    87 .metacustl>div{
    88     /*padding-top: 5px;*/
    89 }
    90 .metacustl th{
    91     text-align: left;
    92 }
    93 .main_gallery_image{
    94     margin-top: 20px;
    95 }
    96 .smallimage_img{
    97     width: 100px;
    98     display: inline-block;
    99     padding-right: 3px;
    100     padding-top: 5px;
    101 }
  • pdf-catalog-woocommerce/trunk/css/style.css

    r2165011 r3256536  
     1.gmwcpApp{
     2  text-align:center;
     3}
     4/* Styling for the download button */
     5.pdf-download-button {
     6  display: inline-block;
     7  padding: 10px 20px;
     8  margin: 20px auto;
     9  font-size: 16px;
     10  font-weight: bold;
     11  color: #fff;
     12  background-color: #007bff;
     13  border: none;
     14  border-radius: 5px;
     15  text-decoration: none;
     16  transition: background-color 0.3s ease;
     17}
     18
     19.pdf-download-button:hover {
     20  background-color: #0056b3;
     21}
     22
     23.pdf-download-button:focus {
     24  outline: none;
     25}
     26
     27.pdf-download-button:active {
     28  background-color: #00408d;
     29}
     30
     31/* Loader styles */
     32.loader {
     33  display: inline-block;
     34  width: 50px;
     35  height: 50px;
     36  border: 3px solid rgba(0, 0, 0, 0.3);
     37  border-radius: 50%;
     38  border-top-color: #000;
     39  animation: spin 1s ease-in-out infinite;
     40  margin-top: 20px;
     41}
     42
     43@keyframes spin {
     44  to {
     45    transform: rotate(360deg);
     46  }
     47}
     48
     49/* Centered text for loading state */
     50.loading-text {
     51  font-size: 16px;
     52  font-weight: bold;
     53  margin-top: 10px;
     54}
  • pdf-catalog-woocommerce/trunk/includes/GMWCP_API.php

    r3228513 r3256536  
    11<?php
    22
     3if ( ! defined( 'ABSPATH' ) ) exit;
    34class GMWCP_API {
    4     public $total_products;
    5 
     5   
    66    public function __construct() {
    7         add_action('rest_api_init', array($this, 'register_routes'));
    8     }
    9 
    10     public function register_routes() {
    11         register_rest_route('gmwcp-pdf/v1', '/products', array(
     7        // Register the REST API route on plugin activation
     8        add_action('rest_api_init', array($this, 'GMWCP_rest_api_init'));
     9    }
     10
     11    public function GMWCP_rest_api_init() {
     12        // Register a custom route for saving settings
     13        register_rest_route('gmwcp/v1', '/save-settings', array(
     14            'methods' => 'POST',
     15            'callback' => array($this, 'GMWCP_save_multiple_settings'),
     16            'permission_callback' => array($this, 'GMWCP_permission_callback'),
     17        ));
     18
     19        register_rest_route('gmwcp/v1', '/save-customfield', array(
     20            'methods' => 'POST',
     21            'callback' => array($this, 'GMWCP_save_custom_field'),
     22            'permission_callback' => array($this, 'GMWCP_permission_callback'),
     23        ));
     24        register_rest_route('gmwcp/v1', '/delete-customfield', array(
     25            'methods' => 'POST',
     26            'callback' => array($this, 'GMWCP_delete_custom_field'),
     27            'permission_callback' => array($this, 'GMWCP_permission_callback'),
     28        ));
     29
     30        // Register a custom route for fetching settings (GET)
     31        register_rest_route('gmwcp/v1', '/get-settings', array(
    1232            'methods' => 'GET',
    13             'callback' => array($this, 'gmwcp_get_woocommerce_products'),
    14             'args' => $this->get_endpoint_args(),
    15             'permission_callback' => '__return_true',
    16         ));
    17         register_rest_route('gmwcp-pdf/v1', '/setting', array(
    18             'methods' => 'GET',
    19             'callback' => array($this, 'gmwcp_get_setting'),
    20             'args' => array(),
    21             'permission_callback' => '__return_true',
    22         ));
    23     }
    24     public function convert_image_to_base64($image_path) {
    25     $file_extension = strtolower(pathinfo($image_path, PATHINFO_EXTENSION));
    26 
    27     // Check if the file is a WebP image
    28     if ($file_extension === 'webp') {
    29         // Attempt to use GD library
    30         if (function_exists('imagecreatefromwebp') && function_exists('imagepng')) {
    31             // Create an image resource from the WebP file
    32             $webp_image = @imagecreatefromwebp($image_path);
    33             if ($webp_image) {
    34                 // Start output buffering
    35                 ob_start();
    36                 // Output the image as PNG
    37                 imagepng($webp_image);
    38                 // Get the image data from the buffer
    39                 $png_data = ob_get_clean();
    40 
    41                 // Free memory
    42                 imagedestroy($webp_image);
    43 
    44                 // Convert the PNG data to a base64 string
    45                 return 'data:image/png;base64,' . base64_encode($png_data);
     33            'callback' => array($this, 'GMWCP_get_settings'),
     34            'permission_callback' => array($this, 'GMWCP_permission_callback'),
     35        ));
     36    }
     37
     38    // Save multiple settings
     39    public function GMWCP_save_multiple_settings($request) {
     40         // Get nonce from request headers
     41        $nonce = $request->get_header('X-WP-Nonce');
     42
     43        // Verify nonce
     44        if ( ! wp_verify_nonce( $nonce, 'wp_rest' ) ) {
     45            return new WP_REST_Response(array(
     46            'success' => false,
     47            'message' => 'Invalid nonce',
     48        ), 403); // Invalid nonce error
     49        }
     50        // Retrieve the settings array from the request body
     51        $settings = $request->get_param('settings');
     52
     53        if (!is_array($settings)) {
     54            return new WP_Error('invalid_settings', 'Settings must be an array', array('status' => 400));
     55        }
     56
     57        $response = array();
     58
     59        // Loop through each setting and save it
     60        foreach ($settings as $option_name => $option_value) {
     61            // Sanitize the option name
     62            $option_name = sanitize_key($option_name);
     63           /* echo "<pre>";
     64            print_r($option_value);
     65            echo "</pre>";*/
     66            // Sanitize the option value based on your use case. Example:
     67            if (is_array($option_value)) {
     68                $option_value = array_map('sanitize_text_field', $option_value); // Sanitize array values
     69            } else {
     70                $option_value = sanitize_text_field($option_value); // Sanitize single value
    4671            }
    47         }
    48 
    49         // Attempt to use Imagick
    50         if (class_exists('Imagick')) {
    51             try {
    52                 $imagick = new Imagick();
    53                 $imagick->readImage($image_path); // Read the WebP image
    54                 $imagick->setImageFormat('png'); // Convert to PNG
    55 
    56                 // Get the PNG data as a string
    57                 $png_data = $imagick->getImageBlob();
    58 
    59                 // Destroy the Imagick object
    60                 $imagick->clear();
    61                 $imagick->destroy();
    62 
    63                 // Convert the PNG data to a base64 string
    64                 return 'data:image/png;base64,' . base64_encode($png_data);
    65             } catch (Exception $e) {
    66                 error_log('Imagick conversion failed: ' . $e->getMessage());
     72
     73            // Save the option
     74            $result = update_option($option_name, $option_value);
     75
     76            // Add the result to the response
     77            $response[$option_name] = $result ? 'saved' : 'failed';
     78        }
     79
     80        return rest_ensure_response(array(
     81            'success' => true,
     82            'message' => 'Settings processed',
     83            'results' => $response,
     84        ));
     85    }
     86
     87    // Save multiple settings
     88    public function GMWCP_save_custom_field($request) {
     89         // Get nonce from request headers
     90        $nonce = $request->get_header('X-WP-Nonce');
     91
     92        // Verify nonce
     93        if ( ! wp_verify_nonce( $nonce, 'wp_rest' ) ) {
     94            return new WP_REST_Response(array(
     95                'success' => false,
     96                'message' => 'Invalid nonce',
     97            ), 403); // Invalid nonce error
     98        }
     99        $settings = $request->get_param('settings');
     100        // Sanitize and retrieve the data from the AJAX request
     101        $field_id = isset($settings['id']) && $settings['id'] != 'null' ? sanitize_text_field($settings['id']) : '';
     102        $field_name = sanitize_text_field($settings['title']);
     103        $field_gmwcpkey = sanitize_text_field($settings['gmwcpkey']);
     104
     105        // Validate the required fields
     106        if (empty($field_name)) {
     107            return new WP_REST_Response(array(
     108                'success' => false,
     109                'message' => 'Field name is required.',
     110            ), 403);
     111        }
     112        if (empty($field_gmwcpkey) ) {
     113             return new WP_REST_Response(array(
     114                'success' => false,
     115                'message' => 'Field key is required.',
     116            ), 403);
     117        }
     118
     119        // Prepare post data for insertion or update
     120        $post_data = array(
     121            'post_title'  => $field_name,
     122            'post_type'   => 'gmwcp_custom_field', // Your custom post type
     123            'post_status' => 'publish', // Set post status
     124        );
     125
     126        if (!empty($field_id)) {
     127            // Update existing field
     128            $post_data['ID'] = $field_id; // Set the ID for updating
     129            $post_id = wp_update_post($post_data); // Update the post
     130
     131            if (is_wp_error($post_id)) {
     132                wp_send_json_error('Error updating post: ' . $post_id->get_error_message()); // Handle update errors
    67133            }
    68         }
    69 
    70         // If neither GD nor Imagick could process the WebP file, log an error
    71         error_log('Neither GD nor Imagick could process the WebP file.');
    72         return null;
    73     }
    74 
    75     // Return the original path for non-WebP images
    76     return $image_path;
     134        } else {
     135            // Insert new field
     136            $post_id = wp_insert_post($post_data); // Insert the post
     137            if (is_wp_error($post_id)) {
     138                wp_send_json_error('Error saving post: ' . $post_id->get_error_message()); // Handle insert errors
     139            }
     140        }
     141        update_post_meta($post_id, 'gmwcpkey', $field_gmwcpkey);
     142        return rest_ensure_response(array(
     143            'success' => true,
     144            'message' => 'Settings processed',
     145        ));
     146    }
     147    // Save multiple settings
     148    public function GMWCP_delete_custom_field($request) {
     149         // Get nonce from request headers
     150        $nonce = $request->get_header('X-WP-Nonce');
     151
     152        // Verify nonce
     153        if ( ! wp_verify_nonce( $nonce, 'wp_rest' ) ) {
     154            return new WP_REST_Response(array(
     155                'success' => false,
     156                'message' => 'Invalid nonce',
     157            ), 403); // Invalid nonce error
     158        }
     159        $settings = $request->get_param('settings');
     160        $field_id = sanitize_text_field($settings['id']);
     161
     162        // Validate the required fields
     163        if (empty($field_id)) {
     164            return new WP_REST_Response(array(
     165                'success' => false,
     166                'message' => 'Field id is required.',
     167            ), 403);
     168        }
     169
     170        // Delete the post (field) from the database
     171        $deleted = wp_delete_post($field_id, true); // true for force delete
     172
     173        if ($deleted) {
     174            return rest_ensure_response(array(
     175                'success' => true,
     176                'message' => 'Field deleted successfully.',
     177            ));
     178            wp_send_json_success('Field deleted successfully.'); // Send success response if deleted
     179        } else {
     180            return rest_ensure_response(array(
     181                'success' => true,
     182                'message' => 'Error deleting field. Please try again.',
     183            ));
     184        }
     185    }
     186
     187    // Retrieve settings
     188    public function GMWCP_get_settings($request) {
     189        global $gmpcp_arr,$gmpcp_translation;
     190         // Get nonce from request headers
     191        $nonce = $request->get_header('X-WP-Nonce');
     192
     193        // Verify nonce
     194        if ( ! wp_verify_nonce( $nonce, 'wp_rest' ) ) {
     195            return new WP_REST_Response(array(
     196                'success' => false,
     197                'message' => 'Invalid nonce',
     198            ), 403); // Invalid nonce error
     199        }
     200        $response = array();
     201
     202        // Retrieve each option and add it to the response array
     203        foreach ($gmpcp_arr as $key_option=>$value_option) {
     204            $response[$key_option] = $value_option;
     205        }
     206        // Fetch fields from the database
     207        $fields = get_posts(array(
     208            'post_type'   => 'gmwcp_custom_field', // Custom post type
     209            'post_status' => 'publish', // Only published posts
     210            'numberposts' => -1 // Retrieve all posts
     211        ));
     212
     213        // Map the retrieved fields to a more usable format
     214        $data = array_map(function($field) {
     215            return array(
     216                'id'       => $field->ID,
     217                'title'    => $field->post_title,
     218                'gmwcpkey'     => get_post_meta($field->ID, 'gmwcpkey', true),
     219               
     220            );
     221        }, $fields);
     222        $response['custom_fields'] = $data;
     223        return rest_ensure_response($response);
     224    }
     225
     226    // Permission callback: only allow admins
     227    public function GMWCP_permission_callback($request) {
     228        return current_user_can('manage_options'); // Allow only admins
     229    }
    77230}
    78231
    79 
    80     public function get_endpoint_args() {
    81         return array(
    82             'page' => array(
    83                 'validate_callback' => function($param, $request, $key) {
    84                     return is_numeric($param) && $param >= 1;
    85                 },
    86                 'sanitize_callback' => 'absint',
    87                 'default' => 1,
    88             ),
    89             'per_page' => array(
    90                 'validate_callback' => function($param, $request, $key) {
    91                     return is_numeric($param) && $param >= 1;
    92                 },
    93                 'sanitize_callback' => 'absint',
    94                 'default' => 10,
    95             ),
    96             'taxonomy' => array(
    97                 'sanitize_callback' => 'sanitize_text_field',
    98             ),
    99             'taxonomy_value' => array(
    100                 'sanitize_callback' => 'sanitize_text_field',
    101             ),
    102             'product_id' => array(
    103                 'validate_callback' => function($param, $request, $key) {
    104                     return is_numeric($param) && $param > 0;
    105                 },
    106                 'sanitize_callback' => 'absint',
    107             ),
    108         );
    109     }
    110 
    111     public function gmwcp_get_setting($data) {
    112         global $gmpcp_translation, $gmpcp_arr;
    113         $arr = array();
    114         $setting = array();
    115         $setting['gmwcp_show_hide'] = $gmpcp_arr['gmwcp_show_hide'];
    116         $setting['gmpcp_pagebreak'] = $gmpcp_arr['gmpcp_pagebreak'];
    117         $setting['gmpcp_image_width'] = $gmpcp_arr['gmpcp_image_width'];
    118         $setting['gmpcp_header_text'] = $gmpcp_arr['gmpcp_header_text'];
    119         $setting['gmpcp_hf_background_color'] = $gmpcp_arr['gmpcp_hf_background_color'];
    120         $setting['gmpcp_hf_item_background_color'] = $gmpcp_arr['gmpcp_hf_item_background_color'];
    121         $setting['gmpcp_footer_text'] = $gmpcp_arr['gmpcp_footer_text'];
    122         $setting['gmpcp_background_color'] = $gmpcp_arr['gmpcp_background_color'];
    123         $setting['gmpcp_item_background_color'] = $gmpcp_arr['gmpcp_item_background_color'];
    124 
    125         $arr['translation'] = $gmpcp_translation;
    126         $arr['setting'] = $setting;
    127 
    128         return rest_ensure_response($arr);
    129     }
    130 
    131     public function gmwcp_get_woocommerce_products($data) {
    132         global $gmpcp_arr;
    133         $gmwcp_exclude_out_of_stock = $gmpcp_arr['gmwcp_exclude_out_of_stock'];
    134         $products = array();
    135 
    136         if (isset($data['product_id']) && !empty($data['product_id'])) {
    137             $product_id = absint($data['product_id']);
    138             $product = $this->gmwcp_get_product_by_id($product_id);
    139 
    140             if (!$product) {
    141                 return new WP_Error('invalid_product_id', __('Invalid product ID.'), array('status' => 404));
    142             }
    143 
    144             $formatted_product = $this->gmwcp_format_product_data($product);
    145             $products[] = $formatted_product;
    146             $response = rest_ensure_response($products);
    147             $response->header('X-WP-TotalPages', 1);
    148         } else {
    149             $args = array(
    150                 'post_type' => 'product',
    151                 'posts_per_page' => $data['per_page'],
    152                 'paged' => $data['page'],
    153             );
    154 
    155             if (!empty($data['taxonomy'])) {
    156                 $args['tax_query'][] = array(
    157                     'taxonomy' => $data['taxonomy'],
    158                     'field' => 'slug',
    159                     'terms' => $data['taxonomy_value'],
    160                 );
    161             }
    162             if (isset($gmpcp_arr['gmpcp_exclude_category'])) {
    163                 $args['tax_query'][] = array(
    164                     'taxonomy' => 'product_cat',
    165                     'field' => 'id',
    166                     'terms' => $gmpcp_arr['gmpcp_exclude_category'],
    167                     'operator' => 'NOT IN',
    168                 );
    169             }
    170 
    171             $products = $this->gmwcp_get_products_by_query($args);
    172             $total_products = $this->total_products;
    173             $total_pages = ceil($total_products / $data['per_page']);
    174 
    175             $response = rest_ensure_response($products);
    176             $response->header('X-WP-TotalPages', $total_pages);
    177         }
    178 
    179         return $response;
    180     }
    181 
    182     public function gmwcp_get_product_by_id($product_id) {
    183         return wc_get_product($product_id);
    184     }
    185 
    186     public function gmwcp_get_products_by_query($args) {
    187         global $gmpcp_arr;
    188         $gmwcp_exclude_out_of_stock = $gmpcp_arr['gmwcp_exclude_out_of_stock'];
    189         $products = array();
    190         $args['meta_query'] = array(
    191             array(
    192                 'key'     => '_gmwcp_exclude_product_single',
    193                 'compare' => 'NOT EXISTS',
    194             ),
    195         );
    196        
    197         if ($gmwcp_exclude_out_of_stock == 'yes') {
    198             $args['meta_query'][] = array(
    199                 'key'     => '_stock_status',
    200                 'value'   => 'instock',
    201                 'compare' => '='
    202             );
    203         }
    204 
    205         $query = new WP_Query($args);
    206         $this->total_products = $query->found_posts;
    207         if ($query->have_posts()) {
    208             while ($query->have_posts()) {
    209                 $query->the_post();
    210                 $product_id = get_the_ID();
    211                 $product = wc_get_product($product_id);
    212                 $formatted_product = $this->gmwcp_format_product_data($product);
    213                 $products[] = $formatted_product;
    214             }
    215             wp_reset_postdata();
    216         }
    217 
    218         return $products;
    219     }
    220 
    221     public function gmwcp_format_product_data($product) {
    222         $gallery_image_ids = $product->get_gallery_image_ids();
    223         $gallery_images = array();
    224         foreach ($gallery_image_ids as $image_id) {
    225             $gallery_images[] = array(
    226                 'src' => $this->convert_image_to_base64(wp_get_attachment_url($image_id)),
    227                 'alt' => get_post_meta($image_id, '_wp_attachment_image_alt', true),
    228             );
    229         }
    230 
    231         $product_cat = wp_get_post_terms($product->get_id(), 'product_cat', array('fields' => 'names'));
    232         $product_tag = wp_get_post_terms($product->get_id(), 'product_tag', array('fields' => 'names'));
    233         $product_description = $product->get_description();
    234 
    235         $allowed_tags = array(
    236             'strong' => array(),
    237             'h1' => array(),
    238             'h2' => array(),
    239             'h3' => array(),
    240             'h4' => array(),
    241             'h6' => array(),
    242             'p' => array(),
    243             'div' => array(),
    244         );
    245         $thumbnail_url = get_the_post_thumbnail_url($product->get_id(), 'thumbnail');
    246         if (!$thumbnail_url) {
    247             $thumbnail_url = wc_placeholder_img_src('full');
    248         }
    249         $full_url = get_the_post_thumbnail_url($product->get_id(), 'full');
    250         if (!$full_url) {
    251             $full_url = wc_placeholder_img_src('full');
    252         }
    253         $images_full=
    254         $formatted_product = array(
    255             'id' => $product->get_id(),
    256             'name' => $product->get_name(),
    257             'short_description' => $product->get_short_description(),
    258             'price' => get_option('woocommerce_currency').' '.$product->get_price(),
    259             'regular_price' => $product->get_regular_price(),
    260             'sale_price' => $product->get_sale_price(),
    261             'permalink' => get_permalink($product->get_id()),
    262             'sku' => $product->get_sku(),
    263             'stock_status' => $product->get_stock_status(),
    264             'stock_quantity' => $product->get_stock_quantity(),
    265             'categories' => wp_get_post_terms($product->get_id(), 'product_cat', array('fields' => 'names')),
    266             'tags' => wp_get_post_terms($product->get_id(), 'product_tag', array('fields' => 'names')),
    267             'images' => array(
    268                 'thumbnail' => $this->convert_image_to_base64($thumbnail_url),
    269                 'full' => $this->convert_image_to_base64($full_url),
    270             ),
    271             'gallery_images' => $gallery_images,
    272             'producat_cat' => $product_cat,
    273             'producat_tag' => $product_tag,
    274             'weight' => $product->get_weight() . ' ' . get_option('woocommerce_weight_unit'),
    275             'dimensions' => $product->get_length() . 'x' . $product->get_width() . 'x' . $product->get_height() . ' ' . get_option('woocommerce_dimension_unit'),
    276             'description' => wp_kses($product_description, $allowed_tags)
    277         );
    278 
    279         $formatted_attributes = array();
    280         $attributes = $product->get_attributes();
    281         foreach ($attributes as $attr => $attr_deets) {
    282             $attribute_label = wc_attribute_label($attr);
    283             if (isset($attributes[$attr]) || isset($attributes['pa_' . $attr])) {
    284                 $attribute = isset($attributes[$attr]) ? $attributes[$attr] : $attributes['pa_' . $attr];
    285                 if ($attribute['is_taxonomy']) {
    286                     $formatted_attributes[$attribute_label] = implode(', ', wc_get_product_terms($product->get_id(), $attribute['name'], array('fields' => 'names')));
    287                 } else {
    288                     $formatted_attributes[$attribute_label] = $attribute['value'];
    289                 }
    290             }
    291         }
    292         $formatted_product['attributes'] = $formatted_attributes;
    293 
    294         return $formatted_product;
    295     }
    296 }
     232// Initialize the API class
     233new GMWCP_API();
  • pdf-catalog-woocommerce/trunk/includes/GMWCP_Admin.php

    r3163565 r3256536  
    77   
    88    public function __construct () {
    9         add_action( 'admin_init', array( $this, 'GMWCP_register_settings' ) );
    109        add_action( 'admin_menu', array( $this, 'GMWCP_admin_menu' ) );
    1110        add_action('admin_enqueue_scripts', array( $this, 'GMWCP_admin_script' ));
     
    1312        add_filter( 'woocommerce_product_data_panels', array( $this, 'GMWCP_custom_product_panels' ) );
    1413        add_action( 'woocommerce_process_product_meta', array( $this, 'GMWCP_custom_save' ) );
     14        add_action( 'init', array( $this, 'GMWCP_init' ) );
    1515        if ( is_admin() ) {
    1616            return;
     
    1818       
    1919    }
     20    public function GMWCP_init () {
     21        $args = array(
     22                'label'               => 'gmwcp_custom_field',
     23                'show_ui'             => false,
     24                'show_in_menu'        => false,
     25                'show_in_nav_menus'   => false,
     26                'show_in_admin_bar'   => false,
     27                'menu_position'       => 5,
     28                'can_export'          => true,
     29                'has_archive'         => true,
     30                'exclude_from_search' => true,
     31                'publicly_queryable'  => true,
     32                );
     33   
     34        // Registering your Custom Post Type
     35        register_post_type( 'gmwcp_custom_field', $args );
     36    }
    2037    public function GMWCP_admin_script ($hook) {
    2138       
    2239        if($hook=='toplevel_page_gmwcp-catalog'){
    23             wp_enqueue_style( 'gmwcp_select2_css' , GMWCP_PLUGINURL.'js/select2/select2.css');
    24             wp_enqueue_script('gmwcp_select2_js', GMWCP_PLUGINURL.'js/select2/select2.js');
    25             wp_enqueue_script( 'wp-color-picker' );
    26             wp_enqueue_style('gmwcp_admin_css', GMWCP_PLUGINURL.'css/admin-style.css');
    27             wp_enqueue_script('gmwcp_admin_js', GMWCP_PLUGINURL.'js/admin-script.js');
     40            wp_enqueue_style('wp-components');
     41             wp_register_script(
     42                'gmwcp-react-admin',
     43                GMWCP_PLUGINURL.'/build/admin/admin.js', // Adjust the path if necessary
     44                ['wp-element','wp-dom-ready','wp-components'], // Ensure this depends on WordPress's React
     45                '1.0',
     46                true
     47
     48                );
     49
     50            global $gmpcp_translation;
     51            wp_localize_script('gmwcp-react-admin', 'gmwcp_wp_ajax', [
     52                'nonce' => wp_create_nonce('wp_rest'),
     53                'getsettings' => rest_url('gmwcp/v1/get-settings'),
     54                'savedata' => rest_url('gmwcp/v1/save-settings'),
     55                'savecustomfield' => rest_url('gmwcp/v1/save-customfield'),
     56                'deletecustomfield' => rest_url('gmwcp/v1/delete-customfield'),
     57                'gmwcpcategory' => get_terms( 'product_cat', array(
     58                        'hide_empty' => false,
     59                    ) ),
     60                'gmwcproles' => wp_roles()->roles,
     61                'gmpcp_translation' => $gmpcp_translation,
     62                'site_url' => get_site_url()
     63            ]);
     64
     65            wp_enqueue_script('gmwcp-react-admin');
     66
     67            wp_enqueue_style(
     68                    'gmwcp-react-admin-style',
     69                    GMWCP_PLUGINURL.'/build/admin/admin.css',
     70                    array(),
     71                    1,
     72                );
     73
    2874        }
    2975       
     
    4490                    Thank you for using our plugin! If you are satisfied, please reward it a full five-star <span style="color:#ffb900">★★★★★</span> rating.                        <br>
    4591                    <a href="https://wordpress.org/support/plugin/pdf-catalog-woocommerce/reviews/?filter=5" target="_blank">Reviews</a>
    46                     | <a href="https://www.codesmade.com/contact-us/" target="_blank">Support</a>
     92                    | <a href="https://www.codesmade.com/contact-us/" target="_blank">Support 24x7</a> <span style="font-weight: bold;">We will respond to your support request within 24 hours.</span>
    4793                </p>
    4894            </div>
    4995        </div>
    50         <hr class="wp-header-end">
     96        <?php
     97        echo '<div id="GMWCP-admin-root"></div>';
     98        ?>
    5199       
    52             <div class="postbox">
    53                    
    54                     <div class="inside">
    55                         <?php
    56                         $navarr = array(
    57                             'page=gmwcp-catalog'=>'Category & Shop Page Setting',
    58                             'page=gmwcp-catalog&view=single'=>'Single Product Page Setting',
    59                             'page=gmwcp-catalog&view=layout'=>'Layout',
    60                             'page=gmwcp-catalog&view=exclude'=>'Exclude',
    61                             'page=gmwcp-catalog&view=trasnlation'=>'Translation',
    62                            
    63                         );
    64                         ?>
    65                         <h2 class="nav-tab-wrapper">
    66                             <?php
    67                             foreach ($navarr as $keya => $valuea) {
    68                                 $pagexl = explode("=",$keya);
    69                                 if(!isset($pagexl[2])){
    70                                     $pagexl[2] = '';
    71                                 }
    72                                 if(!isset($_REQUEST['view'])){
    73                                     $_REQUEST['view'] = '';
    74                                 }
    75                                 ?>
    76                                 <a href="<?php echo admin_url( 'admin.php?'.$keya);?>" class="nav-tab <?php if($pagexl[2]==$_REQUEST['view']){echo 'nav-tab-active';} ?>"><?php echo $valuea;?></a>
    77                                 <?php
    78                             }
    79                             ?>
    80                         </h2>
    81                        
    82                        <?php
    83 
    84                         if($_REQUEST['view']==''){
    85                             include(GMWCP_PLUGINDIR.'includes/GMWCP_Shop_Admin.php');
    86                         }
    87                         if($_REQUEST['view']=='single'){
    88                             include(GMWCP_PLUGINDIR.'includes/GMWCP_Single_Admin.php');
    89                         }
    90                         if($_REQUEST['view']=='layout'){
    91                             include(GMWCP_PLUGINDIR.'includes/GMWCP_layout.php');
    92                         }
    93                         if($_REQUEST['view']=='exclude'){
    94                             include(GMWCP_PLUGINDIR.'includes/GMWCP_Exclude.php');
    95                         }
    96                         if($_REQUEST['view']=='trasnlation'){
    97                             include(GMWCP_PLUGINDIR.'includes/GMWCP_trasnlation.php');
    98                         }
    99                         ?>
    100                     </div>
    101             </div>
    102100           
    103101    </div>
     
    106104    }
    107105
    108     public function GMWCP_register_settings() {
    109         register_setting( 'gmwcp_shop_options_group', 'gmwcp_shop_enable_product', array( $this, 'gmwqp_callbackcheckbox' )  );
    110 
    111         register_setting( 'gmwcp_shop_options_group', 'gmwcp_shop_display_location', array( $this, 'gmwqp_callback' )  );
    112 
    113 
    114 
    115         register_setting( 'gmwcp_options_group', 'gmwcp_enable_single_product' , array( $this, 'gmwqp_callbackcheckbox' ) );
    116         register_setting( 'gmwcp_options_group', 'gmwcp_single_display_location' , array( $this, 'gmwqp_callback' ) );
    117 
    118         register_setting( 'gmpcp_exclude_options_group', 'gmwcp_exclude_out_of_stock', array( $this, 'gmwqp_callback' ) );
    119         register_setting( 'gmpcp_exclude_options_group', 'gmpcp_exclude_category', array( $this, 'gmwqp_callback' ) );
    120         register_setting( 'gmpcp_exclude_options_group', 'gmpcp_exclude_role', array( $this, 'gmwqp_callback' ) );
    121        
    122 
    123         if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'wp_gmpcp_layout'){
    124             if(!isset( $_POST['gmpcp_nonce_field_layout'] ) || !wp_verify_nonce( $_POST['gmpcp_nonce_field_layout'], 'gmpcp_nonce_action_layout' ) ){
    125                 print 'Sorry, your nonce did not verify.';
    126                 exit;
    127             }else{
    128                 update_option( 'gmwcp_show_hide', $_REQUEST['gmwcp_show_hide'] );
    129                 foreach ($_REQUEST['gmpcplayotarr'] as $keya => $valuea) {
    130                     if($keya=='gmpcp_footer_text'){
    131                         //$textToStore = htmlspecialchars($valuea, ENT_QUOTES | ENT_HTML5);
    132                         update_option( $keya, wp_kses_post($valuea) );
    133                     }else{
    134                         update_option( $keya, sanitize_text_field($valuea) );
    135                     }
    136                    
    137                 }
    138                 wp_redirect( admin_url( 'admin.php?page=gmwcp-catalog&view=layout&msg=layout') );
    139             }
    140             exit;
    141         }
    142         if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'wp_gmpcp_trasnlation'){
    143             if(!isset( $_POST['gmpcp_nonce_field_trasnlation'] ) || !wp_verify_nonce( $_POST['gmpcp_nonce_field_trasnlation'], 'gmpcp_nonce_action_trasnlation' ) ){
    144                 print 'Sorry, your nonce did not verify.';
    145                 exit;
    146             }else{
    147                 foreach ($_REQUEST['gmpcp_trasnlation_arr'] as $keya => $valuea) {
    148                         update_option( $keya, sanitize_text_field($valuea) );
    149                 }
    150                 wp_redirect( admin_url( 'admin.php?page=gmwcp-catalog&view=trasnlation&msg=trasnlation') );
    151             }
    152             exit;
    153         }
    154     }
    155     public function gmwqp_callbackcheckbox($option) {
    156         if($option==''){
    157             return 'no';
    158         }
    159         return $option;
    160     }
    161     public function gmwqp_accesstoken_callback($option) {
    162         return $option;
    163     }
    164106   
    165107    public function GMWCP_custom_product_tabs( $tabs) {
  • pdf-catalog-woocommerce/trunk/includes/GMWCP_Cron.php

    r3163565 r3256536  
    1111    public function GMWCP_default(){
    1212        global $gmpcp_arr,$gmpcp_translation;
    13        
     13
    1414        $defalarr = array(
    1515
     
    2525            'gmpcp_trasnlation_weight' => 'Weight',
    2626            'gmpcp_trasnlation_dimensions' => 'Dimensions',
     27            'gmpcp_trasnlation_attribute' => 'Attribute',
    2728            'gmpcp_trasnlation_product_description' => 'Product Description',
     29            'gmpcp_trasnlation_loadding_products' => 'Loading products...',
     30            'gmpcp_trasnlation_loadding_documents' => 'Loading document...',
     31
    2832            'gmpcp_header_text' => 'WooCommerce PDF Catalog',
    2933            'gmpcp_footer_text' => 'Developer By https://wordpress.org/plugins/pdf-catalog-woocommerce/',
     34           
     35            'gmpcp_background_color' => '#ffffff',
     36            'gmpcp_text_color' => '#000000',
     37            'gmpcp_hf_background_color' => '#0084B4',
     38            'gmpcp_hf_text_color' => '#000000',
     39            'gmpcp_product_title_font_size' => '16',
     40            'gmpcp_product_content_font_size' => '12',
     41
     42            'gmwcp_shop_enable_product' => 'yes',
     43            'gmwcp_shop_view' => 'list',
     44            'gmpcp_shop_per_row_grid' => '3',
     45            'gmwcp_shop_pagebreak' => '3',
     46            'gmpcp_shop_image_width' => '40',
     47            'gmwcp_shop_show_hide' => array('title','images','short_desc','long_desc','read_more','sku','price','categories','tags','stock_status'),
    3048            'gmwcp_shop_display_location' => 'before',
     49            'gmwcp_shop_text_align' => 'left',
     50            'gmwcp_shop_order' => 'ASC',
     51            'gmwcp_shop_show_category_wise' => 'no',
     52            'gmwcp_shop_download_file_name' => 'Download PDF',
     53           
     54            'gmwcp_single_enable_product' => 'yes',
     55            'gmpcp_single_image_width' => '40',
     56            'gmwcp_single_show_hide' => array('title','images','short_desc','long_desc','read_more','sku','price','categories','tags','stock_status'),
    3157            'gmwcp_single_display_location' => 'before',
    32             'gmpcp_background_color' => '#ffffff',
    33             'gmpcp_item_background_color' => '#000000',
    34             'gmpcp_hf_background_color' => '#0084B4',
    35             'gmpcp_hf_item_background_color' => '#000000',
    36             'gmwcp_shop_enable_product' => 'yes',
    37             'gmwcp_enable_single_product' => 'yes',
     58            'gmwcp_single_text_align' => 'left',
     59            'gmwcp_single_download_file_name' => 'Download PDF',
     60
    3861            'gmwcp_exclude_out_of_stock' => 'no',
    39             'gmpcp_pagebreak' => '1',
    40             'gmpcp_image_width' => '40',
    41             'gmwcp_show_hide' => array('title','images','short_desc','long_desc','read_more','sku','price','categories','tags','stock_status'),
    4262            'gmpcp_exclude_category' => array(),
    4363            'gmpcp_exclude_role' => array(),
     
    6686            'gmpcp_trasnlation_weight',
    6787            'gmpcp_trasnlation_dimensions',
     88            'gmpcp_trasnlation_attribute',
    6889            'gmpcp_trasnlation_product_description',
     90            'gmpcp_trasnlation_loadding_products',
     91            'gmpcp_trasnlation_loadding_documents',
    6992        );
    7093        foreach ($gmpcp_translation_arr as $keya => $valuea) {
  • pdf-catalog-woocommerce/trunk/includes/GMWCP_Frontend.php

    r3216575 r3256536  
    1010       
    1111        add_action( 'init', array( $this, 'GMWCP_init' ));
     12       
    1213    }
     14   
    1315    function GMWCP_init(){
    1416        global $gmpcp_arr;
    15         $gmwcp_enable_single_product = $gmpcp_arr['gmwcp_enable_single_product'];
     17        $gmwcp_single_enable_product = $gmpcp_arr['gmwcp_single_enable_product'];
    1618        $gmwcp_single_display_location = $gmpcp_arr['gmwcp_single_display_location'];
    17         if($gmwcp_enable_single_product == 'yes'){
     19        if($gmwcp_single_enable_product == 'yes'){
     20
    1821            if($gmwcp_single_display_location == 'before'){
    1922                add_action( 'woocommerce_product_meta_start', array( $this, 'woo_comman_single_button' ), 10, 0 );
     
    7477            $isshow = false;
    7578        }
    76         if ( is_user_logged_in() ) {
    77             $current_user = wp_get_current_user();
    78             $user_roles = $current_user->roles;
    79             $common_elements = array_intersect($user_roles, $gmpcp_arr['gmpcp_exclude_role']);
    80             if (!empty($common_elements)) {
    81                 $isshow = false;
     79        if($isshow == true){
     80            if ( is_user_logged_in()) {
     81                $current_user = wp_get_current_user();
     82                $user_roles = $current_user->roles;
     83                $common_elements = array_intersect($user_roles, $gmpcp_arr['gmpcp_exclude_role']);
     84                if (empty($common_elements) && !empty($gmpcp_arr['gmpcp_exclude_role'])) {
     85                    $isshow = false;
     86                }
     87            }else{
     88
     89                if (!empty($gmpcp_arr['gmpcp_exclude_role'])) {
     90                    $isshow = false;
     91                }
    8292            }
    8393        }
     94       
    8495        if ($isshow==true) {
    8596            $url_custom = add_query_arg( 'action', 'catelog_single', $url_custom );
     
    8899            ?>
    89100            <div class="gmwcp_button">
    90                 <a href="<?php echo esc_url($url_custom); ?>" class="button">
     101                    <a href="<?php echo esc_url($url_custom); ?>" class="button">
    91102                    <?php echo esc_html($gmpcp_arr['gmpcp_trasnlation_single']); ?>
    92103                </a>
    93 
    94104            </div>
    95105            <?php
     
    102112
    103113        global $wp,$wp_query,$gmpcp_arr;
    104        
    105114        ob_start();
    106115        $current_url = $this->getcurrneturl();
    107116        $updated_url = add_query_arg( 'action', 'catelog_shop', $current_url );
    108117        //$updated_url = add_query_arg( 'site_url', get_site_url(), $updated_url );
    109         if(isset($wp_query->query_vars['taxonomy']) && $wp_query->query_vars['taxonomy']!=''){
    110             $updated_url = add_query_arg( 'taxonomy', $wp_query->query_vars['taxonomy'], $updated_url );
    111             $updated_url = add_query_arg( 'taxonomy_value', $wp_query->query_vars['term'], $updated_url );
     118        if (isset($attr) && isset($attr['category_id']) && $attr['category_id'] != '') {
     119            $term = get_term( $attr['category_id'], 'product_cat' );
     120
     121            if ( ! is_wp_error( $term ) && $term ) { // Ensure $term is valid
     122                $updated_url = add_query_arg( 'taxonomy', $term->taxonomy, $updated_url );
     123                $updated_url = add_query_arg( 'taxonomy_value', $term->slug, $updated_url );
     124            }
     125
     126        }else{
     127            if(isset($wp_query->query_vars['taxonomy']) && $wp_query->query_vars['taxonomy']!=''){
     128                $updated_url = add_query_arg( 'taxonomy', $wp_query->query_vars['taxonomy'], $updated_url );
     129                $updated_url = add_query_arg( 'taxonomy_value', $wp_query->query_vars['term'], $updated_url );
     130            }
    112131        }
    113132        $label = $gmpcp_arr['gmpcp_trasnlation_category'];
     
    120139            }
    121140        }
    122         if ( is_user_logged_in() ) {
    123             $current_user = wp_get_current_user();
    124             $user_roles = $current_user->roles;
    125             $common_elements = array_intersect($user_roles, $gmpcp_arr['gmpcp_exclude_role']);
    126             if (!empty($common_elements)) {
    127                 $isshow = false;
     141        if($isshow == true){
     142            if ( is_user_logged_in() ) {
     143                $current_user = wp_get_current_user();
     144                $user_roles = $current_user->roles;
     145                $common_elements = array_intersect($user_roles, $gmpcp_arr['gmpcp_exclude_role']);
     146                if (empty($common_elements) && !empty($gmpcp_arr['gmpcp_exclude_role'])) {
     147                    $isshow = false;
     148                }
     149            }else{
     150                if (!empty($gmpcp_arr['gmpcp_exclude_role'])) {
     151                    $isshow = false;
     152                }
    128153            }
    129154        }
     
    131156        ?>
    132157        <div class="gmwcp_button">
    133             <a href="<?php echo esc_url($updated_url); ?>" class="button">
     158            <a href="<?php echo esc_url($updated_url); ?>" class="button">
    134159                <?php echo esc_html($label); ?>
    135160            </a>
    136161        </div>
    137 
    138162        <?php
    139163        }
  • pdf-catalog-woocommerce/trunk/includes/GMWCP_PDF.php

    r3159464 r3256536  
    1111    public function woo_comman_single_button(){
    1212        global $gmpcp_translation,$gmpcp_arr;
     13        $mode = 'production';
    1314        if (isset($_REQUEST['action']) && $_REQUEST['action']=='catelog_single') {
    1415           
    1516            $arr = array();
    16             $setting = array();
    17             $setting['gmwcp_show_hide']=$gmpcp_arr['gmwcp_show_hide'];
    18             $setting['gmpcp_pagebreak']=$gmpcp_arr['gmpcp_pagebreak'];
    19             $setting['gmpcp_image_width']=$gmpcp_arr['gmpcp_image_width'];
    20             $setting['gmpcp_header_text']=$gmpcp_arr['gmpcp_header_text'];
    21             $setting['gmpcp_hf_background_color']=$gmpcp_arr['gmpcp_hf_background_color'];
    22             $setting['gmpcp_hf_item_background_color']=$gmpcp_arr['gmpcp_hf_item_background_color'];
    23             $setting['gmpcp_footer_text']=$gmpcp_arr['gmpcp_footer_text'];
    24             $setting['gmpcp_background_color']=$gmpcp_arr['gmpcp_background_color'];
    25             $setting['gmpcp_item_background_color']=$gmpcp_arr['gmpcp_item_background_color'];
    26             $setting['gmwcp_show_hide']=$gmpcp_arr['gmwcp_show_hide'];
    27            
    28             $arr['translation']=$gmpcp_translation;
    29             $arr['setting']=$setting;
     17            $arr['setting']=$gmpcp_arr;
    3018            $arr['site_url']=get_site_url();
    3119            $arr['rest_api_url']=get_rest_url();
     
    4937               <head>
    5038                  <meta charset="utf-8"/>
    51                   <link rel="icon" href="/favicon.ico"/>
    5239                  <meta name="viewport" content="width=device-width,initial-scale=1"/>
    5340                  <meta name="theme-color" content="#000000"/>
    54                   <meta name="description" content="Web site created using create-react-app"/>
    5541                  <title>Generate PDF</title>
    5642                   <script>
    5743                     window.GMWCP_PDF_DATA = <?php echo $json_data; ?>;
    5844                  </script>
    59 
    60                   <!-- <script defer="defer" src="http://localhost:3000/static/js/bundle.js"></script> -->
    61                   <script defer="defer" src="<?php echo GMWCP_PLUGINURL;?>/build/static/js/main.js"></script>
    62                   <link href="<?php echo GMWCP_PLUGINURL;?>/build/static/css/main.css" rel="stylesheet">
     45                  <link rel='stylesheet' href='<?php echo GMWCP_PLUGINURL;?>/css/style.css' media='all' />
     46                 
    6347               </head>
    6448               <body>
     49
    6550                  <noscript>You need to enable JavaScript to run this app.</noscript>
    66                   <div id="root"></div>
     51                  <div id="gmpwcp_catelog_single"></div>
     52                   
     53                 <!-- Load React and ReactDOM from CDN -->
     54                <script src="<?php echo GMWCP_PLUGINURL;?>/js/react.production.min.js"></script>
     55                <script src="<?php echo GMWCP_PLUGINURL;?>/build/frontend/frontend.js" ></script>
    6756               </body>
    6857            </html>
     
    7362
    7463            $arr = array();
    75             $setting = array();
    76             $setting['gmwcp_show_hide']=$gmpcp_arr['gmwcp_show_hide'];
    77             $setting['gmpcp_pagebreak']=$gmpcp_arr['gmpcp_pagebreak'];
    78             $setting['gmpcp_image_width']=$gmpcp_arr['gmpcp_image_width'];
    79             $setting['gmpcp_header_text']=$gmpcp_arr['gmpcp_header_text'];
    80             $setting['gmpcp_hf_background_color']=$gmpcp_arr['gmpcp_hf_background_color'];
    81             $setting['gmpcp_hf_item_background_color']=$gmpcp_arr['gmpcp_hf_item_background_color'];
    82             $setting['gmpcp_footer_text']=$gmpcp_arr['gmpcp_footer_text'];
    83             $setting['gmpcp_background_color']=$gmpcp_arr['gmpcp_background_color'];
    84             $setting['gmpcp_item_background_color']=$gmpcp_arr['gmpcp_item_background_color'];
    85             $setting['gmwcp_show_hide']=$gmpcp_arr['gmwcp_show_hide'];
    86            
    87             $arr['translation']=$gmpcp_translation;
    88             $arr['setting']=$setting;
     64            $arr['setting']=$gmpcp_arr;
     65            if($gmpcp_arr['gmwcp_shop_show_category_wise']=='yes'){
     66                $arr['product_cat'] = get_terms( 'product_cat', array(
     67                        'hide_empty' => false,
     68                    ) );
     69            }
    8970            $arr['site_url']=get_site_url();
    9071            $arr['rest_api_url']=get_rest_url();
     
    10788               <head>
    10889                  <meta charset="utf-8"/>
    109                   <link rel="icon" href="/favicon.ico"/>
    11090                  <meta name="viewport" content="width=device-width,initial-scale=1"/>
    11191                  <meta name="theme-color" content="#000000"/>
    112                   <meta name="description" content="Web site created using create-react-app"/>
    11392                  <title>Generate PDF</title>
    11493                  <script>
    11594                     window.GMWCP_PDF_DATA = <?php echo $json_data; ?>;
    11695                  </script>
    117                   <!-- <script defer="defer" src="http://localhost:3000/static/js/bundle.js"></script> -->
    118                   <script defer="defer" src="<?php echo GMWCP_PLUGINURL;?>/build/static/js/main.js"></script>
    119                   <link href="<?php echo GMWCP_PLUGINURL;?>/build/static/css/main.css" rel="stylesheet">
     96                 <link rel='stylesheet' href='<?php echo GMWCP_PLUGINURL;?>/css/style.css' media='all' />
    12097               </head>
    12198               <body>
    12299                  <noscript>You need to enable JavaScript to run this app.</noscript>
    123                   <div id="root"></div>
     100                  <?php
     101                  if($gmpcp_arr['gmwcp_shop_view']=='grid'){
     102                    echo '<div id="gmpwcp_catelog_shop_grid"></div>';
     103                  }else{
     104                    echo '<div id="gmpwcp_catelog_shop_list"></div>';
     105                  }
     106                  ?>
     107                 
     108                 <script src="<?php echo GMWCP_PLUGINURL;?>/js/react.production.min.js"></script>
     109                  <script src="<?php echo GMWCP_PLUGINURL;?>/build/frontend/frontend.js" ></script>
    124110               </body>
    125111            </html>
  • pdf-catalog-woocommerce/trunk/readme.txt

    r3216572 r3256536  
    1717PDF For woocommerce product can be export as pdf in shop , category and single product page. **add pdf download option** in woocommerce pages to easy way to get product information which product you want to get information in **Woocommerce Catalog PDF**.
    1818
    19 = Features =
     19#### FEATURES
    2020
    2121<ul>
    22 <li>One Click installation</li>
    23 <li>Shop and Category wise make Catelog pdf</li>
    24 <li>Exclude Catelog On Particular Product</li>
    25 <li>Signle Product page on make catelog</li>
    26 <li>Customize Background and Text Color</li>
    27 <li>Multiple Location for Show Button</li>
    28 <li>Hide/Show Option with (title ,images ,short_desc ,long_desc ,read_more ,sku ,price ,categories ,tags ,stock_status)</li>
    29 <li>Shortcode : <code>[gmwcp_single_product]</code> or <code>[gmwcp_single_product id='{product_id}']</code>:</li>
     22   <li><strong>One-Click Installation:</strong> Easy and quick setup with a single click.</li>
     23   <li><strong>Shop and Category-wise Catalog PDFs:</strong> Generate PDFs for shops and categories separately.</li>
     24   <li><strong>Grid View / List View Options:</strong> Toggle between grid and list views for category and shop pages.</li>
     25   <li><strong>Design Options:</strong> Customize alignment, color, and font size.</li>
     26   <li><strong>Display Products by Category:</strong> Show category names first, followed by products within each category.</li>
     27   <li><strong>Exclusion Options:</strong> Exclude out-of-stock items, specific products, product categories, and user roles.</li>
     28   <li><strong>Single Product Page Catalog:</strong> Create catalogs for individual product pages.</li>
     29   <li><strong>Custom Background and Text Colors:</strong> Personalize the appearance of catalogs.</li>
     30   <li><strong>Multiple Button Locations:</strong> Display buttons at various locations as needed.</li>
     31   <li><strong>Custom Product Meta Keys:</strong> Add additional product metadata if required.</li>
     32   <li><strong>Image Width Options:</strong> Adjust the width of product images.</li>
     33   <li><strong>Custom PDF File Names:</strong> Define unique names for your PDF files.</li>
     34   <li><strong>Hide/Show Options:</strong> Toggle visibility for title, images, short description, long description, read more, SKU, price, categories, tags, and stock status.</li>
     35   <li>
     36      <strong>Shortcodes Product Page:</strong>
     37      <code>[gmwcp_single_product]</code> or <code>[gmwcp_single_product id='{product_id}']</code>
     38   </li>
     39   <li>
     40      <strong>Shortcodes Category Page:</strong>
     41      <code>[gmwcp_shop_product]</code> or <code>[gmwcp_shop_product category_id='{category_id}']</code>
     42   </li>
    3043</ul>
    3144
     
    3346
    3447<ul>
    35 <li>Header Customize</li>
    36 <li>Footer Customize</li>
    37 <li>Hide/Show Option with (gallery ,attributes)</li>
    38 <li>Translate Keyword</li>
    39 <li>Page Break After Product</li>
     48   <li><strong>Header Customization:</strong> Personalize the header section of your catalogs.</li>
     49   <li><strong>Footer Customization:</strong> Customize the footer area as desired.</li>
     50   <li><strong>Hide/Show Options:</strong> Additional toggles for gallery and attributes visibility.</li>
     51   <li><strong>Translate Keywords:</strong> Enable keyword translation for better localization.</li>
     52   <li><strong>Page Break After Product:</strong> Add page breaks after each product for better formatting.</li>
    4053</ul>
    4154
     
    5063[Add to Quote For Woocommerce](https://wordpress.org/plugins/product-quote-cart-for-wc/) feature to WooCommerce with a brief, one-line product description, you can either use a plugin or manually customize the WooCommerce product loop.
    5164
    52 [Product Shortcode – Widget – Block for Woocommerce](https://wordpress.org/plugins/gm-woo-product-list-widget/) in WooCommerce for displaying products with descriptions, you can leverage the built-in WooCommerce shortcodes or customize them to suit your needs.
     65[Product Shortcode – Widget – Block for Woocommerce](https://wordpress.org/plugins/gm-woo-product-list-widget/) in WooCommerce for displaying products with descriptions, you can leverage the built-in WooCommerce shortcodes or customize them to suit your needs.
    5366
    5467[Show Variations On Shop & Category WooCommerce](https://wordpress.org/plugins/woo-show-single-variations-shop-category/) you can show product variations directly on the shop and category pages.
  • pdf-catalog-woocommerce/trunk/woocommerce-catalog-pdf.php

    r3216571 r3256536  
    1818    define( 'GMWCP_PREFIX', 'gmwcp' );
    1919}
     20
    2021if ( ! defined( 'GMWCP_PLUGINDIR' ) ) {
    2122    define( 'GMWCP_PLUGINDIR', plugin_dir_path( __FILE__ ) );
     
    4849new GMWCP_PDF();
    4950new GMWCP_API();
     51new GMWCP_API_Frontend();
    5052?>
Note: See TracChangeset for help on using the changeset viewer.