Skip to content

Images present in cart are not being optimised by optimole #753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kushh23 opened this issue Dec 14, 2023 · 39 comments
Closed

Images present in cart are not being optimised by optimole #753

kushh23 opened this issue Dec 14, 2023 · 39 comments
Assignees
Labels
bug This label could be used to identify issues that are caused by a defect in the product.
Milestone

Comments

@kushh23
Copy link

kushh23 commented Dec 14, 2023

Description

If you add a product to the cart, then the images on the cart page are not optimized by Optimole. Is this intended for some reason? or a bug?

Step-by-step reproduction instructions

  1. Add a product to the cart.
  2. Check if the image is optimized on the same product page when the noticed appears on page that product is added.
  3. Go to cart page and check the product images.

Screenshots, screen recording, code snippet or Help Scout ticket

It can be quickly verified here - https://travelbirthday.s4-tastewp.com/shop/
Screenshot from 2023-12-14 20-16-07
Screenshot from 2023-12-14 20-15-44

Environment info

https://pastebin.com/g5NGg48m

Is the issue you are reporting a regression

No

@kushh23 kushh23 added the bug This label could be used to identify issues that are caused by a defect in the product. label Dec 14, 2023
@girishpanchal30
Copy link
Contributor

@kushh23 I've checked with tastewp test instance and it seems working fine for me.
Ref: https://tinyurl.com/26jtuzcz

You can check here - https://defectivehill.s4-tastewp.com/shop/

Thanks

@kushh23
Copy link
Author

kushh23 commented Aug 29, 2024

@girishpanchal30 I am still able to replicate this on my tastewp instance, see here - https://vertis.d.pr/i/A9sTJd

https://briefmiddle.s3-tastewp.com/shop
Kushnamdev
vEQ2I65vd#J*ynkQV$pHl2^K

Do you have any idea why this happens on my end?

Thank you!

@girishpanchal30
Copy link
Contributor

@kushh23 I found the issue: we selected the "Optimole Cloud and your website" option, which is causing it to display the local image path.

image

I'll check this issue and let you know here.

Thanks

@girishpanchal30
Copy link
Contributor

@kushh23 I've fixed this here - #826, Chould please check with mentioned PR?

@kushh23
Copy link
Author

kushh23 commented Sep 2, 2024

@girishpanchal30 I have tested the issue and can confirm that the PR build fixes the issue mentioned.

Thank you!

@kushh23
Copy link
Author

kushh23 commented Sep 2, 2024

Hi @girishpanchal30

I noticed one issue now with this PR build. After installing this build, the offloading process is no longer working correctly, I have tested it on a new instance as well.

Steps:
1- Install the PR build.
2- Check the initial issue - It is solved
3- Now enable the offloading option (Optimole cloud only) and check again if the images are offloaded or not.
4- You will notice that the images are not offloaded even after you are trying to "Sync" them again.

Attached Screenshot :
image
image

@girishpanchal30
Copy link
Contributor

@kushh23 I've fixed it with the latest commit, Can you please recheck with the newest build zip?

@kushh23
Copy link
Author

kushh23 commented Sep 2, 2024

@girishpanchal30 I checked with the latest build and its not fixing the issue.

You can also test it here -
https://scintillatinghair.s1-tastewp.com/wp-admin/
kushnamdev
zQcI997p*7Me1&5qVnX@pD

@girishpanchal30
Copy link
Contributor

@kushh23 Provided test instance details are not working.

I've checked with my test instance and it seems working.
Ref: https://tinyurl.com/2b2gee56

https://nimblerequest.s3-tastewp.com/wp-admin

girish / T)ENN%rAB1B4kFt0RvJECLkv

@kushh23
Copy link
Author

kushh23 commented Sep 2, 2024

@girishpanchal30 I have checked the issue on your site too and its not fixing the offload issue there either. Please check the media library page to verify image is offloaded or not (by checking the URL of files), currently it is being Optimised by Optimole but not offloaded.

image

@girishpanchal30
Copy link
Contributor

@kushh23

Now enable the offloading option (Optimole cloud only) and check again if the images are offloaded or not.

After changing the offloading option it will work for new uploads. - https://tinyurl.com/233x6moa

In this PR, I've fixed the WC Cart related issue you can create a new ticket for another issue.

Thanks

@kushh23
Copy link
Author

kushh23 commented Sep 3, 2024

@girishpanchal30 yes, I understand the point that it will work for new uploads, but the Pr build is affecting the offloading process for existing images. It shouldn't affect user's existing images, i.e., if the user has existing images, they won't offload. For more clarity, I have recorded this screencast - https://vertis.d.pr/v/RBSJoS

cc:@selul

@girishpanchal30
Copy link
Contributor

@kushh23 I reviewed the existing media images, and everything appears to be in sync on my end.

Ref: https://tinyurl.com/28y5syoy, https://tinyurl.com/25vl39eh

I've check here: https://fourmove.s4-tastewp.com/wp-admin/upload.php?mode=list

girish / hdzxxBBzgskr$iNENKMy2X1j

@kushh23
Copy link
Author

kushh23 commented Sep 3, 2024

Hi @girishpanchal30,

I was able to replicate the issue on your new test site as well. The problem only occurs after installing the PR build. You can see it in the screencast: https://vertis.d.pr/v/EjTQlQ

I rolled back the plugin to the latest version of Optimole, then added an image (with offloading disabled) to a product. After installing the plugin from the pull request, the image stops being offloaded.

Please review the screencast and let me know if there is any confusion.

Best regards

@girishpanchal30
Copy link
Contributor

@kushh23 I've made some modifications to the load filter only on the cart page. Please check the latest build zip and let me know if you have any issues.

@kushh23
Copy link
Author

kushh23 commented Sep 9, 2024

@girishpanchal30 Sorry for the delay, but I am still not able to offload the existing images prior to the plugin build installation; this is true for all type of images present on the site ( not necessarily connected to Woo products)

https://vertis.d.pr/v/hqZBg7

@girishpanchal30
Copy link
Contributor

@kushh23 I've rechecked the development branch, and it appears that the issue is no longer replicating with either Image Storage option. Could you please verify from your end when you have some time?

Image

Image

@kushh23
Copy link
Author

kushh23 commented Mar 7, 2025

@girishpanchal30 I am not able to download the build from pr as it shows access denied to me - #826

Regarding the issue, the original issue still exists, check here - https://productiveachieve.s2-tastewp.com/product/test/, and the one i shared in this comment can only be checked when i have the pr build file.

Please regenerate those so i can confirm this issue.

@girishpanchal30
Copy link
Contributor

@kushh23

@girishpanchal30 I am not able to download the build from pr as it shows access denied to me - #826

You can download it from the development branch - #879

https://productiveachieve.s2-tastewp.com/product/test/

It looks like the website is not accessible without login credentials. Please provide the login details as well.

@girishpanchal30
Copy link
Contributor

@kushh23,

After further debugging the cart product image issue, I found that it only occurs with the mini-cart. I've fixed it in this PR, so you can test it using the PR build ZIP.

Image

Thanks!

@girishpanchal30 girishpanchal30 linked a pull request Mar 7, 2025 that will close this issue
6 tasks
@kushh23
Copy link
Author

kushh23 commented Mar 7, 2025

@girishpanchal30

The pr fixes the issue with cart images but it still has a small issue of offloading. Please see this full screencast video here - https://www.loom.com/share/2dccaf98d3eb4515a9e887398fa8682d

The reason why it probably offloaded the starting 5 images in second attempt is because of this fix - https://github.com/Codeinwp/optimole-service/issues/1292

But the question is why it doesn't offload them in the first try??

Here is my site credentials:

URL: https://glowcare.s4-tastewp.com/wp-admin
Username: kushnamdev
Password: CG6RDoXHq-k

@girishpanchal30
Copy link
Contributor

@kushh23 It looks like the issue occurs with the test instance. On my local new setup, it works without any failed image uploads.

From my local dashboard setup:
Image

@selul @abaicus
The issue is related to the optimole-sdk, which I identified after enabling Optimole's debug mode.

The first-time image offload returns an error from here - https://github.com/Codeinwp/optimole-php-sdk/blob/main/src/Offload/Manager.php#L165

Full error log - https://github.com/user-attachments/files/19157404/optimole.log

Any thoughts on this issue?

Thanks

@abaicus
Copy link
Contributor

abaicus commented Mar 11, 2025

@kushh23 Is tastewp a reliable environment for offload testing in your experience? IIRC for me it's been a bit hit or miss.

It seems in its context there are issues with images that are attached as product featured images, even with the currently released version of Optimole.

@selul selul added this to the 4.0 milestone Mar 11, 2025
@kushh23
Copy link
Author

kushh23 commented Mar 13, 2025

@abaicus I tested this on my site - https://shop.kushnamdev.com/ as well and facing the same issue.

https://www.loom.com/share/db2bf984599943978dc62e4d59a6af54

@selul selul assigned abaicus and selul and unassigned girishpanchal30 and abaicus Mar 28, 2025
@selul
Copy link
Contributor

selul commented Apr 8, 2025

@kushh23 can you check if this is still happening with the development version. I havent been able to replicate anymore.

@kushh23
Copy link
Author

kushh23 commented Apr 8, 2025

@selul I have tested this and yes the issue is still relevant with the development PR build. the first part of the issue is solved about images being not optimized but the offloading issue still exists for me. I tested it on two separate instances from Instawp as well as tastewp and the issue is the same on both of them.

Image

I tried different images as well to ensure there is no issue with images.

Instance details:

https://optimole1.vertisite.cloud
Username : ciyowiwowa0990
Password : ih64Dd8oN97WIJB5E0lG

I tested with a live instance too:

Image

Instance details:

shop.kushnamdev.com
kush / kush

@selul
Copy link
Contributor

selul commented Apr 9, 2025

@kushh23 this is what I get, tried two times https://vertis.d.pr/i/Org1i3 https://vertis.d.pr/i/ZDmKHx.

I've also added two new images and offloaded them again still working well https://vertis.d.pr/i/9ALkFs

@selul
Copy link
Contributor

selul commented Apr 9, 2025

@kushh23 forgot to mention that I've tried on your instance.

@vytisbulkevicius
Copy link
Contributor

I tested this and I also got similar behavior like @kushh23 but not the same.
When I offloaded images here is the log file:

Image

Images that I added to the Cart during the test have IDs 248 and 250, so both of them were not offloaded even though it sounds weird that adding them to cart makes any effect to offloading.

However, when I click to Sync the images the remaining were offloaded as expected:

Image

To me this behavior is similar to what we were experiencing here: https://github.com/Codeinwp/optimole-service/issues/1318#issuecomment-2753441258

@selul
Copy link
Contributor

selul commented Apr 10, 2025

@vytisbulkevicius this is happening due to the firewall that they have that prevent getting the urls as far as I can tell.

I can look into adding adding the retry for this type of errors.

@selul
Copy link
Contributor

selul commented Apr 10, 2025

added it on dev.

@kushh23
Copy link
Author

kushh23 commented Apr 10, 2025

Rechecking

@kushh23
Copy link
Author

kushh23 commented Apr 10, 2025

@selul Now I am getting this weird error on offloading

Image

@selul
Copy link
Contributor

selul commented Apr 10, 2025

@kushh23 what's weird about it?

@kushh23
Copy link
Author

kushh23 commented Apr 10, 2025

I Saw it the first time.

@selul
Copy link
Contributor

selul commented Apr 10, 2025

@kushh23 retry with the latest build.

@kushh23
Copy link
Author

kushh23 commented Apr 10, 2025

@selul so with this fix, it will reoffload those affected image in same batch, right?

Image

@selul
Copy link
Contributor

selul commented Apr 10, 2025

@kushh23 I dont understand your question, like I've mentioned the error is due to the firewall or cloudflare.

the fix is retrying the offload 3 times before marking the files as errored.

in you case as you can see, it failed first and 2nd time it wworked.

@kushh23
Copy link
Author

kushh23 commented Apr 10, 2025

Ok its more clear now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This label could be used to identify issues that are caused by a defect in the product.
Projects
None yet
5 participants