Jump to content
xt:Commerce Community Forum

Attributverwaltung - zusammenfassen ?


Sportaktiv

Recommended Posts

Hallo,

in unserem Shop haben sich inzwischen ~800 Attribute angesammelt was zu einer "langen Ladezeit" und vorallem unübersichtlichen Geschichte wird.

Jetzt wäre unsere Idee die Attributverwaltung ähnlich einem Baummenü aufzubauen. D.h. beim Öffnen der Seite werden lediglich die "products_options_name" angezeigt.

zb:

+ Farbe

+ Grösse

+ ...

ein klick auf (z.B) Farbe lädt dann die entsprechenden Auswahlmöglichkeiten (products_options_values_name).

+ Farbe

* rot

* blau

* usw

dies würde ein Verkürzung der Ladezeit und vorallem eine übersichtlichere Darstellung ergeben.

HILFE! :)

PS: Version ist die 3.04 SP2.1

Link to comment
Share on other sites

Unser Lösungsansatz basiert hierauf: http://www.dynamicdrive.com/dynamicindex1/navigate1.htm

die entsprechend geänderte new_attributes_include:



<?php

/* --------------------------------------------------------------

   $Id: new_attributes_include.php 901 2005-04-29 10:32:14Z novalis $   


   XT-Commerce - community made shopping

   http://www.xt-commerce.com


   Copyright (c) 2003 XT-Commerce

   --------------------------------------------------------------

   based on: 

   (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)

   (c) 2002-2003 osCommerce(new_attributes_functions); www.oscommerce.com 

   (c) 2003	 nextcommerce (new_attributes_include.php,v 1.11 2003/08/21); www.nextcommerce.org


   Released under the GNU General Public License 

   --------------------------------------------------------------

   Third Party contributions:

   New Attribute Manager v4b				Autor: Mike G | [email protected] | http://downloads.ephing.com


   Released under the GNU General Public License 

   --------------------------------------------------------------*/

defined('_VALID_XTC') or die('Direct Access to this location is not allowed.');

   // include needed functions


   require_once(DIR_FS_INC .'xtc_get_tax_rate.inc.php');

   require_once(DIR_FS_INC .'xtc_get_tax_class_id.inc.php');

   require(DIR_FS_CATALOG.DIR_WS_CLASSES . 'xtcPrice.php');

   $xtPrice = new xtcPrice(DEFAULT_CURRENCY,$_SESSION['customers_status']['customers_status_id']);

?>

  <tr>

    <td class="pageHeading" colspan="3"> <? php echo $pageTitle; ?></td>

  </tr>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="SUBMIT_ATTRIBUTES" enctype="multipart/form-data"><input type="hidden" name="current_product_id" value="<?php echo $_POST['current_product_id']; ?>"><input type="hidden" name="action" value="change">

<?php

echo xtc_draw_hidden_field(xtc_session_name(), xtc_session_id());

  if ($cPath) echo '<input type="hidden" name="cPathID" value="' . $cPath . '">';


  require(DIR_WS_MODULES . 'new_attributes_functions.php');


  // Temp id for text input contribution.. I'll put them in a seperate array.

  $tempTextID = '1999043';



?> 

[B]<a href="javascript:ddtreemenu.flatten('treemenu1', 'expand')">Expand All</a> 

<a href="javascript:ddtreemenu.flatten('treemenu1', 'contact')">Contact All</a>[/B]

<?


  // Lets get all of the possible options

  $query = "SELECT * FROM ".TABLE_PRODUCTS_OPTIONS." where products_options_id LIKE '%' AND language_id = '" . $_SESSION['languages_id'] . "'";

  $result = xtc_db_query($query);

  $matches = xtc_db_num_rows($result);


[B]echo "<ul id='treemenu1' class='treeview'>"; [/B]

  if ($matches) {


    while ($line = xtc_db_fetch_array($result)) {

      $current_product_option_name = $line['products_options_name'];

      $current_product_option_id = $line['products_options_id'];

      // Print the Option Name


[B]echo "<li>" . $current_product_option_name; [/B]


      // Find all of the Current Option's Available Values

	  $query2 = "SELECT o.products_options_values_to_products_options_id, o.products_options_id as products_options_id, o.products_options_values_id as products_options_values_id, p.products_options_values_name as products_options_values_name FROM products_options_values_to_products_options o LEFT JOIN products_options_values p ON o.products_options_values_id = p.products_options_values_id WHERE o.products_options_id = '" . $current_product_option_id . "' and p.language_id = '". $_SESSION['languages_id']. "'"; // ORDER BY p.products_options_values_name";

      $result2 = xtc_db_query($query2);

      $matches2 = xtc_db_num_rows($result2);



      if ($matches2) {


[B]echo "<ul>";	   [/B]

        $i = '0';

        while ($line = xtc_db_fetch_array($result2)) {

          $i++;

          $rowClass = rowClass($i);

          $current_value_id = $line['products_options_values_id'];

          $isSelected = checkAttribute($current_value_id, $_POST['current_product_id'], $current_product_option_id);

          if ($isSelected) {

            $CHECKED = ' CHECKED';

          } else {

            $CHECKED = '';

          }


          $query3 = "SELECT * FROM ".TABLE_PRODUCTS_OPTIONS_VALUES." WHERE products_options_values_id = '" . $current_value_id . "' AND language_id = '" . $_SESSION['languages_id'] . "'";

          $result3 = xtc_db_query($query3);


          while($line = xtc_db_fetch_array($result3)) {

            $current_value_name = $line['products_options_values_name'];

            // Print the Current Value Name

[B]echo "<li> <table width='100%'>"; 	   [/B]			

            echo "<TR class=\"" . $rowClass . "\">";


            echo "<TD class=\"main\">";

            echo "<input type=\"checkbox\" name=\"optionValues[]\" value=\"" . $current_value_id . "\"" . $CHECKED . ">  " . $current_value_name . "  ";

            echo "</TD>";

            echo "<TD class=\"main\" align=\"left\"><input type=\"text\" name=\"" . $current_value_id . "_sortorder\" value=\"" . $sortorder . "\" size=\"4\"></TD>";

            echo "<TD class=\"main\" align=\"left\"><input type=\"text\" name=\"" . $current_value_id . "_model\" value=\"" . $attribute_value_model . "\" size=\"15\"></TD>";

            echo "<TD class=\"main\" align=\"left\"><input type=\"text\" name=\"" . $current_value_id . "_stock\" value=\"" . $attribute_value_stock . "\" size=\"4\"></TD>";

            echo "<TD class=\"main\" align=\"left\"><input type=\"text\" name=\"" . $current_value_id . "_weight\" value=\"" . $attribute_value_weight . "\" size=\"10\"></TD>";

            echo "<TD class=\"main\" align=\"left\"><SELECT name=\"" . $current_value_id . "_weight_prefix\"><OPTION value=\"+\"" . $posCheck_weight . ">+<OPTION value=\"-\"" . $negCheck_weight . ">-</SELECT></TD>";


            // brutto Admin

            if (PRICE_IS_BRUTTO=='true'){

            $attribute_value_price_calculate = $xtPrice->xtcFormat(xtc_round($attribute_value_price*((100+(xtc_get_tax_rate(xtc_get_tax_class_id($_POST['current_product_id']))))/100),PRICE_PRECISION),false);

            } else {

            $attribute_value_price_calculate = xtc_round($attribute_value_price,PRICE_PRECISION);

            }

            echo "<TD class=\"main\" align=\"left\"><input type=\"text\" name=\"" . $current_value_id . "_price\" value=\"" . $attribute_value_price_calculate . "\" size=\"10\">";


            // brutto Admin

            if (PRICE_IS_BRUTTO=='true'){

             echo TEXT_NETTO .'<b>'.$xtPrice->xtcFormat(xtc_round($attribute_value_price,PRICE_PRECISION),true).'</b>  ';

            }


            echo "</TD>";


              echo "<TD class=\"main\" align=\"left\"><SELECT name=\"" . $current_value_id . "_prefix\"> <OPTION value=\"+\"" . $posCheck . ">+<OPTION value=\"-\"" . $negCheck . ">-</SELECT></TD>";




            echo "</TR>";


            // Download function start

/*            if(strtoupper($current_product_option_name) == 'DOWNLOADS') {

                echo "<tr>";


               // echo "<td colspan=\"2\">File: <input type=\"file\" name=\"" . $current_value_id . "_download_file\"></td>";

                echo "<td colspan=\"2\">".xtc_draw_pull_down_menu($current_value_id . '_download_file', xtc_getDownloads(), $attribute_value_download_filename, '')."</td>";

                echo "<td class=\"main\"> ".DL_COUNT." <input type=\"text\" name=\"" . $current_value_id . "_download_count\" value=\"" . $attribute_value_download_count . "\"></td>";

                echo "<td class=\"main\"> ".DL_EXPIRE." <input type=\"text\" name=\"" . $current_value_id . "_download_expire\" value=\"" . $attribute_value_download_expire . "\"></td>";

                echo "</tr>";


            }

            // Download function end

			*/


          } 

		  echo "</table> "; 	   								

[B]echo "</li>";		   	   [/B]



          if ($i == $matches2 ) $i = '0';

        }

[B]echo "</ul>";

echo "</li>";[/B]		

      } 

 else {

        echo "<TR>";

        echo "<TD class=\"main\"><SMALL>No values under this option.</SMALL></TD>";

        echo "</TR>";

      }

}

}

[B]echo "</ul>";  [/B]

?>


<script type="text/javascript">


//ddtreemenu.createTree(treeid, enablepersist, opt_persist_in_days (default is 1))


ddtreemenu.createTree("treemenu1", false)

ddtreemenu.createTree("treemenu2", false)

</script>


  <tr>

    <td colspan="10" class="main"><br>

<?php

echo xtc_button(BUTTON_SAVE) . ' ';

echo xtc_button_link(BUTTON_CANCEL,'javascript:history.back()');

?>

</td>

  </tr>

</form>


funkioniert leider nicht ganz so wie es sollte ^^

ab dem 2. Listenelement (Optionvalue) stimmt die Aufreihung (formatierung ist erstmal egal)

Das 1. Listenelement ist komplett zerschossen.

kann das so funktionieren? oder stimmt schon der Ansatz nicht?

über hilfe würden wir uns freuen

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...