If this is your first visit, check our documentation. To post, register or login.
Forums / Customizing the Look of Your Shop / Templates, Stylesheets, Page Layout / How to display price? "Starting at" prices are blank when attributes_qty_prices exist

How to display price? "Starting at" prices are blank when attributes_qty_prices exist

Started by zean on 18 Mar 2016, 4:30 AM · Views: 2,911

Results 1 to 11 of 11
18 Mar 2016, 4:30 AM
#1
zean avatar

zean

Zen Follower

Join Date:
May 2009
Posts:
200
Plugin Contributions:
0

Post #1 by zean

"Starting at" prices are blank on the product info page when attributes_qty_prices exist with the following admin configuration.
I've been studying the code and am getting a little salty. Help, please?

Prices are set in admin>Catalog>Categories/Products>Attribute Controller>edit option value> Attributes Qty Price Discount: (i.e., attributes_qty_prices)

For example, shown below from the Table products_attributes here are the contents of attributes_qty_prices for 3 of the attributes associated with the product.

3:7.35,9:7.20,29:6.83,49:6.39,99:5.88,299:5.51,499:5.14,999:5.07,9999:4.92
3:9.17,9:8.98,29:8.53,49:7.98,99:7.33,299:6.88,499:6.42,999:6.33,9999:6.14
3:11.20,9:10.98,29:10.42,49:9.75,99:8.96,299:8.40,499:7.84,999:7.73,9999:7.50

**I would therefore want the "Starting at" display price on the product info page to be $4.92 since it is the lowest qty price for the cheapest option.
**

The Product Price is set to 0.00 (i.e., products_price = 0)

The attribute prices are set to 0.00 (i.e., options_values_price = 0)

The Product Priced by Attributes is set to YES

The attribute prices are defined without the price prefix of +

Attribute is Free When Product is Free: yes
Apply Discounts Used by Product Special/Sale: yes
Include in Base Price When Priced by Attributes: yes

Used For Display Purposes Only: no
Attribute Required for Text: no

18 Mar 2016, 9:56 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #2 by mc12345678

Haven't looked at the includes/modules/attrbutes.php code and haven't used the quantity prices field on attributes, but typically the attribute's price is filled in to provide the minimum price for the product. I would think that the quantity discount would be populated in the same manner as when populating the quantity discounts as well, but again, that's just a thought. Otherwise the setup looks correct to support display of the minimum price for the product.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

18 Mar 2016, 7:51 PM
#3
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Post #3 by kobra

What template are you using?

Can you switch to the "classic green" to see what displays?

Zen-Venom Get Bitten

18 Mar 2016, 7:58 PM
#4
zean avatar

zean

Zen Follower

Join Date:
May 2009
Posts:
200
Plugin Contributions:
0

Post #4 by zean

Unfortunately, this is ignored by Zen-Cart . . . Consideration of attribute quantity discounts (i.e., attributes_qty_prices) for displaying the "Starting at" price is not a feature of Zen-Cart. Therefore, the "Starting at" price is blank. Suggestions on how to modify code?

Here is Zen-Cart version 1.5.4. logic and code to display the "Starting at" price:

tpl_product_info_display.php calls the Function zen_get_products_display_price
Function zen_get_products_display_price *calls the *Function ** zen_get_products_base_price

Both Functions are defined in the file named /includes/functions/functions_prices.php
The file includes/modules/attrbutes.php does not seem to be involved.

tpl_product_info_display.php . . . ```

<!--bof Product Price block --> <h2 id="productPrices" class="productGeneral"> <?php // base price if ($show_onetime_charges_description == 'true') { $one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />'; } else { $one_time = ''; } echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . [B][I]zen_get_products_display_price[/I][/B]((int)$_GET['products_id']); ?></h2> <!--eof Product Price block --> ```

Function zen_get_products_display_price . . . ```
function zen_get_products_display_price($products_id) {
global $db, $currencies;

$free_tag = "";
$call_tag = "";

// 0 = normal shopping
// 1 = Login to shop
// 2 = Can browse but no prices
// verify display of prices
switch (true) {
case (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == ''):
// customer must be logged in to browse
return '';
break;
case (CUSTOMERS_APPROVAL == '2' and $_SESSION['customer_id'] == ''):
// customer may browse but no prices
return TEXT_LOGIN_FOR_PRICE_PRICE;
break;
case (CUSTOMERS_APPROVAL == '3' and TEXT_LOGIN_FOR_PRICE_PRICE_SHOWROOM != ''):
// customer may browse but no prices
return TEXT_LOGIN_FOR_PRICE_PRICE_SHOWROOM;
break;
case ((CUSTOMERS_APPROVAL_AUTHORIZATION != '0' and CUSTOMERS_APPROVAL_AUTHORIZATION != '3') and $_SESSION['customer_id'] == ''):
// customer must be logged in to browse
return TEXT_AUTHORIZATION_PENDING_PRICE;
break;
case ((CUSTOMERS_APPROVAL_AUTHORIZATION != '0' and CUSTOMERS_APPROVAL_AUTHORIZATION != '3') and $_SESSION['customers_authorization'] > '0'):
// customer must be logged in to browse
return TEXT_AUTHORIZATION_PENDING_PRICE;
break;
default:
// proceed normally
break;
}

// show case only
if (STORE_STATUS != '0') {
if (STORE_STATUS == '1') {
return '';
}
}

// $new_fields = ', product_is_free, product_is_call, product_is_showroom_only';
$product_check = $db->Execute("select products_tax_class_id, products_price, products_priced_by_attribute, product_is_free, product_is_call, products_type from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'" . " limit 1");

// no prices on Document General
if ($product_check->fields['products_type'] == 3) {
  return '';
}

$show_display_price = '';
$display_normal_price = [B][I]zen_get_products_base_price[/I][/B]($products_id);
$display_special_price = zen_get_products_special_price($products_id, true);
$display_sale_price = zen_get_products_special_price($products_id, false);

$show_sale_discount = '';
if (SHOW_SALE_DISCOUNT_STATUS == '1' and ($display_special_price != 0 or $display_sale_price != 0)) {
  if ($display_sale_price) {
    if (SHOW_SALE_DISCOUNT == 1) {
      if ($display_normal_price != 0) {
        $show_discount_amount = number_format(100 - (($display_sale_price / $display_normal_price) * 100),SHOW_SALE_DISCOUNT_DECIMALS);
      } else {
        $show_discount_amount = '';
      }
      $show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $show_discount_amount . PRODUCT_PRICE_DISCOUNT_PERCENTAGE . '</span>';

    } else {
      $show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $currencies->display_price(($display_normal_price - $display_sale_price), zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . PRODUCT_PRICE_DISCOUNT_AMOUNT . '</span>';
    }
  } else {
    if (SHOW_SALE_DISCOUNT == 1) {
      $show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . number_format(100 - (($display_special_price / $display_normal_price) * 100),SHOW_SALE_DISCOUNT_DECIMALS) . PRODUCT_PRICE_DISCOUNT_PERCENTAGE . '</span>';
    } else {
      $show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $currencies->display_price(($display_normal_price - $display_special_price), zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . PRODUCT_PRICE_DISCOUNT_AMOUNT . '</span>';
    }
  }
}

if ($display_special_price) {
  $show_normal_price = '<span class="normalprice">' . $currencies->display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . ' </span>';
  if ($display_sale_price && $display_sale_price != $display_special_price) {
    $show_special_price = ' ' . '<span class="productSpecialPriceSale">' . $currencies->display_price($display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</span>';
    if ($product_check->fields['product_is_free'] == '1') {
      $show_sale_price = '<br />' . '<span class="productSalePrice">' . PRODUCT_PRICE_SALE . '<s>' . $currencies->display_price($display_sale_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</s>' . '</span>';
    } else {
      $show_sale_price = '<br />' . '<span class="productSalePrice">' . PRODUCT_PRICE_SALE . $currencies->display_price($display_sale_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</span>';
    }
  } else {
    if ($product_check->fields['product_is_free'] == '1') {
      $show_special_price = ' ' . '<span class="productSpecialPrice">' . '<s>' . $currencies->display_price($display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</s>' . '</span>';
    } else {
      $show_special_price = ' ' . '<span class="productSpecialPrice">' . $currencies->display_price($display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</span>';
    }
    $show_sale_price = '';
  }
} else {
  if ($display_sale_price) {
    $show_normal_price = '<span class="normalprice">' . $currencies->display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . ' </span>';
    $show_special_price = '';
    $show_sale_price = '<br />' . '<span class="productSalePrice">' . PRODUCT_PRICE_SALE . $currencies->display_price($display_sale_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</span>';
  } else {
    if ($product_check->fields['product_is_free'] == '1') {
      $show_normal_price = '<s>' . $currencies->display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</s>';
    } else {
      $show_normal_price = $currencies->display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id']));
    }
    $show_special_price = '';
    $show_sale_price = '';
  }
}

if ($display_normal_price == 0) {
  // don't show the $0.00
  $final_display_price = $show_special_price . $show_sale_price . $show_sale_discount;
} else {
  $final_display_price = $show_normal_price . $show_special_price . $show_sale_price . $show_sale_discount;
}

// If Free, Show it
if ($product_check->fields['product_is_free'] == '1') {
  if (OTHER_IMAGE_PRICE_IS_FREE_ON=='0') {
    $free_tag = '<br />' . PRODUCTS_PRICE_IS_FREE_TEXT;
  } else {
    $free_tag = '<br />' . zen_image(DIR_WS_TEMPLATE_IMAGES . OTHER_IMAGE_PRICE_IS_FREE, PRODUCTS_PRICE_IS_FREE_TEXT);
  }
}

// If Call for Price, Show it
if ($product_check->fields['product_is_call']) {
  if (PRODUCTS_PRICE_IS_CALL_IMAGE_ON=='0') {
    $call_tag = '<br />' . PRODUCTS_PRICE_IS_CALL_FOR_PRICE_TEXT;
  } else {
    $call_tag = '<br />' . zen_image(DIR_WS_TEMPLATE_IMAGES . OTHER_IMAGE_CALL_FOR_PRICE, PRODUCTS_PRICE_IS_CALL_FOR_PRICE_TEXT);
  }
}

return $final_display_price . $free_tag . $call_tag;

}


Function zen_get_products_base_price . . . ```
////
// computes products_price + option groups lowest attributes price of each group when on
  function zen_get_products_base_price($products_id) {
    global $db;
      $product_check = $db->Execute("select products_price, products_priced_by_attribute from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

// is there a products_price to add to attributes
      $products_price = $product_check->fields['products_price'];

      // do not select display only attributes and attributes_price_base_included is true
      $product_att_query = $db->Execute("select options_id, price_prefix, options_values_price, attributes_display_only, attributes_price_base_included, round(concat(price_prefix, options_values_price), 5) as value from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and attributes_display_only != '1' and attributes_price_base_included='1'". " order by options_id, value");

      $the_options_id= 'x';
      $the_base_price= 0;
// add attributes price to price
      if ($product_check->fields['products_priced_by_attribute'] == '1' and $product_att_query->RecordCount() >= 1) {
        while (!$product_att_query->EOF) {
          if ( $the_options_id != $product_att_query->fields['options_id']) {
            $the_options_id = $product_att_query->fields['options_id'];
            $the_base_price += (($product_att_query->fields['price_prefix'] == '-') ? -1 : 1) * $product_att_query->fields['options_values_price'];
          }
          $product_att_query->MoveNext();
        }

        $the_base_price = $products_price + $the_base_price;
      } else {
        $the_base_price = $products_price;
      }
      return $the_base_price;
  }


////
18 Mar 2016, 10:48 PM
#5
zean avatar

zean

Zen Follower

Join Date:
May 2009
Posts:
200
Plugin Contributions:
0

Post #5 by zean

kobra:

What template are you using?

Can you switch to the "classic green" to see what displays?

Yes, same result (i.e., blank for Starting Price) with the "classic green" template. This is because, "The Display Price is made up of the lowest attribute price from each Option Name group" without regard to Prices that are set in admin>Catalog>Categories/Products>Attribute Controller>edit option value> Attributes Qty Price Discount: (i.e., attributes_qty_prices)

Attached images show blank result

Attachment 16124Attachment 16125

18 Mar 2016, 11:01 PM
#6
zean avatar

zean

Zen Follower

Join Date:
May 2009
Posts:
200
Plugin Contributions:
0

Post #6 by zean

So, you can see from the above post, it is a feature of Zen-Cart that "Starting at" prices are blank on the product info page if products_price and options_values_price are zero even when attribute price attributes_qty_prices exists.
How to modify code?

19 Mar 2016, 10:49 AM
#7
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Post #7 by kobra

Where is your site

Zen-Venom Get Bitten

19 Mar 2016, 10:51 AM
#8
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #8 by mc12345678

A little curious. What is the price that you wish to see? I mean, normally when working with quantity pricing, the price of the item per unit goes down as more of the item are purchased. Also there is no real requirement to make all values positive... So given the various options available for selection/population, could it not be possible to still fulfill the various requirements to not have to add/change code? Instead let the math do the work? I thought there was either a FAQ or a link from a FAQ to a longer post, but there was an example showing how various multiplication and mathematics could be applied to obtain the desired result.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

19 Mar 2016, 6:41 PM
#9
zean avatar

zean

Zen Follower

Join Date:
May 2009
Posts:
200
Plugin Contributions:
0

Post #9 by zean

Hi mc12345678, here are answers to your questions . . .

mc12345678:

A little curious. What is the price that you wish to see?
Post #1 shows a concrete example of the price I wish to see where I wrote, "I would therefore want the "Starting at" display price on the product info page to be $4.92 since it is the lowest qty price for the cheapest option."

mc12345678:

could it not be possible to still fulfill the various requirements to not have to add/change code? Instead let the math do the work? It is not possible to "let the math do the work" since the relevant Zen-Cart code does not even access the data. That is, as I documented in post #4 and and demonstrated in post #5 circling in red an image of an example from the default installation of the Zen-Cart demo data showing the blank result (please read the text I added to the beginning of the product description in that "classic green" demonstration) . . .

  1. "Consideration of attribute quantity discounts (i.e., attributes_qty_prices) for displaying the 'Starting at' price is not a feature of Zen-Cart."

  2. "The Display Price is made up of the lowest attribute price from each Option Name group without regard to Prices that are set in admin>Catalog>Categories/Products>Attribute Controller>edit option value> Attributes Qty Price Discount: (i.e., attributes_qty_prices)"

and in post #6

  1. "it is a feature of Zen-Cart that 'Starting at' prices are blank on the product info page if products_price and options_values_price are zero even when attribute price attributes_qty_prices exists."

Suggestions on how to modify code?

19 Mar 2016, 6:52 PM
#10
zean avatar

zean

Zen Follower

Join Date:
May 2009
Posts:
200
Plugin Contributions:
0

Post #10 by zean

Hi kobra, what did you learn from this?

kobra:

What template are you using?

Can you switch to the "classic green" to see what displays?

Zean:

Yes, same result (i.e., blank for Starting Price) with the "classic green" template. This is because, "The Display Price is made up of the lowest attribute price from each Option Name group" without regard to Prices that are set in admin>Catalog>Categories/Products>Attribute Controller>edit option value> Attributes Qty Price Discount: (i.e., attributes_qty_prices)

Attached images show blank result

Attachment 16124Attachment 16125

Zean:

So, you can see from the above post, it is a feature of Zen-Cart that "Starting at" prices are blank on the product info page if products_price and options_values_price are zero even when attribute price attributes_qty_prices exists.
How to modify code?

Suggestions on how to modify code?

21 Mar 2016, 11:26 AM
#11
zean avatar

zean

Zen Follower

Join Date:
May 2009
Posts:
200
Plugin Contributions:
0

Post #11 by zean

Maybe this will help someone similarly situated or inspire someone to show us how to do this better.
The below code, has allowed me to accomplish the following . . .

  1. Embed php code in the product description enabling the dynamic linking to the "Quantity Discounts Available" page for the current product.
  2. Change the price displayed only for the attributes that are quantity discounted from their undiscounted price to their lowest quantity discounted price, additionally add text "As low as"
  3. Change the default behavior of Zen Cart from displaying a blank "Starting at" price on the product info page when products_price and options_values_price are zero even when attribute price attributes_qty_prices exists, so that the lowest qty price for the cheapest option is shown for the "Starting at" price for the product.

FILES
tpl_product_info_display.php
includes/languages/english/extra_definitions/my_defines.php
attributes.php

LOCATE THIS FILE
\includes\templates\template_default\templates\tpl_product_info_display.php

AND COPY TO YOUR CUSTOM TEMPLATE DIRECTORY, FOR EXAMPLE . . .

/includes/templates/mycustom/templates/

NOW FIND WITHIN IT

// base price
  if ($show_onetime_charges_description == 'true') {
    $one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />';
  } else {
    $one_time = '';
  }
  echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);
?></h2>
<!--eof Product Price block -->

AND CHANGE TO

// base price
  if ($show_onetime_charges_description == 'true') {
    $one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />';
  } else {
    $one_time = '';
  }
  if ( $dmk_lowest_new_attributes_price > 0 ) { 
  
    echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . "$".number_format($dmk_lowest_new_attributes_price, 2); 
  
  } else {
    echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);
    
  }
  
  ?></h2>
<!--eof Product Price block -->

NOW FIND

 <!--bof Product description -->
<?php if ($products_description != '') { ?>
<div id="productDescription" class="productGeneral biggerText"><?php echo stripslashes($products_description); ?></div>
<?php } ?>
<!--eof Product description -->

AND CHANGE TO

 <!--bof Product description -->
<?php if ($products_description != '') { ?>
<div id="productDescription" class="productGeneral biggerText">

<?php //code based on swguy http://www.thatsoftwareguy.com/zencart_php_in_description.html ?>
<?php 
$stripped_products_description = $products_description;
foreach ($descr_stringlist as $varname) { 
   $stripped_products_description = str_replace($varname, constant($varname), $stripped_products_description);
}
?>
<?php //end code based on swguy ?>
<?php echo stripslashes($stripped_products_description); ?></div>
<?php } ?>
<!--eof Product description -->

CREATE A NEW FILE WHICH I NAMED my_defines.php

includes/languages/english/extra_definitions/my_defines.php

AND COPY THIS INTO IT

<?php

$descr_stringlist = array("SUBSTITUTE_MY_DEFINES_PHP_products_id","SUBSTITUTE_MY_DEFINES_PHP_my_boilerplate01"); 
define('SUBSTITUTE_MY_DEFINES_PHP_products_id', $_GET['products_id']); // This is the important part which allows you to embed php in the product description to dynamically created a link to the Quantity Discounts Available display of attributes_qty_prices
define('SUBSTITUTE_MY_DEFINES_PHP_my_boilerplate01', 'You can use this to automagically add boilerplate material to your product description by merely typing 'SUBSTITUTE_MY_DEFINES_PHP_my_boilerplate01 into the product description field via the admin);

NOW ADD THIS TO YOUR PRODUCT DESCRIPTION VIA ADMIN

if you want an image as a link to emphasize the discounts add a gif to includes/templates/mycustom/images/bulk-quantity-discounts03c.gif

<a href="http://www.yourwebsite.com/yourshop/index.php?main_page=popup_attributes_qty_prices&products_id=SUBSTITUTE_MY_DEFINES_PHP_products_id" target="_blank">
  <img src="includes/templates/customdmk2/images/bulk-quantity-discounts03c.gif" title="See Wholesale Bulk Quantity Discounts" alt="Wholesale Bulk Quantity Discounts">
</a>

SUBSTITUTE_MY_DEFINES_PHP_my_boilerplate01

<a href=javascript:popupWindowPrice('http://www.yourwebsite.com/yourshop/index.php?main_page=popup_attributes_qty_prices&products_id=SUBSTITUTE_MY_DEFINES_PHP_products_id&products_tax_class_id=1')>Bulk Quantity Discounts</a> link for this product's attributes that are quantity discounted.

LOCATE THIS FILE
\includes\modules\attributes.php

AND COPY TO YOUR CUSTOM TEMPLATE DIRECTORY, FOR EXAMPLE . . .

/includes/modules/mycustom/attributes.php

NOW FIND WITHIN IT

                  if (((CUSTOMERS_APPROVAL == '2' and $_SESSION['customer_id'] == '') or (STORE_STATUS == '1')) or ((CUSTOMERS_APPROVAL_AUTHORIZATION == '1' or CUSTOMERS_APPROVAL_AUTHORIZATION == '2') and $_SESSION['customers_authorization'] == '') or (CUSTOMERS_APPROVAL == '2' and $_SESSION['customers_authorization'] == '2') or (CUSTOMERS_APPROVAL_AUTHORIZATION == '2' and $_SESSION['customers_authorization'] != 0) ) {

                    $new_attributes_price = '';
                    $new_options_values_price = 0;
                    $products_options_display_price = '';
                    $price_onetime = '';
                  } else {
                    // collect price information if it exists
                    if ($products_options->fields['attributes_discounted'] == 1) {
                      // apply product discount to attributes if discount is on
                      //              $new_attributes_price = $products_options->fields['options_values_price'];
                      $new_attributes_price = zen_get_attributes_price_final($products_options->fields["products_attributes_id"], 1, '', 'false');
                      $new_attributes_price = zen_get_discount_calc((int)$_GET['products_id'], true, $new_attributes_price);
                    } else {
                      // discount is off do not apply
                      $new_attributes_price = $products_options->fields['options_values_price'];
                    }

                    // reverse negative values for display
                    if ($new_attributes_price < 0) {
                      $new_attributes_price = -$new_attributes_price;
                    }

                    if ($products_options->fields['attributes_price_onetime'] != 0 or $products_options->fields['attributes_price_factor_onetime'] != 0) {
                      $show_onetime_charges_description = 'true';
                      $new_onetime_charges = zen_get_attributes_price_final_onetime($products_options->fields["products_attributes_id"], 1, '');
                      $price_onetime = TEXT_ONETIME_CHARGE_SYMBOL . $currencies->display_price($new_onetime_charges, zen_get_tax_rate($product_info->fields['products_tax_class_id']));
                    } else {
                      $price_onetime = '';
                    }

                    if ($products_options->fields['attributes_qty_prices'] != '' or $products_options->fields['attributes_qty_prices_onetime'] != '') {
                      $show_attributes_qty_prices_description = 'true';
                      $show_attributes_qty_prices_icon = 'true';
                    }

                    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;
                    } else {
                      // if product_is_free and product_attribute_is_free
                      if ($products_options->fields['product_attribute_is_free'] == '1' and $product_info->fields['product_is_free'] == '1') {
                        $products_options_display_price= TEXT_ATTRIBUTES_PRICE_WAS . $products_options->fields['price_prefix'] .
                        $currencies->display_price($new_attributes_price, zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . TEXT_ATTRIBUTE_IS_FREE;
                      } else {
                        // normal price
                        if ($new_attributes_price == 0) {
                          $products_options_display_price= '';
                        } else {
                          $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;
                        }
                      }
                    }

                    $products_options_display_price .= $price_onetime;

                  } // approve
                  $products_options_array[sizeof($products_options_array)-1]['text'] .= $products_options_display_price;

                  // collect weight information if it exists

AND CHANGE TO

                  if (((CUSTOMERS_APPROVAL == '2' and $_SESSION['customer_id'] == '') or (STORE_STATUS == '1')) or ((CUSTOMERS_APPROVAL_AUTHORIZATION == '1' or CUSTOMERS_APPROVAL_AUTHORIZATION == '2') and $_SESSION['customers_authorization'] == '') or (CUSTOMERS_APPROVAL == '2' and $_SESSION['customers_authorization'] == '2') or (CUSTOMERS_APPROVAL_AUTHORIZATION == '2' and $_SESSION['customers_authorization'] != 0) ) {

                    $dmk_lowest_new_attributes_price = ''; //dmk 20160319
                    $dmk_new_attributes_price_array = array(); //dmk 20160319
                    
                    $new_attributes_price = '';
                    $new_options_values_price = 0;
                    $products_options_display_price = '';
                    $price_onetime = '';
                  } else {
                    // collect price information if it exists
                    if ($products_options->fields['attributes_discounted'] == 1) {
                      // apply product discount to attributes if discount is on
                      //              $new_attributes_price = $products_options->fields['options_values_price'];

                      // 20160317 dmk changed below from 1 to 9999999  $new_attributes_price = zen_get_attributes_price_final($products_options->fields["products_attributes_id"], 1, '', 'false');
                      // 20160317 dmk which gives the quantity discount price for a qty from attributes_qty_prices of 9999999 (i.e., lower price) instead for a qty of 1 (higher price) for display purposes.
                      $new_attributes_price = zen_get_attributes_price_final($products_options->fields["products_attributes_id"], 9999999, '', 'false');
                      $new_attributes_price = zen_get_discount_calc((int)$_GET['products_id'], true, $new_attributes_price);
                      if ($products_options->fields['attributes_qty_prices'] != '' or $products_options->fields['attributes_qty_prices_onetime'] != '') {  //dmk

                      $dmk_new_attributes_price_array[] = $new_attributes_price;

                      }
                      
                    } else {
                      // discount is off do not apply
                      $new_attributes_price = $products_options->fields['options_values_price'];
                    }

                    // reverse negative values for display
                    if ($new_attributes_price < 0) {
                      $new_attributes_price = -$new_attributes_price;
                    }

                    if ($products_options->fields['attributes_price_onetime'] != 0 or $products_options->fields['attributes_price_factor_onetime'] != 0) {
                      $show_onetime_charges_description = 'true';
                      $new_onetime_charges = zen_get_attributes_price_final_onetime($products_options->fields["products_attributes_id"], 1, '');
                      $price_onetime = TEXT_ONETIME_CHARGE_SYMBOL . $currencies->display_price($new_onetime_charges, zen_get_tax_rate($product_info->fields['products_tax_class_id']));
                    } else {
                      $price_onetime = '';
                    }

                    if ($products_options->fields['attributes_qty_prices'] != '' or $products_options->fields['attributes_qty_prices_onetime'] != '') {
                      $show_attributes_qty_prices_description = 'true';
                      $show_attributes_qty_prices_icon = 'true';
                      // 20160317 dmk added $ATTRIBUTES_PRICE_DELIMITER_PREFIX_DISPLAY to provide textual explanation communicating price shown is for large qty (see comment above) 
                      $ATTRIBUTES_PRICE_DELIMITER_PREFIX_DISPLAY = attributes_qty_prices_ATTRIBUTES_PRICE_DELIMITER_PREFIX;
                    } else {
                      $ATTRIBUTES_PRICE_DELIMITER_PREFIX_DISPLAY = ATTRIBUTES_PRICE_DELIMITER_PREFIX;
                      // 20160317 dmk end added code
                    }

                    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
                      // 20160317 dmk changed ATTRIBUTES_PRICE_DELIMITER_PREFIX to $ATTRIBUTES_PRICE_DELIMITER_PREFIX_DISPLAY
                      $products_options_display_price= $ATTRIBUTES_PRICE_DELIMITER_PREFIX_DISPLAY . $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;
                    } else {
                      // if product_is_free and product_attribute_is_free
                      if ($products_options->fields['product_attribute_is_free'] == '1' and $product_info->fields['product_is_free'] == '1') {
                        $products_options_display_price= TEXT_ATTRIBUTES_PRICE_WAS . $products_options->fields['price_prefix'] .
                        $currencies->display_price($new_attributes_price, zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . TEXT_ATTRIBUTE_IS_FREE;
                      } else {
                        // normal price
                        if ($new_attributes_price == 0) {
                          $products_options_display_price= '';
                        } else {
                      // 20160317 dmk changed ATTRIBUTES_PRICE_DELIMITER_PREFIX to $ATTRIBUTES_PRICE_DELIMITER_PREFIX_DISPLAY
                        $products_options_display_price= $ATTRIBUTES_PRICE_DELIMITER_PREFIX_DISPLAY . $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;
                        }
                      }
                    }

                    $products_options_display_price .= $price_onetime;

                  } // approve
                  $products_options_array[sizeof($products_options_array)-1]['text'] .= $products_options_display_price;
                  // collect weight information if it exists

NOW FIND

                  // default
                  // find default attribute if set to for default dropdown
                  if ($products_options->fields['attributes_default']=='1') {
                    $selected_attribute = $products_options->fields['products_options_values_id'];
                  }

                  $products_options->MoveNext();

                }

                //echo 'TEST I AM ' . $products_options_names->fields['products_options_name'] . ' Type - ' . $products_options_names->fields['products_options_type'] . '<br />';
                // Option Name Type Display

AND CHANGE TO

                  // default
                  // find default attribute if set to for default dropdown
                  if ($products_options->fields['attributes_default']=='1') {
                    $selected_attribute = $products_options->fields['products_options_values_id'];
                  }

                  $products_options->MoveNext();

                }

                // dmk 20160319 assign value to $dmk_lowest_new_attributes_price for disply price of "Starting at" price. 
                if ($products_options->fields['attributes_qty_prices'] != '' or $products_options->fields['attributes_qty_prices_onetime'] != '') { //dmk 20160319
                    $dmk_lowest_new_attributes_price = min($dmk_new_attributes_price_array); //dmk 20160319

                }
                //echo 'TEST I AM ' . $products_options_names->fields['products_options_name'] . ' Type - ' . $products_options_names->fields['products_options_type'] . '<br />';
                // Option Name Type Display