Hi guys,
I given up on finding an addon that lets me price attributes generated by the grid uniquely. I was so sure it existed, because this is a common feature to stores.
Product Example:
So, I am have been trying to code this feature myself.
This is as far as I have gotten:
The best way I could figure out to do this was to modify the 'Stock by Attributes' and 'Attribute Grid' addons to also price by attributes.
I figured out where in the attributes.php files I want this feature to show up.
PHP Code:
if ($show_attribute_stock == true) {
$attrib_grid .= '<div class="attrb-price">'.sprintf($attribute_grid_price).'</div>';
$attrib_grid .= '<div class="attrb-stock">'.sprintf(TEXT_ATTRIBUTE_GRID_IN_STOCK, $attribute_stock).'</div>';
}
break;
}
$attrib_grid .= '</td>';
}
Now how do I set up $attribute_grid_price to = a price defined in the Admin/Catalog/Products With Attributes Stock that will add to the start price of the product when added to the cart?
I know I need to add too the functions_lookups.php
PHP Code:
// check if any attribute stock values have been set for the product
// (only of there is will we continue, otherwise we'll use product level data)
$attribute_stock = $db->Execute("select stock_id from " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " where products_id = '" . (int)$products_id . "'");
if ($attribute_stock->RecordCount() > 0) {
// prepare to search for details for the particular attribute combination passed as a parameter
if(sizeof($attributes) > 1){
$first_search = 'where options_values_id in ("'.implode('","',$attributes).'")';
} else {
foreach($attributes as $attribute){
$first_search = 'where options_values_id="'.$attribute.'"';
}
}
Other than that I need some help getting me in the right direction.
Thanks.
Bookmarks