Attribute im Warenkorb


german 550
Diese Erweiterung ist für die W3-osCommerce-Version konzipiert. Sie können es aber auch für andere Versionen verwenden. Dazu müssen die CSS-Klassen in divs angepasst werden.

Finde in: catalog/shopping_cart.php
    $any_out_of_stock = 0;
      $products = $cart->get_products();
      for ($i=0, $n=sizeof($products); $i<$n; $i++) {
          // Push all attributes information in an array
          if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
              while (list($option, $value) = each($products[$i]['attributes'])) {
                  echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
                  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
                                      from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                      where pa.products_id = '" . (int)$products[$i]['id'] . "'
                                       and pa.options_id = '" . (int)$option . "'
                                       and pa.options_id = popt.products_options_id
                                       and pa.options_values_id = '" . (int)$value . "'
                                       and pa.options_values_id = poval.products_options_values_id
                                       and popt.language_id = '" . (int)$languages_id . "'
                                       and poval.language_id = '" . (int)$languages_id . "'");
                  $attributes_values = tep_db_fetch_array($attributes);

                  $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
                  $products[$i][$option]['options_values_id'] = $value;
                  $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];
                  $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
                  $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
              }
          }
      }

Ersetze mit:

    $any_out_of_stock = 0;
    $products = $cart->get_products();
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
// Push all attributes information in an array
      if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
        foreach($products[$i]['attributes'] as $option => $value) {
          echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
          $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, poval.products_options_values_id, pa.options_values_price, pa.price_prefix
                                      from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                      where pa.products_id = '" . (int)$products[$i]['id'] . "'
                                       and pa.options_id = '" . (int)$option . "'
                                       and pa.options_id = popt.products_options_id
                                       and pa.options_values_id = poval.products_options_values_id
                                       and popt.language_id = '" . (int)$languages_id . "'
                                       and popt.options_status = '0'
                                       and poval.language_id = '" . (int)$languages_id . "' order by pa.attribute_sort, popt.options_sort");
                                      
          $products[$i][$option]['form_name'] = 'id[' . $products[$i]['id'] . '][' . $option . ']';
          $products[$i][$option]['selected_id'] = $value;
         
          while($attributes_values = tep_db_fetch_array($attributes)){
              $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];

          if ($attributes_values['options_values_price'] != '0') {
              $products[$i][$option]['products_options_values_name'][] = array('id' => $attributes_values['products_options_values_id'],
                                                                             'text' => $attributes_values['products_options_values_name'] .
                                                                                ' ' . $attributes_values['price_prefix'] . ' ' . $currencies->display_price($attributes_values['options_values_price'], tep_get_tax_rate($products[$i]['tax_class_id']))
                                                                             );
          }else{
              $products[$i][$option]['products_options_values_name'][] = array('id' => $attributes_values['products_options_values_id'], 'text' => $attributes_values['products_options_values_name']);
          }
              $products[$i][$option]['options_values_price'][] = $attributes_values['options_values_price'];
              $products[$i][$option]['price_prefix'][] = $attributes_values['price_prefix'];
          }

        }
      }
    }

    $sca_products = $cart->get_products();
    for ($i=0, $n=sizeof($sca_products); $i<$n; $i++) {
// Push all attributes information in an array
      if (isset($sca_products[$i]['attributes']) && is_array($sca_products[$i]['attributes'])) {
        foreach($sca_products[$i]['attributes'] as $sca_option => $sca_value) {
          echo tep_draw_hidden_field('id[' . $sca_products[$i]['id'] . '][' . $sca_option . ']', $sca_value);
          $sca_attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
                                      from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                      where pa.products_id = '" . (int)$sca_products[$i]['id'] . "'
                                       and pa.options_id = '" . (int)$sca_option . "'
                                       and pa.options_id = popt.products_options_id
                                       and pa.options_values_id = '" . (int)$sca_value . "'
                                       and pa.options_values_id = poval.products_options_values_id
                                       and popt.language_id = '" . (int)$languages_id . "'
                                       and popt.options_status = '0'
                                       and poval.language_id = '" . (int)$languages_id . "'");
          $sca_attributes_values = tep_db_fetch_array($sca_attributes);

          $sca_products[$i][$sca_option]['products_options_name'] = $sca_attributes_values['products_options_name'];
          $sca_products[$i][$sca_option]['options_values_id'] = $sca_value;
          $sca_products[$i][$sca_option]['products_options_values_name'] = $sca_attributes_values['products_options_values_name'];
          $sca_products[$i][$sca_option]['options_values_price'] = $sca_attributes_values['options_values_price'];
          $sca_products[$i][$sca_option]['price_prefix'] = $sca_attributes_values['price_prefix'];
        }
      }
    }

Finde:
ACHTUNG! Dies ist der alte Code für PHP 7

        if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
            reset($products[$i]['attributes']);
            while (list($option, $value) = each($products[$i]['attributes'])) {
                $products_name .= '<br /><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
            }
        }

oder:
ACHTUNG! Dies ist der neue Code für PHP 8

        if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
            reset($products[$i]['attributes']);
            foreach($sca_products[$i]['attributes'] as $sca_option => $sca_value) {
                $products_name .= '<br /><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
            }
        }

Ersetze mit:

if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
reset($products[$i]['attributes']);
if ($products[$i]['status'] > 0){
$originalimgString = $products[$i]['name'];
$outputimgString = preg_replace('/s+/', '', $originalimgString);

$products_name .= '
<span type="button" class="pointer btn btn-info btn-xs w3-border w3-border-black" data-toggle="collapse" data-target="#' . $outputimgString . '">' . TEXT_INFO_PRODUCTS_LISTING_ATTRIBUTE . '</span><div id="' . $outputimgString . '" class="collapse">';
$products_name .= '<div class="mb-2 w3-padding w3-pale-red w3-round"><b><i class="fa fa-sync-alt"></i></b> '. INFO_TEXT_FOR_UPDATE_SHOPPING_CART_ATTRIBUTE . '</div>';
$products_name .= '<div class="mt-2 w3-bottombar w3-topbar w3-border-blue w3-padding-small w3-pale-blue w3-round"><div class="clearfix"></div>';
$products_name .= '<div class="mt-2 w3-border-bottom w3-border-blue">';
$products_name .= '<div class="mt-2 w3-border-bottom w3-border-blue w3-text-red"><div class="mb-2"><b>' . TEXT_INFO_PRODUCTS_LISTING_ATTRIBUTE . ' - ' . $products[$i]['name'] . '</b><span class="pull-right"><button class="btn btn-info w3-border w3-border-black"><b><i class="fa fa-sync-alt"></i></b></button></span><div class="clearfix"></div></div></div>';
$products_name .= '</div>';
foreach($products[$i]['attributes'] as $option => $value) {
if (!empty($products[$i][$option]['products_options_values_name'])) {
$products_name .= '<div class="mt-1 mb-1"><b>' . $products[$i][$option]['products_options_name'] . '</b>' . tep_draw_pull_down_menu($products[$i][$option]['form_name'], $products[$i][$option]['products_options_values_name'], $products[$i][$option]['selected_id']) . '</div>';
  }
}
$products_name .= '<div class="mt-2 mb-2"><button class="btn btn-info w3-border w3-border-black btn-block">&nbsp;<i class="fa fa-sync-alt"></i>&nbsp;' . IMAGE_BUTTON_UPDATE_CART . '&nbsp;</button></div>';
$products_name .= '</div></div>';
}
}
/////////////////////////////////////////////////
if (isset($sca_products[$i]['attributes']) && is_array($sca_products[$i]['attributes'])) {
reset($sca_products[$i]['attributes']);
foreach($sca_products[$i]['attributes'] as $sca_option => $sca_value) {
  if (!empty($sca_products[$i][$sca_option]['products_options_values_name'])) {
   if ($sca_products[$i][$sca_option]['options_values_price'] == '0'){
          $products_name .= '<div class="mt-1"><small><i>- ' . $sca_products[$i][$sca_option]['products_options_name'] . ' &nbsp;<font color="#da0000">' . $sca_products[$i][$sca_option]['products_options_values_name'] . '</font></i></small></div>';
}else{
          $products_name .= '<div class="mt-1"><small><i> - ' . $sca_products[$i][$sca_option]['products_options_name'] . ' &nbsp;<font color="#da0000">' . $sca_products[$i][$sca_option]['products_options_values_name'] . '</font>&nbsp;(' . $sca_products[$i][$option]['price_prefix'] . ' ' . $currencies->display_price($sca_products[$i][$sca_option]['options_values_price'], tep_get_tax_rate($sca_products[$i]['tax_class_id'])) . ')' . '</i></small></div>';
}
  }else{
          $products_name .= '<div class="mt-1"></div>';
  }
}
}

Fügen Sie es Ihrer Sprachdatei hinzu:
catalog/includes/languages/german/shopping_cart.php

Deutsch:

define('IMAGE_BUTTON_UPDATE_CART', 'Aktualisieren');
define('TEXT_INFO_PRODUCTS_LISTING_ATTRIBUTE', 'Attribute');
define('INFO_TEXT_FOR_UPDATE_SHOPPING_CART_ATTRIBUTE', 'Nach der Auswahl, das Aktualisieren der Attribute bitte nicht vergessen.');
Warum Ihre E-Mailadresse ?
Bei Bedarf werde ich Sie kontaktieren um Ihnen mit der Umsetzung zu helfen.
Ihre E-Mailadresse wird nicht öffentlich gemacht.
Ist dieser Beitrag für Sie hilfreich ?
Es liegen noch keine Bewertungen vor.
Informationen(2)
Allgemeine Infos
 Kostenloser Werbeeintrag
 Lazy Loading
Beitragszähler
Momentaner Informationsstand:
Kategorien gesamt: 8
Beiträge gesamt: 104
Supportseiten gesamt: 54
Downloads für Mitglieder: 104
Download Zähler: 646
Bewertungen gesamt58
Firmenbewertungen: 26
Supportbewertungen: 25
Beitragswertungen: 7