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

Dynamic Price Updater

Views: 342,272

Results 521 to 540 of 1,701
17 Oct 2009, 11:06 AM
#521
ojm avatar

ojm

New Zenner

Join Date:
Oct 2007
Posts:
68
Plugin Contributions:
0

Dynamic Price Updater

Apologies if this has already been brought up, but is there any code changes available to make this work with qty discounts?

Cheers Chrome!

21 Oct 2009, 1:49 PM
#522
chrome avatar

chrome

Zen Follower

Join Date:
Jul 2005
Location:
Wales, UK
Posts:
392
Plugin Contributions:
0

Re: Dynamic Price Updater

Hi OJM

It depends which version of the Updater you're using... V2 should handle quantity discounts out of the box while V1 wasn't capable of any discounts at all

HTH

Dan

22 Oct 2009, 5:43 PM
#523
new2u avatar

new2u

Zen Follower

Join Date:
Sep 2009
Posts:
186
Plugin Contributions:
0

Re: Dynamic Price Updater

I have installed the DPUv2 and it seems to work great! However I just initiated a sale price on all of my products and the sale price does not reflect in the update. See here

Maybe I jsut set up the options wrong... not quite sure..

22 Oct 2009, 7:18 PM
#524
new2u avatar

new2u

Zen Follower

Join Date:
Sep 2009
Posts:
186
Plugin Contributions:
0

Re: Dynamic Price Updater

Never mind... Just a quick setting... thx for the great mod

24 Oct 2009, 1:36 PM
#525
ojm avatar

ojm

New Zenner

Join Date:
Oct 2007
Posts:
68
Plugin Contributions:
0

Re: Dynamic Price Updater

Chrome:

Hi OJM

It depends which version of the Updater you're using... V2 should handle quantity discounts out of the box while V1 wasn't capable of any discounts at all

HTH

Dan

Brilliant, cheers Dan, missed the v2!

new2u:

Never mind... Just a quick setting... thx for the great mod

What setting did you have to change?

27 Oct 2009, 5:31 PM
#526
ksookma avatar

ksookma

Zen Follower

Join Date:
Aug 2009
Posts:
212
Plugin Contributions:
1

Re: Dynamic Price Updater

Hey Chrome, just wondering if you had gotten an update to the code yet?

28 Oct 2009, 11:47 AM
#527
damiantaylor avatar

damiantaylor

Zen Follower

Join Date:
Aug 2009
Posts:
244
Plugin Contributions:
0

Re: Dynamic Price Updater

I just installed this great mod and cannot get it to work with my sale price either.

My test site is here:
http://snow.byethost8.com/shop/index.php?main_page=product_info&cPath=7&products_id=1

When the page initially loads, the price shows:

Starting at: £15.00 £6.00
Save 60% off

The £15.00 has a strikethrough.

When price updater kicks in, the price changes to:
Starting at £15.00

I've found this post which I think explains how to rectify this:
http://www.zen-cart.com/forum/showthread.php?p=507151&highlight=sale#post507151

But I was wondering if there is a better or easier way than hacking the code?

Also, is there a way to stop the price updater kicking in when I change the quantity in the add to cart box?

30 Oct 2009, 11:07 PM
#528
eentje avatar

eentje

Zen Follower

Join Date:
Jan 2009
Location:
The Netherlands/Germany
Posts:
144
Plugin Contributions:
4

Re: Dynamic Price Updater

Hi Chrome and all...

I've installed the price updater on a couple of shops without a problem.

But now i ran into one.

It somehow doesn't work on tabbed products when the attributes are in a tab.

Is there a workaround or a quick fix?

TIA, eentje

1 Nov 2009, 2:35 AM
#529
testerservers avatar

testerservers

New Zenner

Join Date:
Jun 2008
Posts:
71
Plugin Contributions:
0

Re: Dynamic Price Updater

Thanks! :D.. I was looking for this capability. An old php shopping cart I used does that by default, which is lacking on Zen Cart.

I was looking on this forum to solve a different issue, but somehow I came across this thread, and when I read the original post, I knew I had to have it. No question about it.

I just unzipped the .zip file, then uploaded the file and two dir in about 3 seconds... went to my front page, hit Refresh, then I went to a product page, and sure enough, it updates as the attributes/options change.

This is something that should be a core part of Zen Cart.

Kevin

2 Nov 2009, 12:08 AM
#530
ksookma avatar

ksookma

Zen Follower

Join Date:
Aug 2009
Posts:
212
Plugin Contributions:
1

Re: Dynamic Price Updater

eentje, I think the tabs are causing the same problem for us, I'll be troubleshooting this sometime this week. If I fix the problem Ill post it. :wink:

https://www.ribbonsbaskets.com

8 Nov 2009, 2:46 AM
#531
nyczhenry avatar

nyczhenry

New Zenner

Join Date:
Nov 2007
Posts:
15
Plugin Contributions:
0

Re: Dynamic Price Updater

we need to get this specials thing working!
:flex:

8 Nov 2009, 9:14 PM
#532
bigsy85 avatar

bigsy85

New Zenner

Join Date:
Aug 2008
Posts:
50
Plugin Contributions:
0

Re: Dynamic Price Updater

Has anyone managed to get this working with other AJAX modules, such as the attributes change main image mod?

10 Nov 2009, 3:19 PM
#533
zahid_hussain avatar

zahid_hussain

New Zenner

Join Date:
Sep 2009
Posts:
54
Plugin Contributions:
0

Re: Dynamic Price Updater

Hi Every one!!!

My problem is that, I do my all calculation on price, but now my new price will not to add as final price as I have no idea about final price variable , that I will assigned my final value to that that variable,
my link is:- http://team-kh.awpdc.com/~zadhnanr/bestlaminate.net/index.php?main_page=product_info&cPath=106&products_id=253

Please let me know if you have an idea about this situation.

But plz be urgent thanks.:clap:
Thanks
Zahid.

13 Nov 2009, 1:49 PM
#534
bigsy85 avatar

bigsy85

New Zenner

Join Date:
Aug 2008
Posts:
50
Plugin Contributions:
0

Re: Dynamic Price Updater

Hi all,

I've mentioned a problem I've had before but still not getting anywhere so I've decided to offer £50 sent via PayPay to whoever can fix it.

My problem is I use this mod with the 'attribute image replaces main image' mod. Both work together until the page stops loading then locks down, then only the price updates, and the image does not change?

I know its something to do with Ajax objects.
I think what needs to be done is put both Ajax requests from each mod into one. I have pasted the file including both mods which need combining to work.

I will really appreciate anyone's help, and I'm serious about the £50.

Code for DPU


<?php /** * @package Dynamic Price Updater * @copyright Dan Parry (Chrome) * @author Dan Parry (Chrome) * @version 2.0a (roughly) * @contact [email protected] * @licence This module is free to distribute and use as long as the above copyright message is left in tact */ // define some running vars $load = true; // if any of the PHP conditions fail this will be set to false and DPU won't be fired up define('DPU_PRODUCT_FORM', 'cart_quantity'); // this should never change define('DPU_PRICE_ELEMENT_ID', 'productPrices'); // this is the ID of the element where your price is dieplayed $load = true; $pid = (!empty($_GET['products_id']) ? intval($_GET['products_id']) : 0); if (0==$pid) { $load = false; } elseif (zen_get_products_price_is_call($pid) || zen_get_products_price_is_free($pid) || STORE_STATUS > 0) { $load = false; } $pidp = zen_get_products_display_price($pid); if (empty($pidp)) $load = false; if ($load) { ?> <script language="javascript" type="text/javascript"> // Hidey codey <![CDATA[ // Set some global vars var theFormName = '<?php echo DPU_PRODUCT_FORM; ?>'; var theForm = false; var theURL = '<?php echo DIR_WS_CATALOG; ?>dpu_ajax.php'; var _secondPrice = 'cartAdd'; var objSP = false; // please don't adjust this var request = new Array(); function objXHR() { // scan the function clicked and act on it using the Ajax interthingy var url; // URL to send HTTP requests to var timer; // timer for timing things var XHR; // XMLHttpRequest object var _responseXML; // holds XML formed responses from the server var _responseText; // holds any textual response from the server var request; // associative array to hold requests to be sent request = new Array(); this.createXHR(); } objXHR.prototype.createXHR = function () { // this code has been modified from the Apple developers website this.XHR = false; // branch for native XMLHttpRequest object if(window.XMLHttpRequest) { // decent, normal, law abiding browsers try { // make sure the object can be created this.XHR = new XMLHttpRequest(); } catch(e) { // it can't this.XHR = false; } // branch for IE/Windows ActiveX version } else if(window.ActiveXObject) { // this does stuff too try { this.XHR = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { this.XHR = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { this.XHR = false; } } } } objXHR.prototype.getData = function(strMode, resFunc) { // send a request to the server in either GET or POST strMode = (strMode.toLowerCase() == 'post' ? 'post' : 'get'); var _this = this; // scope resolution this.createXHR(); if (this.XHR) { this.XHR.onreadystatechange = function () { if (_this.XHR.readyState == 4) { // only if "OK" if (_this.XHR.status == 200) { _this._responseXML = _this.XHR.responseXML; _this._responseText = _this.XHR.responseText; _this.responseHandler(resFunc); } else { alert('Status returned - ' + _this.XHR.statusText); } } } this.XHR.open(strMode.toLowerCase(), this.url+(strMode.toLowerCase() == 'get' ? '?' + this.compileRequest() : ''), true); if (strMode.toLowerCase() == 'post') this.XHR.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); this.XHR.send(this.compileRequest()); } else { var mess = "I couldn't contact the server!\n\nIf you use IE please allow ActiveX objects to run"; alert (mess); } } objXHR.prototype.compileRequest = function () { // parse the request array into a URL encoded string var ret = ''; // return request string for (var e in request) { ret += e + '=' + request[e] + '&'; } return (ret.substr(0, ret.length - 1)); } objXHR.prototype.responseHandler = function (theFunction) { // redirect responses from the server to the right function request = new Array(); eval('this.'+theFunction); } objXHR.prototype.getPrice = function () { this.url = theURL; var n=theForm.elements.length; for (var i=0; i<n; i++) { var el = theForm.elements\[i]; switch (el.type) { <?php // I'm not sure this even needed as a switch; testing needed ?> case 'select': case 'select-one': case 'text': case 'hidden': request[el.name] = escape(el.value); break; case 'checkbox': case 'radio': if (true == el.checked) request[el.name] = escape(el.value); } } this.getData('post', 'handlePrice()'); } objXHR.prototype.handlePrice = function () { var thePrice = document.getElementById('<?php echo DPU_PRICE_ELEMENT_ID; ?>'); var type = this._responseXML.getElementsByTagName('responseType')[0].childNodes[0].nodeValue; if (type == 'error') { this.showErrors(); } else { var temp = this._responseXML.getElementsByTagName('responseText'); for(var i=0, n=temp.length; i<n; i++) { var type = temp\[i].getAttribute('type'); switch (type) {<?php // the 'type' attribute defines what type of information is being provided ?> case 'priceTotal': thePrice.innerHTML = temp\[i].childNodes[0].nodeValue; if (_secondPrice !== false) updSP(); break; case 'quantity': with (temp\[i].childNodes[0]) { if (nodeValue != '') { thePrice.innerHTML += nodeValue; updSP(); } } break; } } } } function updSP() { // adjust the second price display; create the div if necessary var flag = false; // error tracking flag if (_secondPrice !== false) { // second price is active var centre = document.getElementById('productGeneral'); var temp = document.getElementById('<?php echo DPU_PRICE_ELEMENT_ID; ?>'); var itemp = document.getElementById(_secondPrice); if (objSP === false) { // create the second price object if (!temp || !itemp) flag = true; if (!flag) { objSP = temp.cloneNode(true); objSP.id = temp.id + 'Second'; itemp.parentNode.insertBefore(objSP, itemp.nextSibling); } } objSP.innerHTML = temp.innerHTML; } } objXHR.prototype.showErrors = function () { var errorText = this._responseXML.getElementsByTagName('responseText'); var alertText = ''; var n=errorText.length; for (var i=0; i<n; i++) { alertText += '\n- '+errorText\[i].childNodes[0].nodeValue; } alert ('Error! Message reads:\n\n'+alertText); } var xhr = new objXHR; function init() { var n=document.forms.length; for (var i=0; i<n; i++) { if (document.forms\[i].name == theFormName) { theForm = document.forms\[i]; continue; } } var n=theForm.elements.length; for (var i=0; i<n; i++) { switch (theForm.elements\[i].type) { case 'select': case 'select-one': theForm.elements\[i].onchange = function () { xhr.getPrice(); } break; case 'text': theForm.elements\[i].onkeyup = function () { xhr.getPrice(); } break; case 'checkbox': case 'radio': theForm.elements\[i].onclick = function () { xhr.getPrice(); } break; } } xhr.getPrice(); } <?php // the following statements should allow multiple onload handlers to be applied // I know this type of event registration is technically deprecated but I decided to use it because I haven't before // There shouldn't be any fallout from the downsides of this method as only a single function is registered (and in the bubbling phase of each model) // For backwards compatibility I've included the traditional DOM registration method ?> try { // the IE event registration model window.attachEvent('onload', init); } catch (e) { // W3C event registration model window.addEventListener('load', init, false); } finally { window.onload = init; } // Endy hidey ]]></script><?php } ?>

________Code for attributes replace main image

<!-- ATTRIBUTE IMAGE REPLACE MAIN IMAGE--> <script language="javascript" type="text/javascript"> function changebgcolor(id,color) { document.getElementById(id).style.backgroundColor=color; } function changevalue(field,color) { for(var i=0;i<document.cart_quantity.elements.length;i++) { if(document.cart_quantity.elements\[i].name==field) { document.cart_quantity.elements\[i].value=color; } } } var xmlHttp function getattribimage(attribfield,width,height,products_options_values_id,products_id) { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="attrib_prod_info.php"; url=url+"?width="+width+"&height="+height+"&products_options_values_id="+products_options_values_id+"&products_id="+products_id; xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4) { var product_color_image=xmlHttp.responseText; if(product_color_image!=''){ document.getElementById('productMainImage').innerHTML = product_color_image; } } } //-------------------------------------------------------- function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } </script>
13 Nov 2009, 2:18 PM
#535
121webconsultancy avatar

121webconsultancy

New Zenner

Join Date:
May 2007
Posts:
42
Plugin Contributions:
0

Re: Dynamic Price Updater

Hi Dan or anybody that can help ...

Simple question with a simple answer I hope ..

http://www.prestigeringcompany.com/index.php?main_page=product_info&cPath=1_2_3&products_id=56

The price i.e: Your Price: £110.00, appears twice on the page. I only want the second/lower price to appear. How would I go about this?

Many thanks in advance.

Steve

13 Nov 2009, 5:49 PM
#536
chrome avatar

chrome

Zen Follower

Join Date:
Jul 2005
Location:
Wales, UK
Posts:
392
Plugin Contributions:
0

Re: Dynamic Price Updater

Hi all

I know I've been highly delinquent in my support of the Updater... For this I apologise; I've some serious employment issues and have hardly any time

Now, I know I've said this before but I am going to fix the Ajax issue (browsers permitting of course)

121: Your issue can be fixed by adjusting the line

var _secondPrice = 'cartAdd';

to

var _secondPrice = false;

HTH

Again, sorry everyone... I'll get back to work on this at my earliest opportunity

Dan

23 Nov 2009, 4:47 AM
#537
exoticcorpse avatar

exoticcorpse

New Zenner

Join Date:
Jan 2008
Posts:
35
Plugin Contributions:
0

Re: Dynamic Price Updater

Can anyone suggest how to remove or hide the '(+$85.00)' from the attribute dropdown. With the dynamic updater, displaying this is kind of irrelevent as the price changed when the attribute is selected. It would make for a much cleaner display if this price increase did not display. Removing it from the modules/attributes.php causes problems with the updater though, so if anyone could make any suggestions, that would be appreciated.

24 Nov 2009, 12:10 AM
#538
boggled avatar

boggled

Zen Follower

Join Date:
Mar 2006
Location:
Tennessee
Posts:
286
Plugin Contributions:
0

Re: Dynamic Price Updater

exoticcorpse:

Can anyone suggest how to remove or hide the '(+$85.00)' from the attribute dropdown. With the dynamic updater, displaying this is kind of irrelevent as the price changed when the attribute is selected. It would make for a much cleaner display if this price increase did not display. Removing it from the modules/attributes.php causes problems with the updater though, so if anyone could make any suggestions, that would be appreciated.

This post explains how:

http://www.zen-cart.com/forum/showpost.php?p=576102&postcount=9

Just remember to make a backup copy of your original file before making the modifications in case something goes wrong.

:smile:

24 Nov 2009, 3:27 AM
#539
stiggy100 avatar

stiggy100

Zen Follower

Join Date:
Jan 2009
Posts:
298
Plugin Contributions:
0

Re: Dynamic Price Updater

Hi All, Superb Addon, really a useful tool...

I found a small issue which I have worked around but thought I would post.

If you have the 'checkbox' attributes option, if you select two, it will not add the base price and only the(+ given_value) to the one already selected.

So if I'm selling size 1 for $20, size 2 is +$20 and size 3 is +40

If I were to sect options 2 AND 3 the price would be $80 and not $100 as it should be as on the 2nd option it misses the base price. I hope this makes sense...

Using radio buttons prevents this happening. No big deal, just thought I would bring it up.

Also - Where can I rename the 'Your Price' do I have to add a comment in order to do this as it seems to be auto generated in the jscript_ajax_update.php file???

One final thing, can I remove the brackets and (1) after Your Price as it will only ever be showing 1 on my site and its a bit pointless for my particular needs?

Thanks

Steve

24 Nov 2009, 11:08 PM
#540
oavs avatar

oavs

Totally Zenned

Join Date:
Jan 2006
Location:
Downunder - QLD - Gold Coast
Posts:
921
Plugin Contributions:
0

Re: Dynamic Price Updater

Great mod. I have been using it with great success . Recently client notified me that the prices showing in the list view does not reflect the prices set by the attributes. Prices in the list view (basically the index page) are listing old prices prior to installation of 'Dynamic Price Updater ' .

How would I go about fixing that. My version of of Dynamic Price Updater was installed around August version v2.03

Thanks