Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18
  1. #11
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Using XHR Request for Ajax based on what product(s) are chosen

    I added the missing quotes into post #7.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  2. #12

    Default Re: Using XHR Request for Ajax based on what product(s) are chosen

    Quote Originally Posted by DrByte View Post
    I added the missing quotes into post #7.
    Well after initial testing and breif spot-checking for consistency across pages it seems to be working with the redirect line intact, thank you!

    If it's not too much to ask, could you maybe try to help me understand more about what the problem was and why this solution fixed it? I'm learning more about Zen Cart, and its use of php, javascript, etc. every day but I really like to understand why something is happening, so that in the future I can implement and build on that knowledge.

    If it's inappropriate to do here then can you private message me? If you are too busy that's okay – like I said I just much prefer to understand more about what's going on than to Copy & Paste a fix and call it a day.
    Last edited by RobertH; 3 Feb 2016 at 03:47 PM. Reason: *just

  3. #13

    Default Re: Using XHR Request for Ajax based on what product(s) are chosen

    I've thought of a possible issue and I don't know if it is already accounted for based on this setup of the XHR POST.

    Right now, as you've seen, I'm working on a test site on localhost, but my live site has an SSL certificate and allows for https browsing. Will the current code be able to .load() "ajax_compare.php" while on https connection?

  4. #14
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Using XHR Request for Ajax based on what product(s) are chosen

    Quote Originally Posted by RobertH View Post
    If it's not too much to ask, could you maybe try to help me understand more about what the problem was and why this solution fixed it?
    Zen Cart, like any responsible framework, protects against CSRF attacks by requiring POSTs to include a security token. When absent, it rejects the POST.
    Your ajax .load() command is passing an object, which forces the ajax call to be a POST.
    The change I suggested causes your ajax command to include the security token as part of the POST, so that it an be validated.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #15
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Using XHR Request for Ajax based on what product(s) are chosen

    Quote Originally Posted by RobertH View Post
    I've thought of a possible issue and I don't know if it is already accounted for based on this setup of the XHR POST.

    Right now, as you've seen, I'm working on a test site on localhost, but my live site has an SSL certificate and allows for https browsing. Will the current code be able to .load() "ajax_compare.php" while on https connection?
    I don't see why it would make any difference.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #16

    Default Re: Using XHR Request for Ajax based on what product(s) are chosen

    Quote Originally Posted by DrByte View Post
    Zen Cart, like any responsible framework, protects against CSRF attacks by requiring POSTs to include a security token. When absent, it rejects the POST.
    Your ajax .load() command is passing an object, which forces the ajax call to be a POST.
    The change I suggested causes your ajax command to include the security token as part of the POST, so that it an be validated.

    Quote Originally Posted by DrByte View Post
    I don't see why it would make any difference.

    Thanks again for your advice. I will report back here how it goes when moving the feature to the live site

  7. #17

    Default Re: Using XHR Request for Ajax based on what product(s) are chosen

    Quote Originally Posted by RobertH View Post
    Thanks again for your advice. I will report back here how it goes when moving the feature to the live site
    Seems to be running smoothly on the live site with http or https!

  8. #18
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Using XHR Request for Ajax based on what product(s) are chosen

    Quote Originally Posted by RobertH View Post
    Seems to be running smoothly on the live site with http or https!
    Great! Thanks for reporting back.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v155 For what does ZC v155 make use of ajax?
    By carlwhat in forum General Questions
    Replies: 3
    Last Post: 21 Mar 2016, 11:40 PM
  2. Looking for a plugin that displays cart totals using AJAX
    By tcarden in forum General Questions
    Replies: 3
    Last Post: 12 Dec 2013, 07:33 PM
  3. v139h Anyone know of an Ajax based review/comment system in Product Detail page?
    By ivan999 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 26 Jul 2012, 08:59 PM
  4. 2 AJAX based module for Zen-Cart, please review
    By jaycode in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 13 Dec 2007, 05:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg