Well Ajeh, in the interest of time, I have just coded a way to make it happen. I usually try to work with the existing code to limit breakage later but ... not this time. I appreciate your efforts.
First off I discovered that to boolean for priced by attribute had not bee set correctly when the product was added to the DB (my error - I had tweaked the info collect php). That solved the issue of the $0.00 attribute price. Then to get the attribute pricing to show up like this:
http://www.mendweb.com/images/attributesale.gif
I added some code, a flag and some more code to attributes.php . My atttributes.php is highly modified so please be careful when trying to use this code. This is only for reference and cannot be directly plugged into your files!!
But essentially here is the logic.
1)Add a flag variable and set to false at the top of file. MIne is on line 19 $onSaleFlag = FALSE;
2) Around line 157 when showing sale discount I changed
if ($products_options->fields['options_values_price'] != '0' and ($products_options->fields['product_attribute_is_free'] != '1' and $product_info->fields['product_is_free'] != '1')) {
// show sale maker discount if a percentage
$products_options_display_price= ATTRIBUTES_PRICE_DELIMITER_PREFIX . $products_options->fields['price_prefix'] .
$currencies->display_price($new_attributes_price, zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ATTRIBUTES_PRICE_DELIMITER_SUFFIX;
```to be
if ($products_options->fields['options_values_price'] != '0' and ($products_options->fields['product_attribute_is_free'] != '1' and $product_info->fields['product_is_free'] != '1')) {
// show sale maker discount if a percentage
$products_options_display_price= ' <!--attributes '.__LINE__.' --><br/><span class="productSalePrice">' . PRODUCT_PRICE_SALE . $products_options->fields['price_prefix'] .
$currencies->display_price($new_attributes_price, zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . '</span> ';
$onSaleFlag = TRUE;
} else {
****Notice I set the flag.
3)Then under RADIO BUTTONS case '6': - line 157 for me but probably closer to 147 on a virgin file?? (I have case six because I am using the MOD "Attribute Image Replaces Main Image" <http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=994>)
I have this: ```
case '6':
$tmp_attributes_image .= '<!-- attributes '.__LINE__.' --><div class="attribImg">' .zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']', $products_options_value_id, $selected_attribute, 'id="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '"'.' '.$parameters5).'<br />' . zen_image(DIR_WS_IMAGES . $products_options->fields['attributes_image'],'attr' ,SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, ' border="1" onclick="document.getElementById(\'attrib-'. $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id .'\').checked = true;getattribimage('.'\'id[' . $products_options_names->fields['products_options_id'] . ']\''.','. MEDIUM_IMAGE_WIDTH.','. MEDIUM_IMAGE_HEIGHT.', '.$products_options->fields['products_options_values_id'].','.$_GET['products_id'].');"'). '<br /><!-- attributes '.__LINE__.' -->'. $products_options_details .'<br />';
if (($products_options->fields['options_values_price'] > '0') && ($onSaleFlag == TRUE)){
$tmp_attributes_image .= '<!-- attributes '.__LINE__.' --><s>$'. number_format($products_options->fields['options_values_price'],2).'</s>';
}
';
$tmp_attributes_image .= '</div>' . "\n";
break;
You must make sure that your attributes name is set to Radio and option 6 or this code will never be triggered and another area of attributes.php will need the tweaks applied.
Well it worked for me... good luck and, Ajeh - again thanks for your attentiveness! You're one big reason this board is a great resource.