Just also noticed that if i do a salemaker for a category discount, and one of those products in the sale is Zero stock.
The discounted price says "0.00"
Printable View
Just also noticed that if i do a salemaker for a category discount, and one of those products in the sale is Zero stock.
The discounted price says "0.00"
So, until now hadn't seen the previous message/request about "throwing" the current price of the selected options to or back to another piece of software. Also, regarding the above, there isn't anything in the price determination code to pick up on being "out-of-stock" in some sub-variant. There can be, it's just not there at the moment. Code would likely go into the class file for dpu in includes/classes. Though I am also trying to figure out the configuration that causes this. Is the problem being seen on the product's listing page (multiple product being displayed) or on the product info page (which at the moment doesn't make sense per se, or may need to be "worked around")?
That final operation is a bit outside this plugin, but... there are a number of tools within it that would aid/support getting the desired result and/or that could be combined into the associated functionality (that way system doesn't have to double dip for data/info, just needs to be handled/processed either on the php side or the javascript side or both.)
What are the settings for stock related to product availability when "sold out", is it possible to purchase items that have a quantity of 0 or less, or are items just on display that are at 0 or less, what conditions are necessary to reproduce the issue so that can incorporate a fix as necessary?
The price that is displayed for the product and attribute selection is based off of attempting to add the product to the cart and figuring out from there what the price became. If something say prevented adding to the cart or gives such a 0 price, then that's the end result as far as this plugin is concerned.
Thank you for that information. Will look into one or more ways to address it. It sounds like based on the discussion of the product being out-of-stock that it the store is setup to not allow purchase of product if the quantity is 0 or less. Therefore that will be/become a factor moving forwards.
It does make me wonder how much if any of the shopping_cart related operation can be hooked into to allow the "addition" of a product in this condition so that the price updating can be visualized, but not to allow the addition of the product through another process. Otherwise (without editing the shopping_cart class), price updating may not be permitted for product that are out-of-stock when store is set to require a positive quantity of stock to add product to the cart.
Of course an alternative would be to include a separate version of a shopping_cart type class that does allow such a condition, but then it would need to either be maintained in parallel with the version of ZC or any other changes uniquely made to it, which just makes things more difficult to maintain consistent operation and the software.
A potential middle ground to that could be to evaluate the in-stock quantity and then manage the price determination based on that knowledge. :/
Some things to review and determine.
If you believe you need a temporary fix to the issue in the interim I can advise how to disable the price update feature for this condition.
In: includes/modules/pages/YOUR_PRODUCT_TYPE/jscript_dynamic_price_updater.php
Before the last line of this code (code section starts about line 23):
Make it look like:Code:if (empty($pidp)) {
$load = false;
}
if ($load)
This is based on the report that there is an issue when a special/sale exists for a product that has a stock quantity of zero and the store does not permit "over-purchase" of the quantity. It does not address the possibility of quantity discounts having the same "result" of displaying the discounted price as 0.Code:if (empty($pidp)) {
$load = false;
}
if ($load && STOCK_ALLOW_CHECKOUT === 'false') {
$pid_quant = $db->Execute("SELECT products_quantity FROM " . TABLE_PRODUCTS . " WHERE products_id = ". (int)$pid, false, false, 0, true);
if ($pid_quant->EOF || $pid_quant->fields['products_quantity'] <= 0) {
if (zen_get_products_special_price((int)$pid, false) !== false) {
$load = false;
}
}
}
if ($load)
HI, thanks for reply, just tried the code change but didnt make any difference.
Just noticed same issue applies to any product (discounted or not) if quantity set to 0, and setting for checkout not allowed when quantity is 0.
just noticed that if the setting "Show Sold Out Image in place of Add to Cart" is set to 1, then i just get 0.00 displayed for the price.
if the setting is set to 0, then the price displays fine.
one presumes that DPU is linked to this setting somehow?
So ,based on digging, found the only way i can get the price to still display correctly when product is sold out is to change the template file
tpl_product_info_display.php
find
and after it addCode:$display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
Code://jf added for dynamic price updater DPU----------------
if (strpos($display_button, 'button_sold_out.gif') !== false) {
$display_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . $display_button ;
}
//eof jf add-------------------------------
this passes the hidden quantity and value fields which it appears DPU requires to calculate its values