Page 128 of 169 FirstFirst ... 2878118126127128129130138 ... LastLast
Results 1,271 to 1,280 of 1681
  1. #1271
    Join Date
    Mar 2009
    Location
    Essex, UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: Price Updater - plugin keeps disabling

    Sorry I had a blonde moment. This is PHP

    But in my defence <?php echo ?> doesn't appear to work
    Debbie Harrison
    DVH Design | Web Design blog

  2. #1272
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Price Updater - plugin keeps disabling

    Quote Originally Posted by dharrison View Post
    Ok the updated price once an attribute is selected does not display whether the price is including or ex VAT. As we cater to both trade and customer, this makes a big difference (especially at 20%)

    I see where to add the suffix, but (and yes I am a newbie when it comes to javascript) what do I add: I tried document.write() and this didn't work

    Please help :)
    To be sure that we're going down the right path: on initial display of the price, the price value as well as a "suffix" are presented, correct? Isn't the price value in its own span class as compared to the suffix?

    If so, it sounds like maybe the javascript portion is replacing "too much" text. I don't recall the class name even though I was adding functionality to the plugin yesterday to specifically address that plugin, but it includes text something like "...IncExc..." for the case where it is the "opposite" tax display, and a different class for the one that is the "normal" final display. If there are two spans displayed, one to show the price, one to show the text of what the price represents, then the file to change is in the includes/modules/pages/YOUR_PRODUCT_TYPE/ folder in the jscript_ file and the handlePrice function to capture the location to be updated as the variable psp.

    If there is only one such class at the product price display then yes need to go back to the class file which is a php file not a javascript file. By that I mean, the responseText would be updated to append the suffix through standard php methods of appending text.

    I believe you provided a link to one of your products, so will take a look soon and be able to further advise, but wanted to express what seemed to be expected as compared to what was asked.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #1273
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Price Updater - plugin keeps disabling

    Quote Originally Posted by dharrison View Post
    Sorry I had a blonde moment. This is PHP

    But in my defence <?php echo ?> doesn't appear to work
    Welcome to AJAX. :) as stated in my last post, the suffix if added to the class file, would be appended to the responseText of the priceTotal key similar to the line modified in the correction posted before.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #1274
    Join Date
    Mar 2009
    Location
    Essex, UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: Price Updater - plugin keeps disabling

    Yes just a suffix on the second price that reminds the visitor that the price given is "ex VAT"
    Debbie Harrison
    DVH Design | Web Design blog

  5. #1275
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Price Updater - plugin keeps disabling

    Quote Originally Posted by dharrison View Post
    Yes just a suffix on the second price that reminds the visitor that the price given is "ex VAT"
    I'll give my recommended code to add the suffix into the class file in a moment, but it appears that the inc_ex_functions file in includes/functions/extra_functions is missing a span tag in one place as seen by your website and then review of that code as downloaded a while back from zc. There is a line in that function file starting with
    Code:
    $show_normal_price=display_price(
    The right side of that "equation" should be encompassed by a span of class normalPrice or similar it looks like.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #1276
    Join Date
    Mar 2009
    Location
    Essex, UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: Price Updater - plugin keeps disabling

    On line 110? I have corrected that
    Debbie Harrison
    DVH Design | Web Design blog

  7. #1277
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Price Updater - plugin keeps disabling

    Quote Originally Posted by mc12345678 View Post
    I'll give my recommended code to add the suffix into the class file in a moment, but it appears that the inc_ex_functions file in includes/functions/extra_functions is missing a span tag in one place as seen by your website and then review of that code as downloaded a while back from zc. There is a line in that function file starting with
    Code:
    $show_normal_price=display_price(
    The right side of that "equation" should be encompassed by a span of class normalPrice or similar it looks like.
    So here are the changes I recommend to support the inc/excl VAT module.

    First, update the includes/functions/extra_functions/inc_ex_functions.php file to change this:
    Code:
            if ($product_check->fields['product_is_free']=='1')
             $show_normal_price='<s>'.display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</s>';
            else
    		 $show_normal_price=display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id']));
    Around line 112 to this (in red):
    Code:
            if ($product_check->fields['product_is_free']=='1')
             $show_normal_price='<s>'.display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</s>';
            else
    		 $show_normal_price='<span class="normalprice">'.display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</span>';
    Then in includes/modules/pages/product_info/jscript_dynamic_price_updater.php:
    At and around line 222:
    Code:
      for (var a=0,b=test.length; a<b; a++) {
        if (test[a].className == "productSpecialPrice" || test[a].className == "productSalePrice" || test[a].className == "productSpecialPriceSale") {
          psp = test[a];
        }
      }
    Add: a check for the className normalprice and a check for the "alternate tax" display possibilities:
    Code:
      var pspInclEx = false;
      var pspEx = false;
      var pspIncl = false;
    
      for (var a=0,b=test.length; a<b; a++) {
        if (test[a].className == "normalprice" || test[a].className == "productSpecialPrice" || test[a].className == "productSalePrice" || test[a].className == "productSpecialPriceSale") {
          psp = test[a];
        }
      }
        if (test[a].className == "productIncExTaxPrice") {
          pspInclEx = test[a];
        }
        if (test[a].className == "productTaxExPrice") {
          pspEx = test[a];
        }
        if (test[a].className == "productTaxPrice") {
          pspIncl = test[a];
        }
    Then below that beginning at line 243:
    Code:
          switch (type) {<?php // the 'type' attribute defines what type of information is being provided ?>
            case "priceTotal":
              if (psp) {
                psp.innerHTML = temp[i].childNodes[0].nodeValue;
              } else {
                thePrice.innerHTML = temp[i].childNodes[0].nodeValue;
              }
              if (_secondPrice !== false) {
                this.updSP();
              }
              break;
            case "quantity":
              with (temp[i].childNodes[0]) {
                if (nodeValue != "") {
                  if (psp) {
                    psp.innerHTML += nodeValue;
                  } else {
                    thePrice.innerHTML += nodeValue;
                  }
                  this.updSP();
                }
              }
              break;
    Insert additional cases of "priceTotalInclTax", "priceTotalExcTax", and "priceTotalIncExcTax" to support the various classes that the plugin uses.
    Code:
          switch (type) {<?php // the 'type' attribute defines what type of information is being provided ?>
            case "priceTotal":
              if (psp) {
                psp.innerHTML = temp[i].childNodes[0].nodeValue;
              } else {
                thePrice.innerHTML = temp[i].childNodes[0].nodeValue;
              }
              if (_secondPrice !== false) {
                this.updSP();
              }
              break;
            case "priceTotalInclTax":
              if (pspIncl) {
                pspIncl.innerHTML = temp[i].childNodes[0].nodeValue;
              } 
              break;
            case "priceTotalExcTax":
              if (pspEx) {
                pspEx.innerHTML = temp[i].childNodes[0].nodeValue;
              } 
              break;
            case "priceTotalInclExcTax":
              if (pspInclEx) {
                pspInclEx.innerHTML = temp[i].childNodes[0].nodeValue;
              } 
              break;
            case "quantity":
              with (temp[i].childNodes[0]) {
                if (nodeValue != "") {
                  if (psp) {
                    psp.innerHTML += nodeValue;
                  } else {
                    thePrice.innerHTML += nodeValue;
                  }
                  this.updSP();
                }
              }
              break;
    Then in includes/classes/dynamic_price_updater.php within the prepareOutput function modifying (for now) the area in blue below (a similar modification will be incorporated for when not showing the currency symbols, but first am trying to get through with when they are displayed):
    Code:
        if (DPU_SHOW_CURRENCY_SYMBOLS == 'false') {
          $decimal_places = $currencies->get_decimal_places($_SESSION['currency']);
          $this->responseText['priceTotal'] .= number_format($this->shoppingCart->total, $decimal_places);
        } else {
          $this->responseText['priceTotal'] .= $currencies->display_price($this->shoppingCart->total, zen_get_tax_rate($product_check->fields['products_tax_class_id'])/* 0 */ /* DISPLAY_PRICE_WITH_TAX */);
        }
    Incorporate the following (in red, the "blue" line remains unchanged):
    Code:
        if (DPU_SHOW_CURRENCY_SYMBOLS == 'false') {
          $decimal_places = $currencies->get_decimal_places($_SESSION['currency']);
          $this->responseText['priceTotal'] .= number_format($this->shoppingCart->total, $decimal_places);
        } else {
    
          $product_tax_class_id = zen_products_lookup((int)$_POST['products_id'], 'products_tax_class_id');
          $tax_rate = zen_get_tax_rate($product_tax_class_id); // Rate comes back as a "whole number" such as 20% returns 20 and NOT 0.20
    
          if (DISPLAY_PRICE_WITH_TAX != 'false') {
    
            $price_without_tax = 100.0 * $this->shoppingCart->total / ($tax_rate + 100.0); // Price of product without tax
           
            $this->responseText['priceTotalInclExcTax'] = $this->responseText['priceTotal'] . $currencies->display_price($price_without_tax, 0);
            $this->responseText['priceTotalExcTax'] = $currencies->display_price($price_without_tax, 0);
          } else {
            $this->responseText['priceTotalInclExcTax'] = $this->responseText['priceTotal'] . $currencies->display_price($this->shoppingCart->total + zen_calculate_tax($this->shoppingCart->total, $tax_rate), 0);
            $this->responseText['priceTotalInclTax'] = $currencies->display_price($this->shoppingCart->total + zen_calculate_tax($this->shoppingCart->total , $tax_rate), 0);
          }
    
          $this->responseText['priceTotal'] .= $currencies->display_price($this->shoppingCart->total, 0)/* 0 */ /* DISPLAY_PRICE_WITH_TAX */;
        }
    I may add a "switch" to the jscript file to detect if the incl/exc VAT plugin is installed/enabled/active, but need to identify what would trigger that "knowledge". Otherwise, for non-users of that code, additional javascript is sent to a browser and possibly a little processing speed/time by calculating the opposite price of what the store is showing on page load/attribute change with no other ill effect(s) by this change.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #1278
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Price Updater - plugin keeps disabling

    Quote Originally Posted by dharrison View Post
    On line 110? I have corrected that
    If I am correct, line 10 didn't have a class assigned and just had a strike through <s>. Generally speaking, that is as expected because there would/should be some other class that follows and would be replaced with an applicable price to update. It would be two lines down where there is no "html" surrounding the price value(s). It appears to be causing on your product info page for the "base price" to not be uniquely surrounded by a span that can be "tagged" and therefore the entire content is being replaced not just the applicable price(s).

    BTW, feedback on the above modification would be greatly appreciated as I have it staged (locally) to be posted to github and to ZC for incorporation. Would like to get it as close to fully operational as possible.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #1279
    Join Date
    Mar 2009
    Location
    Essex, UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: Price Updater - plugin keeps disabling

    Hi

    Ok will do.
    Debbie Harrison
    DVH Design | Web Design blog

  10. #1280
    Join Date
    Mar 2009
    Location
    Essex, UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: Price Updater - plugin keeps disabling

    Around line 112 to this (in red):
    Code:
            if ($product_check->fields['product_is_free']=='1')
             $show_normal_price='<s>'.display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</s>';
            else
    		 $show_normal_price='<span class="normalprice">'.display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</span>';
    I did this and as a result the including VAT price now has a strikethrough

    Name:  ss1.jpg
Views: 129
Size:  29.2 KB


    Then in includes/modules/pages/product_info/jscript_dynamic_price_updater.php:
    At and around line 222:
    Code:
      for (var a=0,b=test.length; a<b; a++) {
        if (test[a].className == "productSpecialPrice" || test[a].className == "productSalePrice" || test[a].className == "productSpecialPriceSale") {
          psp = test[a];
        }
      }


    Add: a check for the className normalprice and a check for the "alternate tax" display possibilities:
    Code:
      var pspInclEx = false;
      var pspEx = false;
      var pspIncl = false;
    
      for (var a=0,b=test.length; a<b; a++) {
        if (test[a].className == "normalprice" || test[a].className == "productSpecialPrice" || test[a].className == "productSalePrice" || test[a].className == "productSpecialPriceSale") {
          psp = test[a];
        }
      }
        if (test[a].className == "productIncExTaxPrice") {
          pspInclEx = test[a];
        }
        if (test[a].className == "productTaxExPrice") {
          pspEx = test[a];
        }
        if (test[a].className == "productTaxPrice") {
          pspIncl = test[a];
        }
    Then below that beginning at line 243:
    Code:
          switch (type) {<?php // the 'type' attribute defines what type of information is being provided ?>
            case "priceTotal":
              if (psp) {
                psp.innerHTML = temp[i].childNodes[0].nodeValue;
              } else {
                thePrice.innerHTML = temp[i].childNodes[0].nodeValue;
              }
              if (_secondPrice !== false) {
                this.updSP();
              }
              break;
            case "quantity":
              with (temp[i].childNodes[0]) {
                if (nodeValue != "") {
                  if (psp) {
                    psp.innerHTML += nodeValue;
                  } else {
                    thePrice.innerHTML += nodeValue;
                  }
                  this.updSP();
                }
              }
              break;
    Insert additional cases of "priceTotalInclTax", "priceTotalExcTax", and "priceTotalIncExcTax" to support the various classes that the plugin uses.
    Code:
          switch (type) {<?php // the 'type' attribute defines what type of information is being provided ?>
            case "priceTotal":
              if (psp) {
                psp.innerHTML = temp[i].childNodes[0].nodeValue;
              } else {
                thePrice.innerHTML = temp[i].childNodes[0].nodeValue;
              }
              if (_secondPrice !== false) {
                this.updSP();
              }
              break;
            case "priceTotalInclTax":
              if (pspIncl) {
                pspIncl.innerHTML = temp[i].childNodes[0].nodeValue;
              } 
              break;
            case "priceTotalExcTax":
              if (pspEx) {
                pspEx.innerHTML = temp[i].childNodes[0].nodeValue;
              } 
              break;
            case "priceTotalInclExcTax":
              if (pspInclEx) {
                pspInclEx.innerHTML = temp[i].childNodes[0].nodeValue;
              } 
              break;
            case "quantity":
              with (temp[i].childNodes[0]) {
                if (nodeValue != "") {
                  if (psp) {
                    psp.innerHTML += nodeValue;
                  } else {
                    thePrice.innerHTML += nodeValue;
                  }
                  this.updSP();
                }
              }
              break;
    This stopped the Price Updater working

    Then in includes/classes/dynamic_price_updater.php within the prepareOutput function modifying (for now) the area in blue below (a similar modification will be incorporated for when not showing the currency symbols, but first am trying to get through with when they are displayed):
    Code:
        if (DPU_SHOW_CURRENCY_SYMBOLS == 'false') {
          $decimal_places = $currencies->get_decimal_places($_SESSION['currency']);
          $this->responseText['priceTotal'] .= number_format($this->shoppingCart->total, $decimal_places);
        } else {
          $this->responseText['priceTotal'] .= $currencies->display_price($this->shoppingCart->total, zen_get_tax_rate($product_check->fields['products_tax_class_id'])/* 0 */ /* DISPLAY_PRICE_WITH_TAX */);
        }
    Incorporate the following (in red, the "blue" line remains unchanged):
    Code:
        if (DPU_SHOW_CURRENCY_SYMBOLS == 'false') {
          $decimal_places = $currencies->get_decimal_places($_SESSION['currency']);
          $this->responseText['priceTotal'] .= number_format($this->shoppingCart->total, $decimal_places);
        } else {
    
          $product_tax_class_id = zen_products_lookup((int)$_POST['products_id'], 'products_tax_class_id');
          $tax_rate = zen_get_tax_rate($product_tax_class_id); // Rate comes back as a "whole number" such as 20% returns 20 and NOT 0.20
    
          if (DISPLAY_PRICE_WITH_TAX != 'false') {
    
            $price_without_tax = 100.0 * $this->shoppingCart->total / ($tax_rate + 100.0); // Price of product without tax
           
            $this->responseText['priceTotalInclExcTax'] = $this->responseText['priceTotal'] . $currencies->display_price($price_without_tax, 0);
            $this->responseText['priceTotalExcTax'] = $currencies->display_price($price_without_tax, 0);
          } else {
            $this->responseText['priceTotalInclExcTax'] = $this->responseText['priceTotal'] . $currencies->display_price($this->shoppingCart->total + zen_calculate_tax($this->shoppingCart->total, $tax_rate), 0);
            $this->responseText['priceTotalInclTax'] = $currencies->display_price($this->shoppingCart->total + zen_calculate_tax($this->shoppingCart->total , $tax_rate), 0);
          }
    
          $this->responseText['priceTotal'] .= $currencies->display_price($this->shoppingCart->total, 0)/* 0 */ /* DISPLAY_PRICE_WITH_TAX */;
        }
    I may add a "switch" to the jscript file to detect if the incl/exc VAT plugin is installed/enabled/active, but need to identify what would trigger that "knowledge". Otherwise, for non-users of that code, additional javascript is sent to a browser and possibly a little processing speed/time by calculating the opposite price of what the store is showing on page load/attribute change with no other ill effect(s) by this change.
    The DPU doesn't work at the moment. I have followed your instructions clearly twice now with the same result.
    Debbie Harrison
    DVH Design | Web Design blog

 

 

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