Can there be more than one "Special" for a product?
From inspecting the code, it seems like the answer to the question in the title is "No". If that's the case, why doesn't the specials table simply use the associated products_id as its primary key?
I ask because a client has, over the past year, run into non-reproducible conditions where adding a special price (via products price manager) winds up adding the special twice ... resulting in the product being displayed twice on various storefront listings.
If each product can have only one special, I was going to simply modify the specials.php handling for the insert action to remove any previous record prior to the insert. If multiple specials are allowable, the solution gets a bit more tricky.
Re: Can there be more than one "Special" for a product?
Somewhat missing the benefit(s) of the specials table being populated with data that remains present for a given products_id and can be toggled between enabled/disabled either manually or perhaps in this case automatically without "pre-planning" (a situation that could be bettered by improved/modified admin/specials handling/review).
What if one were to have a special for a product implemented today, but in 7 days the special was to reduce the price another 10% or to some other "value", that second special for the one product could not be even entered let alone implemented until the first had been "removed". Should perhaps only one be "active" at a time? Would say that it is a good idea, with consideration of current implementation of specials, but there could also be an additional "logic" applied of any numerous factors (last one implemented, combining two or more but then how, etc). As to "removal" (deletion instead of deactivation) of a special, some places may run a "routine" special each year and, although the table does not currently support a "repetitive" configuration, by the special remaining available in the table the date range can be updated which then would trigger the appropriate re-activation of the special at the appropriate date/time.
It seems that the current implementation depends on the store owner "managing" the specials that are in place and preventing a product having two or more active specials at one time, or if protection is offered on the "front end" (admin entry area) that something else permitted the introduction of a special to the database table without similar/appropriate discrimination.
Re: Can there be more than one "Special" for a product?
In the current implementation of "specials" (through ZC 1.5.5e), if a product has a special its products_id is no longer presented in the drop-down list of products; that's what led me to my initial assertion (one special/product).
I agree with you, mc12345678, that with the start/end dates it seems like you should be able to have multiple specials "staged" for a given product but that's not how it currently works.
Re: Can there be more than one "Special" for a product?
Also you Install a special if none exists for a product, or edit it if one does.
Re: Can there be more than one "Special" for a product?
Specials can be date-ranged so you could have multiple entries for a single product id.
Re: Can there be more than one "Special" for a product?
Quote:
Originally Posted by
swguy
Specials can be date-ranged so you could have multiple entries for a single product id.
I see that in the GUI, but it's a different story in the "core" code.
Re: Can there be more than one "Special" for a product?
I agree with lat9 regarding the current implementation which is the same for at least as far back as ZC 1.5.3 as I found in the admin panel when attempting to provide multiple specials for a given products_id. That being that the admin handling is of a basic nature allowing addition/implementation of one special for one product regardless of it being active or disabled.
This indicates that to support what we have described of even a date ranged special requires a separate tool to populate the specials table and that the base install doesn't do anything "unique" if the database is found to have more than one special applied to the product and in particular if two or more specials are active (on purpose or accident) during the same time period.
Re: Can there be more than one "Special" for a product?
Quote:
Originally Posted by
lat9
I see that in the GUI, but it's a different story in the "core" code.
Remember that the status of a special is set in the init code (init_includes/init_special_funcs.php) so as long as your date ranges don't overlap, you could have multiple specials for a single product.
Re: Can there be more than one "Special" for a product?
Quote:
Originally Posted by
swguy
Remember that the status of a special is set in the init code (init_includes/init_special_funcs.php) so as long as your date ranges don't overlap, you could have multiple specials for a single product.
... and could is the operative word! The specials code in the admin (the core version anyway) will not allow multiple specials to be assigned to a single product via its GUI.
Re: Can there be more than one "Special" for a product?
You're right - the admin/specials.php passes $specials_array which is a list of things to be excluded when it calls zen_draw_products_pull_down. Have you tried resetting $specials_array, i.e.
Code:
$specials_array = array();
to see what happens? I think it might work.