angelyssa Posted September 16, 2016 Share Posted September 16, 2016 (edited) Hi everyone, I hope someone can help me figure out an issue I have been having for a long time. Our product pages need to include lots of static HTML, and each page needs specific things placed in specific places... so using the theme template for product page is not good. What I have done is Previewed the product page, copied the SOURCE CODE, and created a static page... my boss also never liked the page URL format with product ID in the URL, and so this is another reason for this. I am having issues (I Think) because of the tokens that are created in the cart, and when they don't match with shopping cart theme (when you add to cart and land on shopping cart summary page), it will have a different token.. because of that, often times the customer sees WHITE page or just the home page of CART.. which shows images and links to the core shopping cart pages...but i don't want to use those. How can I create a STATIC page, without any type of TOKENS, in the header and also in the ADD TO CART, I noticed the token is there too... like so: <input type="hidden" name="token" value="2a4071b7ff7791ca3d4336d3a0ef1fd7" /> I guess that token is dynamically created upon user session... but i cannot have this. Here is a static product page, which I created FROM the PS product page: http://www.allo.com/sparky/sparky-sbc.html And here is the PS page (from the core application: http://www.allo.com/shop/sparky-shields/43-sparky-sbc.html So I copied the "add to cart" area and the "photo" area and the script code for the product, and the header code, and simply pasted them into a new static HTML page : http://www.allo.com/sparky/sparky-sbc.html But sometimes when you add to cart on this page, it does not work. How can I make my STATIC pages work 100% to add product to cart? How can I remove or disabled these tokens? Can anyone assist? Thanks!! Elyssa Using PS version 1.5.3.1 Edited September 16, 2016 by angelyssa (see edit history) Link to comment Share on other sites More sharing options...
angelyssa Posted September 16, 2016 Author Share Posted September 16, 2016 oooh i just had an idea... what if in /theme/XXX/header.tpl I find this code: <script type="text/javascript"> var baseDir = '{$content_dir}'; var static_token = '{$static_token}'; var token = '{$token}'; var priceDisplayPrecision = {$priceDisplayPrecision*$currency->decimals}; var priceDisplayMethod = {$priceDisplay}; var roundMode = {$roundMode}; </script> and then I comment it out .. and then add this code: <script type="text/javascript"> var baseDir = '{$content_dir}'; var static_token = '2a4071b7ff7791ca3d4336d3a0ef1fd7'; var token = '2a4071b7ff7791ca3d4336d3a0ef1fd7'; var priceDisplayPrecision = 2; var priceDisplayMethod = 1; var roundMode = 2; </script> so basically, I "set" the tokens manually... Will this work, if all tokens on my product pages are the same? it this a security risk? what are these tokens for? what if ALL my customers order something and use this same token? can someone tell me what tokens do? Thanks! Link to comment Share on other sites More sharing options...
Apium Posted September 16, 2016 Share Posted September 16, 2016 (edited) I cannot reproduce, i.e. I am not getting any ?token='' tags on your website. Furthermore, if you do not like having IDs in your URLs, there are many addons for that, like http://addons.prestashop.com/en/16633-pretty-urls.html. Regarding the custom content - build a module that hooks into the product page on the locations you need and have your content displayed there. No need for static (?) pages. Edited September 16, 2016 by Apium (see edit history) Link to comment Share on other sites More sharing options...
angelyssa Posted September 16, 2016 Author Share Posted September 16, 2016 thanks.. do you know what those tokens are for? var static_token = '{$static_token}'; var token = '{$token}'; ? thanks! Elyssa Link to comment Share on other sites More sharing options...
Apium Posted September 16, 2016 Share Posted September 16, 2016 (edited) From http://www.webhostinghub.com/help/learn/prestashop-15-tutorials/performance-and-security-15/using-security-tokens, When your customers login to your website they are opening a database session. This session is typically shielded by the fact that your user is connecting to your shop using a secure login. However, an addtionally option called a security token can be added so that every connection that your customers make to your shop utilizes a unique security token providing yet another security layer. This option is used to ensure that the session created by your login cannot be duplicated. Each session will be separated by the unique token. I have, however, never quite seen those 'tokens' in action on the front-end. Could you tell me how I can reproduce your problem? Edited September 16, 2016 by Apium (see edit history) Link to comment Share on other sites More sharing options...
angelyssa Posted September 16, 2016 Author Share Posted September 16, 2016 so you can check on this page... http://www.allo.com/shop/sparky-shields/52-kali-reclocker.html this is the shopping cart page that is created by PS ... so it's the "real" one... When I go to this page and view source code, I see a token ID there... Since I am copying product page source code into a STATIC html page, which will be accessible to all customers, I need to either disable this token.. or make it completely static on the header.tpl page... because, i think (I am not a programmer) that if the static page is accessed by the customer, and they add-to-cart, and then go to the SHOP page (with dynamic tokens in header), it will not match and then they will get blank white screen... basically add-to-cart will not work. So i am trying to find a solution to have STATIC product pages... Is this possible? I may even be 100% wrong that the issue is the tokens.. i am not sure... Here is the current STATIC product page for that same product: http://allo.com/sparky/kali-reclocker.html If you check source code, I put the token codes in there... try to add to cart and let me know if it's working the first try? Thanks!! Elyssa Link to comment Share on other sites More sharing options...
Apium Posted September 17, 2016 Share Posted September 17, 2016 I fail to understand what you mean by static pages? These tokens are only visible in the code, so what is the problem here? Why do you insist on static pages? Link to comment Share on other sites More sharing options...
angelyssa Posted September 17, 2016 Author Share Posted September 17, 2016 sorry, i'll explain When you have products on Prestashop, they create a page, like this: http://www.allo.com/shop/sparky-shields/43-sparky-sbc.html but i cannot use that page, because i can add all my specific product details... so I view source code on that page, and I copy that, and I create a STATIC html page, like this: http://www.allo.com/sparky/sparky-sbc.html So, if you check the source code of that page, I have manually input the tokens ... all my product pages use that same token. I need to have those static product pages.... because 1. my boss does not like the URL format that PS gives... ie: 43-sparky-sbc.html (with product ID in it), and because also I need to add lots of specific product details, which is not simple within PS... so I made static html code with css So how can I have a "static" website with all my products, either without tokens, or with SAME tokens throughout all pages..? Also, can you test this product page on your end, and see if it adds to cart? http://www.allo.com/sparky/sparky-sbc.html Sometimes when I add to cart, the shop directs me to this page: http://www.allo.com/shop/ or it will send me to blank cart page... maybe you can replicate.... Please let me know if you understand me now Thanks for your help!! Elyssa Link to comment Share on other sites More sharing options...
Apium Posted September 17, 2016 Share Posted September 17, 2016 (edited) I can add a product to the cart, yes. So that works. Now, about the URL format. Like I said before, there are modules for this. Regarding changes in the product details: it is better to extend PrestaShop than to copy a page and place it somewhere else. That way, you have way more flexibility too. Are you going to make each and every product page static? The sole amount of work warrants writing some code to add custom code in appropriate hooks I'd advise against copying the page to a different location, and rather just extend Presta to suit your needs. Edited September 17, 2016 by Apium (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now