Closed (fixed)
Project:
e-Commerce
Version:
5.x-4.x-dev
Component:
subproducts
Priority:
Minor
Category:
Bug report
Assigned:
Reporter:
Created:
25 Jul 2006 at 10:49 UTC
Updated:
31 May 2007 at 06:10 UTC
Jump to comment: Most recent file
guys,
i dont know why the attribute stocks are summed during permutations creations. imo, it should be the least attribute stock. (i know thats is a warning on the top of the page saying "Settings you put here for stock will be summed to give a default stock amount for each subproduct.")
example:
variation: color
attribute: green
stock: 100
variation: size
attribute: big
stock: 200
so should be 100 big green stairs, not 300.
to correct this, change this code (in subproducts.inc)
foreach ($permutation as $vid => $aid) {
$form['name'][$fields][$aid] = array('#type' => 'markup', '#value' => $variations[$vid]->attributes[$aid]->name);
$price += $variations[$vid]->attributes[$aid]->surcharge;
$stock += $settings[$vid][$aid]['stock'];
}
to this
$stocktoggle = 0;
foreach ($permutation as $vid => $aid) {
$form['name'][$fields][$aid] = array('#type' => 'markup', '#value' => $variations[$vid]->attributes[$aid]->name);
$price += $variations[$vid]->attributes[$aid]->surcharge;
if ($stocktoggle != 0) {
$stock = ($settings[$vid][$aid]['stock'] >= $stock) ? $stock : $settings[$vid][$aid]['stock'] ;
}
else {
$stock = $settings[$vid][$aid]['stock'] ;
}
$stocktoggle += 1;
}
PS: the instructions on the top of the page will continue to show "Settings you put here for stock will be summed to give a default stock amount for each subproduct."
regards,
massa
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | subproducts.inc_minimunstock1.patch.txt | 1.07 KB | brmassa |
Comments
Comment #1
darren ohNo patch is attached.
Comment #2
brmassa commentedComment #3
recidive commentedSomeone else besides the author needs to test the code before it can be commited.
Comment #4
brmassa commentedComment #5
darren ohSetting to active until the resolution of this issue has been reported.
Comment #6
brmassa commentedGuys,
Since the EC Live Subproducts has this feature and next Ecommerce version (v4) will merge this code to subproducts, i suggest to all to migrate to EC Live Subproducts.
regards,
massa
Comment #7
brmassa commented