function convert_product_attributes_result($attributes_values, $load_option_name = true, $can_operate = false)
 {
     if ($load_option_name) {
         $attributes_values->fields['products_options_name'] = zen_options_name($attributes_values->fields['options_id']);
         $attributes_values->fields['products_options_values_name'] = zen_values_name($attributes_values->fields['options_values_id']);
     }
     $attributes_values->fields['products_display_price'] = $attributes_values->fields['price_prefix'] . $attributes_values->fields['options_values_price'];
     $attributes_values->fields['products_attributes_display_weight'] = $attributes_values->fields['products_attributes_weight_prefix'] . $attributes_values->fields['products_attributes_weight'];
     require_once DIR_WS_CLASSES . 'currencies.php';
     $currencies = new currencies();
     $attributes_price_final = zen_get_attributes_price_final($attributes_values->fields["products_attributes_id"], 1, $attributes_values, 'false');
     $attributes_price_final_value = $attributes_price_final;
     $attributes_price_final = $currencies->display_price($attributes_price_final, zen_get_tax_rate(1), 1);
     $attributes_price_final_onetime = zen_get_attributes_price_final_onetime($attributes_values->fields["products_attributes_id"], 1, $attributes_values);
     $attributes_price_final_onetime = $currencies->display_price($attributes_price_final_onetime, zen_get_tax_rate(1), 1);
     $new_attributes_price = '';
     if ($attributes_values->fields["attributes_discounted"]) {
         $new_attributes_price = zen_get_attributes_price_final($attributes_values->fields["products_attributes_id"], 1, '', 'false');
         $new_attributes_price = zen_get_discount_calc($attributes_values->fields['products_id'], true, $new_attributes_price);
         if ($new_attributes_price != $attributes_price_final_value) {
             $new_attributes_price = '|' . $currencies->display_price($new_attributes_price, zen_get_tax_rate(1), 1);
         } else {
             $new_attributes_price = '';
         }
     }
     $attributes_values->fields['attributes_display_price_final'] = $attributes_price_final . $new_attributes_price . ' ' . $attributes_price_final_onetime;
     // status
     $attributes_values->fields['products_status'] = "";
     foreach ($this->statuses as $type => $icon_info) {
         $attributes_values->fields['products_status'] .= self::make_status_link($attributes_values->fields, $type, $icon_info['color'], $icon_info['alt'], $can_operate);
     }
     return $attributes_values->fields;
 }
 /**
  * Test attribute price.
  */
 public function testValuePrice()
 {
     foreach ($this->get('productService')->getAllProducts(false, 1) as $product) {
         foreach ($product->getAttributes() as $attribute) {
             foreach ($attribute->getValues() as $value) {
                 if ($value->isDiscounted()) {
                     $er = error_reporting(0);
                     $zprice = zen_get_attributes_price_final($value->getAttributeValueDetailsId(), 1, '');
                     $zprice = zen_get_discount_calc($product->getId(), true, $zprice);
                     error_reporting($er);
                 } else {
                     $zprice = $value->getValuePrice();
                 }
                 // default is 4 decimal digits...
                 $this->assertEquals((int) (10000 * $zprice), (int) (10000 * $value->getPrice(false)), '%s productId=' . $product->getId() . ' $valueId=' . $value->getAttributeValueId() . '/' . $value->getAttributeValueDetailsId());
             }
         }
     }
 }
        <td class="smallText" align="center"><?php 
                    echo ($attributes_values->fields["attributes_price_base_included"] == '0' ? '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_price_base_included' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_purple_off.gif', LEGEND_ATTRIBUTE_PRICE_BASE_INCLUDED) . '</a>' : '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_price_base_included' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_purple_on.gif', LEGEND_ATTRIBUTE_PRICE_BASE_INCLUDED)) . '</a>';
                    ?>
</td>
        <td class="smallText" align="center"><?php 
                    echo ($attributes_values->fields["attributes_required"] == '0' ? '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_required' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_red_off.gif', LEGEND_ATTRIBUTES_REQUIRED) . '</a>' : '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_required' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', LEGEND_ATTRIBUTES_REQUIRED)) . '</a>';
                    ?>
</td>
      </tr>
    </table>
</td>
<?php 
                }
                $new_attributes_price = '';
                if ($attributes_values->fields["attributes_discounted"]) {
                    $new_attributes_price = zen_get_attributes_price_final($attributes_values->fields["products_attributes_id"], 1, '', 'false');
                    $new_attributes_price = zen_get_discount_calc($products_filter, true, $new_attributes_price);
                    if ($new_attributes_price != $attributes_price_final_value) {
                        $new_attributes_price = '|' . $currencies->display_price($new_attributes_price, zen_get_tax_rate($product_check->fields['products_tax_class_id']), 1);
                    } else {
                        $new_attributes_price = '';
                    }
                }
                ?>
            <td align="right" class="smallText"><?php 
                echo $attributes_price_final . $new_attributes_price . ' ' . $attributes_price_final_onetime;
                ?>
</td>
<?php 
                if ($action != '') {
                    ?>
Beispiel #4
0
 // reset
 $products_options_display_price = '';
 $new_attributes_price = '';
 $price_onetime = '';
 $products_options_array[] = array('id' => $products_options->fields['products_options_values_id'], 'text' => $products_options->fields['products_options_values_name']);
 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 = '';
 function updateNotifyAttributesModuleOriginalPrice(&$callingClass, $notifier, $paramsArray)
 {
     global $db, $products_options, $products_options_names, $currencies, $new_attributes_price, $product_info, $products_options_display_price, $PWA_STOCK_QTY;
     if ($this->_isSBA && (PRODINFO_ATTRIBUTE_DYNAMIC_STATUS == '1' || PRODINFO_ATTRIBUTE_DYNAMIC_STATUS == '2' && $products_options_names->RecordCount() > 1 || PRODINFO_ATTRIBUTE_DYNAMIC_STATUS == '3' && $products_options_names->RecordCount() == 1)) {
         // Perhaps only certain features need to be bypassed, but for now all mc12345678
         // START "Stock by Attributes" SBA added original price for display, and some formatting
         $originalpricedisplaytext = null;
         if (STOCK_SHOW_ORIGINAL_PRICE_STRUCK == 'true' && !(zen_get_attributes_price_final($products_options->fields["products_attributes_id"], 1, '', 'false') == $new_attributes_price || zen_get_attributes_price_final($products_options->fields["products_attributes_id"], 1, '', 'false') == -$new_attributes_price && (int) ($products_options->fields['price_prefix'] . "1") * $products_options->fields['options_values_price'] < 0)) {
             //Original price struck through
             if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_RADIO || $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_CHECKBOX) {
                 //use this if a PRODUCTS_OPTIONS_TYPE_RADIO or PRODUCTS_OPTIONS_TYPE_CHECKBOX
                 //class="normalprice" can be used in a CSS file to control the text properties, not compatable with selection lists
                 $originalpricedisplaytext = ATTRIBUTES_PRICE_DELIMITER_PREFIX . '<span class="normalprice">' . $products_options->fields['price_prefix'] . $currencies->display_price(zen_get_attributes_price_final($products_options->fields["products_attributes_id"], 1, '', 'false'), zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . '</span>' . ATTRIBUTES_PRICE_DELIMITER_SUFFIX;
             } else {
                 //need to remove the <span> tag for selection lists and text boxes
                 $originalpricedisplaytext = ATTRIBUTES_PRICE_DELIMITER_PREFIX . $products_options->fields['price_prefix'] . $currencies->display_price(abs(zen_get_attributes_price_final($products_options->fields["products_attributes_id"], 1, '', 'false')), zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ATTRIBUTES_PRICE_DELIMITER_SUFFIX;
             }
         }
         $products_options_display_price .= $originalpricedisplaytext . $PWA_STOCK_QTY;
         // END "Stock by Attributes" SBA
     }
 }