rahulnrathodkcl
Forum Replies Created
-
Forum: Plugins
In reply to: [Paytm Payment Gateway] Loading error at checkout pageSure. I will mail it to you right away.
- This reply was modified 4 years, 9 months ago by rahulnrathodkcl.
Forum: Plugins
In reply to: [Paytm Payment Gateway] Loading error at checkout pageHi lovishkalra1, you should probably move to 2.5 version of the paytm gateway plugin. That solved my error.
Forum: Plugins
In reply to: [Paytm Payment Gateway] Loading error at checkout pageHi Author,
I am also facing a similar issue, afer upgrading the plugin from Version 2.5 to 2.6. Pls help.
Note: The plugin is in Production mode.
- This reply was modified 4 years, 11 months ago by rahulnrathodkcl.
No. Actually it is a problem of functioning or the logic behind which this change was made.
Just imagine a store, which shows that there is sale on this product, and again when the user checks the product page, he sees the qty wise pricing table, and gets misguided, as it shows the regular price and not sale price.
In this way, there is no meaning of the qty wise pricing table, as it will show only wrong prices to the user.
How can you justify that ?
OK, Pls find attached screenshot of product settings
Can you guide me on uploading screenshot.
It is not defined by us. Its defined by woocommerce itself.
Sale price is defined by product parameters.
Here is a product link facing this issue.
https://www.ktron.in/product/solenoid-valve/
All the products on sale are facing this issue.
Have you set the plugin to open the PDF file in a new tab (instead of downloading directly)? You may want to try that to see if it shows any errors
Yes, I have checked that. The problem still persists for both options.
The fact that this issue only happens with your custom template and no with the default Simple template may indicate it is an issue with the customizations after all.
The problem also occurs with Simple (Default) template. It did not occur magically once, and the invoice got generated for that single time. Now, if we try the same method, the problem occurs.
And there is no error log file for wpo-wcpdf.
Are there by any chance any errors or codes in the admin-ajax.php file that gets donwnloaded (e.g. things that are not in the original admin-ajax.php file).
The admin-ajax.php that gets downloaded is completely empty.
Hey @pomegranate,
Something very weird occured. I just changed my custom invoice template to not display my custom checkout field. And then tried to generate the invoice, but instead admin-ajax.php file got downloaded.
Now, I changed the invoice template to Simple ( the default one), and tried to generate the invoice, and it got generated.
But now, when I am trying to recreate the scenario, the invoice is not getting generated.
Any idea, what could be the problem ?remove the php close + open tag in line 9 (?><?php)
remove the phe close tag at the end of the file (line 321, ?>)As expected, after making this change, the problem still persists.
Also, as invoice for other orders are generated, this does not seem to be problem of conflict with any other plugin.
- This reply was modified 6 years, 2 months ago by rahulnrathodkcl.
I looked over your functions.php file and see nothing right off the bat that would cause an issue. You might want to make two changes just in case:
remove the php close + open tag in line 9 (?><?php)
remove the phe close tag at the end of the file (line 321, ?>)Ok Will check by changing that.
Does that mean you’re only getting this error with that particular order with 29 items and not with any other orders?
Yes, this problem is occuring only with this particular order. We are still able to generate invoice for other orders without any issues.
Hi,
Thanks for the quick reply. Regarding your suggestions,
Do you have any custom code in your theme functions.php related to PDF invoices? If yes, could you share this with us?
Yes, we do have custom code in functions.php file.
<?php add_action( 'wp_enqueue_scripts', 'martfury_child_enqueue_scripts', 20 ); function martfury_child_enqueue_scripts() { wp_enqueue_style( 'martfury-child-style', get_stylesheet_uri() ); if ( is_rtl() ) { wp_enqueue_style( 'martfury-rtl', get_template_directory_uri() . '/rtl.css', array(), '20180105' ); } } ?><?php /** * * Add HSCODE to WooCommerce products. * */ /** * * Render the HSCODE meta field. * */ function woocommerce_render_hscode_field() { $input = array( 'id' => '_hscode', 'label' => sprintf( '<abbr title="%1$s">%2$s</abbr>', _x( 'HSCode', 'field label', 'storefront-child' ), _x( 'HSCode', 'abbreviated field label', 'storefront-child' ) ), 'value' => get_post_meta( get_the_ID(), '_hscode', true ), 'desc_tip' => true, 'description' => __( 'Enter the HS Code', 'storefront-child' ), ); ?><div id="hscode_attr" class="options_group"> <?php woocommerce_wp_text_input( $input ); ?> </div><?php } add_action( 'woocommerce_product_options_inventory_product_data', 'woocommerce_render_hscode_field' ); /** * * Save the product's GTIN number, if provided. * * * * @param int $product_id The ID of the product being saved. * */ function woocommerce_save_hscode_field( $product_id ) { if ( ! isset( $_POST['_hscode'], $_POST['woocommerce_meta_nonce'] ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ! current_user_can( 'edit_products' ) || ! wp_verify_nonce( $_POST['woocommerce_meta_nonce'], 'woocommerce_save_data' ) ) { return; } $hscode = sanitize_text_field( $_POST['_hscode'] ); update_post_meta( $product_id, '_hscode', $hscode ); } add_action( 'woocommerce_process_product_meta','woocommerce_save_hscode_field' ); // Set Tax Calculation Accordin to Address for Local Pickup Shipping method add_filter( 'woocommerce_apply_base_tax_for_local_pickup' , '__return_false'); // // // //Add Minimum Product Order Qty field on Edit Product -> Inventory Tab. function wc_qty_add_product_field() { echo '<div class="options_group">'; woocommerce_wp_text_input( array( 'id' => '_wc_min_qty_product', 'label' => __( 'Minimum Quantity', 'woocommerce-min-quantity' ), 'placeholder' => '', 'desc_tip' => 'true', 'description' => __( 'Optional. Set a minimum quantity limit allowed per order. Enter a number, 1 or greater.', 'woocommerce-min-quantity' ) ) ); echo '</div>'; // echo '<div class="options_group">'; // woocommerce_wp_text_input( // array( // 'id' => '_wc_max_qty_product', // 'label' => __( 'Maximum Quantity', 'woocommerce-max-quantity' ), // 'placeholder' => '', // 'desc_tip' => 'true', // 'description' => __( 'Optional. Set a maximum quantity limit allowed per order. Enter a number, 1 or greater.', 'woocommerce-max-quantity' ) // ) // ); // echo '</div>'; } add_action( 'woocommerce_product_options_inventory_product_data', 'wc_qty_add_product_field' ); /* * This function will save the value set to Minimum Quantity and Maximum Quantity options * into _wc_min_qty_product and _wc_max_qty_product meta keys respectively */ function wc_qty_save_product_field( $post_id ) { $val_min = trim( get_post_meta( $post_id, '_wc_min_qty_product', true ) ); $new_min = sanitize_text_field( $_POST['_wc_min_qty_product'] ); if ( $val_min != $new_min ) { update_post_meta( $post_id, '_wc_min_qty_product', $new_min ); } } add_action( 'woocommerce_process_product_meta', 'wc_qty_save_product_field' ); /* To Change the Default Add to Cart Qty on Button Press, change the woocommerce plugins' includes/wc-template-functions.php files woocommerce_template_loop_add_to_cart, and change the qty "1" with dynamic wc_min_qty_field if ( ! function_exists( 'woocommerce_template_loop_add_to_cart' ) ) { function woocommerce_template_loop_add_to_cart( $args = array() ) { global $product; if ( $product ) { $product_id = $product->get_id(); $min_qty = get_post_meta( $product_id ,'_wc_min_qty_product', true); $qty = 1; if ( ! empty ( $min_qty)) { if (false !== $min_qty) { $qty = $min_qty; } } $defaults = array( 'quantity' => $qty, 'class' => implode( ' ', array_filter( array( 'button', 'product_type_' . $product->get_type(), $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '', $product->supports( 'ajax_add_to_cart' ) && $product->is_purchasable() && $product->is_in_stock() ? 'ajax_add_to_cart' : '', ) ) ), 'attributes' => array( 'data-product_id' => $product->get_id(), 'data-product_sku' => $product->get_sku(), 'aria-label' => $product->add_to_cart_description(), 'rel' => 'nofollow', ), ); $args = apply_filters( 'woocommerce_loop_add_to_cart_args', wp_parse_args( $args, $defaults ), $product ); if ( isset( $args['attributes']['aria-label'] ) ) { $args['attributes']['aria-label'] = wp_strip_all_tags( $args['attributes']['aria-label'] ); } wc_get_template( 'loop/add-to-cart.php', $args ); } } } */ /* * Setting minimum quantity input args. */ function wc_qty_input_args( $args, $product ) { $product_id = $product->get_parent_id() ? $product->get_parent_id() : $product->get_id(); $product_min = wc_get_product_min_limit( $product_id ); if ( ! empty( $product_min ) ) { // min is empty if ( false !== $product_min ) { $args['min_value'] = $product_min; } } return $args; } add_filter( 'woocommerce_quantity_input_args', 'wc_qty_input_args', 10, 2 ); function wc_get_product_min_limit( $product_id ) { $qty = get_post_meta( $product_id, '_wc_min_qty_product', true ); if ( empty( $qty ) ) { $limit = false; } else { $limit = (int) $qty; } return $limit; } /* * Validating the quantity on add to cart action with the quantity of the same product available in the cart. */ function wc_qty_add_to_cart_validation( $passed, $product_id, $quantity, $variation_id = '', $variations = '' ) { $product_min = wc_get_product_min_limit( $product_id ); // $product_max = wc_get_product_max_limit( $product_id ); if ( ! empty( $product_min ) ) { // min is empty if ( false !== $product_min ) { $new_min = $product_min; } else { // neither max is set, so get out return $passed; } } $already_in_cart = wc_qty_get_cart_qty( $product_id ); $product = wc_get_product( $product_id ); $product_title = $product->get_title(); if ( !is_null( $new_min ) ) { if(($already_in_cart + $quantity) < $new_min) { $passed=false; wc_add_notice( apply_filters( 'isa_wc_min_qty_error_message_already_had', sprintf( __( 'You need to add a minimum of %1$s x %2$s\'s to cart.', 'woocommerce-min-quantity' ), $new_min, $product_title,), $new_min, $already_in_cart ), 'error' ); } // if ( ( $already_in_cart + $quantity ) > $new_max ) { // // oops. too much. // $passed = false; // wc_add_notice( apply_filters( 'isa_wc_max_qty_error_message_already_had', sprintf( __( 'You can add a maximum of %1$s %2$s\'s to %3$s. You already have %4$s.', 'woocommerce-max-quantity' ), // $new_max, // $product_title, // '<a href="' . esc_url( wc_get_cart_url() ) . '">' . __( 'your cart', 'woocommerce-max-quantity' ) . '</a>', // $already_in_cart ), // $new_max, // $already_in_cart ), // 'error' ); // } } return $passed; } add_filter( 'woocommerce_add_to_cart_validation', 'wc_qty_add_to_cart_validation', 1, 5 ); /* * Get the total quantity of the product available in the cart. */ function wc_qty_get_cart_qty( $product_id ) { global $woocommerce; $running_qty = 0; // iniializing quantity to 0 // search the cart for the product in and calculate quantity. foreach($woocommerce->cart->get_cart() as $other_cart_item_keys => $values ) { if ( $product_id == $values['product_id'] ) { $running_qty += (int) $values['quantity']; } } return $running_qty; } /* /*cutomized weight based shipping*//* add_filter( 'woocommerce_package_rates', 'ktron_woocommerce_tiered_shipping',999, 2); function ktron_woocommerce_tiered_shipping( $rates, $package ) { $cart_weight = WC()->cart->cart_contents_weight/1000; $cart_weight = ceil($cart_weight + 0.20) - 1; if ( isset ( $rates['flat_rate:10'] )) { if ($cart_weight>0) { $act_rate = $rates['flat_rate:10']->cost; $per_kg_weight = $act_rate - 20; $extra_cost = $cart_weight * $per_kg_weight; $rates['flat_rate:10']->cost = $act_rate + $extra_cost; } } return $rates; } */ /* Payment Gateway Selection Based on Shipping Method add_filter( 'woocommerce_available_payment_gateways' , 'ktron_gateway_disable_cod' ); function ktron_gateway_disable_cod ($available_gateways) { if( ! is_admin() ) { $chosen_methods = WC()->session->get('chosen_shipping_methods'); $chosen_shipping = $chosen_methods[0]; if( isset( $available_gateways['cod']) && !((0 === strpos($chosen_shipping, 'wbs1515075f87_express_shipping_cod')) || (0 === strpos($chosen_shipping,'wbs1615075f87_express_shipping_cod')) )){ unset( $available_gateways['cod']); } } return $available_gateways; } */ // Display Daily Dispatch Time on Single Product Page add_action('woocommerce_before_add_to_cart_button','display_dispatch_time',20); function display_dispatch_time() { global $product; $id = $product->get_id(); $min_qty = wc_get_product_min_limit($id); if ( !empty (min_qty) && false !== $min_qty) { echo '<div class="dispatch_msg_class">Minimum Order Qty: ' . $min_qty .'</div>'; } echo '<div class="dispatch_msg_class">Due to ongoing Lockdown, orders placed before 12PM would be dispatched same day.</div>';} // // Enqueue Your Font // function my_queue_items() { // wp_enqueue_style( 'ElegantIcons', '/wp-content/themes/martfury/fonts/ElegantIcons.woff', array(), null ); // } // add_action( 'wp_enqueue_scripts', 'my_queue_items', 99 ); // // Add Crossorigin Attribute To Your Font // function style_attributes( $html, $handle ) { // if ( 'ElegantIcons' === $handle ) { // return str_replace( "media='all'", "media='all' crossorigin='anonymous'", $html ); // } // return $html; // } // add_filter( 'style_loader_tag', 'style_attributes', 10, 2 ); ?>Have you made any changes to the invoice template?
Yes, we did changes to template, but the invoice template seems not to be an issue, as we also tried generating invoice with Default template.
Have you tested whether this issue occurs with all plugins disabled except WooCommerce + WooCommerce PDF Invoices & Packing Slips?
Its a live site, so that is hard to do. And invoice for orders are getting generated.
Do you see any errors under WooCommerce > Status > Logs in the fatal-error logs that could be related?
No errors relating to this plugin