aviegrinberg
Forum Replies Created
-
Forum: Plugins
In reply to: [CoCart - Cart API Enhanced] API Enhanced Plugin and 502 bad gateway errorAwesome thank you ??
Forum: Plugins
In reply to: [CoCart - Cart API Enhanced] API Enhanced Plugin and 502 bad gateway errorI enabled PHP logging by downloading a plugin called “Error Log Monitor” because I am unfamiliar with the WordPress / PHP environment. Doing this alone removed the 502 error in postman. Looking at the new error log I noticed the following warning:
Warning: Undefined variable $removed_item in /var/www/html/wp-content/plugins/cocart-get-cart-enhanced/includes/filters/filter-v2.php on line 101
So I just removed that variable completely and the warning disappeared as well. Thank you for the guidance much appreciated.
Forum: Plugins
In reply to: [CoCart - Cart API Enhanced] API Enhanced Plugin and 502 bad gateway errorHi just to follow up I read your article about setting up a custom plugin and it compelled me to look at the underlying code in this plugin as well in the wp-content/plugins/cocart-get-enhanced/includes/filters/filter-v2.php file. I just commented out the two filters separately and retried the postman steps above, and found the problem was within the ‘return_product_details’ filter. After commenting out a few sections of that particular filter, I was able to isolate the issue to the following block of code which I dont really need for my project (so i just commented it out in my plugin) but just so you are aware:
// Product gallery images.
// $gallery_ids = $_product->get_gallery_image_ids();
// $cart_contents[ $item_key ]['gallery'] = array();
// if ( ! empty( $gallery_ids ) ) {
// foreach ( $gallery_ids as $image_id ) {
// $gallery_id = apply_filters( 'cocart_item_gallery', $image_id, $cart_item, $item_key );
// $gallery_src = wp_get_attachment_image_src( $gallery_id, apply_filters( 'cocart_item_gallery_thumbnail_size', 'woocommerce_thumbnail' ) );
// /**
// * Filters the source of the product gallery image.
// *
// * @param string $gallery_src URL of the product gallery image.
// */
// $gallery_src = apply_filters( 'cocart_item_thumbnail_src', $gallery_src[0], $cart_item, $item_key, $removed_item );
// $cart_contents[ $item_key ]['gallery'][ $gallery_id ] = $gallery_src;
// }
// }