-
Re: Dynamic Price Updater
Quote:
Originally Posted by
mc12345678
This is more than likely a jQuery related issue which is a different set of skills than php. :) If can identify what those changes were, perhaps they could be identified as helpful or otherwise further corrected.
Ah! I wouldn't know at all about that.
These are the files I mentioned we modified back then.
includes/modules/pages/product_info/jscript_dynamic_price_updater.php
PHP Code:
<?php
/**
* @package Dynamic Price Updater
* @copyright Dan Parry (Chrome) / Erik Kerkhoven (Design75)
* @original author Dan Parry (Chrome)
* @version 3.0
* @licence This module is released under the GNU/GPL licence
*/
if (defined('DPU_STATUS') && DPU_STATUS === 'true') {
$load = true; // if any of the PHP conditions fail this will be set to false and DPU won't be fired up
$pid = (!empty($_GET['products_id']) ? (int)$_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) {
if (!defined('DPU_PRODUCTDETAILSLIST_PRODUCT_INFO_QUANTITY')) define('DPU_PRODUCTDETAILSLIST_PRODUCT_INFO_QUANTITY', 'productDetailsList_product_info_quantity');
?>
<script type="text/javascript">
// <![CDATA[
// Set some global vars
var theFormName = "<?php echo DPU_PRODUCT_FORM; ?>";
var theForm = false;
var theURL = "<?php echo DIR_WS_CATALOG; ?>ajax.php";
// var theURL = "<?php echo DIR_WS_CATALOG; ?>dpu_ajax.php";
var _secondPrice = <?php echo (DPU_SECOND_PRICE !== '' ? '"' . DPU_SECOND_PRICE . '"' : 'false'); ?>;
var objSP = false; // please don't adjust this
var DPURequest = [];
// Updater sidebox settings
var objSB = false;<?php // this holds the sidebox object // IE. Left sidebox false should become document.getElementById('leftBoxContainer');
// For right sidebox, this should equal document.getElementById('rightBoxContainer');
// Perhaps this could be added as an additional admin configuration key. The result should end up being that a new SideBox is added
// before whatever is described in this "search". So this may actually need to be a div within the left or right boxes instead of the
// left or right side box.
// May also be that this it is entirely unnecessary to create a sidebox when one could already exist based on the file structure.
if (DPU_SHOW_LOADING_IMAGE === 'true') { // create the JS object for the loading image ?>
var imgLoc = "replace"; // Options are "replace" or , "" (empty)
var origPrice;
var loadImg = document.createElement("img");
loadImg.src = "<?php echo DIR_WS_IMAGES; ?>ajax-loader.gif";
loadImg.id = "DPULoaderImage";
var loadImgSB = document.createElement("img");
loadImgSB.src = "<?php echo DIR_WS_IMAGES; ?>ajax-loader.gif";
loadImgSB.id = "DPULoaderImageSB";
loadImgSB.style.margin = "auto";
// loadImg.style.display = 'none';
<?php } ?>
function objXHR() { // scan the function clicked and act on it using the Ajax interthingy
var url; // URL to send HTTP DPURequests to
var timer; // timer for timing things
var XHR; // XMLHttpDPURequest object
var responseXML; // holds XML formed responses from the server
var responseText; // holds any textual response from the server
// var DPURequest = []; // associative array to hold DPURequests to be sent
// DPURequest = new Array();
this.createXHR();
}
objXHR.prototype.createXHR = function () { // this code has been modified from the Apple developers website
this.XHR = false;
// branch for native XMLHttpDPURequest 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
var tryNext = false;
try {
this.XHR = new ActiveXObject("Msxml2.XMLHTTP");
} catch(f) {
tryNext = true;
}
if (tryNext) {
try {
this.XHR = new ActiveXObject("Microsoft.XMLHTTP");
} catch(g) {
this.XHR = false;
}
}
}
};
objXHR.prototype.getData = function(strMode, resFunc, combinedData) { // send a DPURequest to the server in either GET or POST
strMode = (strMode.toLowerCase() === "post" ? "post" : "get");
var _this = this; // scope resolution
if (((typeof zcJS === "undefined" || !zcJS) ? this.XHR : zcJS)) {
if (typeof zcJS === "undefined" || !zcJS) {
this.createXHR();
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, _this);
} else {
console.log("Status returned - " + _this.XHR.statusText);
}
}
};
this.XHR.open(strMode.toLowerCase(), "<?php echo zen_decode_specialchars(zen_href_link('ajax.php', zen_get_all_get_params(array('action','pid')) . 'act=DPU_Ajax&method=dpu_update', $request_type, true, true, true)); ?>" + (strMode.toLowerCase() === "get" ? "&" + this.compileRequest() : ""), true);
/* this.XHR.open(strMode.toLowerCase(), this.url+"?act=DPU_Ajax&method=dpu_update"+(strMode.toLowerCase() == "get" ? "&" + this.compileRequest() : ""), true);*/
if (strMode.toLowerCase() === "post") {
this.XHR.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
this.XHR.setRequestHeader("X-Requested-With", "XMLHttpRequest");
}
this.XHR.send(combinedData.XML);
} else {
var option = {
url: "<?php echo zen_decode_specialchars(zen_href_link('ajax.php', zen_get_all_get_params(array('action','pid')) . 'act=DPU_Ajax&method=dpu_update', $request_type, true, true, true)); ?>",
data: combinedData.JSON,
timeout : 30000
};
zcJS.ajax(option).done(
function (response,textStatus,jqXHR) {
_this.responseJSON = jqXHR.responseJSON;
_this.responseText = jqXHR.responseText;
if (!_this.responseJSON && _this.responseText) {
try {
_this.responseJSON = JSON.parse(_this.responseText);
} catch (e) {
console.log(e.stack);
}
}
_this.responseHandler(resFunc, _this);
}
).fail( function(jqXHR,textStatus,errorThrown) {
<?php if (DPU_SHOW_LOADING_IMAGE === 'true') { ?>
var thePrice = document.getElementById("<?php echo DPU_PRICE_ELEMENT_ID; ?>");
var test = thePrice.getElementsByTagName("span");
var psp = false;
var a;
var b = test.length;
for (a = 0; a < b; a += 1) {
if (test[a].className === "productSpecialPrice" || test[a].className === "productSalePrice" || test[a].className === "productSpecialPriceSale") {
psp = test[a];
}
}
if (typeof(loadImg) !== "undefined" && loadImg.parentNode !== null && loadImg.parentNode.id === thePrice.id && imgLoc !== "replace") {
if (psp) {
psp.removeChild(loadImg);
} else {
thePrice.removeChild(loadImg);
}
} else if (typeof(loadImg) !== "undefined" && imgLoc === "replace") {
_this.updateInnerHTML(origPrice, psp, thePrice);
}
if (_secondPrice !== false) {
_this.updSP();
}
<?php } ?>
//alert("Status returned - " + textStatus);
});
}
} 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 DPURequest array into a URL encoded string
var ret = ""; // return DPURequest string
var e;
for (e in DPURequest) {
ret += e + "=" + DPURequest[e] + "&";
}
return (ret.substr(0, ret.length - 1));
};
objXHR.prototype.responseHandler = function (theFunction, results) { // redirect responses from the server to the right function
DPURequest = new Array();
this[theFunction](results); // Eliminates concern of improper evaluation; however, does limit the response value(s)
};
objXHR.prototype.getPrice = function () {
var pspClass = false;
<?php if (DPU_SHOW_LOADING_IMAGE === 'true') { ?>
var psp = false;
// if (imgLoc === "replace") {
var thePrice = document.getElementById("<?php echo DPU_PRICE_ELEMENT_ID; ?>");
var test = false;
if (thePrice) {
test = thePrice.getElementsByTagName("span");
}
var a;
var b = test.length;
for (a = 0; a < b; a += 1) {
if (test[a].className === "productSpecialPrice" || test[a].className === "productSalePrice" || test[a].className === "productSpecialPriceSale") {
psp = test[a];
}
}
if (!psp) {
psp = thePrice;
}
if (psp) {
pspClass = psp.className;
origPrice = psp.innerHTML;
}
// }
if (psp && imgLoc === "replace") {
if (thePrice) {
loadImg.style.display = "inline"; //'block';
// pspClass = psp.className;
var pspStyle = psp.currentStyle || window.getComputedStyle(psp);
loadImg.style.height = pspStyle.lineHeight; // Maintains the height so that there is not a vertical shift of the content.
origPrice = psp.innerHTML;
this.updateInnerHTML(loadImg.outerHTML, false, psp, true);
}
} else {
document.getElementById("<?php echo DPU_PRICE_ELEMENT_ID; ?>").appendChild(loadImg);
}
if (document.getElementById("dynamicpriceupdatersidebox")) {
var theSB = document.getElementById("dynamicpriceupdatersideboxContent");
// theSB.innerHTML = "";
this.updateInnerHTML("", false, theSB, true);
theSB.style.textAlign = "center";
theSB.appendChild(loadImgSB);
}
<?php } ?>
this.url = theURL;
var n=theForm.elements.length;
var temp = "";
var jsonData = {};
var combinedData = {};
var el;
var i;
for (i = 0; i < n; i += 1) {
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 "textarea":
case "text":
case "number":
case "hidden":
temp += el.name+"="+encodeURIComponent(el.value)+"&";
if (!(el.name in jsonData)) { // Ensure not to replace an existing value. I.e. drop a duplicate value.
jsonData[el.name] = el.value;
}
break;
case "checkbox":
case "radio":
if (true === el.checked) {
temp += el.name+"="+encodeURIComponent(el.value)+"&";
if (!(el.name in jsonData)) { // Ensure not to replace an existing value. I.e. drop a duplicate value.
jsonData[el.name] = el.value;
}
}
break;
}
}
if (!("products_id" in jsonData)) {
temp += "products_id=<?php echo (int)$pid; ?>&";
jsonData.products_id = <?php echo (int)$pid; ?>;
}
if (pspClass) {
temp += "pspClass="+encodeURIComponent(pspClass)+"&";
jsonData.pspClass = pspClass;
}
temp += "stat=main&";
jsonData.stat = "main";
temp += "outputType=XML&";
jsonData.outputType = "JSON";
temp = temp.substr(0, temp.length - 1);
combinedData.XML = temp;
combinedData.JSON = jsonData;
this.getData("post", "handlePrice", combinedData);
//temp = temp.substr(0, temp.length - 1)
//this.getData("post", "handlePrice", temp);
};
objXHR.prototype.updateInnerHTML = function (storeVal, psp, obj, replace) {
if (typeof(replace) === "undefined") {
replace = true;
}
if (storeVal !== "") {
if (psp) {
if (replace) {
psp.innerHTML = storeVal;
} else {
psp.innerHTML += storeVal;
}
} else {
if (replace) {
obj.innerHTML = storeVal;
} else {
obj.innerHTML += storeVal;
}
}
if (_secondPrice !== false) {
this.updSP();
}
}
};
objXHR.prototype.handlePrice = function (results) {
var thePrice = document.getElementById("<?php echo DPU_PRICE_ELEMENT_ID; ?>");
if (typeof(loadImg) !== "undefined" && loadImg.parentNode !== null && loadImg.parentNode.id === thePrice.id && imgLoc !== "replace") {
thePrice.removeChild(loadImg);
}
// use the spans to see if there is a discount occuring up in this here house
var test = thePrice.getElementsByTagName("span");
var psp = false;
var a;
var b = test.length;
var pdpt = false;
for (a = 0; a < b; a += 1) {
if (test[a].className === "normalprice") {
pdpt = test[a];
}
if (test[a].className === "productSpecialPrice" || test[a].className === "productSalePrice" || test[a].className === "productSpecialPriceSale") {
psp = test[a];
}
}
// var type = this.responseXML.getElementsByTagName("responseType")[0].childNodes[0].nodeValue;
var type;
var updateSidebox;
if (results.responseXML) {
type = results.responseXML.getElementsByTagName("responseType")[0].childNodes[0].nodeValue;
} else if (results.responseJSON) {
type = results.responseJSON.responseType;
}
if (document.getElementById("dynamicpriceupdatersidebox")) {
var theSB = document.getElementById("dynamicpriceupdatersideboxContent");
theSB.style.textAlign = "left";
var sbContent = "";
updateSidebox = true;
} else {
updateSidebox = false;
}
if (type === "error") {
this.showErrors();
} else {
// var temp = this.responseXML.getElementsByTagName("responseText");
var temp;
if (results.responseXML) {
temp = results.responseXML.getElementsByTagName("responseText");
} else if (results.responseJSON) {
temp = results.responseJSON.data;
}
/* for(var i=0, n=temp.length; i<n; i++) {
var type = temp[i].getAttribute("type");*/
var storeVal;
var i;
for(i in temp) {
if (results.responseXML) {
if (!(temp.hasOwnProperty(i))) {
continue;
}
type = temp[i].getAttribute("type");
storeVal = temp[i].childNodes[0].nodeValue;
} else if (results.responseJSON) {
type = i;
storeVal = temp[i];
}
switch (type) {<?php // the 'type' attribute defines what type of information is being provided ?>
case "preDiscPriceTotal":
if (pdpt) {
this.updateInnerHTML(storeVal, pdpt, thePrice, true);
}
break;
case "preDiscPriceTotalText":
if (pdpt) {
// $(thePrice).contents().first()[0].textContent = storeVal;
if (thePrice.firstChild.nodeType === 3) {
thePrice.firstChild.nodeValue = storeVal;
}
}
break;
case "priceTotal":
/*if (psp) {
psp.innerHTML = temp[i].childNodes[0].nodeValue;
} else {
thePrice.innerHTML = temp[i].childNodes[0].nodeValue;
}
if (_secondPrice !== false) {
this.updSP();
}*/
this.updateInnerHTML(storeVal, psp, thePrice, true);
break;
case "quantity":
/* with (temp[i].childNodes[0]) {
if (nodeValue != "") {
if (psp) {
psp.innerHTML += nodeValue;
} else {
thePrice.innerHTML += nodeValue;
}
this.updSP();
}
}*/
this.updateInnerHTML(storeVal, psp, thePrice, false);
break;
case "weight":
var theWeight = document.getElementById("<?php echo DPU_WEIGHT_ELEMENT_ID; ?>");
if (theWeight) {
// theWeight.innerHTML = temp[i].childNodes[0].nodeValue;
this.updateInnerHTML(storeVal, false, theWeight, true);
}
break;
case "sideboxContent":
if (updateSidebox) {
// sbContent += temp[i].childNodes[0].nodeValue;
sbContent += storeVal;
}
break;
case "stock_quantity":
var theStockQuantity = document.getElementById("<?php echo DPU_PRODUCTDETAILSLIST_PRODUCT_INFO_QUANTITY; ?>");
if (theStockQuantity) {
this.updateInnerHTML(storeVal, false, theStockQuantity, true);
}
break;
}
}
}
if (updateSidebox) {
// theSB.innerHTML = sbContent;
this.updateInnerHTML(sbContent, false, theSB, true);
}
};
objXHR.prototype.updSP = function () {
// 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);
flag = false;
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;
}
};
<?php
$show_dynamic_price_updater_sidebox = true;
if ($show_dynamic_price_updater_sidebox === true)
{
?>
objXHR.prototype.createSB = function () { // create the sidebox for the attributes info display
if (!(document.getElementById("dynamicpriceupdatersidebox")) && objSB) {
var tempC = document.createElement("div");
tempC.id = "dynamicpriceupdatersideboxContent";
tempC.className = "sideBoxContent";
tempC.innerHTML = "If you can read this Chrome has broken something";
objSB.appendChild(tempC);
temp.parentNode.insertBefore(objSB, temp);
}
};
<?php
}
?>
objXHR.prototype.showErrors = function () {
// var errorText = this.responseXML.getElementsByTagName("responseText");
var alertText = "";
var errVal;
var errorText;
var i;
if (typeof zcJS === "undefined" || !zcJS) {
errorText = this.responseXML.getElementsByTagName("responseText");
} else {
errorText = this.responseJSON.responseText;
}
//var n=errorText.length;
for (i in errorText/*var i=0; i<n; i++*/) {
if (!(errorText.hasOwnProperty(i))) {
continue;
}
if (typeof zcJS === "undefined" || !zcJS) {
errVal = errorText[i].childNodes[0].nodeValue;
} else {
errVal = i;
}
alertText += "\n- "+errVal;
}
alert ("Error! Message reads:\n\n"+alertText);
};
var xhr = new objXHR;
function init() {
var n=document.forms.length;
var i;
for (i = 0; i < n; i += 1) {
if (document.forms[i].name === theFormName) {
theForm = document.forms[i];
//continue; // Unnecessary though had originally thought of building more into this area.
}
}
n=theForm.elements.length;
for (i = 0; i < n; i += 1) {
switch (theForm.elements[i].type) {
case "select":
case "select-one":
theForm.elements[i].addEventListener("change", function () {
xhr.getPrice();
});
break;
case "textarea":
case "text":
theForm.elements[i].addEventListener("input", function () {
xhr.getPrice();
});
break;
case "checkbox":
case "radio":
theForm.elements[i].addEventListener("click", function () {
xhr.getPrice();
});
break;
case "number":
theForm.elements[i].addEventListener("change", function () {
xhr.getPrice();
});
theForm.elements[i].addEventListener("keyup", function () {
xhr.getPrice();
});
theForm.elements[i].addEventListener("input", function () {
xhr.getPrice();
});
break;
}
}
<?php
$show_dynamic_price_updater_sidebox = true;
if ($show_dynamic_price_updater_sidebox === true)
{
?>
xhr.createSB();
<?php
}
?>
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 ?>
<?php /*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;
}*/ ?>
// ]]></script>
<?php
}
}
-
1 Attachment(s)
Re: Dynamic Price Updater
The other file was too big to insert in the comments area
includes/classes/dynamic_price_updater.php
Attachment 19926
I don't believe we changed any other files, but I'll look just to make sure.
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
mvstudio
Ah! I wouldn't know at all about that.
These are the files I mentioned we modified back then.
includes/modules/pages/product_info/jscript_dynamic_price_updater.php
PHP Code:
<?php
/**
* @package Dynamic Price Updater
* @copyright Dan Parry (Chrome) / Erik Kerkhoven (Design75)
* @original author Dan Parry (Chrome)
* @version 3.0
* @licence This module is released under the GNU/GPL licence
*/
if (defined('DPU_STATUS') && DPU_STATUS === 'true') {
$load = true; // if any of the PHP conditions fail this will be set to false and DPU won't be fired up
$pid = (!empty($_GET['products_id']) ? (int)$_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) {
if (!defined('DPU_PRODUCTDETAILSLIST_PRODUCT_INFO_QUANTITY')) define('DPU_PRODUCTDETAILSLIST_PRODUCT_INFO_QUANTITY', 'productDetailsList_product_info_quantity');
?>
<script type="text/javascript">
// <=!=[=C=D=A=T=A=[
// Set some global vars
var theFormName = "<?php echo DPU_PRODUCT_FORM; ?>";
var theForm = false;
var theURL = "<?php echo DIR_WS_CATALOG; ?>ajax.php";
// var theURL = "<?php echo DIR_WS_CATALOG; ?>dpu_ajax.php";
var _secondPrice = <?php echo (DPU_SECOND_PRICE !== '' ? '"' . DPU_SECOND_PRICE . '"' : 'false'); ?>;
var objSP = false; // please don't adjust this
var DPURequest = [];
// Updater sidebox settings
var objSB = false;<?php // this holds the sidebox object // IE. Left sidebox false should become document.getElementById('leftBoxContainer');
// For right sidebox, this should equal document.getElementById('rightBoxContainer');
// Perhaps this could be added as an additional admin configuration key. The result should end up being that a new SideBox is added
// before whatever is described in this "search". So this may actually need to be a div within the left or right boxes instead of the
// left or right side box.
// May also be that this it is entirely unnecessary to create a sidebox when one could already exist based on the file structure.
if (DPU_SHOW_LOADING_IMAGE === 'true') { // create the JS object for the loading image ?>
var imgLoc = "replace"; // Options are "replace" or , "" (empty)
var origPrice;
var loadImg = document.createElement("img");
loadImg.src = "<?php echo DIR_WS_IMAGES; ?>ajax-loader.gif";
loadImg.id = "DPULoaderImage";
var loadImgSB = document.createElement("img");
loadImgSB.src = "<?php echo DIR_WS_IMAGES; ?>ajax-loader.gif";
loadImgSB.id = "DPULoaderImageSB";
loadImgSB.style.margin = "auto";
// loadImg.style.display = 'none';
<?php } ?>
function objXHR() { // scan the function clicked and act on it using the Ajax interthingy
var url; // URL to send HTTP DPURequests to
var timer; // timer for timing things
var XHR; // XMLHttpDPURequest object
var responseXML; // holds XML formed responses from the server
var responseText; // holds any textual response from the server
// var DPURequest = []; // associative array to hold DPURequests to be sent
// DPURequest = new Array();
this.createXHR();
}
objXHR.prototype.createXHR = function () { // this code has been modified from the Apple developers website
this.XHR = false;
// branch for native XMLHttpDPURequest 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
var tryNext = false;
try {
this.XHR = new ActiveXObject("Msxml2.XMLHTTP");
} catch(f) {
tryNext = true;
}
if (tryNext) {
try {
this.XHR = new ActiveXObject("Microsoft.XMLHTTP");
} catch(g) {
this.XHR = false;
}
}
}
};
objXHR.prototype.getData = function(strMode, resFunc, combinedData) { // send a DPURequest to the server in either GET or POST
strMode = (strMode.toLowerCase() === "post" ? "post" : "get");
var _this = this; // scope resolution
if (((typeof zcJS === "undefined" || !zcJS) ? this.XHR : zcJS)) {
if (typeof zcJS === "undefined" || !zcJS) {
this.createXHR();
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, _this);
} else {
console.log("Status returned - " + _this.XHR.statusText);
}
}
};
this.XHR.open(strMode.toLowerCase(), "<?php echo zen_decode_specialchars(zen_href_link('ajax.php', zen_get_all_get_params(array('action','pid')) . 'act=DPU_Ajax&method=dpu_update', $request_type, true, true, true)); ?>" + (strMode.toLowerCase() === "get" ? "&" + this.compileRequest() : ""), true);
/* this.XHR.open(strMode.toLowerCase(), this.url+"?act=DPU_Ajax&method=dpu_update"+(strMode.toLowerCase() == "get" ? "&" + this.compileRequest() : ""), true);*/
if (strMode.toLowerCase() === "post") {
this.XHR.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
this.XHR.setRequestHeader("X-Requested-With", "XMLHttpRequest");
}
this.XHR.send(combinedData.XML);
} else {
var option = {
url: "<?php echo zen_decode_specialchars(zen_href_link('ajax.php', zen_get_all_get_params(array('action','pid')) . 'act=DPU_Ajax&method=dpu_update', $request_type, true, true, true)); ?>",
data: combinedData.JSON,
timeout : 30000
};
zcJS.ajax(option).done(
function (response,textStatus,jqXHR) {
_this.responseJSON = jqXHR.responseJSON;
_this.responseText = jqXHR.responseText;
if (!_this.responseJSON && _this.responseText) {
try {
_this.responseJSON = JSON.parse(_this.responseText);
} catch (e) {
console.log(e.stack);
}
}
_this.responseHandler(resFunc, _this);
}
).fail( function(jqXHR,textStatus,errorThrown) {
<?php if (DPU_SHOW_LOADING_IMAGE === 'true') { ?>
var thePrice = document.getElementById("<?php echo DPU_PRICE_ELEMENT_ID; ?>");
var test = thePrice.getElementsByTagName("span");
var psp = false;
var a;
var b = test.length;
for (a = 0; a < b; a += 1) {
if (test[a].className === "productSpecialPrice" || test[a].className === "productSalePrice" || test[a].className === "productSpecialPriceSale") {
psp = test[a];
}
}
if (typeof(loadImg) !== "undefined" && loadImg.parentNode !== null && loadImg.parentNode.id === thePrice.id && imgLoc !== "replace") {
if (psp) {
psp.removeChild(loadImg);
} else {
thePrice.removeChild(loadImg);
}
} else if (typeof(loadImg) !== "undefined" && imgLoc === "replace") {
_this.updateInnerHTML(origPrice, psp, thePrice);
}
if (_secondPrice !== false) {
_this.updSP();
}
<?php } ?>
//alert("Status returned - " + textStatus);
});
}
} 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 DPURequest array into a URL encoded string
var ret = ""; // return DPURequest string
var e;
for (e in DPURequest) {
ret += e + "=" + DPURequest[e] + "&";
}
return (ret.substr(0, ret.length - 1));
};
objXHR.prototype.responseHandler = function (theFunction, results) { // redirect responses from the server to the right function
DPURequest = new Array();
this[theFunction](results); // Eliminates concern of improper evaluation; however, does limit the response value(s)
};
objXHR.prototype.getPrice = function () {
var pspClass = false;
<?php if (DPU_SHOW_LOADING_IMAGE === 'true') { ?>
var psp = false;
// if (imgLoc === "replace") {
var thePrice = document.getElementById("<?php echo DPU_PRICE_ELEMENT_ID; ?>");
var test = false;
if (thePrice) {
test = thePrice.getElementsByTagName("span");
}
var a;
var b = test.length;
for (a = 0; a < b; a += 1) {
if (test[a].className === "productSpecialPrice" || test[a].className === "productSalePrice" || test[a].className === "productSpecialPriceSale") {
psp = test[a];
}
}
if (!psp) {
psp = thePrice;
}
if (psp) {
pspClass = psp.className;
origPrice = psp.innerHTML;
}
// }
if (psp && imgLoc === "replace") {
if (thePrice) {
loadImg.style.display = "inline"; //'block';
// pspClass = psp.className;
var pspStyle = psp.currentStyle || window.getComputedStyle(psp);
loadImg.style.height = pspStyle.lineHeight; // Maintains the height so that there is not a vertical shift of the content.
origPrice = psp.innerHTML;
this.updateInnerHTML(loadImg.outerHTML, false, psp, true);
}
} else {
document.getElementById("<?php echo DPU_PRICE_ELEMENT_ID; ?>").appendChild(loadImg);
}
if (document.getElementById("dynamicpriceupdatersidebox")) {
var theSB = document.getElementById("dynamicpriceupdatersideboxContent");
// theSB.innerHTML = "";
this.updateInnerHTML("", false, theSB, true);
theSB.style.textAlign = "center";
theSB.appendChild(loadImgSB);
}
<?php } ?>
this.url = theURL;
var n=theForm.elements.length;
var temp = "";
var jsonData = {};
var combinedData = {};
var el;
var i;
for (i = 0; i < n; i += 1) {
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 "textarea":
case "text":
case "number":
case "hidden":
temp += el.name+"="+encodeURIComponent(el.value)+"&";
if (!(el.name in jsonData)) { // Ensure not to replace an existing value. I.e. drop a duplicate value.
jsonData[el.name] = el.value;
}
break;
case "checkbox":
case "radio":
if (true === el.checked) {
temp += el.name+"="+encodeURIComponent(el.value)+"&";
if (!(el.name in jsonData)) { // Ensure not to replace an existing value. I.e. drop a duplicate value.
jsonData[el.name] = el.value;
}
}
break;
}
}
if (!("products_id" in jsonData)) {
temp += "products_id=<?php echo (int)$pid; ?>&";
jsonData.products_id = <?php echo (int)$pid; ?>;
}
if (pspClass) {
temp += "pspClass="+encodeURIComponent(pspClass)+"&";
jsonData.pspClass = pspClass;
}
temp += "stat=main&";
jsonData.stat = "main";
temp += "outputType=XML&";
jsonData.outputType = "JSON";
temp = temp.substr(0, temp.length - 1);
combinedData.XML = temp;
combinedData.JSON = jsonData;
this.getData("post", "handlePrice", combinedData);
//temp = temp.substr(0, temp.length - 1)
//this.getData("post", "handlePrice", temp);
};
objXHR.prototype.updateInnerHTML = function (storeVal, psp, obj, replace) {
if (typeof(replace) === "undefined") {
replace = true;
}
if (storeVal !== "") {
if (psp) {
if (replace) {
psp.innerHTML = storeVal;
} else {
psp.innerHTML += storeVal;
}
} else {
if (replace) {
obj.innerHTML = storeVal;
} else {
obj.innerHTML += storeVal;
}
}
if (_secondPrice !== false) {
this.updSP();
}
}
};
objXHR.prototype.handlePrice = function (results) {
var thePrice = document.getElementById("<?php echo DPU_PRICE_ELEMENT_ID; ?>");
if (typeof(loadImg) !== "undefined" && loadImg.parentNode !== null && loadImg.parentNode.id === thePrice.id && imgLoc !== "replace") {
thePrice.removeChild(loadImg);
}
// use the spans to see if there is a discount occuring up in this here house
var test = thePrice.getElementsByTagName("span");
var psp = false;
var a;
var b = test.length;
var pdpt = false;
for (a = 0; a < b; a += 1) {
if (test[a].className === "normalprice") {
pdpt = test[a];
}
if (test[a].className === "productSpecialPrice" || test[a].className === "productSalePrice" || test[a].className === "productSpecialPriceSale") {
psp = test[a];
}
}
// var type = this.responseXML.getElementsByTagName("responseType")[0].childNodes[0].nodeValue;
var type;
var updateSidebox;
if (results.responseXML) {
type = results.responseXML.getElementsByTagName("responseType")[0].childNodes[0].nodeValue;
} else if (results.responseJSON) {
type = results.responseJSON.responseType;
}
if (document.getElementById("dynamicpriceupdatersidebox")) {
var theSB = document.getElementById("dynamicpriceupdatersideboxContent");
theSB.style.textAlign = "left";
var sbContent = "";
updateSidebox = true;
} else {
updateSidebox = false;
}
if (type === "error") {
this.showErrors();
} else {
// var temp = this.responseXML.getElementsByTagName("responseText");
var temp;
if (results.responseXML) {
temp = results.responseXML.getElementsByTagName("responseText");
} else if (results.responseJSON) {
temp = results.responseJSON.data;
}
/* for(var i=0, n=temp.length; i<n; i++) {
var type = temp[i].getAttribute("type");*/
var storeVal;
var i;
for(i in temp) {
if (results.responseXML) {
if (!(temp.hasOwnProperty(i))) {
continue;
}
type = temp[i].getAttribute("type");
storeVal = temp[i].childNodes[0].nodeValue;
} else if (results.responseJSON) {
type = i;
storeVal = temp[i];
}
switch (type) {<?php // the 'type' attribute defines what type of information is being provided ?>
case "preDiscPriceTotal":
if (pdpt) {
this.updateInnerHTML(storeVal, pdpt, thePrice, true);
}
break;
case "preDiscPriceTotalText":
if (pdpt) {
// $(thePrice).contents().first()[0].textContent = storeVal;
if (thePrice.firstChild.nodeType === 3) {
thePrice.firstChild.nodeValue = storeVal;
}
}
break;
case "priceTotal":
/*if (psp) {
psp.innerHTML = temp[i].childNodes[0].nodeValue;
} else {
thePrice.innerHTML = temp[i].childNodes[0].nodeValue;
}
if (_secondPrice !== false) {
this.updSP();
}*/
this.updateInnerHTML(storeVal, psp, thePrice, true);
break;
case "quantity":
/* with (temp[i].childNodes[0]) {
if (nodeValue != "") {
if (psp) {
psp.innerHTML += nodeValue;
} else {
thePrice.innerHTML += nodeValue;
}
this.updSP();
}
}*/
this.updateInnerHTML(storeVal, psp, thePrice, false);
break;
case "weight":
var theWeight = document.getElementById("<?php echo DPU_WEIGHT_ELEMENT_ID; ?>");
if (theWeight) {
// theWeight.innerHTML = temp[i].childNodes[0].nodeValue;
this.updateInnerHTML(storeVal, false, theWeight, true);
}
break;
case "sideboxContent":
if (updateSidebox) {
// sbContent += temp[i].childNodes[0].nodeValue;
sbContent += storeVal;
}
break;
case "stock_quantity":
var theStockQuantity = document.getElementById("<?php echo DPU_PRODUCTDETAILSLIST_PRODUCT_INFO_QUANTITY; ?>");
if (theStockQuantity) {
this.updateInnerHTML(storeVal, false, theStockQuantity, true);
}
break;
}
}
}
if (updateSidebox) {
// theSB.innerHTML = sbContent;
this.updateInnerHTML(sbContent, false, theSB, true);
}
};
objXHR.prototype.updSP = function () {
// 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);
flag = false;
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;
}
};
<?php
$show_dynamic_price_updater_sidebox = true;
if ($show_dynamic_price_updater_sidebox === true)
{
?>
objXHR.prototype.createSB = function () { // create the sidebox for the attributes info display
if (!(document.getElementById("dynamicpriceupdatersidebox")) && objSB) {
var tempC = document.createElement("div");
tempC.id = "dynamicpriceupdatersideboxContent";
tempC.className = "sideBoxContent";
tempC.innerHTML = "If you can read this Chrome has broken something";
objSB.appendChild(tempC);
temp.parentNode.insertBefore(objSB, temp);
}
};
<?php
}
?>
objXHR.prototype.showErrors = function () {
// var errorText = this.responseXML.getElementsByTagName("responseText");
var alertText = "";
var errVal;
var errorText;
var i;
if (typeof zcJS === "undefined" || !zcJS) {
errorText = this.responseXML.getElementsByTagName("responseText");
} else {
errorText = this.responseJSON.responseText;
}
//var n=errorText.length;
for (i in errorText/*var i=0; i<n; i++*/) {
if (!(errorText.hasOwnProperty(i))) {
continue;
}
if (typeof zcJS === "undefined" || !zcJS) {
errVal = errorText[i].childNodes[0].nodeValue;
} else {
errVal = i;
}
alertText += "\n- "+errVal;
}
alert ("Error! Message reads:\n\n"+alertText);
};
var xhr = new objXHR;
function init() {
var n=document.forms.length;
var i;
for (i = 0; i < n; i += 1) {
if (document.forms[i].name === theFormName) {
theForm = document.forms[i];
//continue; // Unnecessary though had originally thought of building more into this area.
}
}
n=theForm.elements.length;
for (i = 0; i < n; i += 1) {
switch (theForm.elements[i].type) {
case "select":
case "select-one":
theForm.elements[i].addEventListener("change", function () {
xhr.getPrice();
});
break;
case "textarea":
case "text":
theForm.elements[i].addEventListener("input", function () {
xhr.getPrice();
});
break;
case "checkbox":
case "radio":
theForm.elements[i].addEventListener("click", function () {
xhr.getPrice();
});
break;
case "number":
theForm.elements[i].addEventListener("change", function () {
xhr.getPrice();
});
theForm.elements[i].addEventListener("keyup", function () {
xhr.getPrice();
});
theForm.elements[i].addEventListener("input", function () {
xhr.getPrice();
});
break;
}
}
<?php
$show_dynamic_price_updater_sidebox = true;
if ($show_dynamic_price_updater_sidebox === true)
{
?>
xhr.createSB();
<?php
}
?>
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 ?>
<?php /*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;
}*/ ?>
// ]=]=></script>
<?php
}
}
Effectively there are no changes to this file that "add" value to the existing problem. The change made was to eliminate the CDATA encapsulation on the script. That CDATA was added to permit the file to be parsed as XML... Not an issue with the newer implementation as it is not encapsulated with CDATA and also as far as I can tell is not expected to be parsed as XML.
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
mvstudio
The other file was too big to insert in the comments area
includes/classes/dynamic_price_updater.php
Attachment 19926
I don't believe we changed any other files, but I'll look just to make sure.
And as for this file, the only change(s) really were in the default text constants (as compared to the master version of the file in github) where that difference may just be "temporary" or recent. I would not expect that difference to really cause an issue though I would suggest checking to see if you have any debug logs generated as a result of using the plugin. I wouldn't be surprised if there is a missing definition that execution of the ajax code may stop and that could be preventing the next step from occurring and leaving the spinning circle... Just an idea...
Note that if no debug logs exist then there may be a separate issue preventing debug logs from being generated/written. I often will then try to force a debug log to be generated just to prove that it *can* happen which validates that the absence of a log is because there isn't a log worthy event occurring... Sort of "backwards" thinking but a logic principle.
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
mc12345678
And as for this file, the only change(s) really were in the default text constants (as compared to the master version of the file in github) where that difference may just be "temporary" or recent. I would not expect that difference to really cause an issue though I would suggest checking to see if you have any debug logs generated as a result of using the plugin. I wouldn't be surprised if there is a missing definition that execution of the ajax code may stop and that could be preventing the next step from occurring and leaving the spinning circle... Just an idea...
Note that if no debug logs exist then there may be a separate issue preventing debug logs from being generated/written. I often will then try to force a debug log to be generated just to prove that it *can* happen which validates that the absence of a log is because there isn't a log worthy event occurring... Sort of "backwards" thinking but a logic principle.
Oh, and absent all of that logging issue/problem, while the initial claim was that this happened under version "3", was corrected and now is happening in version "4", indicates that if all else is good and correct (page validates, java code is sound, no php errors), then there is some problem with the way the data is being "handled" or processed that needs to be corrected... The fun part of that is figuring out what is erroring or not processing, when, and why...
Ideally though, perhaps you find some other modification had been made to the "older" site to make this work. It really could also be outside the scope of the plugin and instead something in another file that had to be modified to function. I saw that there were a lot of other scripts available/executed on the product page. Again I didn't have access to appropriate tools to follow the program flow to be able to see if one of other plugins might cause an issue with this... I mean, even loading sequence of those other plugins could make a difference as well... Etc...
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
mc12345678
Oh, and absent all of that logging issue/problem, while the initial claim was that this happened under version "3", was corrected and now is happening in version "4", indicates that if all else is good and correct (page validates, java code is sound, no php errors), then there is some problem with the way the data is being "handled" or processed that needs to be corrected... The fun part of that is figuring out what is erroring or not processing, when, and why...
Ideally though, perhaps you find some other modification had been made to the "older" site to make this work. It really could also be outside the scope of the plugin and instead something in another file that had to be modified to function. I saw that there were a lot of other scripts available/executed on the product page. Again I didn't have access to appropriate tools to follow the program flow to be able to see if one of other plugins might cause an issue with this... I mean, even loading sequence of those other plugins could make a difference as well... Etc...
No error logs were generated. So I generated one to see what would show, and nothing did.
I removed the two files I've been working on, which I made cosmetic changes to see if maybe the plugin didn't like what I did, and that didn't do anything the behavior is still present.
So I went back to see if maybe I left some clues that would point on why I was having this issue back then. I had installed the wholesale plugin which I didn't install in this one, and the stock by attributes plugin, which I don't have on this one either. So whatever happened then, has to be unrelated to this event. Which means another one of the plugins I have installed could be the culprit.
I switched templates to the classic and the issue persists.
This is the list of all the plugins I have installed. Some of them I was able to turn off from the admin area and the issue still persisted. Do you know of any of these plugins messing with this? That would help me in narrowing down on what to look for.
About us (define page)
Admin order weight (displays the order weight in admin)
Admin notes
Average product rating
Category tab simple dropdown
Google recaptcha
Instafeed (displays an Instagram feed at the bottom of the homepage)
Invoice payment module
New item badge
One page checkout
Order comments boilerplate
Print invoice popup
Returns and refunds define page
Sitemap XML
Snap affiliates
Specials define page
Square payments
User tracking
USPS
UPS
Ultimate URL
TyPackagage tracking
Better together
Dynamic price updater
Zen colorbox
Thank you for taking the time. I truly appreciate it.
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
mvstudio
No error logs were generated. So I generated one to see what would show, and nothing did.
I removed the two files I've been working on, which I made cosmetic changes to see if maybe the plugin didn't like what I did, and that didn't do anything the behavior is still present.
So I went back to see if maybe I left some clues that would point on why I was having this issue back then. I had installed the wholesale plugin which I didn't install in this one, and the stock by attributes plugin, which I don't have on this one either. So whatever happened then, has to be unrelated to this event. Which means another one of the plugins I have installed could be the culprit.
I switched templates to the classic and the issue persists.
This is the list of all the plugins I have installed. Some of them I was able to turn off from the admin area and the issue still persisted. Do you know of any of these plugins messing with this? That would help me in narrowing down on what to look for.
About us (define page)
Admin order weight (displays the order weight in admin)
Admin notes
Average product rating
Category tab simple dropdown
Google recaptcha
Instafeed (displays an Instagram feed at the bottom of the homepage)
Invoice payment module
New item badge
One page checkout
Order comments boilerplate
Print invoice popup
Returns and refunds define page
Sitemap XML
Snap affiliates
Specials define page
Square payments
User tracking
USPS
UPS
Ultimate URL
TyPackagage tracking
Better together
Dynamic price updater
Zen colorbox
Thank you for taking the time. I truly appreciate it.
Great to have all that information; however, I discovered that by looking at the console when accessing the "problem" product, that the issue is in fact a script related issue. The following error was in the "log":
Quote:
DPU catch error: TypeError: Cannot use 'in' operator to search for 'id[2]' in
at getPrice (https://www.byvalenti.com/ZCBASE/tinted-lip-balms-c-15_30/lip-whip-souffle-tinted-lip-balm-in-6-beautiful-colors-p-33:305:31)
at init (https://www.byvalenti.com/ZCBASE/tinted-lip-balms-c-15_30/lip-whip-souffle-tinted-lip-balm-in-6-beautiful-colors-p-33:562:9)
at onload (https://www.byvalenti.com/ZCBASE/tinted-lip-balms-c-15_30/lip-whip-souffle-tinted-lip-balm-in-6-beautiful-colors-p-33:674:3)
May I recommend attempting the following?
Change at/about line 154 of includes/modules/pages/product_info/jscript_dynamic_price_updater.php
from:
Code:
if (!(el.name in attributes) && el.name.startsWith("id[")) { // Ensure not to replace an existing value. I.e. drop a duplicate value.
to:
Code:
if ((attributes === '' || !(el.name in attributes)) && el.name.startsWith("id[")) { // Ensure not to replace an existing value. I.e. drop a duplicate value.
"Easy" way to modify it so that you "build" up to the final result:
start with:
Code:
if (!(el.name in attributes) && el.name.startsWith("id[")) { // Ensure not to replace an existing value. I.e. drop a duplicate value.
add parentheses around the first term:
Code:
if ((!(el.name in attributes)) && el.name.startsWith("id[")) { // Ensure not to replace an existing value. I.e. drop a duplicate value.
Then, just before the exclamation point (represents a logical "not" or flip the "truthiness" of the variable that follows. If it was true, then consider it false, if it was false, then consider it true) add the test to see that attributes still is an empty text string (original value) so that if that is true, then there is no need to check for el.name being in the string... (Not that I'm entirely sure that "el.name in attributes" is the right way to perform that test considering I didn't make that change and haven't done *ANY* testing on that version of DPU.)
Code:
if ((attributes === '' || !(el.name in attributes)) && el.name.startsWith("id[")) { // Ensure not to replace an existing value. I.e. drop a duplicate value.
Now, all that said, and I was *assuming* that this particular site was a development location, turning off the spinning feature would have at least allowed the base/normal price to be displayed. (I should know the exact configuration switch to change, but am drawing a blank at the moment and need to move on.)
And sorry if it doesn't resolve the issue, there's some action being done/taken in here that I didn't code and wouldn't have used for multiple reasons. I also haven't opened up a tool to test execute and see results of the way the data is being handled... What is considered desired in this line is to determine if the collected data already includes the radio item that has the name it is given where that name *SHOULD* be unique to all other objects within the group (otherwise basically there is a problem with the page) and if that named item is not already captured AND the associated attribute's "name" starts with id[, then go ahead and collect the attributes name and the value assigned to it so that later that data can be decoded to display the price... Something about the process though seems wrong because I would expect the javascript: X in Y to work for any length of text (IF that operator is the correct operator for a string of text... Problem is that the MDN instruction references use of the 'in' operator to search through an object or its prototype chain... I'm not seeing either of those in my "limited vision"... Unfortunately and further, using this method/style of looking through a string of text for matching "text" (assuming that really is what is being done) seems problematic to successfully perform: E.g. the text contains: 'test~5|run~6|test2~7', well when get to a variable that has the name 'ru', it appears that a text search for 'ru' would indicate that it already exists because 'run' is present and 'ru' is a subset of 'run'...
Anyways, I'm showing what I don't know/understand and babbling on further... Again, didn't have this issue in the version I prepared... Post back on success/failure (or at least when it has been incorporated)...
Again, the issue is not with your other plugins but specifically/directly with the javascript/jQuery code associated with a series of attributes only having radio buttons (or perhaps any radio button at all), perhaps change to another selection type if need to support operation? Not really one that does the same thing of showing the picture right in ones face without switching from one to another... Sorry, enough.. :)
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
mc12345678
Great to have all that information; however, I discovered that by looking at the console when accessing the "problem" product, that the issue is in fact a script related issue. The following error was in the "log":
How?! Where did you find that error?? I have much to learn!
Quote:
Now, all that said, and I was *assuming* that this particular site was a development location, turning off the spinning feature would have at least allowed the base/normal price to be displayed. (I should know the exact configuration switch to change, but am drawing a blank at the moment and need to move on.)
Yes. It's on development, not a live store, yet. I was finishing a few cosmetic details and playing around to make sure everything was working fine before launching it when I saw the endless spinning wheel. Since it isn't a live store is not that big deal the wheel keeps spinning. The control to turn it off is in configuration/dynamic price updater/show a small loading graphic, and yes if I turned it off the wheel of course stops spinning. That worked.
I made the change you suggested, and the wheel stopped spinning, so that's progress!
So here is what's different about the live store and the one I'm working on, the one you're helping me with.
This is the live store https://www.byvalenti.com/index.php?...&products_id=6
Same product and everything, when a selection of color is made the wheel spins and stops with every selection made even if the product isn't priced by attribute. If there would be a change in price on a per color basis, the price updates. That's how it's supposed to work, or at least how it's been working for year now.
On the development store https://www.byvalenti.com/ZCBASE/tin...ul-colors-p-33 with the modification you suggested now loaded, the wheel spins while the page is being loaded and stops. If a different color is selected the wheel won't spin, that's because I'm assuming it detects the product isn't priced by attribute, so it doesn't have to. So I went to check it out to see if the price was different if it would update. So I changed the attributes on the product to price by attributes and changed the prices for each attribute and they do change perfectly.
All this to report, the changes suggested do work! You're brilliant!!!! Thank you so, so much!! Please let me know how I could donate or the least buy you a coffee?... :hug:
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
mvstudio
How?! Where did you find that error?? I have much to learn!
Yes. It's on development, not a live store, yet. I was finishing a few cosmetic details and playing around to make sure everything was working fine before launching it when I saw the endless spinning wheel. Since it isn't a live store is not that big deal the wheel keeps spinning. The control to turn it off is in configuration/dynamic price updater/show a small loading graphic, and yes if I turned it off the wheel of course stops spinning. That worked.
I made the change you suggested, and the wheel stopped spinning, so that's progress!
So here is what's different about the live store and the one I'm working on, the one you're helping me with.
This is the live store
https://www.byvalenti.com/index.php?...&products_id=6
Same product and everything, when a selection of color is made the wheel spins and stops with every selection made even if the product isn't priced by attribute. If there would be a change in price on a per color basis, the price updates. That's how it's supposed to work, or at least how it's been working for year now.
On the development store
https://www.byvalenti.com/ZCBASE/tin...ul-colors-p-33 with the modification you suggested now loaded, the wheel spins while the page is being loaded and stops. If a different color is selected the wheel won't spin, that's because I'm assuming it detects the product isn't priced by attribute, so it doesn't have to. So I went to check it out to see if the price was different if it would update. So I changed the attributes on the product to price by attributes and changed the prices for each attribute and they do change perfectly.
All this to report, the changes suggested do work! You're brilliant!!!! Thank you so, so much!! Please let me know how I could donate or the least buy you a coffee?... :hug:
I can be reached via my signature "link" (a little bit of an unnecessary tortuous path) so long as it continues to exist on my account or you are always welcome to provide to the Zen Cart fund of which I receive like all users of the software only the benefit of its continued use and the occasional fun of fixing some new and unique issue..
As to seeing the console, like 99% of browsers have some form of "debug" view (on a PC) by pressing the F12 key. It's been a while since I've looked up/talked about macintosh, but seems that there is something similar. Anyways, there is often (and each browser is different) some sort of console that provides "feedback" about the operation(s). Some are better than others and some are easier than others, using many different ones offers the ability to "figure it all" out... :)
BTW, good work on developing *NOT* on the live site...
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
mc12345678
As to seeing the console, like 99% of browsers have some form of "debug" view (on a PC) by pressing the F12 key. It's been a while since I've looked up/talked about macintosh, but seems that there is something similar. Anyways, there is often (and each browser is different) some sort of console that provides "feedback" about the operation(s). Some are better than others and some are easier than others, using many different ones offers the ability to "figure it all" out... :)
Oh man! I totally forgot about that one! Of course I knew about it, I just didn't think of it :wacko:
Quote:
Originally Posted by
mc12345678
BTW, good work on developing *NOT* on the live site...
Thank you!??? :laugh: I might not have *developed* the site, I praise you all for the mechanics of it, but the design aspect is most certainly all me :D
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
mvstudio
How?! Where did you find that error?? I have much to learn!
Yes. It's on development, not a live store, yet. I was finishing a few cosmetic details and playing around to make sure everything was working fine before launching it when I saw the endless spinning wheel. Since it isn't a live store is not that big deal the wheel keeps spinning. The control to turn it off is in configuration/dynamic price updater/show a small loading graphic, and yes if I turned it off the wheel of course stops spinning. That worked.
I made the change you suggested, and the wheel stopped spinning, so that's progress!
So here is what's different about the live store and the one I'm working on, the one you're helping me with.
This is the live store
https://www.byvalenti.com/index.php?...&products_id=6
Same product and everything, when a selection of color is made the wheel spins and stops with every selection made even if the product isn't priced by attribute. If there would be a change in price on a per color basis, the price updates. That's how it's supposed to work, or at least how it's been working for year now.
On the development store
https://www.byvalenti.com/ZCBASE/tin...ul-colors-p-33 with the modification you suggested now loaded, the wheel spins while the page is being loaded and stops. If a different color is selected the wheel won't spin, that's because I'm assuming it detects the product isn't priced by attribute, so it doesn't have to. So I went to check it out to see if the price was different if it would update. So I changed the attributes on the product to price by attributes and changed the prices for each attribute and they do change perfectly.
All this to report, the changes suggested do work! You're brilliant!!!! Thank you so, so much!! Please let me know how I could donate or the least buy you a coffee?... :hug:
I'm curious, and the condition may not exist on either site, but do you have a product that has only two option names with each set for radio buttons and where at least one option value in each of the option names has a price associated with it? Curious to validate that the above proposed change doesn't cause an issue. Testing would involve selecting option values in a sequence to verify that the price updates/changes as expected for each condition *and* sequence of selecting.
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
mc12345678
I'm curious, and the condition may not exist on either site, but do you have a product that has only two option names with each set for radio buttons and where at least one option value in each of the option names has a price associated with it? Curious to validate that the above proposed change doesn't cause an issue. Testing would involve selecting option values in a sequence to verify that the price updates/changes as expected for each condition *and* sequence of selecting.
I don't have one at the moment, but I did a test and seems to be working as expected. I changed the product to price by attributes and gave each option a price and it looks like it does change the price accordingly depending on which option is selected. In adding the product to the shopping cart with the various selections and heading over to checkout everything appears to be working.
Again my developing skills are quite limited, so I wouldn't know if there is an error I should be aware of or look out for. No error logs in the admin area, just this in the browser console which I wouldn't know what it all means.
PHP Code:
Some cookies are misusing the recommended “SameSite“ attribute 7
Cookie “_fbc” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite fbevents.js:24:77689
Cookie “_fbp” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite fbevents.js:24:77689
Cookie “_ga” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite analytics.js:35:486
Cookie “_gid” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite analytics.js:35:486
Cookie “_gat_gtag_UA_1317268_7” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite analytics.js:35:486
Cookie “_fbc” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite fbevents.js:24:77689
Cookie “_fbp” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite fbevents.js:24:77689
This page is in Almost Standards Mode. Page layout may be impacted. For Standards Mode use “<!DOCTYPE html>”.
Object { cache: false, type: "POST", traditional: true, dataType: "json", timeout: 5000, data: {…}, url: "ajax.php?act=DPU_Ajax&method=getDetails" }
​cache: false
​data: Object { securityToken: "686992c2aa0f0014bd8d6494dcd48008", products_id: 33, attributes: "id[2]~14|", … }
​dataType: "json"
​timeout: 5000
​traditional: true
​type: "POST"
​url: "ajax.php?act=DPU_Ajax&method=getDetails"
​<prototype>: Object { … }
​__defineGetter__: function __defineGetter__()
​__defineSetter__: function __defineSetter__()
​__lookupGetter__: function __lookupGetter__()
​__lookupSetter__: function __lookupSetter__()
​__proto__:
​constructor: function Object()
​hasOwnProperty: function hasOwnProperty()
​isPrototypeOf: function isPrototypeOf()
​propertyIsEnumerable: function propertyIsEnumerable()
​toLocaleString: function toLocaleString()
​toString: function toString()
​valueOf: function valueOf()
​<get __proto__()>: function __proto__()
​<set __proto__()>: function __proto__()
I left the item with the price options active if you would like to check it out https://www.byvalenti.com/ZCBASE/tin...ul-colors-p-33
-
Re: Dynamic Price Updater
Is it possible to point to ONE location where we might find a working copy of this mod.
The plugins say 3.2 loaded 5 years ago. Github has three versions including a 4.0 version from 8 years ago. I did find one of the two 3.2 versions was touched in 2020.
Just a little bit of clarity as to where we can find the latest and greastes would be appreciated.:yes:
-
Re: Dynamic Price Updater
I understand the frustration. Effort was made to shepherd the wandering tribes together and I would suggest this is used as a starting point:
https://github.com/Zen4All-nl/Zen-Ca...-Price-Updater
and to report issues there.
I have not compared in aeons since my site is not broken.
-
Re: Dynamic Price Updater
....subsequent to that post I see no activity on that Github account since April 2021 and no post from Design75 since June 2021, which is a concern.
-
Re: Dynamic Price Updater
Have anyone been able to get the
Dynamic Price Updater v4.0.0 Beta 3
from GitHub to work on Zen-Cart 1.5.7d?
I tried the old version that is listed here but it's not working. I have this new one installed but all 3 places it is suppose to update, they just spin the ajax.gif, and nothing happens. Below is what errors I'm getting in the Admin of the Zen-Cart
Code:
[01-Jul-2022 22:15:03 UTC] Request URI: /Lrjs-5tGH-pQgkk/index.php?cmd=configuration&gID=35, IP address: 70.90.246.89
#1 file_get_contents() called at [/Lrjs-5tGH-pQgkk/includes/init_includes/init_dpu_config.php:159]
#2 this_plugin_version_check_for_updates() called at [/Lrjs-5tGH-pQgkk/includes/init_includes/init_dpu_config.php:185]
#3 require_once(/Lrjs-5tGH-pQgkk/includes/init_includes/init_dpu_config.php) called at [/includes/autoload_func.php:37]
#4 require(/includes/autoload_func.php) called at [/Lrjs-5tGH-pQgkk/includes/application_top.php:37]
#5 require(/Lrjs-5tGH-pQgkk/includes/application_top.php) called at [/Lrjs-5tGH-pQgkk/configuration.php:8]
#6 require(/Lrjs-5tGH-pQgkk/configuration.php) called at [/Lrjs-5tGH-pQgkk/index.php:11]
--> PHP Warning: file_get_contents(https://plugins.zen-cart.com/versioncheck/1301): failed to open stream: HTTP request failed! HTTP/1.1 526
in /Lrjs-5tGH-pQgkk/includes/init_includes/init_dpu_config.php on line 159.
[01-Jul-2022 22:15:03 UTC] PHP Notice: file_get_contents() error checking plugin versions.
Trying http instead. in /Lrjs-5tGH-pQgkk/includes/init_includes/init_dpu_config.php on line 161
[01-Jul-2022 22:15:04 UTC] Request URI: /Lrjs-5tGH-pQgkk/index.php?cmd=configuration&gID=35, IP address: 70.90.246.89
#1 file_get_contents() called at [/Lrjs-5tGH-pQgkk/includes/init_includes/init_dpu_config.php:162]
#2 this_plugin_version_check_for_updates() called at [/Lrjs-5tGH-pQgkk/includes/init_includes/init_dpu_config.php:185]
#3 require_once(/Lrjs-5tGH-pQgkk/includes/init_includes/init_dpu_config.php) called at [/includes/autoload_func.php:37]
#4 require(/includes/autoload_func.php) called at [/Lrjs-5tGH-pQgkk/includes/application_top.php:37]
#5 require(/Lrjs-5tGH-pQgkk/includes/application_top.php) called at [/Lrjs-5tGH-pQgkk/configuration.php:8]
#6 require(/Lrjs-5tGH-pQgkk/configuration.php) called at [/Lrjs-5tGH-pQgkk/index.php:11]
--> PHP Warning: file_get_contents(http://plugins.zen-cart.com/versioncheck/1301): failed to open stream: HTTP request failed! HTTP/1.1 526
in /Lrjs-5tGH-pQgkk/includes/init_includes/init_dpu_config.php on line 162.
[01-Jul-2022 22:15:04 UTC] PHP Notice: file_get_contents() error checking plugin versions.
Aborting. in /Lrjs-5tGH-pQgkk/includes/init_includes/init_dpu_config.php on line 165
I'm trying to figure it out because I need this to work as the original one worked on my v1.5.5e cart.
Just when you think you're getting your website back up and going, there is something that has changed dramatically somewhere, and even everywhere.
The site works fine, except for me not being able to get the products to update.
I was thinking that everyone that uses this mod should put together a pool of about $5 per person and even pay to have someone or entity redo this mod so it works without breaking every time there is an update to Zen-Cart.
Any help appreciated!
TesterServers.
-
Re: Dynamic Price Updater
Hi there,
When I installed this module, my product info page is keep refreshing and never stop.
Does anyone know what is the reason?
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
morrysmith
Hi there,
When I installed this module, my product info page is keep refreshing and never stop.
Does anyone know what is the reason?
If you'll look back through the thread you'll see that some think this mod is somewhat abandoned.:(
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
dbltoe
If you'll look back through the thread you'll see that some think this mod is somewhat abandoned.:(
Agreed.. but it still should be carried on since it's "open source". I'll contact a few sources to see what they'll charge to redo the mod. If I had the time, I could create a testing server and install it back on a v1.5.5e zen cart, and then install it on newer versions to find out what has changed, in order to pin-point why the mod isn't working anymore. I'm starting to believe it may be the changes to the newer PHP versions, and probably some other changes in server configurations.
This mod was, and still is too good to just let it go by the wayside. It made shopping for my customers so easy.
I'm going to get this mod reworked, even if I have to pay to have it done. I'm going to make a few testing sites starting with the version of zen where the mod worked, and then step up the zen version until I spot where the mod quit working properly or at all.
Stay tuned...
TesterServers
-
Re: Dynamic Price Updater
@zen4all: are you still in the running or you wish to transfer ownership of the source github elsewhere?
-
Re: Dynamic Price Updater
Yes, I installed it on the newest version of zen cart(v1.5.7d), and it's not working but just keep refreshing the product info page about 2 times/every second.
And when I tested it on v1.5.6c, there is no problem.
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
morrysmith
Yes, I installed it on the newest version of zen cart(v1.5.7d), and it's not working but just keep refreshing the product info page about 2 times/every second.
And when I tested it on v1.5.6c, there is no problem.
That issue is addressed in: https://www.zen-cart.com/showthread....58#post1370158
As referenced by: https://www.zen-cart.com/showthread....63#post1371663
Found by going back 2 or 3ish pages.
Explanation of why that is occurring is provided back there.
-
Re: Dynamic Price Updater
Thank you so much for your help, I've been stuck with this problem for weeks and it finally works.
-
Re: Dynamic Price Updater
I've been testing locally so far and everything works fine.
My version is v1.5.7d, the local PHP version is 7.4, and so is the server.
But whenever I move the site to the server, the plugin doesn't work at all except for loading images all the time when I input the quantity.
Any ideas?
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
morrysmith
I've been testing locally so far and everything works fine.
My version is v1.5.7d, the local PHP version is 7.4, and so is the server.
But whenever I move the site to the server, the plugin doesn't work at all except for loading images all the time when I input the quantity.
Any ideas?
Several come to mind, though not all specifically related to the plugin and in no particular order: files exist in the server that are not in the local version, file differences between the two, database differences that have some affect, two or more observers trying to monitor the same notifier but are loaded in a different sequence on the site than the local version, that there has been done html validation differences between the output, differences in jquery versions, etc.
Basically that there is a difference between the two that has brought out a difference in operation. Look for logs, create logs if necessary, include browser (javascript/jquery) as well, etc.
-
Re: Dynamic Price Updater
DPU v3.2.1
Upgrading a site from ZC 1.5.7d to ZC 1.5.8 (PHP 8.0.17) and I get this fatal error when visiting a product_info page
Code:
[21-Jan-2023 12:18:02 Europe/London] PHP Fatal error: Uncaught Error: Cannot access protected property shoppingCart::$total_before_discounts in D:\wamp64\www\mydomain.com\includes\classes\dynamic_price_updater.php:181
Stack trace:
#0 D:\wamp64\www\mydomain.com\includes\classes\dynamic_price_updater.php(79): DPU->prepareOutput()
#1 D:\wamp64\www\mydomain.com\includes\classes\ajax\zcDPU_Ajax.php(16): DPU->getDetails('JSON')
#2 D:\wamp64\www\mydomain.com\ajax.php(85): zcDPU_Ajax->dpu_update()
#3 {main}
thrown in D:\wamp64\www\mydomain.com\includes\classes\dynamic_price_updater.php on line 181
[21-Jan-2023 12:18:02 Europe/London] Request URI: /ajax.php?product_info&act=DPU_Ajax&method=dpu_update, IP address: 127.0.0.1
--> PHP Fatal error: Uncaught Error: Cannot access protected property shoppingCart::$total_before_discounts in D:\wamp64\www\mydomain.com\includes\classes\dynamic_price_updater.php:181
Stack trace:
#0 D:\wamp64\www\mydomain.com\includes\classes\dynamic_price_updater.php(79): DPU->prepareOutput()
#1 D:\wamp64\www\mydomain.com\includes\classes\ajax\zcDPU_Ajax.php(16): DPU->getDetails('JSON')
#2 D:\wamp64\www\mydomain.com\ajax.php(85): zcDPU_Ajax->dpu_update()
#3 {main}
thrown in D:\wamp64\www\mydomain.com\includes\classes\dynamic_price_updater.php on line 181.
Lines 174 - 182 of includes/classes/dynamic_price_updater.php
Code:
174. $this->responseText['priceTotal'] .= number_format($this->shoppingCart->total, $decimal_places, $decimal_point, $thousands_point);
175. // $this->responseText['priceTotalTaxed'] .=
176. $this->responseText['midDiscPriceTotal'] = number_format(zen_add_tax($this->shoppingCart->total_before_discounts, zen_get_tax_rate($product_check->fields['products_tax_class_id'])), $decimal_places, $decimal_point, $thousands_point);
177. $this->responseText['preDiscPriceTotal'] = number_format(zen_add_tax($this->shoppingCart->total_before_discounts, zen_get_tax_rate($product_check->fields['products_tax_class_id'])), $decimal_places, $decimal_point, $thousands_point);
178. } else {
179. $this->responseText['priceTotal'] .= $currencies->display_price($this->shoppingCart->total, 0 /*zen_get_tax_rate($product_check->fields['products_tax_class_id'])*//* 0 */ /* DISPLAY_PRICE_WITH_TAX */);
180. $this->responseText['priceTotalTaxed'] .= $currencies->display_price($this->shoppingCart->total, zen_get_tax_rate($product_check->fields['products_tax_class_id']));
181. $this->responseText['midDiscPriceTotal'] = $currencies->display_price($this->shoppingCart->total_before_discounts, zen_get_tax_rate($product_check->fields['products_tax_class_id'])); // Need to determine if/how price should be adjusted associated with multiple price discounts.
182. $this->responseText['preDiscPriceTotal'] = $currencies->display_price($this->shoppingCart->total_before_discounts, zen_get_tax_rate($product_check->fields['products_tax_class_id']));
Any thoughts/suggestions?
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
simon1066
DPU v3.2.1
Upgrading a site from ZC 1.5.7d to ZC 1.5.8 (PHP 8.0.17) and I get this fatal error when visiting a product_info page
Code:
[21-Jan-2023 12:18:02 Europe/London] PHP Fatal error: Uncaught Error: Cannot access protected property shoppingCart::$total_before_discounts in D:\wamp64\www\mydomain.com\includes\classes\dynamic_price_updater.php:181
Stack trace:
#0 D:\wamp64\www\mydomain.com\includes\classes\dynamic_price_updater.php(79): DPU->prepareOutput()
#1 D:\wamp64\www\mydomain.com\includes\classes\ajax\zcDPU_Ajax.php(16): DPU->getDetails('JSON')
#2 D:\wamp64\www\mydomain.com\ajax.php(85): zcDPU_Ajax->dpu_update()
#3 {main}
thrown in D:\wamp64\www\mydomain.com\includes\classes\dynamic_price_updater.php on line 181
[21-Jan-2023 12:18:02 Europe/London] Request URI: /ajax.php?product_info&act=DPU_Ajax&method=dpu_update, IP address: 127.0.0.1
--> PHP Fatal error: Uncaught Error: Cannot access protected property shoppingCart::$total_before_discounts in D:\wamp64\www\mydomain.com\includes\classes\dynamic_price_updater.php:181
Stack trace:
#0 D:\wamp64\www\mydomain.com\includes\classes\dynamic_price_updater.php(79): DPU->prepareOutput()
#1 D:\wamp64\www\mydomain.com\includes\classes\ajax\zcDPU_Ajax.php(16): DPU->getDetails('JSON')
#2 D:\wamp64\www\mydomain.com\ajax.php(85): zcDPU_Ajax->dpu_update()
#3 {main}
thrown in D:\wamp64\www\mydomain.com\includes\classes\dynamic_price_updater.php on line 181.
Another mod that has fallen foul of changes made to the ZC 1.5.8 `shoppingCart` class which reassigned some variables
from generically `public` to specifically `protected`.
The mod is going to require some reworking. Not sure who's managing this one now.
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
simon1066
DPU v3.2.1
Any thoughts/suggestions?
Have you tried using the beta version from GitHub? It can be found at https://github.com/Zen4All-nl/Zen-Ca...-Price-Updater
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
strelitzia
Thanks for that, I knew it existed but couldn't for the life of me remember where I had seen it - or whether I was just dreaming about it. I'll take a look and see if it helps.
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
strelitzia
I haven't tried installing this v4.0.0 but it looks as though it makes use of the same variable as v3.2.1
Code:
shoppingCart->total_before_discounts
A workaround on the site I'm currently working on is to remove the offending lines from dynamic_price_updater.php. I don't use the native ZC specials, sales and discounts (just @swguy's Quantity Discounts) so it should be ok.
-
Re: Dynamic Price Updater
Comparing my working version to
https://github.com/Zen4All-nl/Zen-Ca...-Price-Updater
+ the pending pull request,
is pretty much the same, so you should try it.
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
torvista
Thanks, will do.
-
Re: Dynamic Price Updater
I forgot to mention you should use the develop branch, not the master. There is a world of difference.
-
Re: Dynamic Price Updater
158 **github latest**
PHP 8
latest responsive cloned
OPC latest
Get spinning icon on entry to product page
Code:
[14-Feb-2023 15:56:01 America/New_York] PHP Fatal error: Uncaught Error: Cannot access protected property shoppingCart::$total_before_discounts in /includes/classes/ajax/zcDPU_Ajax.php:177
Stack trace:
#0 /includes/classes/ajax/zcDPU_Ajax.php(89): zcDPU_Ajax->prepareOutput()
#1 /ajax.php(85): zcDPU_Ajax->getDetails()
#2 {main}
thrown in /includes/classes/ajax/zcDPU_Ajax.php on line 177
[14-Feb-2023 15:56:01 America/New_York] Request URI: /ajax.php?act=DPU_Ajax&method=getDetails, IP address: 216.177.186.199
--> PHP Fatal error: Uncaught Error: Cannot access protected property shoppingCart::$total_before_discounts in /includes/classes/ajax/zcDPU_Ajax.php:177
Stack trace:
#0 /includes/classes/ajax/zcDPU_Ajax.php(89): zcDPU_Ajax->prepareOutput()
#1 /ajax.php(85): zcDPU_Ajax->getDetails()
#2 {main}
thrown in /includes/classes/ajax/zcDPU_Ajax.php on line 177.
-
Re: Dynamic Price Updater
Noting that there is a shopping_cart class method (show_total_before_discounts) to retrieve that value.
-
Re: Dynamic Price Updater
Upgrading from ZC v157 to v158. Currently using Dynamic Price Updater v3.2.1 (confirmed the version in my Admin Configuration>Dynamic Price Updater). On the plugins page I see v3.2.0 but no v3.2.1. What happened to v3.2.1? Also will v3.2.0 or v3.2.1 work with v158? Secondly I see that there is a 4.0.0 Beta 3 from April 2020 in Github (https://github.com/Zen4All-nl/Zen-Ca...-Price-Updater). Is it due out of Beta soon? Also, is anyone here working on an updated version specifically for 158? I would like to work with them if they are to add some additional functionality to it that I think may be useful to others besides myself.
Thanks,
John
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
lat9
Noting that there is a shopping_cart class method (show_total_before_discounts) to retrieve that value.
any further hint for the code-challenged among us?
asking for a friend:P
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
dbltoe
any further hint for the code-challenged among us?
asking for a friend:P
What's the code on the following line?
/includes/classes/ajax/zcDPU_Ajax.php on line 177.
-
Re: Dynamic Price Updater
lines 173-182,
Code:
$this->responseText['priceTotal'] .= number_format($this->shoppingCart->total, $decimal_places, $decimal_point, $thousands_point); $this->responseText['preDiscPriceTotal'] = number_format(zen_add_tax($this->shoppingCart->total_before_discounts, zen_get_tax_rate($product_check->fields['products_tax_class_id'])), $decimal_places, $decimal_point, $thousands_point);
} else {
$this->responseText['priceTotal'] .= $currencies->display_price($this->shoppingCart->total, 0 /* zen_get_tax_rate($product_check->fields['products_tax_class_id']) *//* 0 */ /* DISPLAY_PRICE_WITH_TAX */);
$this->responseText['preDiscPriceTotal'] = $currencies->display_price($this->shoppingCart->total_before_discounts, zen_get_tax_rate($product_check->fields['products_tax_class_id']));
}
if (!defined('DPU_OUT_OF_STOCK_IMAGE')) {
define('DPU_OUT_OF_STOCK_IMAGE', '%s');
}
All these files are from the development branch of github.
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
dbltoe
lines 173-182,
Code:
$this->responseText['priceTotal'] .= number_format($this->shoppingCart->total, $decimal_places, $decimal_point, $thousands_point); $this->responseText['preDiscPriceTotal'] = number_format(zen_add_tax($this->shoppingCart->total_before_discounts, zen_get_tax_rate($product_check->fields['products_tax_class_id'])), $decimal_places, $decimal_point, $thousands_point);
} else {
$this->responseText['priceTotal'] .= $currencies->display_price($this->shoppingCart->total, 0 /* zen_get_tax_rate($product_check->fields['products_tax_class_id']) *//* 0 */ /* DISPLAY_PRICE_WITH_TAX */);
$this->responseText['preDiscPriceTotal'] = $currencies->display_price($this->shoppingCart->total_before_discounts, zen_get_tax_rate($product_check->fields['products_tax_class_id']));
}
if (!defined('DPU_OUT_OF_STOCK_IMAGE')) {
define('DPU_OUT_OF_STOCK_IMAGE', '%s');
}
All these files are from the development branch of github.
Change this line
Code:
$this->responseText['preDiscPriceTotal'] = number_format(zen_add_tax($this->shoppingCart->total_before_discounts, zen_get_tax_rate($product_check->fields['products_tax_class_id'])), $decimal_places, $decimal_point, $thousands_point);
to
Code:
$this->responseText['preDiscPriceTotal'] = number_format(zen_add_tax($this->shoppingCart->show_total_before_discounts(), zen_get_tax_rate($product_check->fields['products_tax_class_id'])), $decimal_places, $decimal_point, $thousands_point);
-
Re: Dynamic Price Updater
Perfect!
Temporary location for updated files at https://github.com/dbltoe/Zen-Cart-D...dater/tree/158
Those files will NOT work prior to 1.5.8
-
Re: Dynamic Price Updater
Spoke a little too soon.
Still a glitch
Code:
[16-Feb-2023 10:50:14 America/New_York] Request URI: /ajax.php?act=DPU_Ajax&method=getDetails, IP address: 216.177.186.199, Language id 1
#1 zcDPU_Ajax->prepareOutput() called at [/includes/classes/ajax/zcDPU_Ajax.php:88]
#2 zcDPU_Ajax->getDetails() called at [/ajax.php:85]
--> PHP Warning: Undefined property: shoppingCart::$show_total_before_discounts in /includes/classes/ajax/zcDPU_Ajax.php on line 176.
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
dbltoe
Spoke a little too soon.
Still a glitch
Code:
[16-Feb-2023 10:50:14 America/New_York] Request URI: /ajax.php?act=DPU_Ajax&method=getDetails, IP address: 216.177.186.199, Language id 1
#1 zcDPU_Ajax->prepareOutput() called at [/includes/classes/ajax/zcDPU_Ajax.php:88]
#2 zcDPU_Ajax->getDetails() called at [/ajax.php:85]
--> PHP Warning: Undefined property: shoppingCart::$show_total_before_discounts in /includes/classes/ajax/zcDPU_Ajax.php on line 176.
Same change as the previous one, this on line 176.
-
Re: Dynamic Price Updater
Unfortunately, I still get the error when both are "fixed"
Code:
$this->responseText['priceTotal'] .= number_format($this->shoppingCart->total, $decimal_places, $decimal_point, $thousands_point); $this->responseText['preDiscPriceTotal'] = number_format(zen_add_tax($this->shoppingCart->show_total_before_discounts, zen_get_tax_rate($product_check->fields['products_tax_class_id'])), $decimal_places, $decimal_point, $thousands_point);
} else {
$this->responseText['priceTotal'] .= $currencies->display_price($this->shoppingCart->total, 0 /* zen_get_tax_rate($product_check->fields['products_tax_class_id']) *//* 0 */ /* DISPLAY_PRICE_WITH_TAX */);
$this->responseText['preDiscPriceTotal'] = $currencies->display_price($this->shoppingCart->show_total_before_discounts, zen_get_tax_rate($product_check->fields['products_tax_class_id']));
}
One checker advised to change
Code:
protected string $responseType = 'success';
to
Code:
protected $responseType = 'success';
for php 8 compliance. That had no effect.
One checker also suggested that the $_post variables are not properly set before being used.
-
Re: Price Updater
I have installed a new test site with v1.5.8 using the Responsive Classic template and then installed DPU v4.0.0 Beta 3 (https://github.com/Zen4All-nl/Zen-Ca...Price-Updater/) Ajax-loader.gif is spinning upon entering a quantity in the quantity box or selecting an attribute but no price is displaying. Is it compatible with v158?
https://test.discountprintingservice...roducts_id=181
Thanks,
John
-
Re: Price Updater
Quote:
Originally Posted by
GoldBuckle
Are you looking at the previous posts?
-
Re: Price Updater
Reading through it now. Console is showing:
jquery-3.6.1.min.js:2
POST https://test.discountprintingservice...hod=getDetails 500
send @ jquery-3.6.1.min.js:2
ajax @ jquery-3.6.1.min.js:2
(anonymous) @ index.php?main_page=…&products_id=181:70
Deferred @ jquery-3.6.1.min.js:2
zcJS.ajax @ index.php?main_page=…&products_id=181:36
getPrice @ index.php?main_page=…products_id=181:407
(anonymous) @ index.php?main_page=…products_id=181:654
Quote:
Originally Posted by
dbltoe
Are you looking at the previous posts?
-
Re: Dynamic Price Updater
Okay, just missed this one I guess. Will install v5 and report back soon. Thanks dbltoe!
Quote:
Originally Posted by
dbltoe
-
Re: Price Updater
Upgraded to ZC v158, store and admin work as should. Install v5 and store works but admin gives me an error. Delete all v5 files and admin works again. And yes I change the Your Admin and Your Template folders as necessary.
This page isn’t working
www.discountprintingservice.com is currently unable to handle this request.
[COLOR=var(--error-code-color)]HTTP ERROR 500
[/COLOR]
Thanks,
John
-
Re: Price Updater
@lat9 and @dbltoe
Had working v158 store and admin in test folder and added DPU v5 with no other modules installed and store works but admin gives a 500 error. I had changed the <Your Admin> and <Your Template> folders accordingly. Has either of you got v5 to work with v158?
Quote:
Originally Posted by
dbltoe
Are you looking at the previous posts?
Quote:
Originally Posted by
GoldBuckle
Upgraded to ZC v158, store and admin work as should. Install v5 and store works but admin gives me an error. Delete all v5 files and admin works again. And yes I change the Your Admin and Your Template folders as necessary.
This page isn’t working
www.discountprintingservice.com is currently unable to handle this request.
[COLOR=var(--error-code-color)]HTTP ERROR 500
[/COLOR]
Thanks,
John
-
Re: Dynamic Price Updater
I do get the ZC Admin login page but after the submit button I get a 500 error page.
-
Re: Dynamic Price Updater
Quote:
Originally Posted by
GoldBuckle
I do get the ZC Admin login page but after the submit button I get a 500 error page.
500 error implies a PHP log present in the site's /logs sub-directory. Since you can't log in, view that sub-directory either using an FTP program (e.g. WinSCP or FileZilla) or via your webhost's cPanel's File Manager tool.
Remember that since the log was issued from the admin, its contents will include reference to your admin directory's name. Be sure and xxx those occurrences out and post a pertinent log within a "CODE" tag (the big # in the menu bar shown when you're writing your response).
-
Re: Dynamic Price Updater
[17-Feb-2023 10:01:43 America/New_York] PHP Parse error: Unterminated comment starting line 2 in admin/includes/installers/dpu/4_0_0-beta_1.php on line 2
[17-Feb-2023 10:01:43 America/New_York] PHP Parse error: Unterminated comment starting line 2 in admin/includes/installers/dpu/4_0_0-beta_1.php on line 2.
Does this help?
Quote:
Originally Posted by
lat9
500 error implies a PHP log present in the site's /logs sub-directory. Since you can't log in, view that sub-directory either using an FTP program (e.g. WinSCP or FileZilla) or via your webhost's cPanel's File Manager tool.
Remember that since the log was issued from the admin, its contents will include reference to your admin directory's name. Be sure and xxx those occurrences out and post a pertinent log within a "CODE" tag (the big # in the menu bar shown when you're writing your response).
-
Re: Price Updater
@lat9 admin/includes/installers/dpu/4_0_0-beta_1.php on line 2
4_0_0-beta_1.php:
<?php
/**
V4.0.0, What changed:
- updated the jquery to 4.3.1
- rewritten the class and javascript. Removing all the ancient code, and moving to the builtin ajax functions of Zen Cart
- removed the Multi code formthe class, as it is not used (since v1). If neededit can always be put back in.
4_0_0-beta_2.php
<?php
/**
V4.0.0, What changed:
- updated the jquery to 4.3.1
- rewritten the class and javascript. Removing all the ancient code, and moving to the builtin ajax functions of Zen Cart
- removed the Multi code formthe class, as it is not used (since v1). If neededit can always be put back in.
4_0_0-beta_3.php
<?php
/**
V4.0.0, What changed:
- updated the jquery to 4.3.1
- rewritten the class and javascript. Removing all the ancient code, and moving to the builtin ajax functions of Zen Cart
- removed the Multi code form the class, as it is not used (since v1). If neededit can always be put back in.
- Added code changes from Torvista, MC12345678, and Zen4All
I just removed all three php files above and wallah it now works! I feel like I accomplished something!
-
Re: Price Updater
Now that I can get into my test site's admin I tested a product and I am just getting the spinning ajax-gif, price never loads.
-
Re: Price Updater
Yep, those old installers were supposed to be gone. They are now.
You should have a log file for the spinner. Check for that.
AND, a new fix for the spinner. fingers crossed
-
Re: Price Updater
I updated the DPU using the v5 file on Git from your update Friday. Still not working. Ajax gif doesn't stop spinning on product page. After login page on admin side I get blank page and 500 error.
Do I need to re-install zc and then re-install DPU?
Thanks,
John
Quote:
Originally Posted by
dbltoe
Yep, those old installers were supposed to be gone. They are now.
You should have a log file for the spinner. Check for that.
AND, a new fix for the spinner. fingers crossed
-
Re: Price Updater
After multiple failed attempts of 158 and DPU v5 with a test site with data from 157 db I created a new test site with a blank database added 1 product with 2 attributes and 2 options each. Installed DPU v5 and when I go to the login page for admin enter credentials I get a blank page and 500 error. Need some help here as it seems something in v5 is not right using dbltoe 's revision from Friday in the Github.
Thanks,
John
-
Re: Price Updater
Trying to multi-quote previous posts, please see post prior to this one.
Quote:
Originally Posted by
lat9
500 error implies a PHP log present in the site's /logs sub-directory. Since you can't log in, view that sub-directory either using an FTP program (e.g. WinSCP or FileZilla) or via your webhost's cPanel's File Manager tool.
Remember that since the log was issued from the admin, its contents will include reference to your admin directory's name. Be sure and xxx those occurrences out and post a pertinent log within a "CODE" tag (the big # in the menu bar shown when you're writing your response).
Quote:
Originally Posted by
dbltoe
Yep, those old installers were supposed to be gone. They are now.
You should have a log file for the spinner. Check for that.
AND, a new fix for the spinner. fingers crossed
-
Re: Price Updater
I have narrowed the offending file down: config.dpu.php (admin/includes/autoloaders)
looks like it is missing "?>" at the end of the below code. Anyone else see any problems?
<?php
// Dynamic Price Updater 5.0
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
if (IS_ADMIN_FLAG === true) {
$autoLoadConfig[999][] = array(
'autoType' => 'init_script',
'loadFile' => 'init_dpu_config.php'
);
} else {
trigger_error(__FILE__ . ' loaded from catalog side, verify upload of files.', E_USER_WARNING);
@unlink(__FILE__);
}
// uncomment the following line to perform a uninstall
// $uninstall = 'uninstall';
Quote:
Originally Posted by
lat9
500 error implies a PHP log present in the site's /logs sub-directory. Since you can't log in, view that sub-directory either using an FTP program (e.g. WinSCP or FileZilla) or via your webhost's cPanel's File Manager tool.
Remember that since the log was issued from the admin, its contents will include reference to your admin directory's name. Be sure and xxx those occurrences out and post a pertinent log within a "CODE" tag (the big # in the menu bar shown when you're writing your response).
Quote:
Originally Posted by
dbltoe
Yep, those old installers were supposed to be gone. They are now.
You should have a log file for the spinner. Check for that.
AND, a new fix for the spinner. fingers crossed
-
Dynamic Price Updater
Note to Admin, please link plugin to this active repository:
https://github.com/dbltoe/Zen-Cart-D...-Price-Updater
The code in "158" is being actively reviewed but currently installs and works in ZC158.
I'm currently reviewing this complex plugin.
So, if others have bugs or points to make, first try out the code from the "158" branch on a vanilla ZC158 site to reproduce the bug/demonstrate your point, then raise an issue on the repository, then someone may try and fix it if you can't.
-
Re: Dynamic Price Updater
my specials are displaying weird, how do i fix?
https://jnsflooringandsupplies.com/M...&products_id=1
and it never says a percent off
-
Re: Dynamic Price Updater
After spending a stupid amount of time intending to clear such errors,
https://github.com/dbltoe/Zen-Cart-D...ater/issues/26
I eventually gave up as I have to do real work and could not justify any more fettling.
It.Is.Complicated.
But, you could start hacking from here:
https://github.com/dbltoe/Zen-Cart-D..._Ajax.php#L127
that's where all these permutations are constructed.
-
Re: Price Updater
Is there anyone in the ZenCart community that can update this plugging for the latest version 1.5.8 or 1.5.8a?
-
Re: Price Updater
You can try an updated version in branch 158 here:
https://github.com/dbltoe/Zen-Cart-D...-Price-Updater
with no guarantees.
Due to the complexity of this mod, the development and support is pretty forked-up, as various well-meaning people have attempted to keep it alive.
This functionality really should be a core function, but it is not trivial to implement once it touches discount-pricing-hell.
-
1 Attachment(s)
Re: Price Updater
Just a bit question... I was done some stuff and bored.. I turned on, signed 158a and put the files for DPU, I put the create language files and it works now! I need some testing and work for additional image swapped with it, but it's not working yet. I think both worked better with one then two plugins.
-
Re: Price Updater
Quote:
Originally Posted by
davewest
Just a bit question... I was done some stuff and bored.. I turned on, signed 158a and put the files for DPU, I put the create language files and it works now! I need some testing and work for additional image swapped with it, but it's not working yet. I think both worked better with one then two plugins.
The zip file includes a language file for the admin and the shop. The language file for the shop should be placed in includes/languages/english/extra_definitions/ versus includes/languages/english/extra_definitions/responsive_classic. Otherwise, the language file would only work when the selected template was exactly responsive_classic. Putting it directly in extra_definitions allows any template to use the language file.
-
Re: Price Updater
Quote:
Originally Posted by
dbltoe
The zip file includes a language file for the admin and the shop. The language file for the shop should be placed in includes/languages/english/extra_definitions/ versus includes/languages/english/extra_definitions/responsive_classic. Otherwise, the language file would only work when the selected template was exactly responsive_classic. Putting it directly in extra_definitions allows any template to use the language file.
You no, but I like template. Also I can try with or without php strict, it still worked...
My system:
Zen Cart 1.5.8a
Database Patch Level: 1.5.8
Server Linux 6.2.0-33-generic
Apache 2.4.53 (Unix)
PHP 8.1.6 (Zend: 4.1.6)
MySQL 10.4.24-MariaDB
jQuery v3.5.1
-
Re: Price Updater
Note that with the inclusion of POSM (stock control of attributes) in ZC 2.1.0, this add-on
https://vinosdefrutastropicales.com/...products_id=60
can replace DPU.
-
Re: Price Updater
Are you running it successfully with EO installed?
-
Re: Price Updater
-
Re: Price Updater
Quote:
Originally Posted by
torvista
I don't use Edit Orders.
:wow: well done!
-
Re: Price Updater
Quote:
Originally Posted by
torvista
I s there a demo page to demonstrate the price updating?
-
Re: Price Updater
Quote:
Originally Posted by
Georgecy
I s there a demo page to demonstrate the price updating?
https://zc158.vinosdefrutastropicale...&products_id=1
-
Re: Price Updater
The price changes with options selected but does not change when I change the quantity from 1 to 2 or 3 etc etc. That is what makes DPU so great.
Quote:
Originally Posted by
lat9
-
Re: Price Updater
Note that this change to ajax.php
https://github.com/zencart/zencart/b...7/ajax.php#L51
only allows alpha-numeric characters/does not allow an underscore in either of the parameters.
So this call from DPU gets failed:
https://yoursite/ajax.php?act=DPU_Aj...hod=getDetails
as can be seen on the browser console network XHR with the 400 responses.
A quick fix is add the underscore to the check
Code:
!preg_match('/^[a-zA-Z0-9_]+$/', $_GET['act'])
but the class/use of this variable needs to be renamed.
Since DPU needs to taken behind the shed to be shot/replaced with this add-on to the core attributes stock manager
https://vinosdefrutastropicales.com/...products_id=60
I'm just giving a heads-up.
-
Re: Price Updater
ZC 2.1.0 / PHP 8.3 / Using ZCABootstrap as template.
Managed to get everything to work by using the version loaded in from the GitHub, but changing attribute options on a product page, I get the following error:
Code:
[03-Dec-2024 22:50:55 America/New_York] Request URI: /justuptown/ajax.php?act=DPU_Ajax&method=getDetails, IP address: 127.0.0.1, Language id 1#0 E:\xampp\htdocs\justuptown\includes\classes\ajax\zcDPU_Ajax.php(110): zen_debug_error_handler()
#1 E:\xampp\htdocs\justuptown\ajax.php(77): zcDPU_Ajax->getDetails()
--> PHP Warning: Undefined property: DPU::$sideboxActive in E:\xampp\htdocs\justuptown\includes\classes\ajax\zcDPU_Ajax.php on line 110.
[03-Dec-2024 22:50:55 America/New_York] Request URI: /justuptown/ajax.php?act=DPU_Ajax&method=getDetails, IP address: 127.0.0.1, Language id 1
#0 E:\xampp\htdocs\justuptown\includes\classes\ajax\zcDPU_Ajax.php(110): zen_debug_error_handler()
#1 E:\xampp\htdocs\justuptown\ajax.php(77): zcDPU_Ajax->getDetails()
--> PHP Warning: Undefined property: DPU::$sideboxActive in E:\xampp\htdocs\justuptown\includes\classes\ajax\zcDPU_Ajax.php on line 110.
-
Re: Price Updater
Quote:
Originally Posted by
retched
ZC 2.1.0 / PHP 8.3 / Using ZCABootstrap as template.
Managed to get everything to work by using the version loaded in from the GitHub, but changing attribute options on a product page, I get the following error:
Code:
[03-Dec-2024 22:50:55 America/New_York] Request URI: /justuptown/ajax.php?act=DPU_Ajax&method=getDetails, IP address: 127.0.0.1, Language id 1#0 E:\xampp\htdocs\justuptown\includes\classes\ajax\zcDPU_Ajax.php(110): zen_debug_error_handler()
#1 E:\xampp\htdocs\justuptown\ajax.php(77): zcDPU_Ajax->getDetails()
--> PHP Warning: Undefined property: DPU::$sideboxActive in E:\xampp\htdocs\justuptown\includes\classes\ajax\zcDPU_Ajax.php on line 110.
[03-Dec-2024 22:50:55 America/New_York] Request URI: /justuptown/ajax.php?act=DPU_Ajax&method=getDetails, IP address: 127.0.0.1, Language id 1
#0 E:\xampp\htdocs\justuptown\includes\classes\ajax\zcDPU_Ajax.php(110): zen_debug_error_handler()
#1 E:\xampp\htdocs\justuptown\ajax.php(77): zcDPU_Ajax->getDetails()
--> PHP Warning: Undefined property: DPU::$sideboxActive in E:\xampp\htdocs\justuptown\includes\classes\ajax\zcDPU_Ajax.php on line 110.
Okay... this is a bandaid, the errors have stopped but I fear this is only temporary:
include/classes/ajax/zcDPU_Ajax.php:
Change line about 110:
PHP Code:
if ($this->dpu->sideboxActive) {
to
PHP Code:
if ($this->dpu->sideboxActive ?? FALSE) {
And change \includes\templates\bootstrap\jscript\jscript_dynamic_price_updater.php, line 79 from:
PHP Code:
const DPUsideboxActive = ('<?php echo $dpu->sideboxActive; ?>' === '1');
to
PHP Code:
const DPUsideboxActive = ('<?php echo $dpu->sideboxActive ?? NULL; ?>' === '1');
I do not like these, but not sure where to go about declaring the property.
-
Re: Price Updater
Can anyone confirm if the GitHub version of the Dynamic Price Updater v5 (linked below) is compatible with Zen Cart 2.10?
https://github.com/dbltoe/Zen-Cart-D...-Price-Updater
I'm encountering an issue where the price is not updating, and the browser console logs a 400 Bad Request error for the AJAX call.
I noticed that I had the same issue as described in the last post of this thread by retched. I applied the two suggested edits, which resolved that specific problem, but the 400 Bad Request error persists.
Any insights or confirmation on compatibility would be greatly appreciated!
Thanks in advance!
-
Re: Price Updater
The 'quick fix' in this post fixed the 400 error for me in v2.1.0. I have not (needed to) apply the two suggested edits.
-
Re: Price Updater
Quote:
Originally Posted by
simon1066
Thank you that fixed it!