Skip to content
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

Product javascript not being inserted into product page #18

Open
ums-uk opened this issue Jul 17, 2019 · 4 comments
Open

Product javascript not being inserted into product page #18

ums-uk opened this issue Jul 17, 2019 · 4 comments

Comments

@ums-uk
Copy link

ums-uk commented Jul 17, 2019

Hi,

I have a problem where the javascript used to calculate the price of the product has stopped working in production mode. It seems to run fine and then just stopped. Viewing the source code the javascript required to update the price when a dropdown is selected is not there. There are no errors in the production log or the browser console.

An example page can be seen here: https://www.yournewbed.co.uk/products/kozee-sleep-limited-edition-2-drawer-set?taxon_id=6

Any thoughts?

Thanks.

@dhonig
Copy link
Contributor

dhonig commented Jul 17, 2019

@ums-uk The asset pipeline is configured differently for development/staging/production. It may be something about the way you have it configured is causing the scripts to not be loaded after the asset pipeline is compiled. I might try running locally as production to see if the problem persists. This would tell me it something about my projects packaging of assets. Perhaps @acreilly who has done more work maintaining this gem will have some more ideas for you.

@ums-uk
Copy link
Author

ums-uk commented Jul 19, 2019

I have done some more investigating and can see the problem is that the line <%= yield :flexi_variants_body_js %> doesn't return any information. I've run the production server with non-compiled JS to see if this helps but it still does not return any details. Running in production mode on my local computer also recreates the same problem - running in development mode and all works fine.

@ums-uk
Copy link
Author

ums-uk commented Jul 19, 2019

I've found a work around by dumping the contents of the file solidus_flexi_variants/app/views/spree/products/_pricing.html.erb into the bottom of the body of the application and surrounding it with a if @product.present? clause - not ideal but works for me. I expect I could actually put that content into a product view page...

@dhonig
Copy link
Contributor

dhonig commented Jul 19, 2019

@ums-uk that sounds reasonable. It really does seem that something about your project isn't automatically including the JS in the asset pipeline for prod mode. It's not the worst thing in the world to include the JS in the partial that needs it. You would just want to be sure its slowing down the page rendering in any way and this code shouldn't do that as it fires after the page is loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants