samnabi / shopkit

Comprehensive commerce solution for Kirby CMS v2
https://shopkit.samnabi.com
Other
99 stars 15 forks source link

Fixed the path to the new assets directory. #142

Closed antjpar closed 7 years ago

antjpar commented 7 years ago

While evaluating Shopkit I noticed none of the CSS files where being loaded.

I have corrected the links.

samnabi commented 7 years ago

These assets are loaded using the correct paths as per https://getkirby.com/docs/developer-guide/plugins/assets

Can you confirm the steps to replicate this issue? These credit card images are only loaded on the process.php page of the Square gateway.

antjpar commented 7 years ago

I simply cloned out the newest version:

git clone --recursive  https://github.com/samnabi/shopkit.git

Then ran php server

 php -S localhost:8000

Then I got the following error messages when I loaded the landing page

[Mon May  1 23:07:18 2017] 127.0.0.1:33024 [200]: /
[Mon May  1 23:07:18 2017] 127.0.0.1:33026 [404]: /assets/plugins/shopkit/css/shopkit.eeeeee.00a8e6.0077dd.css - No such file or directory
[Mon May  1 23:07:18 2017] 127.0.0.1:33028 [200]: /assets/css/custom.css
[Mon May  1 23:07:18 2017] 127.0.0.1:33030 [404]: /assets/plugins/shopkit/css/font.asap.css - No such file or directory

404 not found so I then fixed the first two and then went through the code and changed the remaining links that I found. I may have been a bit aggressive but the site works again.

It looks like the assets where moved but the code was not updated

samnabi commented 7 years ago

What happens if you navigate to another page on the site? Does it load properly? Seems like you have a larger modrewrite error going on.

antjpar commented 7 years ago

Not sure what you mean by large morewrite error.

I have not setup any rewrite rules and simple using the php webserver to serve the freshly cloned shopkit. As I stated in the steps to repeat the problem, it is essentially a fresh checkout and the code is looking for files in the wrong folder.

I then went through the code and found the files the code was looking for and updated the url's.

If you make a clean clone and test the website you will see the problem. It is very difficult to navigate the site as the html is not styled because the css files could not be found.

You will see that 8 files have been updated.

Do you not have the same problem when you setup a clean clone of the project? You may need to cleanup oyur checkout as the files may still be in the old directory on your machine.

samnabi commented 7 years ago

Quoting from the Docs page linked in my first comment:

Since all requests to the site folder are blocked by Kirby's htaccess file for security reasons, you cannot just store public assets, such as js files, css or images in your plugin folder. [...] All plugin assets must go into an assets folder. /site/plugins/{pluginName}/assets [...] As long as you store your assets in the assets folder, your assets are publicly available at the following URL: http://{domain}/assets/plugins/{pluginName}/{optionalSubfolder}/{filename}

On a clean install, trying to access http://localhost/site/plugins/shopkit/assets/js/ajax-helpers.min.js should fail (404 error). The paths to assets must start with /assets/plugins/{pluginName}.


Now, this still doesn't answer why the assets are not loading on your server.

I think it's a problem with your mod_rewrite settings. What happens when you try to navigate to a page other than home, for example the Contact page?

antjpar commented 7 years ago

Oh wow definitely helps to read the documentation. My apologies for the confusion.

The problem was in the end then that I used the php built in webserver to serve the shopkit directory as explained here: https://getkirby.com/docs/installation/running-with-php

The problem with php webserver is that it does not support any form rewrite configurations as it is a simple webserver.

I will close the merge request will use a webserver with rewrite rules.

With the following command one could test the shopkit quickly once the project has been checked out rather then the instructions listed on the getkirby website

 docker run -e ALLOW_OVERRIDE=true -p 8000:80 -v $(pwd):/app tutum/apache-php
samnabi commented 7 years ago

Good to know about the Docker command. Thanks for following up!