Hi mc
Thanks for the advice ref the ZenID. I have set this properly now.
How can I add a suffix to the 2nd price?
Just to pinpoint, this is the price which shows below the add cart button at https://sitstandforbusiness.com/heig...dule-p-29.html
Hi mc
Thanks for the advice ref the ZenID. I have set this properly now.
How can I add a suffix to the 2nd price?
Just to pinpoint, this is the price which shows below the add cart button at https://sitstandforbusiness.com/heig...dule-p-29.html
Unable to access your site at the moment to identify the details of what is going on; however, if all that is needed is to add something at the end of the text, then this could be done within the includes/modules/pages/product_info/jscript_dynamic_price_updater.php file within the objXHR.prototype.updSP = function () { section such as:
The content between the double quotes could be php provided to depend on settings of the store or to use a constant that is language dependent for example.Code: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 + " suffix";
If the suffix is to be added elsewhere within the content, then some additional javascript or other php could/would be used to split out temp.innerHTML to the desired parts in order to insert the associated text.Code:objSP.innerHTML = temp.innerHTML + " <?php if ($condition) { echo CONSTANT;} else { echo CONSTANT2; } ?>";
This area was chosen because the updSP (Second price location) is not presented until one of the attributes has been changed and that text is dependent on/reflects the content of the primary price display.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Thanks. The first method worked.
Glad that worked.
The "second" method is intended to support multiple languages and demonstrates a simple if/then/else comparison or operation, but requires at least one define to be added into the includes/languages file structure such as either at the base language file includes/languages/YOUR_LANGUAGE.php (overrideable at includes/languages/YOUR_TEMPLATE/YOUR_LANGUAGE.php) or the applicable product type (also overrideable) as in includes/languages/YOUR_LANGUAGE/product_info.php or preferably includes/languages/YOUR_LANGUAGE/YOUR_TEMPLATE/product_info.php for example. If placed in the individual product type file, then it would need to be duplicated across product types used on the site; however, by being placed in the probably more preferred overridden main language file, then it is entered once and applied across all product types that may be used in the store.
The define(s) would be similar to:
Code:define('CONSTANT', 'suffix text'); define('CONSTANT2', 'other suffix text');
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Apologies for the late notification.
Last weekend, I uploaded an updated copy of DPU for review; however, in true fashion shortly after doing so I discovered a couple of issues when I attempted to use the features from a specific mobile device which ultimately was a result of using a default value in a parameter within the javascript code. By review of javascript discussions, this shouldn't have been a problem, but it would seem that the particular device wasn't playing by "today's" standards, so a resolution to that has been created. Also, in rewriting a portion of the dpu class code, I had not taken into account changes that would be needed for the provided/included sidebox. Also, the newly included installer includes a check for updated versions; however, it also expects the ability to disable version checking which was not included in the installer sql.
Anyways, all of that said, I am working on the instruction to address the updates/modifications most of which are available currently from github: https://github.com/mc12345678/Dynamic_Price_Updater
So stay tuned for version 3.0.6, I would like to have it pushed to the forum for review over the weekend, other projects pending.
Available here.Version 3.0.5:
- Improved installation/installer
- Previous process for installation included a delete of previous settings. This is now performed using insert ignore style sql and as necessary to update settings with a focus of configuration sort order.
- Rewrote the data collection about a product to improve ability to compare to the active cart.
- If using the class function of insertProducts, the resulting prid is an integer only and does not include the possibility of addressing attributes based on the change(s) made here. This is equivalent to a standard product being listed in the product listing screen being added to the cart where attributes are "typically" not selectable.
- Modified quantity reporting to provide quantity already in cart for selected attributes if the quantity is greater than zero.
- Incorporated forum correction for operation when DPU_SHOW_LOADING_IMAGE is set to false.
- Added JSON response information when retrieving results.
- Incorporated the use of Zen Cart's provided zcJS when it is available.
- Made the DPU class part of the overall system to better support additional observers as needed.
- Maintained the "default" XML response if JSON is not requested to align with potential historical alterations.
- Added the restoration of the price display if the transaction fails.
- Added jscript function to perform data/screen update/swap.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Submitted v3.0.6, awaiting review. When posted should be available from here: https://www.zen-cart.com/downloads.php?do=file&id=1301
Description provided:
Anyone that has fully installed version 3.0.5 should be notified through their admin when version 3.0.6 is made available for download.3.0.6:
- Modified/updated the class information to provide the sidebox data.
- Correct additional javascript errors to prevent having to catch them.
- Modified sidebox to not display/be active if the page's javascript for dpu is not active.
- Added additional type casting to force data to the expected type.
- Incorporate the tax calculation correction posted in the forum into the code.
- Removed the use of default parameters because some browsers do/did not support it.
- Add separate control for update checking of this plugin.
- Updated installer version check to ZC 1.5.5e version.
- Corrected installer code to validate new version exists.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Version 3.0.6 has been posted for download; however, there were a few additional things discovered that are addressed in version 3.0.7 (also on github):
Only the dpu class file was modified in version 3.0.7 as compared to 3.0.6 and the addition of the installer "version" file.3.0.7, What changed:
- Corrected issue that price of product without attributes was not incorporated/considered because
the dpu javascript code basically prevented overwriting the price until corrections were made
in version 3.0.6 that would automatically rewrite the current price display based on what
dpu determined based on the product. (This additional feature was added to support display of
the appropriate information when returning to the product from the shopping cart.)
- Because the price is automatically calculated based on arriving at a product, if a product is
priced by attributes and not all of the "mandatory" attributes are selected then the price
was only showing the price point of those that were selected. The code now calculates the
lowest available price based on the selections already made. The displayed text has not been
edited to account for this "feature" yet, but could be modified to support the condition.
When the software review team has made it through the review and posting of the update it should be available here: https://www.zen-cart.com/downloads.php?do=file&id=1301
Welcome further feedback/suggestions of how these additional features/calculations are presented. See at least one place where an additional notifier could maybe add some functionality to the code.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...