Zen Cart Logo
Forums / All Other Contributions/Addons / Dynamic Price Updater

Dynamic Price Updater

Views: 342,272

Results 1,441 to 1,460 of 1,701
14 Apr 2018, 4:49 PM
#1441
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Dynamic Price Updater

mvstudio:

We did. The error wasn't on the mod that was uninstalled at all although I thought it was. In the middle of sleep deprivation things can go wrong in epic unexpected ways, lol!

We installed the mod that we needed TwitchWholesale with attributes and is working as it should, but DPU only shows retail price not wholesale. It shows wholesale price briefly, then switches to retail. How can I make it work?

DPU is designed to generally retrieve the price of the product as reported by the shopping_cart. I don't know what process(es) that plugin uses to determine and report the price(s), but if it is not called as a part of the shopping_cart class, then that additional calculation will need to be fed into/through DPU.

The shopping cart is built in includes/classes/dynamic_price_updater.php, function insertProduct. As part of building the shopping_cart, there are some other variables that are built to support identifying where in product building the customer is at and to support removing additional data from the shopping cart.

Then the price is retrieved from the shopping cart in prepareOutput of the same class file.

The brief display is where the other plugin's price is displayed and then DPU's javascript pick's up and overwrite's on screen text. So whatever is done in that plugin to set the shopping_cart class data will need to be called to update the pricing information of the shopping_cart to support DPU and then may need to be undone after that so that it doesn't happen twice.

14 Apr 2018, 8:06 PM
#1442
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: Dynamic Price Updater

Thank you for getting back to me.
That actually helped a lot in figuring out how to make it work.
Thankfully I had no need to modify any of the DPU files, but tweak a bit the wholesale module.
So far it works.
Thank you and have a great weekend! =)

14 Apr 2018, 9:26 PM
#1443
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Dynamic Price Updater

mvstudio:

Thank you for getting back to me.
That actually helped a lot in figuring out how to make it work.
Thankfully I had no need to modify any of the DPU files, but tweak a bit the wholesale module.
So far it works.
Thank you and have a great weekend! =)

Hopefully you have shared the fix in the thread applicable to that plugin. It may perhaps help others with some similar problem or get the code updated to some extent.

14 Apr 2018, 10:36 PM
#1444
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: Dynamic Price Updater

I will as soon as everything works as it should. I still have some tweaking to do.
Thanks! =)

29 May 2018, 3:37 PM
#1445
tile_mural_store_uk avatar

tile_mural_store_uk

New Zenner

Join Date:
Jun 2016
Location:
Lowestoft
Posts:
7
Plugin Contributions:
0

Re: Dynamic Price Updater

Hello
I really like Plam Template from https://www.templatemonster.com/free-templates/responsive-plumbing-zencart-template-55417.html#tab-support
I have today installed 6 different templates ALL of which worked great the DPU
why can i not getting it working with Plam at http://picture-tiles.co.uk/index.php?main_page=product_info&cPath=48&products_id=24
zencart 1.55f
on a new install

29 May 2018, 4:22 PM
#1446
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Dynamic Price Updater

Tile Mural Store UK:

Hello
I really like Plam Template from https://www.templatemonster.com/free-templates/responsive-plumbing-zencart-template-55417.html#tab-support
I have today installed 6 different templates ALL of which worked great the DPU
why can i not getting it working with Plam at http://picture-tiles.co.uk/index.php?main_page=product_info&cPath=48&products_id=24
zencart 1.55f
on a new install

Well, there are a few validation errors within the form portion of the add-to-cart. Not sure if that is the issue or perhaps something in javascript that loads after DPU that is preventing it's operations from executing. Unfortunately at the moment I'm not able to review javascript related errors/messages to be able to see what is activating and what/where an error is occurring preventing operation.

Glad that it has worked for other setups. Be advised though that templates from that vendor are known to do things "differently" and to not be fully compatible and require editing to make functional.

An example of error reporting: https://validator.w3.org/nu/?doc=http%3A%2F%2Fpicture-tiles.co.uk%2Findex.php%3Fmain_page%3Dproduct_info%26cPath%3D8%26products_id%3D12

29 May 2018, 4:46 PM
#1447
tile_mural_store_uk avatar

tile_mural_store_uk

New Zenner

Join Date:
Jun 2016
Location:
Lowestoft
Posts:
7
Plugin Contributions:
0

Re: Dynamic Price Updater

Big Thank you for quick reply - glad is was not me, i will keep look for a template i like.

6 Jul 2018, 2:24 PM
#1448
preluvbags avatar

preluvbags

New Zenner

Join Date:
Jul 2018
Location:
Singapore
Posts:
5
Plugin Contributions:
0

Re: Dynamic Price Updater

Hi Chrome,

A big thank you for this marvellous plugin! I've installed it on zc ver 1.5.5f and it is working as designed for.

I need some help for my custom script. I've added plus and minus buttons to the product quantity and uses jquery to update the quantity input. My custom script is still working but I couldn't get it to update the price. Could you help me please?

HTML Code:

<div id="cartAdd"> <h2 id="productPrices" class="productGeneral">S$8.00</h2> <span id="button-minus" class="addqty-minus">-</span> <input id="addqty" class="addqtycart" type="text" name="cart_quantity" value="1" maxlength="6" size="4"> <span id="button-plus" class="addqty-plus">+</span> <input type="hidden" name="products_id" value="1"> <input class="cssButton submit_button button button_in_cart" onmouseover="this.className='cssButtonHover button_in_cart button_in_cartHover'" onmouseout="this.className='cssButton submit_button button button_in_cart'" type="submit" value="Add to Cart"> </div>

Javascript:
$(document).ready(function() {
var chkqty = $('#addqty').val();
$("#button-minus").click(function(){
var addqty = $('#addqty').val();
if(parseInt(addqty)>1) {
var newval = parseInt(addqty) - 1;
$('#addqty').val(newval);
return true;
}else{
return false;
}
});
$('#button-plus').click(function(){
var addqty = $('#addqty').val();
var newval = parseInt(addqty) + 1;
$('#addqty').val(newval);
return true;
});
});

Hope you or someone could help me, thank you guys!

6 Jul 2018, 2:58 PM
#1449
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Dynamic Price Updater

preluvbags:

Hi Chrome,

A big thank you for this marvellous plugin! I've installed it on zc ver 1.5.5f and it is working as designed for.

I need some help for my custom script. I've added plus and minus buttons to the product quantity and uses jquery to update the quantity input. My custom script is still working but I couldn't get it to update the price. Could you help me please?

HTML Code:

<div id="cartAdd"> <h2 id="productPrices" class="productGeneral">S$8.00</h2> <span id="button-minus" class="addqty-minus">-</span> <input id="addqty" class="addqtycart" type="text" name="cart_quantity" value="1" maxlength="6" size="4"> <span id="button-plus" class="addqty-plus">+</span> <input type="hidden" name="products_id" value="1"> <input class="cssButton submit_button button button_in_cart" onmouseover="this.className='cssButtonHover button_in_cart button_in_cartHover'" onmouseout="this.className='cssButton submit_button button button_in_cart'" type="submit" value="Add to Cart"> </div> ``` > > Javascript: > ``` $(document).ready(function() { var chkqty = $('#addqty').val(); $("#button-minus").click(function(){ var addqty = $('#addqty').val(); if(parseInt(addqty)>1) { var newval = parseInt(addqty) - 1; $('#addqty').val(newval); return true; }else{ return false; } }); $('#button-plus').click(function(){ var addqty = $('#addqty').val(); var newval = parseInt(addqty) + 1; $('#addqty').val(newval); return true; }); }); ``` > > Hope you or someone could help me, thank you guys! The javascript code that has been added to modify some number related to the overall product quantity, does not force the actions to occur for the updated entry. In the above code, the val is updated, but javascript does not take action on that programattic change. It would take action if the user had specifically modified the field directly. I have also not forced a change of the val to cause such an update, leaving someone that writes such additional code to incorporate the necessary action.

See below (untested) what I think would fix this issue for your site:

$(document).ready(function() {
   var chkqty = $('#addqty').val();
   $("#button-minus").click(function(){
      var addqty	= $('#addqty').val();
      if(parseInt(addqty)>1) {
         var newval	= parseInt(addqty) - 1;
         $('#addqty').val(newval);
         [b]$('#addqty').change();[/b]
         return true;
      }else{
         return false;
      }
   });
   $('#button-plus').click(function(){
      var addqty	= $('#addqty').val();
      var newval	= parseInt(addqty) + 1;
      $('#addqty').val(newval);
      [b]$('#addqty').change();[/b]
      return true;
   });
 });

I added a manual call to the change event for the field being edited by the addition of:

$('#addqty').change();
6 Jul 2018, 3:17 PM
#1450
preluvbags avatar

preluvbags

New Zenner

Join Date:
Jul 2018
Location:
Singapore
Posts:
5
Plugin Contributions:
0

Re: Dynamic Price Updater

Hi mc12345678,

Thank you so much for your super fast response. I tried adding $('#addqty').change() but no luck; it still couldn't update. :(

6 Jul 2018, 4:24 PM
#1451
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Dynamic Price Updater

preluvbags:

Hi mc12345678,

Thank you so much for your super fast response. I tried adding $('#addqty').change() but no luck; it still couldn't update. :(

Have a link to an effected page?

8 Jul 2018, 11:17 AM
#1452
preluvbags avatar

preluvbags

New Zenner

Join Date:
Jul 2018
Location:
Singapore
Posts:
5
Plugin Contributions:
0

Re: Dynamic Price Updater

mc12345678:

Have a link to an effected page?

Apology, it's internal server at the moment so I don't have an external link for you to access. Is there any other way I could get around this?

8 Jul 2018, 12:51 PM
#1453
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Dynamic Price Updater

preluvbags:

Apology, it's internal server at the moment so I don't have an external link for you to access. Is there any other way I could get around this?

Well, I was wondering if there were javascript errors that were causing it not to function properly. Does DPU still function properly if the user manually updates the quantity field while your script is installed? Also is what has been provided for code all that is added to support the additional functionality?

8 Jul 2018, 1:32 PM
#1454
preluvbags avatar

preluvbags

New Zenner

Join Date:
Jul 2018
Location:
Singapore
Posts:
5
Plugin Contributions:
0

Re: Dynamic Price Updater

mc12345678:

Well, I was wondering if there were javascript errors that were causing it not to function properly. Does DPU still function properly if the user manually updates the quantity field while your script is installed? Also is what has been provided for code all that is added to support the additional functionality?

Yes, that's correct. DPU is working as intended and there isn't any js error; no other js has been added till yet.

8 Jul 2018, 4:52 PM
#1455
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Dynamic Price Updater

preluvbags:

Yes, that's correct. DPU is working as intended and there isn't any js error; no other js has been added till yet.
Ok, so went and reproduced the code/situation. While there may still be a better way to implement this, what I did that worked was to instead modify the javascript code like so:

$(document).ready(function() {
    var chkqty = $('#addqty').val();
    $("#button-minus").click(function(){
       var addqty    = $('#addqty').val();
       if(parseInt(addqty)>1) {
          var newval    = parseInt(addqty) - 1;
          $('#addqty').val(newval);
[B]          try {
             init();
          } catch (call_err) {
             console.log(call_err.stack);[/B][B][B]
          }[/B]
[/B]         return true;
       }else{
          return false;
       }
    });
    $('#button-plus').click(function(){
       var addqty    = $('#addqty').val();
       var newval    = parseInt(addqty) + 1;
       $('#addqty').val(newval);
[B]       try {
          init();
       } catch (call_err) {
          console.log(call_err.stack);
[/B][B][B]       }[/B]
[/B]      return true;
    });
  });

This worked for me and would update after every increase/decrease made by clicking the + or -.

9 Jul 2018, 5:20 AM
#1456
preluvbags avatar

preluvbags

New Zenner

Join Date:
Jul 2018
Location:
Singapore
Posts:
5
Plugin Contributions:
0

Re: Dynamic Price Updater

mc12345678:

Ok, so went and reproduced the code/situation. While there may still be a better way to implement this, what I did that worked was to instead modify the javascript code like so:

$(document).ready(function() {
var chkqty = $('#addqty').val();
...

> 
> 
> This worked for me and would update after every increase/decrease made by clicking the + or -.

Thank you Sir! Works like a charm! Appreciate so much of your precious time for helping me out; once again thank you very much!
6 Aug 2018, 11:39 AM
#1457
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,763
Plugin Contributions:
9

Re: Dynamic Price Updater

ZC 1.5.5f PHP 7.1 https://allpecans.com/index.php?main_page=product_info&cPath=38&products_id=138

I've read thru this thread a couple of times trying to figure out how to get this updater to not fire on products that are not priced by attribute. Or, to get it to not fire on individual attributes.

It's an excellent concept, but at the very least annoying to have the price "bouncing around" as you make changes/selections that have no change whatsoever to the price. At its scariest point, I wonder if it violates 508 accessibility in the possible blink rate when adding text. Certain colors blinking at specific rates can result in seizures. I agree that this is stretching things a bit, but having seen a flashing screen cause a seizure makes me understand why 508 specifies no blinking at certain rates. https://webaim.org/articles/seizure

In the link above, it's possible that an unaware typist could set off an improper flicker by typing a Gift Message. Again, I agree that this is worst case scenario. I think that most would agree that it is at least distracting.

In earlier portions of the thread, it was intimated that there were ways of turning off the properties of DPU. Some threads mentioned removing the plus sign. I have not been successful in finding any way to turn this off individually.

Best case in the above example would be to not fire DPU at all as the item is not priced by attributes. However, even an item priced by attributes might need to turn off one attribute. The Gift Message at https://allpecans.com/index.php?main_page=product_info&cPath=26&products_id=115 being an example.

Not having the expertise to mess with jscript_dynamin_price_updater.php, I'm hoping some of you have suggestions.

THANX

6 Aug 2018, 8:23 PM
#1458
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Dynamic Price Updater

This was something brought up as an issue over the weekend in the github repository.

The upfront way to disable it for no attributes affecting price and not displaying the quantity box would be to assess all of the attributes to determine if they have an affect on price, if they do not then to disable the javascript in its entirety for the product. This is supposed to be accomplished by the functions_lookups.php function of zen_has_product_attributes_values($products_id); however, has a potential flaw in the pre-ZC 1.5.6 version of the file in that if the sum of options_values_price is 0 (say made of 3 values such as -1, 0, and 1), then it would appear that none of the attributes of the product have an effect on the price. Unfortunately the function also does not evaluate the presence of text field pricing changes (so could report false when the text fields have an effect on pricing). So, there are two ways being considered to implement that code. One is to directly use the code that has been incorporated into ZC 1.5.6 to correct this issue, the other is to just use the function and as seen fit to update the internal code of the function. Regardless it may be best for stable operation to build functions within the DPU class to test for these conditions.

For individual attributes, where a product has more than one attribute, I'm thinking that in the attributes build, to include a html to support skipping the updating or as part of the above review, to build a data set that would prevent adding the applicable "change" action to the applicable field. Thing is that the current operation pretty much is indiscriminate about what the field is and looks mostly at what type of field it is. Adding additional "checks" against it necessitates additional consistency in the template, regardless the designer.

Otherwise disabling the "image" replacement/presentation (setting show a small loading graphic set to false) would reduce flicker and just change the price where/when appropriate.

I'm working on implementing the above to become more detailed; however, want to be mindful of maintaining flexibility of integration.

6 Aug 2018, 9:53 PM
#1459
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,763
Plugin Contributions:
9

Re: Dynamic Price Updater

Thanks for taking a look.

8 Aug 2018, 4:58 AM
#1460
devlyn avatar

devlyn

New Zenner

Join Date:
Jan 2006
Location:
Texas
Posts:
64
Plugin Contributions:
0

Re: Dynamic Price Updater

Zen version 1.5.5f
I was using a different template and got dynamic price updater working great! Then I switched to a new template and no love. I've tried uninstalling and reinstalling.

Can you put eyes on it and see if there's somehing obvious I'm missing? http://odd-bodkin.com/chemise/sylvia/broadcloth