Page 150 of 167 FirstFirst ... 50100140148149150151152160 ... LastLast
Results 1,491 to 1,500 of 1668
  1. #1491
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Dynamic Price Updater

    Quote Originally Posted by Calljj View Post
    then showing the JSON gives:
    Code:
    {"XML":"securityToken=468ca6253914efa9633b14fdd8368a21&id[1]=2&id[2]=97&id[32]=292&cart_quantity=1&products_id=8902&pspClass=productGeneral&stat=main&outputType=XML","JSON":{"securityToken":"468ca6253914efa9633b14fdd8368a21","id[1]":"2","id[2]":"97","id[32]":"292","cart_quantity":"1","products_id":"8902","pspClass":"productGeneral","stat":"main","outputType":"JSON"}}
    Something doesn't look right about that returned "JSON", if the includes/classes/dynamic_price_updater.php file of the current version were in place then only either XML **OR** JSON would be returned not both.

    Here is the JSON response I get when using firefox on ZC default demo product index.php?main_page=product_info&cPath=54_56&products_id=159:
    Code:
    {"responseType":"success","data":{"sideboxContent":"<span class=\"DPUSideBoxName\">Base price<\/span><span class=\"DPUSideboxQuantity\">&nbsp;x&nbsp;0<\/span>&nbsp;($33.00)<br \/><span class=\"DPUSideBoxName\">Yellow<\/span><span class=\"DPUSideboxQuantity\">&nbsp;x&nbsp;1<\/span>&nbsp;($0.00)<br \/><hr \/><span class=\"DPUSideboxTotalText\">Total: <\/span><span class=\"DPUSideboxTotalDisplay\">$33.00<\/span>","priceTotal":"Sale:&nbsp;$33.00","preDiscPriceTotalText":"Sale:&nbsp;","midDiscPriceTotal":"$35.50","preDiscPriceTotal":"$35.50","stock_quantity":"10000","weight":"1"}}
    Now there is a little extra data sent back as I am trying to work on the "middle" price display for a product that would display three different prices if has say a special and a sale.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #1492
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Dynamic Price Updater

    This is the function in question at the end of the file:
    Code:
      /*
       * Formats the response and flushes with the appropriate headers
       * This should be called last as it issues an exit
       *
       * @return void
       */
      protected function dumpOutput($outputType = "XML") {
        if ($outputType == "XML") {
        // output the header for XML
        header("content-type: text/xml");
        // set the XML file DOCTYPE
        echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
        // set the responseType
        echo '<root>' . "\n" . '<responseType>' . $this->responseType . '</responseType>' . "\n";
        // now loop through the responseText nodes
        foreach ($this->responseText as $key => $val) {
          echo '<responseText' . (!is_numeric($key) && !empty($key) ? ' type="' . $key . '"' : '') . '><![CDATA[' . $val . ']]></responseText>' . "\n";
        }
        die('</root>');
        } elseif ($outputType == "JSON") {
          $data = array();
          // output the header for JSON
          header('Content-Type: application/json');
          // DO NOT set a JSON file DOCTYPE as there is none to be included.
    //      echo '<?xml version="1.0" encoding="UTF-8" ' . "\n";
          // set the responseType
          $data['responseType'] = $this->responseType;
          // now loop through the responseText nodes
          foreach ($this->responseText as $key => $val) {
              if (!is_numeric($key) && !empty($key)) {
                $data['data'][$key] = $val;
              }
          }
          die(json_encode($data));
        }
      }
    $data is an array that is created in the function, $this->responseText is populated throughout the class, but it contains only the key/response information captured throughout the process and XML is not at all captured in that process from what I see of the file. The die at the end of each if statement is present to prevent processing any further information.

    Is an older version or mix of files being used for some reason?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #1493
    Join Date
    Mar 2007
    Posts
    248
    Plugin Contributions
    6

    Default Re: Dynamic Price Updater

    nope, all latest, the json i presented was the request to the ajax, not the response, i presumed it was getting the hump with the request seeing as the result was an error.
    i posted the response back earlier in the thread:

    pasted here again for clarity:

    Code:
    responseText: "\r\n\ufeff{\"responseType\":\"success\",\"data\":{\"priceTotal\":\"<font size=\\\"0.5\\\" color=\\\"#636363\\\">Price: <\\/font>&pound;1,209.00\",\"preDiscPriceTotalText\":\"<font size=\\\"0.5\\\" color=\\\"#636363\\\">Price: <\\/font>\",\"preDiscPriceTotal\":\"&pound;1,007.50\",\"stock_quantity\":\"1\",\"weight\":\"7\"}}"
    Last edited by Calljj; 17 Jan 2019 at 03:18 PM.

  4. #1494
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Dynamic Price Updater

    Quote Originally Posted by Calljj View Post
    nope, all latest, the json i presented was the request to the ajax, not the response, i presumed it was getting the hump with the request seeing as the result was an error
    I'm currently away from a device that can show me related information. Will respond back when able. Note, that between now and then, if this site is not navigated, you will not receive notification of my response if you only read your emails.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #1495
    Join Date
    Mar 2007
    Posts
    248
    Plugin Contributions
    6

    Default Re: Dynamic Price Updater

    Quote Originally Posted by mc12345678 View Post
    This is the function in question at the end of the file:

    $data is an array that is created in the function, $this->responseText is populated throughout the class, but it contains only the key/response information captured throughout the process and XML is not at all captured in that process from what I see of the file. The die at the end of each if statement is present to prevent processing any further information.
    outputs:

    Code:
     Array
    (
        [responseType] => success
        [data] => Array
            (
                [priceTotal] => <font size="0.5" color="#636363">Price: </font>&pound;909.00
                [preDiscPriceTotalText] => <font size="0.5" color="#636363">Price: </font>
                [preDiscPriceTotal] => &pound;757.50
                [stock_quantity] => 1
                [weight] => 7
            )
    
    )

  6. #1496
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Dynamic Price Updater

    Quote Originally Posted by Calljj View Post
    outputs:

    Code:
     Array
    (
        [responseType] => success
        [data] => Array
            (
                [priceTotal] => <font size="0.5" color="#636363">Price: </font>&pound;909.00
                [preDiscPriceTotalText] => <font size="0.5" color="#636363">Price: </font>
                [preDiscPriceTotal] => &pound;757.50
                [stock_quantity] => 1
                [weight] => 7
            )
    
    )
    Would you mind trying something?

    file: includes/modules/pages/product_info/jscript_dynamic_price_updater.php
    Line: 137

    Change:
    Code:
    _this.responseJSON = jqXHR.responseJSON;
    to:
    Code:
    _this.responseJSON = response;
    Also, could you in the watch screen enter the following and identify what version of software we are talking about?
    Code:
    jQuery.fn.jquery
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #1497
    Join Date
    Mar 2007
    Posts
    248
    Plugin Contributions
    6

    Default Re: Dynamic Price Updater

    Quote Originally Posted by mc12345678 View Post
    Would you mind trying something?

    file: includes/modules/pages/product_info/jscript_dynamic_price_updater.php
    Line: 137

    Change:
    Code:
    _this.responseJSON = jqXHR.responseJSON;
    to:
    Code:
    _this.responseJSON = response;
    Also, could you in the watch screen enter the following and identify what version of software we are talking about?
    Code:
    jQuery.fn.jquery
    so changing the line not made any difference, the error is thrown back as a result of the request, whereas that line is processing a successfull request?

    jquery gives 3.2.1

    thanks for continued help on this.

  8. #1498
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Dynamic Price Updater

    Quote Originally Posted by Calljj View Post
    so changing the line not made any difference, the error is thrown back as a result of the request, whereas that line is processing a successfull request?

    jquery gives 3.2.1

    thanks for continued help on this.
    That seem to indicate that for some reason returning from the class back to the page, the data is basically being stripped...

    By making that change, the variable _this.responseJSON was supposed to be set to the response data, the if statement is intended to offer an alternate way of processing as has/had been identified maybe possible; however, now the responseText seems to not be formatted within the parse call to support making that conversion. So need to see what can be done/altered for that.

    Can you also provide the value of responseText as identified just before that error? I'm going to try to see what I can offer as a modified suggestion, but I'm also wondering if some other header information needs to be sent from the class to prevent "screening" the data away.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #1499
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Dynamic Price Updater

    Quote Originally Posted by Calljj View Post
    so changing the line not made any difference, the error is thrown back as a result of the request, whereas that line is processing a successfull request?

    jquery gives 3.2.1

    thanks for continued help on this.
    Could you try:
    in includes/classes/dynamic_price_updater.php
    at/around line 746
    just below:
    Code:
          // output the header for JSON
          header('Content-Type: application/json');
    adding:
    Code:
          header('X-Content-Type-Options: nosniff');
    so that area of the code would look like:
    Code:
          // output the header for JSON
          header('Content-Type: application/json');
          header('X-Content-Type-Options: nosniff');
    By the way is this happening on one browser only or any?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #1500
    Join Date
    Mar 2007
    Posts
    248
    Plugin Contributions
    6

    Default Re: Dynamic Price Updater

    Quote Originally Posted by mc12345678 View Post
    Could you try:
    so that area of the code would look like:
    Code:
          // output the header for JSON
          header('Content-Type: application/json');
          header('X-Content-Type-Options: nosniff');
    By the way is this happening on one browser only or any?
    Changed code,no difference.
    happening on all browsers.

 

 

Similar Threads

  1. v151 Help with dynamic price updater
    By anderson6230 in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 23 Jul 2014, 08:52 AM
  2. v139h Dynamic Price Updater 3.0 Help!
    By Newbie 2011 in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 12 Mar 2014, 06:46 AM
  3. Dynamic Price Updater Error
    By Inxie in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 26 Oct 2012, 06:19 PM
  4. Alternative to Dynamic Price Updater?
    By thebigkick in forum General Questions
    Replies: 0
    Last Post: 9 Jul 2012, 11:41 PM
  5. Dynamic Price Updater with href
    By maxell6230 in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 1 Mar 2012, 12:34 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR